waibu-bootstrap 1.1.7 → 1.1.9

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-bootstrap",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "description": "Bootstrap suport for Waibu Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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.render({ tag: tag ?? 'div', attr: group.hint, html: group._.hint })
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.render({ tag: tag ?? 'label', attr: group.label, html: group._.label })
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.render({ tag: 'input', attr, selfClosing: true })
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.render({ tag: 'input', attr, selfClosing: true })
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.render({ tag: 'input', attr, selfClosing: true })
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.render({ tag: 'input', attr, selfClosing: true })
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.render({ tag: 'input', attr, selfClosing: true })
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,35 @@ 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.render({ tag: 'input', attr, selfClosing: true })
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.render({ tag: 'input', attr, selfClosing: true })
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.render({ tag: 'input', attr, selfClosing: true })
99
+ if (!attr.dim) attr.dim = 'width:100'
100
+ return await this.component.buildTag({ tag: 'input', attr, selfClosing: true })
100
101
  }
101
102
 
102
103
  export async function buildFormFile (group, params) {
103
104
  const attr = getInputAttr.call(this, group)
104
105
  attr.type = 'file'
105
- return await this.component.render({ tag: 'input', attr, selfClosing: true })
106
+ return await this.component.buildTag({ tag: 'input', attr, selfClosing: true })
106
107
  }
107
108
 
108
109
  export async function buildFormTextarea (group, params) {
109
110
  const attr = getInputAttr.call(this, group)
110
111
  params.html = attr.value
111
112
  delete attr.value
112
- return await this.component.render({ tag: 'textarea', attr, html: params.html })
113
+ return await this.component.buildTag({ tag: 'textarea', attr, html: params.html })
113
114
  }
114
115
 
115
116
  export async function buildFormSelect (group, params) {
@@ -129,12 +130,12 @@ export async function buildFormSelect (group, params) {
129
130
  html = items.join('\n')
130
131
  }
131
132
  attr = omit(attr, ['size', 'type', 'options', 'value'])
132
- return await this.component.render({ tag: 'select', attr, html })
133
+ return await this.component.buildTag({ tag: 'select', attr, html })
133
134
  }
134
135
 
135
136
  export async function buildFormRange (group, params) {
136
137
  const attr = getInputAttr.call(this, group, false)
137
138
  attr.type = 'range'
138
139
  attr.class.push('form-range')
139
- return await this.component.render({ tag: 'input', attr, selfClosing: true })
140
+ return await this.component.buildTag({ tag: 'input', attr, selfClosing: true })
140
141
  }
@@ -22,7 +22,7 @@ async function accordionItem () {
22
22
  `aria-expanded="${this.params.attr.showOnStart}"`,
23
23
  'x-data',
24
24
  `@click="$dispatch('accordion-item', { id: $el.closest('.accordion').id, cls: '${clsList.join(' ')}' })"`,
25
- `aria-controls="${this.params.attr.id}">${this.params.attr.header}</button></c:h2>`]
25
+ `aria-controls="${this.params.attr.id}"><c:span margin="end-2">${this.params.attr.header}</c:span></button></c:h2>`]
26
26
  const body = await this.component.buildTag({ tag: 'div', attr: group.body, html: this.params.html })
27
27
  const details = [`<div id="${this.params.attr.id}" class="accordion-collapse collapse${this.params.attr.showOnStart ? ' show' : ''}">`,
28
28
  body, '</div']
@@ -9,8 +9,7 @@ async function dropdownItem () {
9
9
  }
10
10
 
11
11
  build = async () => {
12
- const { $ } = this.component
13
- if ($(this.params.html).children().length === 0 && !this.params.attr.href) this.params.attr.href = '#'
12
+ if (!this.params.attr.href) this.params.attr.href = '#'
14
13
  if (this.params.attr.divider) {
15
14
  this.params.tag = 'hr'
16
15
  this.params.attr.class.push('dropdown-divider')
@@ -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)) {
@@ -56,7 +56,7 @@ const styles = [
56
56
  async function afterBuildTag (tag, params) {
57
57
  const { omit, map, isEmpty } = this.plugin.lib._
58
58
  const keys = map(styles, 'key')
59
- const excluded = []
59
+ let excluded = []
60
60
  params.attr = params.attr ?? {}
61
61
  tag = tag ?? params.tag
62
62
  if (tag === 'any') tag = params.tag
@@ -98,6 +98,7 @@ async function afterBuildTag (tag, params) {
98
98
  if (key.includes(k)) excluded.push(key)
99
99
  }
100
100
  }
101
+ excluded = excluded.filter(item => !['disabled'].includes(item))
101
102
  params.attr = omit(params.attr, ['color', 'noDismiss', 'size', 'split', 'ordered',
102
103
  'dir', 'menu', 'divider', 'header', 'autoClose', 'offset', 'group', 'toggleAll',
103
104
  'showOnStart', 'autoPlay', 'fade', 'indicator', 'noNavigation', 'noTouch', 'alwaysOpen',
@@ -82,7 +82,7 @@ class Wbs {
82
82
  this.$el.closest('.modal-body').querySelector('button[type=submit]').click()
83
83
  }
84
84
  }" @keyup.enter="submit" value="` + (value ?? opts.value) + '"/>',
85
- msg ? ('<c:div margin="top-3">' + msg + '</c:div>') : ''
85
+ msg ? ('<c:div margin="top-3"><c:t>' + msg + '</c:t></c:div>') : ''
86
86
  ].join('\n')
87
87
  opts.close = opts.close ?? ''
88
88
  opts.buttons = [