Skip to content

Commit f2e4975

Browse files
committed
component.Progress: get label(), get progress(), afterSetLabelText() => use removeDom #6545
1 parent b2b5af3 commit f2e4975

2 files changed

Lines changed: 27 additions & 6 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
.neo-progress {
1+
.neo-progress-wrapper {
22
color: var(--progress-label-color);
33
}

src/component/Progress.mjs

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,25 @@ class Progress extends Base {
3737
* @member {Object} _vdom
3838
*/
3939
_vdom:
40-
{tag: 'div', cls: ['neo-progress'], cn: [
40+
{tag: 'div', cls: ['neo-progress-wrapper'], cn: [
4141
{tag: 'label'},
4242
{tag: 'progress'}
4343
]}
4444
}
4545

46+
/**
47+
* @member {Object} label
48+
*/
49+
get label() {
50+
return this.vdom.cn[0]
51+
}
52+
/**
53+
* @member {Object} progress
54+
*/
55+
get progress() {
56+
return this.vdom.cn[1]
57+
}
58+
4659
/**
4760
* Triggered after the id config got changed
4861
* @param {String} value
@@ -52,7 +65,7 @@ class Progress extends Base {
5265
afterSetId(value, oldValue) {
5366
super.afterSetId(value, oldValue);
5467

55-
this.vdom.cn[0].for = value;
68+
this.label.for = value;
5669
this.update()
5770
}
5871

@@ -63,7 +76,15 @@ class Progress extends Base {
6376
* @protected
6477
*/
6578
afterSetLabelText(value, oldValue) {
66-
this.vdom.cn[0].html = value;
79+
let {label} = this;
80+
81+
if (!value) {
82+
label.removeDom = true
83+
} else {
84+
delete label.removeDom
85+
}
86+
87+
label.html = value;
6788
this.update()
6889
}
6990

@@ -74,7 +95,7 @@ class Progress extends Base {
7495
* @protected
7596
*/
7697
afterSetMax(value, oldValue) {
77-
this.vdom.cn[1].max = value;
98+
this.progress.max = value;
7899
this.update()
79100
}
80101

@@ -85,7 +106,7 @@ class Progress extends Base {
85106
* @protected
86107
*/
87108
afterSetValue(value, oldValue) {
88-
this.vdom.cn[1].value = value;
109+
this.progress.value = value;
89110
this.update()
90111
}
91112

0 commit comments

Comments
 (0)