@live-change/vue3-components 0.2.10 → 0.2.13

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.
@@ -479,6 +479,7 @@
479
479
  let np = name.split('.')
480
480
  let node = this.formRoot
481
481
  for(let p of np) {
482
+ if(!p) continue
482
483
  if(node.properties) node = node.properties[p]
483
484
  else if(node.elements) node = node.elements[p]
484
485
  if(!node) throw new Error(`form field ${name} not found`)//return null
@@ -489,6 +490,7 @@
489
490
  let np = name.split('.')
490
491
  let node = this.formRoot
491
492
  for(let p of np) {
493
+ if(!p) continue
492
494
  if(node.properties) node = node.properties[p]
493
495
  else if(node.elements) node = node.elements[p]
494
496
  if(!node) return node
@@ -528,6 +530,17 @@
528
530
  //console.log("Form after reset", JSON.stringify(this.formRoot.getValue(), null, ' '))
529
531
  },
530
532
 
533
+ getValidationContext(srcContext) {
534
+ const context = {
535
+ ...(srcContext || { parameters: this.parameters }),
536
+ ...this.provided,
537
+ source: this.definition,
538
+ props: this.formRoot.getValue(),
539
+ form: this
540
+ }
541
+ return context
542
+ },
543
+
531
544
  addValidator(name, validator) {
532
545
  this.getNode(name).validators.push(validator)
533
546
  },
@@ -537,18 +550,11 @@
537
550
  if(id == -1) throw new Error("validator not found")
538
551
  validators.splice(id)
539
552
  },
540
- validateField(name) {
541
- return this.getNode(name).validate(this.formRoot.properties, name, this.definition)
553
+ validateField(name, context) {
554
+ return this.getNode(name).validate(this.getValidationContext(context))
542
555
  },
543
556
  validate(context) {
544
- context = {
545
- ...(context || { parameters: this.parameters }),
546
- ...this.provided,
547
- source: this.definition,
548
- props: this.formRoot.getValue(),
549
- form: this
550
- }
551
- return this.formRoot.validate(context)
557
+ return this.formRoot.validate(this.getValidationContext(context))
552
558
  },
553
559
  clearFieldValidation(name) {
554
560
  this.getNode(name).clearValidation()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/vue3-components",
3
- "version": "0.2.10",
3
+ "version": "0.2.13",
4
4
  "description": "Live Change Framework - vue components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,10 +21,10 @@
21
21
  },
22
22
  "homepage": "https://github.com/live-change/live-change-framework-vue3",
23
23
  "dependencies": {
24
- "@live-change/vue3-ssr": "^0.2.10",
24
+ "@live-change/vue3-ssr": "^0.2.13",
25
25
  "debug": "^4.3.4",
26
26
  "mitt": "3.0.0",
27
27
  "vue": "^3.2.33"
28
28
  },
29
- "gitHead": "589481d53e4599a6682db2fc4c787cc9dfd13974"
29
+ "gitHead": "2a8fa3e359bb31fecf9ea0674e10a3cd11c460e9"
30
30
  }