@sme.up/ketchup 4.2.0-SNAPSHOT → 4.2.0
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.
- package/dist/cjs/{cell-utils-1d44a3f0.js → cell-utils-dc0884a3.js} +2 -2
- package/dist/cjs/{f-button-a5788453.js → f-button-2ba74fb5.js} +1 -1
- package/dist/cjs/{f-cell-eba6f39e.js → f-cell-fe60a08d.js} +31 -27
- package/dist/cjs/{f-chip-ce69b7d2.js → f-chip-90d95d22.js} +2 -2
- package/dist/cjs/{f-image-e03842eb.js → f-image-d3bd4e08.js} +1 -1
- package/dist/cjs/ketchup.cjs.js +1 -1
- package/dist/cjs/kup-accordion.cjs.entry.js +3 -3
- package/dist/cjs/kup-autocomplete_28.cjs.entry.js +1050 -650
- package/dist/cjs/kup-calendar.cjs.entry.js +6 -6
- package/dist/cjs/kup-cell.cjs.entry.js +6 -6
- package/dist/cjs/kup-dash-list.cjs.entry.js +3 -3
- package/dist/cjs/kup-dash_2.cjs.entry.js +2 -2
- package/dist/cjs/kup-drawer.cjs.entry.js +2 -2
- package/dist/cjs/kup-field.cjs.entry.js +1 -1
- package/dist/cjs/kup-iframe.cjs.entry.js +2 -2
- package/dist/cjs/kup-lazy.cjs.entry.js +2 -2
- package/dist/cjs/kup-magic-box.cjs.entry.js +3 -3
- package/dist/cjs/{kup-manager-75f1a2cd.js → kup-manager-1a2688ca.js} +20 -1
- package/dist/cjs/kup-nav-bar.cjs.entry.js +2 -2
- package/dist/cjs/kup-probe.cjs.entry.js +1 -1
- package/dist/cjs/kup-qlik.cjs.entry.js +1 -1
- package/dist/cjs/kup-snackbar.cjs.entry.js +4 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{utils-b3ec89fe.js → utils-0cc466b9.js} +1 -59
- package/dist/collection/assets/data-table.js +44 -0
- package/dist/collection/components/kup-card/builtin/kup-card-builtin.js +20 -0
- package/dist/collection/components/kup-card/builtin/kup-card-calendar.js +458 -0
- package/dist/collection/components/kup-card/builtin/kup-card-clock.js +321 -0
- package/dist/collection/components/kup-card/free/kup-card-free.js +13 -0
- package/dist/collection/components/kup-card/kup-card-declarations.js +19 -0
- package/dist/collection/components/kup-card/kup-card.css +502 -3
- package/dist/collection/components/kup-card/kup-card.js +18 -9
- package/dist/collection/components/kup-data-table/kup-data-table-declarations.js +1 -1
- package/dist/collection/components/kup-data-table/kup-data-table-state.js +1 -1
- package/dist/collection/components/kup-data-table/kup-data-table.css +0 -38
- package/dist/collection/components/kup-data-table/kup-data-table.js +27 -10
- package/dist/collection/components/kup-date-picker/kup-date-picker.css +0 -82
- package/dist/collection/components/kup-date-picker/kup-date-picker.js +35 -309
- package/dist/collection/components/kup-text-field/kup-text-field.css +1 -0
- package/dist/collection/components/kup-time-picker/kup-time-picker.css +1 -0
- package/dist/collection/components/kup-time-picker/kup-time-picker.js +51 -241
- package/dist/collection/components/kup-tree/kup-tree.js +20 -15
- package/dist/collection/f-components/f-cell/f-cell.js +26 -22
- package/dist/collection/utils/kup-search/kup-search.js +0 -1
- package/dist/esm/{cell-utils-9a2914fc.js → cell-utils-8f512ea9.js} +2 -2
- package/dist/esm/{f-button-55a9ed88.js → f-button-30dbcaa9.js} +1 -1
- package/dist/esm/{f-cell-ac520cb2.js → f-cell-95c186c6.js} +31 -27
- package/dist/esm/{f-chip-babf1740.js → f-chip-c0e9c0ff.js} +2 -2
- package/dist/esm/{f-image-70ca9dfe.js → f-image-3bc8b24f.js} +1 -1
- package/dist/esm/ketchup.js +1 -1
- package/dist/esm/kup-accordion.entry.js +3 -3
- package/dist/esm/kup-autocomplete_28.entry.js +1079 -679
- package/dist/esm/kup-calendar.entry.js +6 -6
- package/dist/esm/kup-cell.entry.js +6 -6
- package/dist/esm/kup-dash-list.entry.js +3 -3
- package/dist/esm/kup-dash_2.entry.js +2 -2
- package/dist/esm/kup-drawer.entry.js +2 -2
- package/dist/esm/kup-field.entry.js +1 -1
- package/dist/esm/kup-iframe.entry.js +2 -2
- package/dist/esm/kup-lazy.entry.js +2 -2
- package/dist/esm/kup-magic-box.entry.js +3 -3
- package/dist/esm/{kup-manager-bba32828.js → kup-manager-7fc234da.js} +21 -2
- package/dist/esm/kup-nav-bar.entry.js +2 -2
- package/dist/esm/kup-probe.entry.js +1 -1
- package/dist/esm/kup-qlik.entry.js +1 -1
- package/dist/esm/kup-snackbar.entry.js +4 -4
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{utils-cfcbe33f.js → utils-6c73709d.js} +2 -58
- package/dist/ketchup/ketchup.esm.js +1 -1
- package/dist/ketchup/{p-1ce9a037.js → p-15321eae.js} +1 -1
- package/dist/ketchup/{p-daf03877.entry.js → p-1baf1205.entry.js} +1 -1
- package/dist/ketchup/p-1c6178e4.entry.js +1 -0
- package/dist/ketchup/{p-52038ccb.js → p-44375e49.js} +1 -1
- package/dist/ketchup/p-4dcdbd31.entry.js +45 -0
- package/dist/ketchup/{p-d58dbf0e.js → p-5a5f2a53.js} +1 -1
- package/dist/ketchup/{p-4748be4b.js → p-61faaa38.js} +2 -2
- package/dist/ketchup/{p-69a705ae.entry.js → p-62816d0b.entry.js} +1 -1
- package/dist/ketchup/{p-ff7d590e.entry.js → p-65adc15b.entry.js} +1 -1
- package/dist/ketchup/p-7e23ea7c.entry.js +1 -0
- package/dist/ketchup/{p-5faf7715.entry.js → p-a378ba56.entry.js} +1 -1
- package/dist/ketchup/{p-74259992.entry.js → p-a878016f.entry.js} +1 -1
- package/dist/ketchup/{p-d6ce1ac6.entry.js → p-a96e6e32.entry.js} +1 -1
- package/dist/ketchup/{p-6cc8264d.entry.js → p-ad32821e.entry.js} +1 -1
- package/dist/ketchup/{p-03ae1be9.entry.js → p-af4a6191.entry.js} +1 -1
- package/dist/ketchup/{p-a7687c0e.entry.js → p-c18c7bb0.entry.js} +5 -5
- package/dist/ketchup/{p-62208488.entry.js → p-ca0ca27f.entry.js} +1 -1
- package/dist/ketchup/{p-e90934b5.entry.js → p-ccda584a.entry.js} +1 -1
- package/dist/ketchup/p-d4aa4922.js +1 -0
- package/dist/ketchup/{p-40df35de.entry.js → p-dbb6998b.entry.js} +1 -1
- package/dist/ketchup/{p-06c209a5.js → p-de83f2f6.js} +1 -1
- package/dist/ketchup/p-ec3a3db9.js +1 -0
- package/dist/types/components/kup-card/builtin/kup-card-builtin.d.ts +14 -0
- package/dist/types/components/kup-card/builtin/kup-card-calendar.d.ts +2 -0
- package/dist/types/components/kup-card/builtin/kup-card-clock.d.ts +2 -0
- package/dist/types/components/kup-card/free/kup-card-free.d.ts +8 -0
- package/dist/types/components/kup-card/kup-card-declarations.d.ts +74 -0
- package/dist/types/components/kup-card/kup-card.d.ts +3 -3
- package/dist/types/components/kup-data-table/kup-data-table-declarations.d.ts +1 -6
- package/dist/types/components/kup-data-table/kup-data-table-state.d.ts +1 -1
- package/dist/types/components/kup-data-table/kup-data-table.d.ts +1 -2
- package/dist/types/components/kup-date-picker/kup-date-picker.d.ts +0 -10
- package/dist/types/components/kup-time-picker/kup-time-picker.d.ts +2 -9
- package/dist/types/components.d.ts +2 -2
- package/package.json +1 -1
- package/dist/ketchup/p-1e2c3497.js +0 -1
- package/dist/ketchup/p-5db41fae.entry.js +0 -45
- package/dist/ketchup/p-756aa8b1.entry.js +0 -1
- package/dist/ketchup/p-ea387b49.entry.js +0 -1
- package/dist/ketchup/p-f6bff949.js +0 -1
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
import { FButton } from '../../../f-components/f-button/f-button';
|
|
3
|
+
import { FButtonStyling, } from '../../../f-components/f-button/f-button-declarations';
|
|
4
|
+
import { KupDatesFormats } from '../../../utils/kup-dates/kup-dates-declarations';
|
|
5
|
+
import { KupCardBuiltinClockElements, KupCardCSSClasses, } from '../kup-card-declarations';
|
|
6
|
+
const dom = document.documentElement;
|
|
7
|
+
export function prepareClock(component) {
|
|
8
|
+
const el = component.rootElement;
|
|
9
|
+
el.kupData = {};
|
|
10
|
+
if (component.data && component.data.options) {
|
|
11
|
+
const opts = component.data.options;
|
|
12
|
+
const obj = opts.initialValue;
|
|
13
|
+
if (opts.initialValue) {
|
|
14
|
+
if (obj && obj.k)
|
|
15
|
+
el.kupData.value = obj.k;
|
|
16
|
+
else
|
|
17
|
+
el.kupData.value = opts.initialValue;
|
|
18
|
+
}
|
|
19
|
+
if (opts.manageSeconds != null)
|
|
20
|
+
el.kupData.manageSeconds = opts.manageSeconds;
|
|
21
|
+
if (opts.hoursActive != null)
|
|
22
|
+
el.kupData.hoursActive = opts.hoursActive;
|
|
23
|
+
if (opts.minutesActive != null)
|
|
24
|
+
el.kupData.minutesActive = opts.minutesActive;
|
|
25
|
+
if (opts.secondsActive != null)
|
|
26
|
+
el.kupData.secondsActive = opts.secondsActive;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
el.kupData.hoursActive = true;
|
|
30
|
+
}
|
|
31
|
+
return prepTimeArea(component);
|
|
32
|
+
}
|
|
33
|
+
function isManageSeconds(component) {
|
|
34
|
+
const el = component.rootElement;
|
|
35
|
+
if (el.kupData.manageSeconds != null)
|
|
36
|
+
return el.kupData.manageSeconds;
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
function getValue(component) {
|
|
40
|
+
const el = component.rootElement;
|
|
41
|
+
if (el.kupData.value)
|
|
42
|
+
return el.kupData.value;
|
|
43
|
+
return '';
|
|
44
|
+
}
|
|
45
|
+
function setValue(component, value) {
|
|
46
|
+
const el = component.rootElement;
|
|
47
|
+
el.kupData.value = value;
|
|
48
|
+
}
|
|
49
|
+
function getHoursActive(component) {
|
|
50
|
+
const el = component.rootElement;
|
|
51
|
+
if (el.kupData.hoursActive != null)
|
|
52
|
+
return el.kupData.hoursActive;
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
function getMinutesActive(component) {
|
|
56
|
+
const el = component.rootElement;
|
|
57
|
+
if (el.kupData.minutesActive != null)
|
|
58
|
+
return el.kupData.minutesActive;
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
function getSecondsActive(component) {
|
|
62
|
+
const el = component.rootElement;
|
|
63
|
+
if (el.kupData.secondsActive != null)
|
|
64
|
+
return el.kupData.secondsActive;
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
function setElement(component, elem) {
|
|
68
|
+
if (elem) {
|
|
69
|
+
const el = component.rootElement;
|
|
70
|
+
el.kupData[elem.id] = elem;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function getElement(component, elemId) {
|
|
74
|
+
return component.rootElement.shadowRoot.getElementById(elemId);
|
|
75
|
+
}
|
|
76
|
+
function prepTimeArea(component) {
|
|
77
|
+
return (h("div", { id: "clock-div", onBlur: (e) => {
|
|
78
|
+
if (!isRelatedTargetInThisComponent(e, component)) {
|
|
79
|
+
onKupBlur(component);
|
|
80
|
+
}
|
|
81
|
+
} }, createClock(component)));
|
|
82
|
+
}
|
|
83
|
+
function onKupClockItemClick(e, component, value) {
|
|
84
|
+
if (e != null) {
|
|
85
|
+
if (value == null) {
|
|
86
|
+
value = e.detail.selected.value;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
setClockValueSelected(component, value);
|
|
90
|
+
component.onKupClick(component.rootElement.id, value);
|
|
91
|
+
}
|
|
92
|
+
function setClockValueSelected(component, newValue) {
|
|
93
|
+
if (newValue == null) {
|
|
94
|
+
newValue = getValue(component);
|
|
95
|
+
}
|
|
96
|
+
if (newValue == null) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
setValue(component, newValue);
|
|
100
|
+
}
|
|
101
|
+
function isRelatedTargetInThisComponent(e, component) {
|
|
102
|
+
if (!e.relatedTarget) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
let id = e.relatedTarget.id;
|
|
106
|
+
if (id == null || id.trim() == '') {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
if (id == getElement(component, KupCardBuiltinClockElements.CLOCK).id) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
let idConc = '#clock-div#confirm#';
|
|
113
|
+
return idConc.indexOf('#' + id + '#') >= 0;
|
|
114
|
+
}
|
|
115
|
+
function onKupBlur(component) {
|
|
116
|
+
component.onKupClick(component.rootElement.id, getValue(component));
|
|
117
|
+
}
|
|
118
|
+
function createClock(component) {
|
|
119
|
+
let selectedTime;
|
|
120
|
+
if (getValue(component)) {
|
|
121
|
+
selectedTime = dom.ketchup.dates.toDate(getValue(component), isManageSeconds(component)
|
|
122
|
+
? KupDatesFormats.ISO_TIME
|
|
123
|
+
: KupDatesFormats.ISO_TIME_WITHOUT_SECONDS);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
selectedTime = new Date();
|
|
127
|
+
}
|
|
128
|
+
let hh = selectedTime.getHours().toString();
|
|
129
|
+
let mm = selectedTime.getMinutes().toString();
|
|
130
|
+
if (hh.length === 1) {
|
|
131
|
+
hh = '0' + hh;
|
|
132
|
+
}
|
|
133
|
+
if (mm.length === 1) {
|
|
134
|
+
mm = '0' + mm;
|
|
135
|
+
}
|
|
136
|
+
let ss = '';
|
|
137
|
+
if (isManageSeconds(component)) {
|
|
138
|
+
ss = selectedTime.getSeconds().toString();
|
|
139
|
+
if (ss.length === 1) {
|
|
140
|
+
ss = '0' + ss;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
let seconds;
|
|
144
|
+
let time = [
|
|
145
|
+
h("span", { id: KupCardBuiltinClockElements.HOURS, class: `h ${getHoursActive(component) ? KupCardCSSClasses.VISIBLE : ''}`, ref: (el) => {
|
|
146
|
+
setElement(component, el);
|
|
147
|
+
}, onClick: () => {
|
|
148
|
+
setClockViewActive(component, true, false, false);
|
|
149
|
+
switchView(component, KupCardBuiltinClockElements.HOURS, KupCardBuiltinClockElements.HOURSCIRCLE);
|
|
150
|
+
}, innerHTML: hh }),
|
|
151
|
+
':',
|
|
152
|
+
h("span", { id: KupCardBuiltinClockElements.MINUTES, class: `m ${getMinutesActive(component) ? KupCardCSSClasses.VISIBLE : ''}`, ref: (el) => {
|
|
153
|
+
setElement(component, el);
|
|
154
|
+
}, onClick: () => {
|
|
155
|
+
setClockViewActive(component, false, true, false);
|
|
156
|
+
switchView(component, KupCardBuiltinClockElements.MINUTES, KupCardBuiltinClockElements.MINUTESCIRCLE);
|
|
157
|
+
}, innerHTML: mm }),
|
|
158
|
+
];
|
|
159
|
+
if (isManageSeconds(component)) {
|
|
160
|
+
seconds = (h("div", { id: KupCardBuiltinClockElements.SECONDSCIRCLE, class: `circle seconds ${getSecondsActive(component) ? KupCardCSSClasses.VISIBLE : ''}`, ref: (el) => {
|
|
161
|
+
setElement(component, el);
|
|
162
|
+
} },
|
|
163
|
+
buildClock(60, 101, 115, 115, 'sec unit', 0, 5, ss, component),
|
|
164
|
+
h("div", { class: "mid" })));
|
|
165
|
+
time.push(':', h("span", { id: KupCardBuiltinClockElements.SECONDS, class: `s ${getSecondsActive(component) ? KupCardCSSClasses.VISIBLE : ''}`, ref: (el) => {
|
|
166
|
+
setElement(component, el);
|
|
167
|
+
}, onClick: () => {
|
|
168
|
+
setClockViewActive(component, false, false, true);
|
|
169
|
+
switchView(component, KupCardBuiltinClockElements.SECONDS, KupCardBuiltinClockElements.SECONDSCIRCLE);
|
|
170
|
+
}, innerHTML: ss }));
|
|
171
|
+
}
|
|
172
|
+
const confirmButtonProp = {
|
|
173
|
+
label: 'Ok',
|
|
174
|
+
styling: FButtonStyling.FLAT,
|
|
175
|
+
onClick: (e) => {
|
|
176
|
+
setTimeFromClock(e, component);
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
return (h("div", { class: "clock", id: KupCardBuiltinClockElements.CLOCK, ref: (el) => {
|
|
180
|
+
setElement(component, el);
|
|
181
|
+
} },
|
|
182
|
+
h("div", { class: "top" }, time),
|
|
183
|
+
h("div", { id: KupCardBuiltinClockElements.HOURSCIRCLE, class: `circle hours ${getHoursActive(component) ? KupCardCSSClasses.VISIBLE : ''}`, ref: (el) => {
|
|
184
|
+
setElement(component, el);
|
|
185
|
+
} },
|
|
186
|
+
buildClock(12, 101, 105, 105, 'hour', 0, 1, hh, component),
|
|
187
|
+
buildClock(12, 64, 110, 110, 'hour2', 12, 1, hh, component),
|
|
188
|
+
h("div", { class: "mid" })),
|
|
189
|
+
h("div", { id: KupCardBuiltinClockElements.MINUTESCIRCLE, class: `circle minutes ${getMinutesActive(component) ? KupCardCSSClasses.VISIBLE : ''}`, ref: (el) => {
|
|
190
|
+
setElement(component, el);
|
|
191
|
+
} },
|
|
192
|
+
buildClock(60, 101, 115, 115, 'min unit', 0, 5, mm, component),
|
|
193
|
+
h("div", { class: "mid" })),
|
|
194
|
+
seconds,
|
|
195
|
+
h("div", { class: "actions" },
|
|
196
|
+
h(FButton, Object.assign({}, confirmButtonProp)))));
|
|
197
|
+
}
|
|
198
|
+
function setClockViewActive(component, hoursAct, minutesAct, secondsAct) {
|
|
199
|
+
const el = component.rootElement;
|
|
200
|
+
el.kupData.hoursActive = hoursAct;
|
|
201
|
+
el.kupData.minutesActive = minutesAct;
|
|
202
|
+
el.kupData.secondsActive = secondsAct;
|
|
203
|
+
}
|
|
204
|
+
function switchView(component, elId, elCircleId) {
|
|
205
|
+
getElement(component, KupCardBuiltinClockElements.HOURS).classList.remove(KupCardCSSClasses.VISIBLE);
|
|
206
|
+
getElement(component, KupCardBuiltinClockElements.HOURSCIRCLE).classList.remove(KupCardCSSClasses.VISIBLE);
|
|
207
|
+
getElement(component, KupCardBuiltinClockElements.MINUTES).classList.remove(KupCardCSSClasses.VISIBLE);
|
|
208
|
+
getElement(component, KupCardBuiltinClockElements.MINUTESCIRCLE).classList.remove(KupCardCSSClasses.VISIBLE);
|
|
209
|
+
if (isManageSeconds(component)) {
|
|
210
|
+
getElement(component, KupCardBuiltinClockElements.SECONDS).classList.remove(KupCardCSSClasses.VISIBLE);
|
|
211
|
+
getElement(component, KupCardBuiltinClockElements.SECONDSCIRCLE).classList.remove(KupCardCSSClasses.VISIBLE);
|
|
212
|
+
}
|
|
213
|
+
getElement(component, elId).classList.add(KupCardCSSClasses.VISIBLE);
|
|
214
|
+
getElement(component, elCircleId).classList.add(KupCardCSSClasses.VISIBLE);
|
|
215
|
+
}
|
|
216
|
+
function buildClock(num, radius, offsetX, offsetY, className, add, separator, selectedValue, component) {
|
|
217
|
+
let x, y;
|
|
218
|
+
const divsArray = [];
|
|
219
|
+
for (let n = 0; n < num; n++) {
|
|
220
|
+
x = radius * Math.cos((n / num) * 2 * Math.PI);
|
|
221
|
+
y = radius * Math.sin((n / num) * 2 * Math.PI);
|
|
222
|
+
let text;
|
|
223
|
+
let dataValue = {};
|
|
224
|
+
let style = {};
|
|
225
|
+
if (separator == 1) {
|
|
226
|
+
if (n + 3 > 12) {
|
|
227
|
+
text = n + 3 - 12 + add + '';
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
let calc = n + 3 + add;
|
|
231
|
+
if (calc !== 24) {
|
|
232
|
+
text = n + 3 + add + '';
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
text = '00';
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
dataValue['data-value'] = text;
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
if (n % separator == 0) {
|
|
242
|
+
if (n + 15 >= 60) {
|
|
243
|
+
dataValue['data-value'] = n + 15 - 60 + '';
|
|
244
|
+
text = n + 15 - 60 + add + '';
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
dataValue['data-value'] = n + 15 + '';
|
|
248
|
+
text = n + 15 + add + '';
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
if (n + 15 >= 60) {
|
|
253
|
+
dataValue['data-value'] = n + 15 - 60 + '';
|
|
254
|
+
text = '⋅';
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
dataValue['data-value'] = n + 15 + '';
|
|
258
|
+
text = '\u00B7';
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
style['left'] = x + offsetX + 'px';
|
|
263
|
+
style['top'] = y + offsetY + 'px';
|
|
264
|
+
if (dataValue['data-value'].length === 1) {
|
|
265
|
+
dataValue['data-value'] = '0' + dataValue['data-value'];
|
|
266
|
+
}
|
|
267
|
+
let elClass = className;
|
|
268
|
+
if (dataValue['data-value'] === selectedValue) {
|
|
269
|
+
elClass += ' selected';
|
|
270
|
+
}
|
|
271
|
+
let div = (h("div", Object.assign({ class: elClass, style: style }, dataValue, { onClick: (e) => setClockTime(e, component) }), text));
|
|
272
|
+
divsArray.push(div);
|
|
273
|
+
}
|
|
274
|
+
return divsArray;
|
|
275
|
+
}
|
|
276
|
+
function setTimeFromClock(e, component) {
|
|
277
|
+
const hoursEl = getElement(component, KupCardBuiltinClockElements.HOURS);
|
|
278
|
+
const minutesEl = getElement(component, KupCardBuiltinClockElements.MINUTES);
|
|
279
|
+
const secondsEl = getElement(component, KupCardBuiltinClockElements.SECONDS);
|
|
280
|
+
let text = hoursEl.innerText + ':' + minutesEl.innerText;
|
|
281
|
+
if (isManageSeconds(component)) {
|
|
282
|
+
text += ':' + secondsEl.innerText;
|
|
283
|
+
}
|
|
284
|
+
onKupClockItemClick(e, component, text);
|
|
285
|
+
}
|
|
286
|
+
function setClockTime(e, component) {
|
|
287
|
+
const hoursEl = getElement(component, KupCardBuiltinClockElements.HOURS);
|
|
288
|
+
const minutesEl = getElement(component, KupCardBuiltinClockElements.MINUTES);
|
|
289
|
+
const hoursCircleEl = getElement(component, KupCardBuiltinClockElements.HOURSCIRCLE);
|
|
290
|
+
const minutesCircleEl = getElement(component, KupCardBuiltinClockElements.MINUTESCIRCLE);
|
|
291
|
+
const secondsEl = getElement(component, KupCardBuiltinClockElements.SECONDS);
|
|
292
|
+
const secondsCircleEl = getElement(component, KupCardBuiltinClockElements.SECONDSCIRCLE);
|
|
293
|
+
let time = e.target.getAttribute('data-value');
|
|
294
|
+
if (getHoursActive(component)) {
|
|
295
|
+
hoursEl.innerText = time;
|
|
296
|
+
hoursCircleEl.querySelector('.selected').classList.remove('selected');
|
|
297
|
+
setClockViewActive(component, false, true, false);
|
|
298
|
+
switchView(component, KupCardBuiltinClockElements.MINUTES, KupCardBuiltinClockElements.MINUTESCIRCLE);
|
|
299
|
+
}
|
|
300
|
+
else if (getMinutesActive(component)) {
|
|
301
|
+
minutesEl.innerText = time;
|
|
302
|
+
minutesCircleEl.querySelector('.selected').classList.remove('selected');
|
|
303
|
+
if (isManageSeconds(component)) {
|
|
304
|
+
setClockViewActive(component, false, false, true);
|
|
305
|
+
switchView(component, KupCardBuiltinClockElements.SECONDS, KupCardBuiltinClockElements.SECONDSCIRCLE);
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
setTimeFromClock(e, component);
|
|
309
|
+
setClockViewActive(component, true, false, false);
|
|
310
|
+
switchView(component, KupCardBuiltinClockElements.HOURS, KupCardBuiltinClockElements.HOURSCIRCLE);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
secondsEl.innerText = time;
|
|
315
|
+
secondsCircleEl.querySelector('.selected').classList.remove('selected');
|
|
316
|
+
setTimeFromClock(e, component);
|
|
317
|
+
setClockViewActive(component, true, false, false);
|
|
318
|
+
switchView(component, KupCardBuiltinClockElements.HOURS, KupCardBuiltinClockElements.HOURSCIRCLE);
|
|
319
|
+
}
|
|
320
|
+
e.target.classList.add('selected');
|
|
321
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
import { compList } from '../kup-card-helper';
|
|
3
|
+
const dom = document.documentElement;
|
|
4
|
+
/**
|
|
5
|
+
* 1st free card layout, only slots.
|
|
6
|
+
* @param {KupCard} component - Card component.
|
|
7
|
+
* @returns {VNode} 1st standard layout virtual node.
|
|
8
|
+
*/
|
|
9
|
+
export function create1(component) {
|
|
10
|
+
//Slot list
|
|
11
|
+
const slots = Array.prototype.slice.call(component.rootElement.children, 0);
|
|
12
|
+
return (h("div", { class: `free-layout-${component.layoutNumber}` }, slots.length > 0 ? compList(slots, 'slot') : null));
|
|
13
|
+
}
|
|
@@ -13,17 +13,35 @@ export var KupCardProps;
|
|
|
13
13
|
KupCardProps["sizeX"] = "The width of the card, defaults to 100%. Accepts any valid CSS format (px, %, vw, etc.).";
|
|
14
14
|
KupCardProps["sizeY"] = "The height of the card, defaults to 100%. Accepts any valid CSS format (px, %, vh, etc.).";
|
|
15
15
|
})(KupCardProps || (KupCardProps = {}));
|
|
16
|
+
/**
|
|
17
|
+
* Element ids for kup-card clock builtin.
|
|
18
|
+
*/
|
|
19
|
+
export var KupCardBuiltinClockElements;
|
|
20
|
+
(function (KupCardBuiltinClockElements) {
|
|
21
|
+
KupCardBuiltinClockElements["CLOCK"] = "clockEl";
|
|
22
|
+
KupCardBuiltinClockElements["HOURS"] = "hoursEl";
|
|
23
|
+
KupCardBuiltinClockElements["MINUTES"] = "minutesEl";
|
|
24
|
+
KupCardBuiltinClockElements["SECONDS"] = "secondsEl";
|
|
25
|
+
KupCardBuiltinClockElements["HOURSCIRCLE"] = "hoursCircleEl";
|
|
26
|
+
KupCardBuiltinClockElements["MINUTESCIRCLE"] = "minutesCircleEl";
|
|
27
|
+
KupCardBuiltinClockElements["SECONDSCIRCLE"] = "secondsCircleEl";
|
|
28
|
+
})(KupCardBuiltinClockElements || (KupCardBuiltinClockElements = {}));
|
|
16
29
|
/**
|
|
17
30
|
* Layout families of the kup-card component.
|
|
18
31
|
* @enum {string}
|
|
32
|
+
* @property {string} BUILTIN - Cards belonging to this family will created automatically by library.
|
|
19
33
|
* @property {string} COLLAPSIBLE - Cards belonging to this family will display an area usable to expand the content of the card.
|
|
34
|
+
* @property {string} DIALOG - Cards belonging to this family will be movable and usually closable.
|
|
35
|
+
* @property {string} FREE - This family of card will only receive slots, usually already arranged from the outside style.
|
|
20
36
|
* @property {string} SCALABLE - Content will fit its container, resizing itself automatically.
|
|
21
37
|
* @property {string} STANDARD - Stndard layouts.
|
|
22
38
|
*/
|
|
23
39
|
export var KupCardFamily;
|
|
24
40
|
(function (KupCardFamily) {
|
|
41
|
+
KupCardFamily["BUILTIN"] = "builtin";
|
|
25
42
|
KupCardFamily["COLLAPSIBLE"] = "collapsible";
|
|
26
43
|
KupCardFamily["DIALOG"] = "dialog";
|
|
44
|
+
KupCardFamily["FREE"] = "free";
|
|
27
45
|
KupCardFamily["SCALABLE"] = "scalable";
|
|
28
46
|
KupCardFamily["STANDARD"] = "standard";
|
|
29
47
|
})(KupCardFamily || (KupCardFamily = {}));
|
|
@@ -47,6 +65,7 @@ export var KupCardIds;
|
|
|
47
65
|
*/
|
|
48
66
|
export var KupCardCSSClasses;
|
|
49
67
|
(function (KupCardCSSClasses) {
|
|
68
|
+
KupCardCSSClasses["BUILTIN_CARD"] = "builtin-card";
|
|
50
69
|
KupCardCSSClasses["CARD_VIEW"] = "card-view";
|
|
51
70
|
KupCardCSSClasses["CLICKABLE_LINK"] = "clickable-link";
|
|
52
71
|
KupCardCSSClasses["COLLAPSIBLE_ACTIVE"] = "collapsible-active";
|