courthive-components 6.11.0 → 6.12.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/components/interactive-scoring/index.d.ts +1 -1
- package/dist/components/ladderChart/index.d.ts +1 -1
- package/dist/components/policy-catalog/editors/privacy/domain/privacyProjections.d.ts +16 -3
- package/dist/components/policy-catalog/editors/privacy/index.d.ts +1 -1
- package/dist/components/policy-catalog/editors/scoring/index.d.ts +2 -2
- package/dist/components/policy-catalog/index.d.ts +3 -3
- package/dist/components/ratingDistributionChart/index.d.ts +1 -1
- package/dist/components/topology-builder/domain/edgeTraversal.d.ts +15 -0
- package/dist/components/topology-builder/ui/edgeEditMode.d.ts +15 -0
- package/dist/courthive-components.es.js +1509 -1440
- package/dist/courthive-components.umd.js +46 -46
- package/dist/{dist-D160D4O-.mjs → dist-DPnSc4eG.mjs} +492 -393
- package/dist/{range-CbB5sPGX.mjs → range-C-KhEV-d.mjs} +263 -84
- package/package.json +3 -2
|
@@ -1,66 +1,91 @@
|
|
|
1
|
-
//#region node_modules/.pnpm/timepicker-ui@4.
|
|
2
|
-
var e = /^(0?[1-9]|1[0-2]):([0-5]?\d)(?::([0-5]?\d))?\s*(AM|PM)$/i, t = /^([01]?\d|2[0-3]):([0-5]?\d)(?::([0-5]?\d))?$/, n = (e) => String(e).padStart(2, "0");
|
|
3
|
-
function
|
|
4
|
-
let a =
|
|
1
|
+
//#region node_modules/.pnpm/timepicker-ui@4.6.0/node_modules/timepicker-ui/dist/plugins/range.js
|
|
2
|
+
var e = /^(0?[1-9]|1[0-2]):([0-5]?\d)(?::([0-5]?\d))?\s*(AM|PM)$/i, t = /^([01]?\d|2[0-3]):([0-5]?\d)(?::([0-5]?\d))?$/, n = /^\s*\d{1,2}:\d{1,2}:\d{1,2}/, r = (e) => String(e).padStart(2, "0");
|
|
3
|
+
function i(n, i) {
|
|
4
|
+
let a = n.trim().match(i.clockType === "12h" ? e : t);
|
|
5
5
|
if (!a) return null;
|
|
6
6
|
let o = {
|
|
7
|
-
hour:
|
|
8
|
-
minutes:
|
|
7
|
+
hour: r(a[1]),
|
|
8
|
+
minutes: r(a[2])
|
|
9
9
|
};
|
|
10
|
-
return i.showSeconds && (o.seconds =
|
|
10
|
+
return i.showSeconds && (o.seconds = r(a[3] ?? "0")), i.clockType === "12h" && (o.type = a[4].toUpperCase()), o;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
function a(e) {
|
|
13
|
+
return n.test(e);
|
|
14
|
+
}
|
|
15
|
+
function o(e, t) {
|
|
16
|
+
let n = `${r(e.hour)}:${r(e.minutes)}`, i = t.showSeconds ? `${n}:${r(e.seconds ?? "0")}` : n;
|
|
17
|
+
return t.clockType === "12h" && e.type ? `${i} ${e.type}` : i;
|
|
18
|
+
}
|
|
19
|
+
var s = (e, t, n) => {
|
|
13
20
|
if (n !== "12h" || !t) return e;
|
|
14
21
|
let r = t.toUpperCase();
|
|
15
22
|
return r === "PM" && e !== 12 ? e + 12 : r === "AM" && e === 12 ? 0 : e;
|
|
16
23
|
};
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
function c(e, t, n) {
|
|
25
|
+
return n === "24h" ? {
|
|
26
|
+
hour: r(e),
|
|
27
|
+
...t,
|
|
28
|
+
type: void 0
|
|
29
|
+
} : {
|
|
30
|
+
hour: r(e % 12 || 12),
|
|
31
|
+
...t,
|
|
32
|
+
type: e >= 12 ? "PM" : "AM"
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function l(e, t, n) {
|
|
36
|
+
let i = s(parseInt(e.hour, 10), e.type, t), a = n.showSeconds ? r(e.seconds ?? "0") : void 0;
|
|
37
|
+
return c(i, {
|
|
38
|
+
minutes: e.minutes,
|
|
39
|
+
seconds: a
|
|
40
|
+
}, n.clockType);
|
|
41
|
+
}
|
|
42
|
+
function u(e, t) {
|
|
43
|
+
let n = parseInt(e.hour, 10), r = parseInt(e.minutes, 10), i = parseInt(e.seconds ?? "0", 10);
|
|
44
|
+
return Number.isNaN(n) || Number.isNaN(r) || Number.isNaN(i) ? 0 : s(n, e.type, t) * 3600 + r * 60 + i;
|
|
20
45
|
}
|
|
21
|
-
var
|
|
22
|
-
function
|
|
46
|
+
var d = "--", f = (e) => e.startsWith(d);
|
|
47
|
+
function p(e = !1) {
|
|
23
48
|
return e ? "--:--:--" : "--:--";
|
|
24
49
|
}
|
|
25
|
-
function
|
|
26
|
-
if (!e ||
|
|
27
|
-
let n = (n) =>
|
|
50
|
+
function m(e, t = !1) {
|
|
51
|
+
if (!e || f(e)) return null;
|
|
52
|
+
let n = (n) => i(e, {
|
|
28
53
|
clockType: n,
|
|
29
54
|
showSeconds: t
|
|
30
55
|
});
|
|
31
56
|
return n("12h") ?? n("24h");
|
|
32
57
|
}
|
|
33
|
-
function
|
|
34
|
-
let
|
|
58
|
+
function h(e, t = !1) {
|
|
59
|
+
let n = `${e.hour}:${r(e.minutes)}`, i = t ? `${n}:${r(e.seconds ?? "0")}` : n;
|
|
35
60
|
return e.type ? `${i} ${e.type}` : i;
|
|
36
61
|
}
|
|
37
|
-
function
|
|
38
|
-
return e ?
|
|
62
|
+
function g(e, t = !1) {
|
|
63
|
+
return e ? h(e, t) : p(t);
|
|
39
64
|
}
|
|
40
|
-
function
|
|
41
|
-
return !e || !t ? 0 :
|
|
65
|
+
function _(e, t, n) {
|
|
66
|
+
return !e || !t ? 0 : u(t, n) - u(e, n);
|
|
42
67
|
}
|
|
43
|
-
function
|
|
44
|
-
return Math.floor(
|
|
68
|
+
function v(e, t, n) {
|
|
69
|
+
return Math.floor(_(e, t, n) / 60);
|
|
45
70
|
}
|
|
46
|
-
function
|
|
71
|
+
function y(e, t) {
|
|
47
72
|
return e ? t === "12h" ? !!(e.hour && e.minutes && e.type) : !!(e.hour && e.minutes) : !1;
|
|
48
73
|
}
|
|
49
|
-
function
|
|
74
|
+
function b(e, t = !1) {
|
|
50
75
|
if (!e || !e.includes(" - ")) return {
|
|
51
76
|
from: null,
|
|
52
77
|
to: null
|
|
53
78
|
};
|
|
54
79
|
let n = e.split(" - ").map((e) => e.trim());
|
|
55
|
-
return n.length !== 2 || n.some(
|
|
80
|
+
return n.length !== 2 || n.some(f) ? {
|
|
56
81
|
from: null,
|
|
57
82
|
to: null
|
|
58
83
|
} : {
|
|
59
|
-
from:
|
|
60
|
-
to:
|
|
84
|
+
from: m(n[0], t),
|
|
85
|
+
to: m(n[1], t)
|
|
61
86
|
};
|
|
62
87
|
}
|
|
63
|
-
var
|
|
88
|
+
var x = (e) => Array.from({ length: e }, (e, t) => r(t)), S = class {
|
|
64
89
|
activePart = "from";
|
|
65
90
|
fromValue = null;
|
|
66
91
|
toValue = null;
|
|
@@ -70,9 +95,10 @@ var g = (e) => Array.from({ length: e }, (e, t) => n(t)), _ = class {
|
|
|
70
95
|
maxDuration;
|
|
71
96
|
emitter;
|
|
72
97
|
showSeconds;
|
|
98
|
+
linked;
|
|
73
99
|
chosenFields = /* @__PURE__ */ new Set();
|
|
74
|
-
constructor(e, t, n, r, i = !1) {
|
|
75
|
-
this.clockType = e, this.minDuration = t, this.maxDuration = n, this.emitter = r, this.showSeconds = i;
|
|
100
|
+
constructor(e, t, n, r, i = !1, a = !0) {
|
|
101
|
+
this.clockType = e, this.minDuration = t, this.maxDuration = n, this.emitter = r, this.showSeconds = i, this.linked = a;
|
|
76
102
|
}
|
|
77
103
|
getActivePart() {
|
|
78
104
|
return this.activePart;
|
|
@@ -96,25 +122,27 @@ var g = (e) => Array.from({ length: e }, (e, t) => n(t)), _ = class {
|
|
|
96
122
|
this.previewValue = e;
|
|
97
123
|
}
|
|
98
124
|
isFromComplete() {
|
|
99
|
-
return
|
|
125
|
+
return y(this.fromValue, this.clockType);
|
|
100
126
|
}
|
|
101
127
|
isToComplete() {
|
|
102
|
-
return
|
|
128
|
+
return y(this.toValue, this.clockType);
|
|
103
129
|
}
|
|
104
130
|
canSwitchToEnd() {
|
|
105
|
-
return this.isFromComplete();
|
|
131
|
+
return !this.linked || this.isFromComplete();
|
|
106
132
|
}
|
|
107
133
|
getCompletePreview(e) {
|
|
108
134
|
let t = this.previewValue;
|
|
109
135
|
if (!t || this.activePart !== e) return null;
|
|
110
|
-
let n = [t.minutes, t.seconds ?? ""].some(
|
|
111
|
-
return
|
|
136
|
+
let n = [t.minutes, t.seconds ?? ""].some(f);
|
|
137
|
+
return y(t, this.clockType) && !n ? t : null;
|
|
112
138
|
}
|
|
113
139
|
getPendingFrom() {
|
|
114
140
|
return this.isFromComplete() ? null : this.getCompletePreview("from");
|
|
115
141
|
}
|
|
116
142
|
canConfirm() {
|
|
117
|
-
let e = this.chosenFields.size > 0 ? this.getCompletePreview("to") : null, t = this.isFromComplete() && this.isToComplete() ? this.toValue : null
|
|
143
|
+
let e = this.chosenFields.size > 0 ? this.getCompletePreview("to") : null, t = this.isFromComplete() && this.isToComplete() ? this.toValue : null;
|
|
144
|
+
if (!this.linked) return this.isFromComplete() && (e ?? t) !== null;
|
|
145
|
+
let n = _(this.fromValue, e ?? t, this.clockType);
|
|
118
146
|
return n > 0 && this.isWithinLimits(n);
|
|
119
147
|
}
|
|
120
148
|
isWithinLimits(e) {
|
|
@@ -133,17 +161,17 @@ var g = (e) => Array.from({ length: e }, (e, t) => n(t)), _ = class {
|
|
|
133
161
|
this.previewValue &&= (this.activePart === "from" ? this.fromValue = this.previewValue : this.toValue = this.previewValue, null);
|
|
134
162
|
}
|
|
135
163
|
getDurationSeconds() {
|
|
136
|
-
return
|
|
164
|
+
return _(this.fromValue, this.toValue, this.clockType);
|
|
137
165
|
}
|
|
138
166
|
getDuration() {
|
|
139
|
-
return
|
|
167
|
+
return v(this.fromValue, this.toValue, this.clockType);
|
|
140
168
|
}
|
|
141
169
|
validate() {
|
|
142
170
|
if (!this.fromValue || !this.toValue) return {
|
|
143
171
|
valid: !0,
|
|
144
172
|
duration: 0
|
|
145
173
|
};
|
|
146
|
-
let e = this.getDuration(), t = this.getDurationSeconds(), n = this.isWithinLimits(t), r = this.showSeconds ? {
|
|
174
|
+
let e = this.getDuration(), t = this.getDurationSeconds(), n = !this.linked || this.isWithinLimits(t), r = this.showSeconds ? {
|
|
147
175
|
valid: n,
|
|
148
176
|
duration: e,
|
|
149
177
|
durationSeconds: t
|
|
@@ -158,45 +186,88 @@ var g = (e) => Array.from({ length: e }, (e, t) => n(t)), _ = class {
|
|
|
158
186
|
}), r;
|
|
159
187
|
}
|
|
160
188
|
getDisabledTimeForEndPart() {
|
|
161
|
-
if (this.activePart === "from" || !this.fromValue || !this.isFromComplete()) return null;
|
|
189
|
+
if (!this.linked || this.activePart === "from" || !this.fromValue || !this.isFromComplete()) return null;
|
|
162
190
|
let e = parseInt(this.fromValue.hour, 10), t = parseInt(this.fromValue.minutes, 10), n = {
|
|
163
191
|
hours: [],
|
|
164
|
-
minutes:
|
|
192
|
+
minutes: x(t),
|
|
165
193
|
fromHour: e
|
|
166
194
|
};
|
|
167
|
-
return this.clockType === "24h" ? n.hours =
|
|
195
|
+
return this.clockType === "24h" ? n.hours = x(e) : n.fromType = this.fromValue.type, this.showSeconds && (n.seconds = x(parseInt(this.fromValue.seconds ?? "0", 10)), n.fromMinute = t), n;
|
|
168
196
|
}
|
|
169
197
|
reset() {
|
|
170
198
|
this.activePart = "from", this.fromValue = null, this.toValue = null, this.previewValue = null, this.chosenFields.clear();
|
|
171
199
|
}
|
|
172
|
-
},
|
|
200
|
+
}, C = (e, t, n) => {
|
|
173
201
|
e?.classList.toggle(t, n);
|
|
174
|
-
},
|
|
202
|
+
}, w = (e, t, n) => {
|
|
175
203
|
n ? e.getAttribute(t) !== n && e.setAttribute(t, n) : e.removeAttribute(t);
|
|
176
|
-
},
|
|
177
|
-
e &&
|
|
178
|
-
},
|
|
179
|
-
|
|
180
|
-
},
|
|
181
|
-
|
|
182
|
-
},
|
|
204
|
+
}, T = (e, t) => {
|
|
205
|
+
e && w(e, "aria-pressed", String(t));
|
|
206
|
+
}, E = (e, t) => {
|
|
207
|
+
C(e, "active", t), T(e, t);
|
|
208
|
+
}, D = (e, t, n) => {
|
|
209
|
+
E(e, n === "AM"), E(t, n === "PM");
|
|
210
|
+
}, O = [
|
|
183
211
|
"aria-label",
|
|
184
212
|
"aria-valuemin",
|
|
185
213
|
"aria-valuemax",
|
|
186
214
|
"aria-valuenow",
|
|
187
215
|
"aria-valuetext"
|
|
188
|
-
],
|
|
216
|
+
], k = (e) => {
|
|
189
217
|
if (!e) return;
|
|
190
218
|
let t = e.querySelector(".tp-ui-clock-face");
|
|
191
219
|
if (!t) return;
|
|
192
220
|
let n = e.querySelector("input.active") ?? e.querySelector(".tp-ui-hour");
|
|
193
|
-
|
|
194
|
-
},
|
|
221
|
+
O.forEach((e) => w(t, e, n?.getAttribute(e)));
|
|
222
|
+
}, A = (e, t) => {
|
|
195
223
|
if (!e) return;
|
|
196
224
|
e.value = t;
|
|
197
225
|
let n = parseInt(t, 10), r = !Number.isNaN(n);
|
|
198
|
-
|
|
199
|
-
}
|
|
226
|
+
w(e, "aria-valuenow", r && String(n)), w(e, "aria-valuetext", r && t), k(e.closest(".tp-ui-modal"));
|
|
227
|
+
};
|
|
228
|
+
function j(e) {
|
|
229
|
+
return e.clock.type === "24h" ? "24h" : "12h";
|
|
230
|
+
}
|
|
231
|
+
function M(e) {
|
|
232
|
+
return {
|
|
233
|
+
clockType: j(e),
|
|
234
|
+
showSeconds: !!e.clock.showSeconds
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
var N = {
|
|
238
|
+
hour: {
|
|
239
|
+
input: "getHour",
|
|
240
|
+
event: "select:hour",
|
|
241
|
+
announce: "announceHour"
|
|
242
|
+
},
|
|
243
|
+
minutes: {
|
|
244
|
+
input: "getMinutes",
|
|
245
|
+
event: "select:minute",
|
|
246
|
+
announce: "announceMinute"
|
|
247
|
+
},
|
|
248
|
+
seconds: {
|
|
249
|
+
input: "getSeconds",
|
|
250
|
+
event: "select:second",
|
|
251
|
+
announce: "second"
|
|
252
|
+
}
|
|
253
|
+
}, P = [
|
|
254
|
+
"hour",
|
|
255
|
+
"minutes",
|
|
256
|
+
"seconds"
|
|
257
|
+
], F = (e, t) => e[N[t].input](), I = (e, t, n) => {
|
|
258
|
+
e.emit(N[t].event, { [t]: n });
|
|
259
|
+
}, L = (e, t) => {
|
|
260
|
+
P.forEach((n) => C(F(e, n), "active", n === t)), k(e.getModalElement());
|
|
261
|
+
};
|
|
262
|
+
function R(e) {
|
|
263
|
+
let t = {
|
|
264
|
+
hour: e.getHour()?.value,
|
|
265
|
+
minutes: e.getMinutes()?.value,
|
|
266
|
+
type: e.getActiveType()
|
|
267
|
+
};
|
|
268
|
+
return e.options.clock.showSeconds && (t.seconds = e.getSeconds()?.value ?? "00"), t;
|
|
269
|
+
}
|
|
270
|
+
var z = class {
|
|
200
271
|
core;
|
|
201
272
|
state;
|
|
202
273
|
constructor(e, t) {
|
|
@@ -205,7 +276,7 @@ var g = (e) => Array.from({ length: e }, (e, t) => n(t)), _ = class {
|
|
|
205
276
|
updateTabs() {
|
|
206
277
|
let e = this.core.getModalElement();
|
|
207
278
|
if (!e) return;
|
|
208
|
-
let t = e.querySelector(".tp-ui-range-tab.tp-ui-range-from"), n = e.querySelector(".tp-ui-range-tab.tp-ui-range-to"), r = this.state.getActivePart() === "from", i = this.state.
|
|
279
|
+
let t = e.querySelector(".tp-ui-range-tab.tp-ui-range-from"), n = e.querySelector(".tp-ui-range-tab.tp-ui-range-to"), r = this.state.getActivePart() === "from", i = this.state.canSwitchToEnd() || this.state.getPendingFrom() !== null;
|
|
209
280
|
t?.classList.toggle("active", r), n?.classList.toggle("active", !r), n?.classList.toggle("disabled", !i), t?.setAttribute("aria-selected", String(r)), n?.setAttribute("aria-selected", String(!r)), n?.setAttribute("aria-disabled", String(!i)), t?.setAttribute("tabindex", r ? "0" : "-1"), n?.setAttribute("tabindex", r || !i ? "-1" : "0");
|
|
210
281
|
}
|
|
211
282
|
updateTimeDisplay() {
|
|
@@ -217,7 +288,7 @@ var g = (e) => Array.from({ length: e }, (e, t) => n(t)), _ = class {
|
|
|
217
288
|
renderTime(e, t) {
|
|
218
289
|
if (!e) return;
|
|
219
290
|
let { showSeconds: n } = this.state;
|
|
220
|
-
t ? (e.textContent =
|
|
291
|
+
t ? (e.textContent = h(t, n), e.removeAttribute("aria-hidden")) : (e.textContent = p(n), e.setAttribute("aria-hidden", "true"));
|
|
221
292
|
}
|
|
222
293
|
updateOkButton() {
|
|
223
294
|
let e = this.core.getOkButton();
|
|
@@ -229,52 +300,160 @@ var g = (e) => Array.from({ length: e }, (e, t) => n(t)), _ = class {
|
|
|
229
300
|
let e = this.core.getInput();
|
|
230
301
|
if (!e) return;
|
|
231
302
|
let { showSeconds: t } = this.state;
|
|
232
|
-
e.value = `${
|
|
303
|
+
e.value = `${g(this.state.getFromValue(), t)} - ${g(this.state.getToValue(), t)}`;
|
|
233
304
|
}
|
|
234
305
|
syncClockToActivePart() {
|
|
235
|
-
let
|
|
236
|
-
|
|
306
|
+
let { hourInput: e, minutesInput: t, secondsInput: n } = this.writeActivePartValues();
|
|
307
|
+
[t, n].forEach((e) => {
|
|
237
308
|
e?.blur(), e?.classList.remove("active");
|
|
238
|
-
}),
|
|
309
|
+
}), e && e.click();
|
|
310
|
+
}
|
|
311
|
+
showActivePartHours() {
|
|
312
|
+
let { hourInput: e } = this.writeActivePartValues();
|
|
313
|
+
return e && L(this.core, "hour"), e;
|
|
314
|
+
}
|
|
315
|
+
writeActivePartValues() {
|
|
316
|
+
let e = this.state.getSavedValue(), t = this.core.getHour(), n = this.core.getMinutes(), r = this.state.showSeconds ? this.core.getSeconds() : null;
|
|
317
|
+
return A(t, e?.hour ?? "12"), A(n, e?.minutes ?? "00"), A(r, e?.seconds ?? "00"), this.core.options.clock.type === "12h" && D(this.core.getAM(), this.core.getPM(), e?.type), {
|
|
318
|
+
hourInput: t,
|
|
319
|
+
minutesInput: n,
|
|
320
|
+
secondsInput: r
|
|
321
|
+
};
|
|
239
322
|
}
|
|
240
323
|
updateAll() {
|
|
241
324
|
this.updateTabs(), this.updateTimeDisplay(), this.updateOkButton();
|
|
242
325
|
}
|
|
243
326
|
};
|
|
244
|
-
function
|
|
327
|
+
function B(e, t, n, r) {
|
|
245
328
|
e.on(n, r), t.push(() => e.off(n, r));
|
|
246
329
|
}
|
|
247
|
-
var
|
|
330
|
+
var V = (e) => e.replace(/[^0-9:APMapm\s]/g, ""), H = {
|
|
331
|
+
"12h": "24h",
|
|
332
|
+
"24h": "12h"
|
|
333
|
+
}, U = (e) => ({
|
|
334
|
+
...e,
|
|
335
|
+
type: e.type ?? "AM"
|
|
336
|
+
});
|
|
337
|
+
function W(e, t) {
|
|
338
|
+
let n = M(e.options), r = i(t, n);
|
|
339
|
+
if (r) {
|
|
340
|
+
let e = n.showSeconds || a(t) ? o(r, n) : t;
|
|
341
|
+
return {
|
|
342
|
+
parsed: U(r),
|
|
343
|
+
inputText: e
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
let s = H[n.clockType], c = i(t, {
|
|
347
|
+
...n,
|
|
348
|
+
clockType: s
|
|
349
|
+
});
|
|
350
|
+
if (!c) return null;
|
|
351
|
+
let u = l(c, s, n);
|
|
352
|
+
return {
|
|
353
|
+
parsed: U(u),
|
|
354
|
+
inputText: o(u, n)
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
var G = class {
|
|
248
358
|
core;
|
|
249
359
|
emitter;
|
|
250
360
|
state;
|
|
251
361
|
ui;
|
|
252
362
|
cleanupHandlers = [];
|
|
253
363
|
isSyncingAmPm = !1;
|
|
364
|
+
isBound = !1;
|
|
365
|
+
pendingRange = null;
|
|
366
|
+
pendingPart = null;
|
|
254
367
|
constructor(e, t) {
|
|
255
368
|
this.core = e, this.emitter = t, this.createState();
|
|
256
369
|
}
|
|
257
370
|
get isEnabled() {
|
|
258
371
|
return this.core.options.range?.enabled === !0;
|
|
259
372
|
}
|
|
373
|
+
get isLive() {
|
|
374
|
+
return this.isBound && this.core.isOpen;
|
|
375
|
+
}
|
|
260
376
|
createState() {
|
|
261
377
|
let { range: e, clock: t } = this.core.options;
|
|
262
|
-
this.state = new
|
|
378
|
+
this.state = new S(t.type, e?.minDuration, e?.maxDuration, this.emitter, t.showSeconds === !0, e?.linked !== !1), this.ui = new z(this.core, this.state);
|
|
263
379
|
}
|
|
264
380
|
init() {
|
|
265
381
|
if (this.releaseHandlers(), !this.isEnabled) return;
|
|
266
382
|
this.createState();
|
|
267
|
-
let { from: e, to: t } =
|
|
268
|
-
this.state.setFromValue(e), this.state.setToValue(t), this.bindEvents(), this.ui.syncClockToActivePart(), this.emitAmPmSyncEvent(), this.ui.updateAll();
|
|
383
|
+
let { from: e, to: t } = this.readInitialRange();
|
|
384
|
+
this.state.setFromValue(e), this.state.setToValue(t), this.bindEvents(), this.isBound = !0, this.applyPendingPart(), this.ui.syncClockToActivePart(), this.emitAmPmSyncEvent(), this.ui.updateAll();
|
|
385
|
+
}
|
|
386
|
+
readInitialRange() {
|
|
387
|
+
let e = this.core.getInput()?.value || "", t = this.pendingRange;
|
|
388
|
+
if (t && t.inputValue === e) {
|
|
389
|
+
let e = this.parseEnd(t.from), n = this.parseEnd(t.to);
|
|
390
|
+
if (e && n) return {
|
|
391
|
+
from: e,
|
|
392
|
+
to: n
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
return this.pendingRange = null, b(e, this.state.showSeconds);
|
|
396
|
+
}
|
|
397
|
+
applyPendingPart() {
|
|
398
|
+
let e = this.pendingPart;
|
|
399
|
+
this.pendingPart = null, e && this.state.setActivePart(e) && this.emitter.emit("range:switch", {
|
|
400
|
+
active: e,
|
|
401
|
+
disabledTime: this.state.getDisabledTimeForEndPart()
|
|
402
|
+
});
|
|
269
403
|
}
|
|
270
404
|
getActivePart() {
|
|
271
405
|
return this.state.getActivePart();
|
|
272
406
|
}
|
|
273
|
-
setActivePart(e) {
|
|
274
|
-
|
|
407
|
+
setActivePart(e, t = {}) {
|
|
408
|
+
if (!this.isEnabled) return !1;
|
|
409
|
+
if (t.focus === !1 && !this.isLive) {
|
|
410
|
+
this.state.setActivePart(e);
|
|
411
|
+
let t = this.state.getActivePart() === e;
|
|
412
|
+
return this.pendingPart = t ? e : null, t;
|
|
413
|
+
}
|
|
414
|
+
return this.state.setActivePart(e) && this.emitter.emit("range:switch", {
|
|
275
415
|
active: e,
|
|
276
416
|
disabledTime: this.state.getDisabledTimeForEndPart()
|
|
277
|
-
}), this.ui.syncClockToActivePart(), this.emitAmPmSyncEvent(), this.ui.updateAll());
|
|
417
|
+
}), t.focus === !1 ? this.syncClockWithoutFocus() : this.ui.syncClockToActivePart(), this.emitAmPmSyncEvent(), this.ui.updateAll(), this.state.getActivePart() === e;
|
|
418
|
+
}
|
|
419
|
+
setRange(e, t, n) {
|
|
420
|
+
if (!this.isEnabled) return !1;
|
|
421
|
+
let r = this.parseEnd(e), i = this.parseEnd(t);
|
|
422
|
+
return !r || !i ? !1 : (this.state.setFromValue(r), this.state.setToValue(i), this.state.setPreviewValue(null), this.state.chosenFields.clear(), n && this.ui.updateInputValue(), this.pendingRange = {
|
|
423
|
+
from: e,
|
|
424
|
+
to: t,
|
|
425
|
+
inputValue: this.core.getInput()?.value || ""
|
|
426
|
+
}, this.isLive && this.syncOpenRange(), this.state.validate(), this.ui.updateAll(), !0);
|
|
427
|
+
}
|
|
428
|
+
getRange() {
|
|
429
|
+
return {
|
|
430
|
+
from: this.state.isFromComplete() ? this.copyValue(this.state.getFromValue()) : null,
|
|
431
|
+
to: this.state.isToComplete() ? this.copyValue(this.state.getToValue()) : null
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
copyValue(e) {
|
|
435
|
+
return e ? { ...e } : null;
|
|
436
|
+
}
|
|
437
|
+
parseEnd(e) {
|
|
438
|
+
if (typeof e != "string" || !e.trim()) return null;
|
|
439
|
+
let t = W(this.core, V(e.trim()));
|
|
440
|
+
if (!t) return null;
|
|
441
|
+
let { hour: n, minutes: r, seconds: i, type: a } = t.parsed, o = {
|
|
442
|
+
hour: n,
|
|
443
|
+
minutes: r
|
|
444
|
+
};
|
|
445
|
+
return this.core.options.clock.showSeconds === !0 && (o.seconds = i ?? "00"), this.core.options.clock.type === "12h" && (o.type = a), o;
|
|
446
|
+
}
|
|
447
|
+
syncOpenRange() {
|
|
448
|
+
let e = this.state.getDisabledTimeForEndPart();
|
|
449
|
+
this.state.getActivePart() === "to" && e && this.emitter.emit("range:switch", {
|
|
450
|
+
active: "to",
|
|
451
|
+
disabledTime: e
|
|
452
|
+
}), this.syncClockWithoutFocus(), this.emitAmPmSyncEvent();
|
|
453
|
+
}
|
|
454
|
+
syncClockWithoutFocus() {
|
|
455
|
+
let e = this.ui.showActivePartHours();
|
|
456
|
+
e && (I(this.emitter, "hour", e.value), this.emitter.emit("update", R(this.core)));
|
|
278
457
|
}
|
|
279
458
|
getFromValue() {
|
|
280
459
|
return this.state.getFromValue();
|
|
@@ -302,15 +481,15 @@ var O = class {
|
|
|
302
481
|
if (!e || !t) return null;
|
|
303
482
|
let { showSeconds: n } = this.state;
|
|
304
483
|
return {
|
|
305
|
-
from:
|
|
306
|
-
to:
|
|
484
|
+
from: h(e, n),
|
|
485
|
+
to: h(t, n)
|
|
307
486
|
};
|
|
308
487
|
}
|
|
309
488
|
bindEvents() {
|
|
310
489
|
let e = this.core.getModalElement();
|
|
311
490
|
if (!e) return;
|
|
312
491
|
let t = e.querySelector(".tp-ui-range-tab.tp-ui-range-from"), n = e.querySelector(".tp-ui-range-tab.tp-ui-range-to");
|
|
313
|
-
this.listen(t, "click", () => this.activatePart("from", t)), this.listen(n, "click", () => this.activatePart("to", n)), this.bindTabKeyboard(t, n), this.bindFieldChoice("hour", this.core.getHour()), this.bindFieldChoice("minutes", this.core.getMinutes()), this.bindFieldChoice("seconds", this.state.showSeconds ? this.core.getSeconds() : null),
|
|
492
|
+
this.listen(t, "click", () => this.activatePart("from", t)), this.listen(n, "click", () => this.activatePart("to", n)), this.bindTabKeyboard(t, n), this.bindFieldChoice("hour", this.core.getHour()), this.bindFieldChoice("minutes", this.core.getMinutes()), this.bindFieldChoice("seconds", this.state.showSeconds ? this.core.getSeconds() : null), B(this.emitter, this.cleanupHandlers, "update", (e) => this.handleUpdate(e?.hour)), B(this.emitter, this.cleanupHandlers, "range:minute:commit", (e) => this.handleMinuteCommit(e)), B(this.emitter, this.cleanupHandlers, "confirm", () => this.handleConfirm()), B(this.emitter, this.cleanupHandlers, "select:am", () => this.handleAmPm()), B(this.emitter, this.cleanupHandlers, "select:pm", () => this.handleAmPm()), B(this.emitter, this.cleanupHandlers, "clear", () => this.handleClear());
|
|
314
493
|
}
|
|
315
494
|
listen(e, t, n) {
|
|
316
495
|
e && (e.addEventListener(t, n), this.cleanupHandlers.push(() => e.removeEventListener(t, n)));
|
|
@@ -366,7 +545,7 @@ var O = class {
|
|
|
366
545
|
this.isEnabled && (this.state.setPreviewValue(e === void 0 ? null : this.buildPreview(e)), this.ui.updateAll());
|
|
367
546
|
}
|
|
368
547
|
buildPreview(e) {
|
|
369
|
-
let t = this.state.getSavedValue()?.minutes, n = !!t && !
|
|
548
|
+
let t = this.state.getSavedValue()?.minutes, n = !!t && !f(t), r = (e, t) => (n || this.state.chosenFields.has(e)) && t?.value || d;
|
|
370
549
|
return {
|
|
371
550
|
hour: e,
|
|
372
551
|
minutes: r("minutes", this.core.getMinutes()),
|
|
@@ -427,26 +606,26 @@ var O = class {
|
|
|
427
606
|
}
|
|
428
607
|
handleConfirm() {
|
|
429
608
|
if (!this.isEnabled) return;
|
|
430
|
-
this.state.commitPreview();
|
|
609
|
+
this.state.commitPreview(), this.pendingRange = null;
|
|
431
610
|
let { showSeconds: e } = this.state, t = {
|
|
432
|
-
from:
|
|
433
|
-
to:
|
|
611
|
+
from: g(this.state.getFromValue(), e),
|
|
612
|
+
to: g(this.state.getToValue(), e),
|
|
434
613
|
duration: this.state.getDuration()
|
|
435
614
|
};
|
|
436
615
|
e && (t.durationSeconds = this.state.getDurationSeconds()), this.ui.updateInputValue(), this.emitter.emit("range:confirm", t);
|
|
437
616
|
}
|
|
438
617
|
reset() {
|
|
439
|
-
this.state.reset();
|
|
618
|
+
this.state.reset(), this.pendingRange = null, this.pendingPart = null;
|
|
440
619
|
}
|
|
441
620
|
destroy() {
|
|
442
621
|
this.releaseHandlers(), this.reset();
|
|
443
622
|
}
|
|
444
623
|
releaseHandlers() {
|
|
445
|
-
this.cleanupHandlers.forEach((e) => e()), this.cleanupHandlers = [];
|
|
624
|
+
this.cleanupHandlers.forEach((e) => e()), this.cleanupHandlers = [], this.isBound = !1;
|
|
446
625
|
}
|
|
447
|
-
},
|
|
626
|
+
}, K = {
|
|
448
627
|
name: "range",
|
|
449
|
-
factory: (e, t) => new
|
|
628
|
+
factory: (e, t) => new G(e, t)
|
|
450
629
|
};
|
|
451
630
|
//#endregion
|
|
452
|
-
export {
|
|
631
|
+
export { K as RangePlugin };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "courthive-components",
|
|
3
3
|
"packageManager": "pnpm@12.14.0",
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.12.0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=24"
|
|
7
7
|
},
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"lint:fix": "eslint src --fix --cache",
|
|
68
68
|
"lint:report": "eslint src & eslint --cache src -f json > eslint-report.json",
|
|
69
69
|
"format": "prettier --write src",
|
|
70
|
+
"format:check": "prettier --check src",
|
|
70
71
|
"release:major": "npm run commits && npm version $(semver $npm_package_version -i major) && git push && git push --tags",
|
|
71
72
|
"release:minor": "npm run commits && npm version $(semver $npm_package_version -i minor) && git push && git push --tags",
|
|
72
73
|
"release:patch": "npm run commits && npm version $(semver $npm_package_version -i patch) && git push && git push --tags",
|
|
@@ -110,7 +111,7 @@
|
|
|
110
111
|
"semver": "7.8.5",
|
|
111
112
|
"storybook": "^10.2.17",
|
|
112
113
|
"tabulator-tables": "6.6.1",
|
|
113
|
-
"tods-competition-factory": "7.
|
|
114
|
+
"tods-competition-factory": "7.20.0",
|
|
114
115
|
"typescript": "^6.0.2",
|
|
115
116
|
"vite": "8.3.4",
|
|
116
117
|
"vite-plugin-dts": "^5.0.0",
|