@shival99/z-ui 1.3.31 → 1.3.34
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/fesm2022/shival99-z-ui-components-z-calendar.mjs +70 -13
- package/fesm2022/shival99-z-ui-components-z-calendar.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-menu.mjs +2 -2
- package/fesm2022/shival99-z-ui-components-z-menu.mjs.map +1 -1
- package/fesm2022/shival99-z-ui-components-z-tabs.mjs +9 -9
- package/fesm2022/shival99-z-ui-components-z-tabs.mjs.map +1 -1
- package/package.json +1 -1
- package/types/shival99-z-ui-components-z-calendar.d.ts +1 -0
- package/types/shival99-z-ui-components-z-tabs.d.ts +6 -6
|
@@ -445,6 +445,10 @@ const getYearState = (year, selectedYear, todayYear) => {
|
|
|
445
445
|
}
|
|
446
446
|
return 'default';
|
|
447
447
|
};
|
|
448
|
+
/**
|
|
449
|
+
* Check if the format string contains time tokens (HH, hh, mm, ss)
|
|
450
|
+
*/
|
|
451
|
+
const hasTimeTokens = (format) => /HH|hh|mm|ss/.test(format);
|
|
448
452
|
|
|
449
453
|
const zCalendarVariants = cva([
|
|
450
454
|
'group flex min-w-0 w-full items-center overflow-hidden rounded-[6px] border border-input bg-white shadow-xs cursor-pointer',
|
|
@@ -1214,8 +1218,24 @@ class ZCalendarComponent {
|
|
|
1214
1218
|
return true;
|
|
1215
1219
|
}, ...(ngDevMode ? [{ debugName: "canNavigateEndPrev" }] : []));
|
|
1216
1220
|
displayValue = computed(() => {
|
|
1217
|
-
|
|
1218
|
-
|
|
1221
|
+
const format = this.zFormat();
|
|
1222
|
+
const formatHasTime = hasTimeTokens(format);
|
|
1223
|
+
if (this.isTimeMode()) {
|
|
1224
|
+
const timeParts = [];
|
|
1225
|
+
if (this.zShowHour()) {
|
|
1226
|
+
timeParts.push(this.zTimeFormat() === '12h' ? 'hh' : 'HH');
|
|
1227
|
+
}
|
|
1228
|
+
if (this.zShowMinute()) {
|
|
1229
|
+
timeParts.push('mm');
|
|
1230
|
+
}
|
|
1231
|
+
if (this.zShowSecond()) {
|
|
1232
|
+
timeParts.push('ss');
|
|
1233
|
+
}
|
|
1234
|
+
const timeFormat = timeParts.join(':');
|
|
1235
|
+
const periodSuffix = this.zTimeFormat() === '12h' ? ` ${this.period()}` : '';
|
|
1236
|
+
return this._formatDisplayValue(timeFormat + periodSuffix);
|
|
1237
|
+
}
|
|
1238
|
+
if (this.zShowTime() && !formatHasTime) {
|
|
1219
1239
|
const timeParts = [];
|
|
1220
1240
|
if (this.zShowHour()) {
|
|
1221
1241
|
timeParts.push(this.zTimeFormat() === '12h' ? 'hh' : 'HH');
|
|
@@ -1228,8 +1248,11 @@ class ZCalendarComponent {
|
|
|
1228
1248
|
}
|
|
1229
1249
|
const timeFormat = timeParts.join(':');
|
|
1230
1250
|
const periodSuffix = this.zTimeFormat() === '12h' ? ` ${this.period()}` : '';
|
|
1231
|
-
|
|
1251
|
+
return this._formatDisplayValue(`${format} ${timeFormat}${periodSuffix}`);
|
|
1232
1252
|
}
|
|
1253
|
+
return this._formatDisplayValue(format);
|
|
1254
|
+
}, ...(ngDevMode ? [{ debugName: "displayValue" }] : []));
|
|
1255
|
+
_formatDisplayValue(format) {
|
|
1233
1256
|
if (this.isRangeMode()) {
|
|
1234
1257
|
const start = this._rangeStart();
|
|
1235
1258
|
const end = this._rangeEnd();
|
|
@@ -1253,7 +1276,7 @@ class ZCalendarComponent {
|
|
|
1253
1276
|
return `Q${quarter} ${date.getFullYear()}`;
|
|
1254
1277
|
}
|
|
1255
1278
|
return formatDate(date, format, this.zLocale());
|
|
1256
|
-
}
|
|
1279
|
+
}
|
|
1257
1280
|
_inputDisplayStart = signal('', ...(ngDevMode ? [{ debugName: "_inputDisplayStart" }] : []));
|
|
1258
1281
|
_inputDisplayEnd = signal('', ...(ngDevMode ? [{ debugName: "_inputDisplayEnd" }] : []));
|
|
1259
1282
|
inputDisplayStart = computed(() => this._inputDisplayStart(), ...(ngDevMode ? [{ debugName: "inputDisplayStart" }] : []));
|
|
@@ -1269,8 +1292,9 @@ class ZCalendarComponent {
|
|
|
1269
1292
|
return end ? formatDate(end, format, this.zLocale()) : '';
|
|
1270
1293
|
}, ...(ngDevMode ? [{ debugName: "displayValueEnd" }] : []));
|
|
1271
1294
|
_getDisplayFormatStart() {
|
|
1272
|
-
|
|
1273
|
-
|
|
1295
|
+
const format = this.zFormat();
|
|
1296
|
+
const formatHasTime = hasTimeTokens(format);
|
|
1297
|
+
if (this.isTimeMode()) {
|
|
1274
1298
|
const timeParts = [];
|
|
1275
1299
|
if (this.zShowHour()) {
|
|
1276
1300
|
timeParts.push(this.zTimeFormat() === '12h' ? 'hh' : 'HH');
|
|
@@ -1283,13 +1307,29 @@ class ZCalendarComponent {
|
|
|
1283
1307
|
}
|
|
1284
1308
|
const timeFormat = timeParts.join(':');
|
|
1285
1309
|
const periodSuffix = this.zTimeFormat() === '12h' ? ` ${this.period()}` : '';
|
|
1286
|
-
|
|
1310
|
+
return timeFormat + periodSuffix;
|
|
1311
|
+
}
|
|
1312
|
+
if (this.zShowTime() && !formatHasTime) {
|
|
1313
|
+
const timeParts = [];
|
|
1314
|
+
if (this.zShowHour()) {
|
|
1315
|
+
timeParts.push(this.zTimeFormat() === '12h' ? 'hh' : 'HH');
|
|
1316
|
+
}
|
|
1317
|
+
if (this.zShowMinute()) {
|
|
1318
|
+
timeParts.push('mm');
|
|
1319
|
+
}
|
|
1320
|
+
if (this.zShowSecond()) {
|
|
1321
|
+
timeParts.push('ss');
|
|
1322
|
+
}
|
|
1323
|
+
const timeFormat = timeParts.join(':');
|
|
1324
|
+
const periodSuffix = this.zTimeFormat() === '12h' ? ` ${this.period()}` : '';
|
|
1325
|
+
return `${format} ${timeFormat}${periodSuffix}`;
|
|
1287
1326
|
}
|
|
1288
1327
|
return format;
|
|
1289
1328
|
}
|
|
1290
1329
|
_getDisplayFormatEnd() {
|
|
1291
|
-
|
|
1292
|
-
|
|
1330
|
+
const format = this.zFormat();
|
|
1331
|
+
const formatHasTime = hasTimeTokens(format);
|
|
1332
|
+
if (this.isTimeMode()) {
|
|
1293
1333
|
const timeParts = [];
|
|
1294
1334
|
if (this.zShowHour()) {
|
|
1295
1335
|
timeParts.push(this.zTimeFormat() === '12h' ? 'hh' : 'HH');
|
|
@@ -1302,7 +1342,22 @@ class ZCalendarComponent {
|
|
|
1302
1342
|
}
|
|
1303
1343
|
const timeFormat = timeParts.join(':');
|
|
1304
1344
|
const periodSuffix = this.zTimeFormat() === '12h' ? ` ${this._periodEnd()}` : '';
|
|
1305
|
-
|
|
1345
|
+
return timeFormat + periodSuffix;
|
|
1346
|
+
}
|
|
1347
|
+
if (this.zShowTime() && !formatHasTime) {
|
|
1348
|
+
const timeParts = [];
|
|
1349
|
+
if (this.zShowHour()) {
|
|
1350
|
+
timeParts.push(this.zTimeFormat() === '12h' ? 'hh' : 'HH');
|
|
1351
|
+
}
|
|
1352
|
+
if (this.zShowMinute()) {
|
|
1353
|
+
timeParts.push('mm');
|
|
1354
|
+
}
|
|
1355
|
+
if (this.zShowSecond()) {
|
|
1356
|
+
timeParts.push('ss');
|
|
1357
|
+
}
|
|
1358
|
+
const timeFormat = timeParts.join(':');
|
|
1359
|
+
const periodSuffix = this.zTimeFormat() === '12h' ? ` ${this._periodEnd()}` : '';
|
|
1360
|
+
return `${format} ${timeFormat}${periodSuffix}`;
|
|
1306
1361
|
}
|
|
1307
1362
|
return format;
|
|
1308
1363
|
}
|
|
@@ -2479,7 +2534,8 @@ class ZCalendarComponent {
|
|
|
2479
2534
|
}
|
|
2480
2535
|
_handleSingleSelection(date) {
|
|
2481
2536
|
let finalDate = date;
|
|
2482
|
-
|
|
2537
|
+
const shouldApplyTime = this.zShowTime() || hasTimeTokens(this.zFormat());
|
|
2538
|
+
if (shouldApplyTime) {
|
|
2483
2539
|
const defaultTime = this._resolveDefaultTime(this.zDefaultTime());
|
|
2484
2540
|
this.hour.set(defaultTime.hour);
|
|
2485
2541
|
this.minute.set(defaultTime.minute);
|
|
@@ -2500,9 +2556,10 @@ class ZCalendarComponent {
|
|
|
2500
2556
|
_handleRangeSelection(date) {
|
|
2501
2557
|
const start = this._rangeStart();
|
|
2502
2558
|
const end = this._rangeEnd();
|
|
2559
|
+
const shouldApplyTime = this.zShowTime() || hasTimeTokens(this.zFormat());
|
|
2503
2560
|
if (!start || (start && end)) {
|
|
2504
2561
|
let startDate = date;
|
|
2505
|
-
if (
|
|
2562
|
+
if (shouldApplyTime) {
|
|
2506
2563
|
const defaultTime = this._resolveRangeStartTime();
|
|
2507
2564
|
this.hour.set(defaultTime.hour);
|
|
2508
2565
|
this.minute.set(defaultTime.minute);
|
|
@@ -2520,7 +2577,7 @@ class ZCalendarComponent {
|
|
|
2520
2577
|
return;
|
|
2521
2578
|
}
|
|
2522
2579
|
let endDate = date;
|
|
2523
|
-
if (
|
|
2580
|
+
if (shouldApplyTime) {
|
|
2524
2581
|
const defaultTime = this._resolveRangeEndTime();
|
|
2525
2582
|
this._hourEnd.set(defaultTime.hour);
|
|
2526
2583
|
this._minuteEnd.set(defaultTime.minute);
|