@stencil/vue-output-target
Advanced tools
Comparing version 0.3.1-0 to 0.4.0-0
@@ -26,3 +26,3 @@ import { dashToPascalCase } from './utils'; | ||
options.modelUpdateEvent = findModel.event; | ||
options.externalModelUpdateEvent = findModel.externalEvent || findModel.event; | ||
options.externalModelUpdateEvent = findModel.externalEvent; | ||
} | ||
@@ -29,0 +29,0 @@ if (Object.keys(options).length > 0) { |
@@ -114,3 +114,3 @@ 'use strict'; | ||
options.modelUpdateEvent = findModel.event; | ||
options.externalModelUpdateEvent = findModel.externalEvent || findModel.event; | ||
options.externalModelUpdateEvent = findModel.externalEvent; | ||
} | ||
@@ -117,0 +117,0 @@ if (Object.keys(options).length > 0) { |
@@ -105,3 +105,3 @@ import path from 'path'; | ||
options.modelUpdateEvent = findModel.event; | ||
options.externalModelUpdateEvent = findModel.externalEvent || findModel.event; | ||
options.externalModelUpdateEvent = findModel.externalEvent; | ||
} | ||
@@ -108,0 +108,0 @@ if (Object.keys(options).length > 0) { |
@@ -12,3 +12,3 @@ export interface OutputTargetVue { | ||
modelProp?: string; | ||
modelUpdateEvent?: string; | ||
modelUpdateEvent?: string | string[]; | ||
externalModelUpdateEvent?: string; | ||
@@ -15,0 +15,0 @@ } |
{ | ||
"name": "@stencil/vue-output-target", | ||
"version": "0.3.1-0", | ||
"version": "0.4.0-0", | ||
"description": "Vue output target for @stencil/core components.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
@@ -19,3 +19,3 @@ import { VNode, defineComponent, getCurrentInstance, h, inject, ref, Ref } from 'vue'; | ||
modelProp?: string; | ||
modelUpdateEvent?: string; | ||
modelUpdateEvent?: string | string[]; | ||
externalModelUpdateEvent?: string; | ||
@@ -59,15 +59,18 @@ } | ||
if (vnode.el) { | ||
vnode.el.addEventListener(modelUpdateEvent.toLowerCase(), (e: Event) => { | ||
modelPropValue = (e?.target as any)[modelProp]; | ||
emit(UPDATE_VALUE_EVENT, modelPropValue); | ||
const eventsNames = Array.isArray(modelUpdateEvent) ? modelUpdateEvent : [modelUpdateEvent]; | ||
eventsNames.forEach((eventName: string) => { | ||
vnode.el.addEventListener(eventName.toLowerCase(), (e: Event) => { | ||
modelPropValue = (e?.target as any)[modelProp]; | ||
emit(UPDATE_VALUE_EVENT, modelPropValue); | ||
/** | ||
* We need to emit the change event here | ||
* rather than on the web component to ensure | ||
* that any v-model bindings have been updated. | ||
* Otherwise, the developer will listen on the | ||
* native web component, but the v-model will | ||
* not have been updated yet. | ||
*/ | ||
emit(externalModelUpdateEvent, e); | ||
/** | ||
* We need to emit the change event here | ||
* rather than on the web component to ensure | ||
* that any v-model bindings have been updated. | ||
* Otherwise, the developer will listen on the | ||
* native web component, but the v-model will | ||
* not have been updated yet. | ||
*/ | ||
emit(externalModelUpdateEvent, e); | ||
}); | ||
}); | ||
@@ -74,0 +77,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38854
836