waibu-bootstrap 1.1.7 → 1.1.8
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/package.json
CHANGED
|
@@ -25,7 +25,7 @@ function getInputAttr (group, formControl = true, ro) {
|
|
|
25
25
|
export async function buildFormHint (group, tag, cls) {
|
|
26
26
|
if (!group.hint.id && group._.id) group.hint.id = group._.id + '-hint'
|
|
27
27
|
group.hint.class.push(cls ?? 'form-text')
|
|
28
|
-
return await this.component.
|
|
28
|
+
return await this.component.buildTag({ tag: tag ?? 'div', attr: group.hint, html: group._.hint })
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export async function buildFormLabel (group, tag, cls) {
|
|
@@ -33,12 +33,12 @@ export async function buildFormLabel (group, tag, cls) {
|
|
|
33
33
|
group.label.for = group._.id
|
|
34
34
|
if (!group.label.floating) group.label.class.push(cls ?? 'form-label')
|
|
35
35
|
group.label = omit(group.label, ['floating'])
|
|
36
|
-
return await this.component.
|
|
36
|
+
return await this.component.buildTag({ tag: tag ?? 'label', attr: group.label, html: group._.label })
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export async function buildFormInput (group, params) {
|
|
40
40
|
const attr = getInputAttr.call(this, group)
|
|
41
|
-
return await this.component.
|
|
41
|
+
return await this.component.buildTag({ tag: 'input', attr, selfClosing: true })
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
export async function buildFormCheck (group, params) {
|
|
@@ -48,7 +48,7 @@ export async function buildFormCheck (group, params) {
|
|
|
48
48
|
attr.class.push('form-check-input')
|
|
49
49
|
if (has(attr, 'name') && !attr.value) attr.value = 'true'
|
|
50
50
|
if (has(attr, 'name') && !has(attr, 'checked') && attr.value === get(this, `locals.form.${attr.name}`)) attr.checked = true
|
|
51
|
-
return await this.component.
|
|
51
|
+
return await this.component.buildTag({ tag: 'input', attr, selfClosing: true })
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export async function buildFormSwitch (group, params) {
|
|
@@ -59,14 +59,14 @@ export async function buildFormSwitch (group, params) {
|
|
|
59
59
|
attr.role = 'switch'
|
|
60
60
|
if (has(attr, 'name') && !attr.value) attr.value = 'true'
|
|
61
61
|
if (has(attr, 'name') && !has(attr, 'checked') && attr.value === get(this, `locals.form.${attr.name}`)) attr.checked = true
|
|
62
|
-
return await this.component.
|
|
62
|
+
return await this.component.buildTag({ tag: 'input', attr, selfClosing: true })
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
export async function buildFormRadio (group, params) {
|
|
66
66
|
const attr = getInputAttr.call(this, group, false)
|
|
67
67
|
attr.type = 'radio'
|
|
68
68
|
attr.class.push('form-check-input')
|
|
69
|
-
return await this.component.
|
|
69
|
+
return await this.component.buildTag({ tag: 'input', attr, selfClosing: true })
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
export async function buildFormCheckToggle (group, params) {
|
|
@@ -74,7 +74,7 @@ export async function buildFormCheckToggle (group, params) {
|
|
|
74
74
|
attr.type = 'checkbox'
|
|
75
75
|
attr.autocomplete = 'off'
|
|
76
76
|
attr.class.push('btn-check')
|
|
77
|
-
return await this.component.
|
|
77
|
+
return await this.component.buildTag({ tag: 'input', attr, selfClosing: true })
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
export async function buildFormRadioToggle (group, params) {
|
|
@@ -82,34 +82,34 @@ export async function buildFormRadioToggle (group, params) {
|
|
|
82
82
|
attr.type = 'radio'
|
|
83
83
|
attr.autocomplete = 'off'
|
|
84
84
|
attr.class.push('btn-check')
|
|
85
|
-
return await this.component.
|
|
85
|
+
return await this.component.buildTag({ tag: 'input', attr, selfClosing: true })
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
export async function buildFormPlaintext (group, params) {
|
|
89
89
|
const attr = getInputAttr.call(this, group, false, true)
|
|
90
90
|
attr.class.push('form-control-plaintext')
|
|
91
91
|
attr.readonly = ''
|
|
92
|
-
return await this.component.
|
|
92
|
+
return await this.component.buildTag({ tag: 'input', attr, selfClosing: true })
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
export async function buildFormColor (group, params) {
|
|
96
96
|
const attr = getInputAttr.call(this, group)
|
|
97
97
|
attr.class.push('form-control-color')
|
|
98
98
|
attr.type = 'color'
|
|
99
|
-
return await this.component.
|
|
99
|
+
return await this.component.buildTag({ tag: 'input', attr, selfClosing: true })
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
export async function buildFormFile (group, params) {
|
|
103
103
|
const attr = getInputAttr.call(this, group)
|
|
104
104
|
attr.type = 'file'
|
|
105
|
-
return await this.component.
|
|
105
|
+
return await this.component.buildTag({ tag: 'input', attr, selfClosing: true })
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
export async function buildFormTextarea (group, params) {
|
|
109
109
|
const attr = getInputAttr.call(this, group)
|
|
110
110
|
params.html = attr.value
|
|
111
111
|
delete attr.value
|
|
112
|
-
return await this.component.
|
|
112
|
+
return await this.component.buildTag({ tag: 'textarea', attr, html: params.html })
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
export async function buildFormSelect (group, params) {
|
|
@@ -129,12 +129,12 @@ export async function buildFormSelect (group, params) {
|
|
|
129
129
|
html = items.join('\n')
|
|
130
130
|
}
|
|
131
131
|
attr = omit(attr, ['size', 'type', 'options', 'value'])
|
|
132
|
-
return await this.component.
|
|
132
|
+
return await this.component.buildTag({ tag: 'select', attr, html })
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
export async function buildFormRange (group, params) {
|
|
136
136
|
const attr = getInputAttr.call(this, group, false)
|
|
137
137
|
attr.type = 'range'
|
|
138
138
|
attr.class.push('form-range')
|
|
139
|
-
return await this.component.
|
|
139
|
+
return await this.component.buildTag({ tag: 'input', attr, selfClosing: true })
|
|
140
140
|
}
|
|
@@ -94,6 +94,7 @@ export async function build (handler, params = {}) {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
const group = groupAttrs(this.params.attr, ['label', 'hint', 'wrapper', 'col'], false)
|
|
97
|
+
if (group.label && group.label.floating && this.params.tag === 'formColor') group.label.style.top = '-1px'
|
|
97
98
|
let datalist
|
|
98
99
|
|
|
99
100
|
if (group._.datalist && !['password', 'file', 'checkbox', 'radio'].includes(group._.type)) {
|