widget: define isDynamicProp
This commit is contained in:
parent
ab4f02de18
commit
0db5d36393
4 changed files with 11 additions and 5 deletions
|
|
@ -27,7 +27,7 @@ function updateWidget(widget, options={}) {
|
|||
|
||||
if (
|
||||
// if non dynamic props have changed, skip this and use rebuild routine
|
||||
!propNames.some(n => !widget.constructor.dynamicProps.includes(n))
|
||||
!propNames.some(n => !widget.isDynamicProp(n))
|
||||
) {
|
||||
|
||||
var edited = widget.updateProps(options.changedProps, null) || widget
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ var widgetCategories = require('../widgets/').categories,
|
|||
|
||||
module.exports = function editField(editor, widget, propName, defaultValue){
|
||||
|
||||
let dynamic = widget.constructor.dynamicProps.includes(propName),
|
||||
let dynamic = widget.isDynamicProp(propName),
|
||||
disabled = widget.disabledProps.indexOf(propName) > -1,
|
||||
error = widget.errors[propName]
|
||||
|
||||
|
|
|
|||
|
|
@ -604,6 +604,13 @@ class Widget extends EventEmitter {
|
|||
return this.cachedProps[propName]
|
||||
}
|
||||
|
||||
|
||||
isDynamicProp(propName) {
|
||||
|
||||
return this.constructor.dynamicProps.indexOf(propName) !== -1
|
||||
|
||||
}
|
||||
|
||||
updateProps(propNames, widget, options, updatedProps = []) {
|
||||
|
||||
if (propNames.includes('value')) {
|
||||
|
|
@ -623,8 +630,7 @@ class Widget extends EventEmitter {
|
|||
|
||||
if (!deepEqual(oldPropValue, propValue)) {
|
||||
|
||||
|
||||
if (!this.constructor.dynamicProps.includes(propName)) {
|
||||
if (!this.isDynamicProp(propName)) {
|
||||
|
||||
reCreate = true
|
||||
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ class Clone extends Container {
|
|||
diff.patch(widget.props, patch)
|
||||
|
||||
|
||||
if (changedProps.some(x => !widget.constructor.dynamicProps.includes(x))) {
|
||||
if (changedProps.some(x => !widget.isDynamicProp(x))) {
|
||||
|
||||
clone.reCreateWidget({reuseChildren: false})
|
||||
this.updateContainer(false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue