Skip to content

Commit 6ab4eb6

Browse files
fix: Close dialog
1 parent 0b6a796 commit 6ab4eb6

File tree

3 files changed

+27
-24
lines changed

3 files changed

+27
-24
lines changed

packages/ct-input/src/ct-input-phone.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import "./ct-input-container.js";
22

3-
import { CtLit, customElement, query } from "@conectate/ct-lit";
3+
import { CtLit, customElement, property, query } from "@conectate/ct-lit";
44
import { css, html } from "lit";
55

66
/**
@@ -14,6 +14,7 @@ export class CtInputPhone extends CtLit {
1414
label: string = "";
1515
errorMessage: string = "";
1616
required: boolean = false;
17+
@property({ type: String }) autocomplete: AutoFill = "off";
1718
@query("#cd") $cd!: HTMLInputElement;
1819
@query("#phone") $phone!: HTMLInputElement;
1920

@@ -81,6 +82,7 @@ export class CtInputPhone extends CtLit {
8182
size="1"
8283
placeholder="XXX"
8384
type="tel"
85+
autocomplete=${this.autocomplete as "on" | "off"}
8486
onkeypress="return event.charCode >= 48 &amp;&amp; event.charCode <= 57"
8587
/>
8688
<span class="sep">)</span>
@@ -93,6 +95,7 @@ export class CtInputPhone extends CtLit {
9395
pattern="[0-9]{5,}"
9496
placeholder="#### ####"
9597
type="tel"
98+
autocomplete=${this.autocomplete as "on" | "off"}
9699
onkeypress="return (event.charCode >= 48 &amp;&amp; event.charCode <= 57) || event.charCode == 45 || event.charCode == 32"
97100
/>
98101
</span>

packages/ct-input/src/ct-input.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -397,25 +397,25 @@ export class CtInput extends CtLit {
397397
<input
398398
id="input"
399399
class=${classMap({ "has-value": !this.isEmpty, error: this.invalid && this.errorMessage })}
400-
@focus="${this._onFocus}"
401-
@blur="${this._onBlur}"
402-
@input="${this._onInput}"
403-
.type="${this.type}"
404-
.placeholder="${this.placeholder || this.rawPlaceholder}"
405-
.size="${this.size}"
406-
?autofocus="${this.autofocus}"
407-
?readonly="${this.readonly}"
408-
?multiple="${this.multiple}"
409-
autocomplete="${this.autocomplete as any}"
410-
inputmode="${ifDefined(this.inputmode)}"
411-
minlength="${ifDefined(this.minlength)}"
412-
maxlength="${ifDefined(this.maxlength)}"
413-
min="${ifDefined(this.min)}"
414-
max="${ifDefined(this.max)}"
415-
step="${ifDefined(this.step)}"
416-
name="${ifDefined(this.name)}"
417-
autocapitalize="${ifDefined(this.autocapitalize)}"
418-
accept="${ifDefined(this.accept)}"
400+
@focus=${this._onFocus}
401+
@blur=${this._onBlur}
402+
@input=${this._onInput}
403+
.type=${this.type}
404+
.placeholder=${this.placeholder || this.rawPlaceholder}
405+
.size=${this.size}
406+
?autofocus=${this.autofocus}
407+
?readonly=${this.readonly}
408+
?multiple=${this.multiple}
409+
autocomplete=${this.autocomplete as any}
410+
inputmode=${ifDefined(this.inputmode)}
411+
minlength=${ifDefined(this.minlength)}
412+
maxlength=${ifDefined(this.maxlength)}
413+
min=${ifDefined(this.min)}
414+
max=${ifDefined(this.max)}
415+
step=${ifDefined(this.step)}
416+
name=${ifDefined(this.name)}
417+
autocapitalize=${ifDefined(this.autocapitalize)}
418+
accept=${ifDefined(this.accept)}
419419
/>
420420
</div>
421421
<slot name="suffix"></slot>
@@ -445,7 +445,7 @@ export class CtInput extends CtLit {
445445
}
446446

447447
set value(val: string | number | undefined | null) {
448-
val ||= "";
448+
val ??= "";
449449
val = val.toString();
450450
this.initValue = val;
451451
if (this.$input && this.$input.value != val && val.length - 1 < this.maxlength) {

packages/ct-select/src/ct-select-dialog.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ export class CtSelectDialog extends CtLit {
351351

352352
async onClickItem(e: any, value: any) {
353353
if (!this.multi) {
354+
await this.dialog.close();
354355
this.solve(value);
355-
await this.dialog.closeDialog();
356356
} else {
357357
let selected = Boolean(e.target.selected); //e.target.classList.contains('selected');
358358
// e.target.classList.toggle('selected', !selected);
@@ -369,12 +369,12 @@ export class CtSelectDialog extends CtLit {
369369
}
370370

371371
async okbtn() {
372-
await this.dialog.closeDialog();
372+
await this.dialog.close();
373373
this.solve(this.multiValue);
374374
}
375375

376376
async cancelbtn() {
377-
await this.dialog.closeDialog();
377+
await this.dialog.close();
378378
this.solve(undefined);
379379
}
380380

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy