waibu-bootstrap 2.7.2 → 2.8.0

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.
@@ -13,10 +13,10 @@ async function getInputAttr (group, formControl = true, ro) {
13
13
  else {
14
14
  const prop = this.getProp(attr.name)
15
15
  attr.dataType = attr.dataType ?? prop.type
16
- attr.dataValue = get(this.formData, `_orig.${attr.name}`, get(this.formData, attr.name))
16
+ attr.dataValue = this.formData[attr.name]
17
17
  if (isPlainObject(attr.dataValue) || isArray(attr.dataValue)) attr.dataValue = JSON.stringify(attr.dataValue)
18
+ attr.value = escape(get(this.formData, `_fmt.${attr.name}`, attr.dataValue))
18
19
  attr.dataValue = escape(attr.dataValue)
19
- attr.value = attr.dataValue
20
20
  if (prop.values) {
21
21
  const values = (isString(prop.values) ? await callHandler(prop.values) : [...prop.values]).map(v => {
22
22
  if (isString(v)) v = { value: v, text: v }
@@ -9,7 +9,7 @@ export async function build (handler, params = {}) {
9
9
  if (!this.params.attr.label && this.params.attr.name) this.params.attr.label = this.component.req.t(`field.${this.params.attr.name}`)
10
10
  const attr = groupAttrs(this.params.attr, ['label', 'hint', 'wrapper'])
11
11
  const contents = []
12
- attr._.id = this.params.attr.id ?? generateId()
12
+ attr._.id = this.params.attr.id ?? generateId('alpha')
13
13
  if (attr._.color) attr.label.class.push(parseVariant.call(this, { cls: 'btn', value: attr._.color, values: colors, variants, prepend: true }))
14
14
  delete attr._.color
15
15
 
@@ -10,7 +10,7 @@ export async function build (handler, params = {}) {
10
10
  if (this.params.attr.noLabel) this.params.attr.label = undefined
11
11
  const group = groupAttrs(this.params.attr, ['label', 'hint', 'wrapper', 'col'], false)
12
12
  const contents = []
13
- group._.id = this.params.attr.id ?? generateId()
13
+ group._.id = this.params.attr.id ?? generateId('alpha')
14
14
  if (!isEmpty(group._.label)) {
15
15
  group.wrapper.class.push('form-check')
16
16
  if (group.wrapper.inline) group.wrapper.class.push('form-check-inline')
@@ -98,7 +98,7 @@ export async function build (handler, params = {}) {
98
98
 
99
99
  if (group._.datalist && !['password', 'file', 'checkbox', 'radio'].includes(group._.type)) {
100
100
  datalist = group._.datalist
101
- group._.list = generateId()
101
+ group._.list = generateId('alpha')
102
102
  }
103
103
  const contents = await handleInput.call(this, { handler, params, group })
104
104
  if (datalist) {
@@ -12,13 +12,11 @@ async function formPlaintext () {
12
12
  if (this.params.attr.labelFloating) this.params.attr.class.push('border', 'rounded')
13
13
  if (!isEmpty(name) && isEmpty(this.params.attr.value)) {
14
14
  const prop = this.getProp(name)
15
- const dataValue = get(this.formData, `_orig.${name}`, '')
16
- let value = get(this.oldData, name, get(this.formData, name, ''))
15
+ const dataValue = this.formData[name] ?? ''
16
+ let value = get(this.oldData, `_fmt.${name}`, get(this.formData, `_fmt.${name}`, dataValue))
17
17
  const format = get(this.schema, `view.format.${name}`)
18
- const formatValue = get(this.schema, `view.formatValue.${name}`)
19
18
  const labelField = get(this.schema, `view.widget.${name}.attr.labelField`)
20
- if (formatValue) value = await formatValue.call(this, value, this.formData, { req })
21
- else if (prop.ref) {
19
+ if (prop.ref) {
22
20
  value = this.getRefValue({ field: name, labelField, refName: this.getRefName(name) })
23
21
  if (format && !isEmpty(value)) this.params.attr.href = await format.call(this, value, this.formData, { linkOnly: true })
24
22
  } else if (format && !isEmpty(value)) value = await format.call(this, value, this.formData)
@@ -37,7 +37,7 @@ async function navbar () {
37
37
  if (this.params.attr.scroll) el.prop('style', `--bs-scroll-height: ${numUnit(this.params.attr.scroll, 'px')};`)
38
38
  html = el.removeClass('nav').parent().html()
39
39
  this.params.attr.class.push(parseSimple.call(this, { cls: `${cls}-expand`, value: this.params.attr.expandable, values: breakpoints }))
40
- const id = generateId()
40
+ const id = generateId('alpha')
41
41
  if (this.params.group.drawer) this.params.group.drawer.id = id
42
42
  const btn = `<button class="navbar-toggler" type="button" data-bs-toggle="${type}" ` +
43
43
  `data-bs-target="#${id}" aria-controls="${id}"${this.params.attr.drawer ? '' : ' aria-expanded="false"'} aria-label="${this.component.req.t('toggleNavigation')}">` +
@@ -10,7 +10,7 @@ async function scrollspy () {
10
10
  build = async () => {
11
11
  const { isString } = this.app.lib._
12
12
  const { generateId } = this.app.lib.aneka
13
- const target = isString(this.params.attr.target) ? this.params.attr.target : generateId()
13
+ const target = isString(this.params.attr.target) ? this.params.attr.target : generateId('alpha')
14
14
  this.component.normalizeAttr(this.params, {
15
15
  tag: 'div',
16
16
  dataBsSpy: 'scroll',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-bootstrap",
3
- "version": "2.7.2",
3
+ "version": "2.8.0",
4
4
  "description": "Bootstrap suport for Waibu Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-04-25
4
+
5
+ - [2.8.0] Change options to format value using the new key set by dobo
6
+ - [2.8.0] Use ```generateId('alpha')``` to make sure all generated id in widget doesn;t start with number
7
+
3
8
  ## 2026-04-18
4
9
 
5
10
  - [2.7.2] Bug fix in ```getInputAttr()``` of ```_lib.js```