@haiilo/catalyst 10.19.2 → 10.19.3
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/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/catalyst.esm.js.map +1 -1
- package/dist/catalyst/{p-5d82e37e.entry.js → p-d6926655.entry.js} +4 -4
- package/dist/catalyst/p-d6926655.entry.js.map +1 -0
- package/dist/cjs/cat-alert_29.cjs.entry.js +23 -5
- package/dist/cjs/cat-alert_29.cjs.entry.js.map +1 -1
- package/dist/cjs/catalyst.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/cat-time/cat-time.js +25 -6
- package/dist/collection/components/cat-time/cat-time.js.map +1 -1
- package/dist/components/cat-time.js +24 -5
- package/dist/components/cat-time.js.map +1 -1
- package/dist/esm/cat-alert_29.entry.js +23 -5
- package/dist/esm/cat-alert_29.entry.js.map +1 -1
- package/dist/esm/catalyst.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/cat-time/cat-time.d.ts +2 -0
- package/package.json +2 -2
- package/dist/catalyst/p-5d82e37e.entry.js.map +0 -1
|
@@ -13329,6 +13329,7 @@ const CatTime = class {
|
|
|
13329
13329
|
this.hasSlottedHint = false;
|
|
13330
13330
|
this.selectionTime = null;
|
|
13331
13331
|
this.isAm = true;
|
|
13332
|
+
this.valueChangedBySelection = false;
|
|
13332
13333
|
this.requiredMarker = 'optional';
|
|
13333
13334
|
this.horizontal = false;
|
|
13334
13335
|
this.autoComplete = undefined;
|
|
@@ -13366,11 +13367,16 @@ const CatTime = class {
|
|
|
13366
13367
|
}
|
|
13367
13368
|
}
|
|
13368
13369
|
onValueChanged(value, oldValue) {
|
|
13369
|
-
if (
|
|
13370
|
+
if (this.valueChangedBySelection) {
|
|
13371
|
+
this.valueChangedBySelection = false;
|
|
13372
|
+
}
|
|
13373
|
+
else if (value !== oldValue) {
|
|
13374
|
+
this.set12hFormat();
|
|
13370
13375
|
this.syncValue(value);
|
|
13371
13376
|
}
|
|
13372
13377
|
}
|
|
13373
13378
|
componentWillLoad() {
|
|
13379
|
+
this.set12hFormat();
|
|
13374
13380
|
this.syncValue(this.value ?? '');
|
|
13375
13381
|
}
|
|
13376
13382
|
componentWillRender() {
|
|
@@ -13402,6 +13408,7 @@ const CatTime = class {
|
|
|
13402
13408
|
*/
|
|
13403
13409
|
async select(date) {
|
|
13404
13410
|
const oldValue = this.value;
|
|
13411
|
+
let newValue = this.value;
|
|
13405
13412
|
if (!date) {
|
|
13406
13413
|
this.selectionTime = null;
|
|
13407
13414
|
this.value = undefined;
|
|
@@ -13410,16 +13417,21 @@ const CatTime = class {
|
|
|
13410
13417
|
const time = clampTime(this.min ?? null, date, this.max ?? null);
|
|
13411
13418
|
this.isAm = this.format(time).toLowerCase().includes('am');
|
|
13412
13419
|
this.selectionTime = time;
|
|
13413
|
-
|
|
13420
|
+
newValue = formatIso(time);
|
|
13414
13421
|
}
|
|
13415
13422
|
// we need to set the input explicitly to sync the input even without a
|
|
13416
13423
|
// rerender (if the value is not changed)
|
|
13417
13424
|
if (this.input) {
|
|
13418
13425
|
this.input.value = this.format(this.selectionTime, false);
|
|
13419
13426
|
}
|
|
13420
|
-
if (oldValue !==
|
|
13427
|
+
if (oldValue !== newValue) {
|
|
13428
|
+
this.valueChangedBySelection = true;
|
|
13429
|
+
this.value = newValue;
|
|
13421
13430
|
this.catChange.emit(this.value);
|
|
13422
13431
|
}
|
|
13432
|
+
else {
|
|
13433
|
+
this.valueChangedBySelection = false;
|
|
13434
|
+
}
|
|
13423
13435
|
}
|
|
13424
13436
|
/**
|
|
13425
13437
|
* Programmatically move focus to the input. Use this method instead of
|
|
@@ -13445,14 +13457,14 @@ const CatTime = class {
|
|
|
13445
13457
|
this.input?.clear();
|
|
13446
13458
|
}
|
|
13447
13459
|
render() {
|
|
13448
|
-
return (index.h(index.Host, { key: '
|
|
13460
|
+
return (index.h(index.Host, { key: '257e8034002a6c0cfd53d2d8b99d32953ecd229a' }, index.h("cat-input", { key: 'b0572967e133b2b099e9010f6e9ce67168f9592c', class: "cat-time-input", ref: el => (this.input = el), requiredMarker: this.requiredMarker, horizontal: this.horizontal, autoComplete: this.autoComplete, clearable: this.clearable, disabled: this.disabled, hint: this.hint, icon: this.icon, iconRight: this.iconRight, identifier: this.identifier, label: this.label, labelHidden: this.labelHidden, name: this.name, placeholder: this.placeholder, textPrefix: this.textPrefix, textSuffix: this.textSuffix, readonly: this.readonly, required: this.required, value: this.format(this.selectionTime, false), errors: this.errors, errorUpdate: this.errorUpdate, nativeAttributes: this.nativeAttributes, onCatFocus: e => this.catFocus.emit(e.detail), onCatBlur: e => this.onInputBlur(e.detail) }, index.h("span", { key: '5b21ff245c6f582803756c7b5177d735a1e360fb', slot: "label" }, this.hasSlottedLabel && index.h("slot", { key: 'e5dfa72756d8698f1e0bfc55e45fb0791c272157', name: "label" }), !this.hasSlottedLabel && this.label, index.h("span", { key: 'ea2ac13fb8bddf7168448d7f3f50bd2703391393', class: "label-aria" }, " (HH:mm)")), index.h("div", { key: '50cedc1bf604b00ba062dff0881cad36f3eb62d3', slot: "addon", class: "cat-time-addon" }, this.locale.timeFormat === '12' && (index.h("cat-button", { key: '238e1a4005a877ab8dd0fa2d23d2cafdf48dab38', class: "cat-time-format", disabled: this.disabled || this.readonly, onCatClick: () => this.toggleAm() }, this.isAm ? 'AM' : 'PM')), index.h("cat-dropdown", { key: '42367ea0ef47e851555ca3aae23d51169069158b', slot: "addon", placement: this.placement }, index.h("cat-button", { key: '8cd18784f5f4077b66dd0f5e134ff6fae83ce79b', slot: "trigger", class: "cat-time-toggle", disabled: this.disabled || this.readonly, icon: "$cat:timepicker-clock", iconOnly: true, a11yLabel: this.selectionTime ? `${this.locale.change}, ${this.format(this.selectionTime)}` : this.locale.choose }), index.h("nav", { key: 'e89d88df8d6612eb48bb211954ef4b924f9e2d15', slot: "content", class: "cat-nav" }, index.h("ul", { key: '631bcc9f06b20e71fd175951671c66abaafaf5c0' }, this.timeArray().map(time => {
|
|
13449
13461
|
const isoTime = formatIso(time);
|
|
13450
13462
|
const disabled = isBefore(time, this.min ?? null) || isAfter(time, this.max ?? null);
|
|
13451
13463
|
return (index.h("li", null, index.h("cat-button", { class: {
|
|
13452
13464
|
'cat-nav-item': true,
|
|
13453
13465
|
'time-disabled': disabled
|
|
13454
13466
|
}, disabled: disabled, active: isoTime === this.value, color: isoTime === this.value ? 'primary' : 'secondary', variant: isoTime === this.value ? 'filled' : 'outlined', onCatClick: () => this.select(time), "data-time": isoTime }, this.format(time))));
|
|
13455
|
-
}))))), this.hasSlottedHint && (index.h("span", { key: '
|
|
13467
|
+
}))))), this.hasSlottedHint && (index.h("span", { key: 'f2d0bf13097fac363af4a309ac69b77114b01168', slot: "hint" }, index.h("slot", { key: 'e44ce224148d9bf82803a4eff9bbed89fbb04dc2', name: "hint" }))))));
|
|
13456
13468
|
}
|
|
13457
13469
|
timeArray() {
|
|
13458
13470
|
const result = [];
|
|
@@ -13474,6 +13486,12 @@ const CatTime = class {
|
|
|
13474
13486
|
? new Date(2000, 5, 1, hh, mm, 0)
|
|
13475
13487
|
: new Date(2000, 5, 1, (hh % 12) + (this.isAm ? 0 : 12), mm, 0));
|
|
13476
13488
|
}
|
|
13489
|
+
set12hFormat() {
|
|
13490
|
+
const [, hh] = this.value?.match(/(\d{2}):(\d{2})/)?.map(Number) ?? [];
|
|
13491
|
+
if (this.locale.timeFormat === '12') {
|
|
13492
|
+
this.isAm = hh === 0 || hh < 12;
|
|
13493
|
+
}
|
|
13494
|
+
}
|
|
13477
13495
|
toggleAm() {
|
|
13478
13496
|
if (this.selectionTime) {
|
|
13479
13497
|
this.select(new Date(this.selectionTime.getTime() + (this.isAm ? 12 : -12) * 3600000));
|