@haiilo/catalyst 10.19.1 → 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-688a521e.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 +29 -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 +32 -5
- package/dist/collection/components/cat-time/cat-time.js.map +1 -1
- package/dist/components/cat-time.js +32 -6
- package/dist/components/cat-time.js.map +1 -1
- package/dist/esm/cat-alert_29.entry.js +29 -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 +3 -0
- package/package.json +2 -2
- package/dist/catalyst/p-688a521e.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;
|
|
@@ -13365,7 +13366,17 @@ const CatTime = class {
|
|
|
13365
13366
|
this.reclamp('max', max);
|
|
13366
13367
|
}
|
|
13367
13368
|
}
|
|
13369
|
+
onValueChanged(value, oldValue) {
|
|
13370
|
+
if (this.valueChangedBySelection) {
|
|
13371
|
+
this.valueChangedBySelection = false;
|
|
13372
|
+
}
|
|
13373
|
+
else if (value !== oldValue) {
|
|
13374
|
+
this.set12hFormat();
|
|
13375
|
+
this.syncValue(value);
|
|
13376
|
+
}
|
|
13377
|
+
}
|
|
13368
13378
|
componentWillLoad() {
|
|
13379
|
+
this.set12hFormat();
|
|
13369
13380
|
this.syncValue(this.value ?? '');
|
|
13370
13381
|
}
|
|
13371
13382
|
componentWillRender() {
|
|
@@ -13397,6 +13408,7 @@ const CatTime = class {
|
|
|
13397
13408
|
*/
|
|
13398
13409
|
async select(date) {
|
|
13399
13410
|
const oldValue = this.value;
|
|
13411
|
+
let newValue = this.value;
|
|
13400
13412
|
if (!date) {
|
|
13401
13413
|
this.selectionTime = null;
|
|
13402
13414
|
this.value = undefined;
|
|
@@ -13405,16 +13417,21 @@ const CatTime = class {
|
|
|
13405
13417
|
const time = clampTime(this.min ?? null, date, this.max ?? null);
|
|
13406
13418
|
this.isAm = this.format(time).toLowerCase().includes('am');
|
|
13407
13419
|
this.selectionTime = time;
|
|
13408
|
-
|
|
13420
|
+
newValue = formatIso(time);
|
|
13409
13421
|
}
|
|
13410
13422
|
// we need to set the input explicitly to sync the input even without a
|
|
13411
13423
|
// rerender (if the value is not changed)
|
|
13412
13424
|
if (this.input) {
|
|
13413
13425
|
this.input.value = this.format(this.selectionTime, false);
|
|
13414
13426
|
}
|
|
13415
|
-
if (oldValue !==
|
|
13427
|
+
if (oldValue !== newValue) {
|
|
13428
|
+
this.valueChangedBySelection = true;
|
|
13429
|
+
this.value = newValue;
|
|
13416
13430
|
this.catChange.emit(this.value);
|
|
13417
13431
|
}
|
|
13432
|
+
else {
|
|
13433
|
+
this.valueChangedBySelection = false;
|
|
13434
|
+
}
|
|
13418
13435
|
}
|
|
13419
13436
|
/**
|
|
13420
13437
|
* Programmatically move focus to the input. Use this method instead of
|
|
@@ -13440,14 +13457,14 @@ const CatTime = class {
|
|
|
13440
13457
|
this.input?.clear();
|
|
13441
13458
|
}
|
|
13442
13459
|
render() {
|
|
13443
|
-
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 => {
|
|
13444
13461
|
const isoTime = formatIso(time);
|
|
13445
13462
|
const disabled = isBefore(time, this.min ?? null) || isAfter(time, this.max ?? null);
|
|
13446
13463
|
return (index.h("li", null, index.h("cat-button", { class: {
|
|
13447
13464
|
'cat-nav-item': true,
|
|
13448
13465
|
'time-disabled': disabled
|
|
13449
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))));
|
|
13450
|
-
}))))), this.hasSlottedHint && (index.h("span", { key: '
|
|
13467
|
+
}))))), this.hasSlottedHint && (index.h("span", { key: 'f2d0bf13097fac363af4a309ac69b77114b01168', slot: "hint" }, index.h("slot", { key: 'e44ce224148d9bf82803a4eff9bbed89fbb04dc2', name: "hint" }))))));
|
|
13451
13468
|
}
|
|
13452
13469
|
timeArray() {
|
|
13453
13470
|
const result = [];
|
|
@@ -13469,6 +13486,12 @@ const CatTime = class {
|
|
|
13469
13486
|
? new Date(2000, 5, 1, hh, mm, 0)
|
|
13470
13487
|
: new Date(2000, 5, 1, (hh % 12) + (this.isAm ? 0 : 12), mm, 0));
|
|
13471
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
|
+
}
|
|
13472
13495
|
toggleAm() {
|
|
13473
13496
|
if (this.selectionTime) {
|
|
13474
13497
|
this.select(new Date(this.selectionTime.getTime() + (this.isAm ? 12 : -12) * 3600000));
|
|
@@ -13505,7 +13528,8 @@ const CatTime = class {
|
|
|
13505
13528
|
get hostElement() { return index.getElement(this); }
|
|
13506
13529
|
static get watchers() { return {
|
|
13507
13530
|
"min": ["onMinChanged"],
|
|
13508
|
-
"max": ["onMaxChanged"]
|
|
13531
|
+
"max": ["onMaxChanged"],
|
|
13532
|
+
"value": ["onValueChanged"]
|
|
13509
13533
|
}; }
|
|
13510
13534
|
};
|
|
13511
13535
|
CatTime.style = CatTimeStyle0;
|