(2.4.5)Is there way to apply type polymorphism in "properties" field in UI editor?

For example, suppose I have a parent component called PopupComponent:

//PopupComponent.js
cc.Class({
    extends: cc.Component,

    properties: {

    },

    getName(){
        return "";
    },

    showPopup(){
    }
});

And 3 child classes extend from PopupComponent:

//BigPrizePopupComponent.js
cc.Class({
    extends: require('PopupComponent'),

    properties: {
        animation:{
            type:cc.Animation,
            default:null
        }
    },
    
    getPrizeName(){
        return "Big";
    },

    showPopup(){
        alert("Big Prize Popup shows");
    }
});
//SmallPrizePopupComponent.js
cc.Class({
    extends: require('PopupComponent'),

    properties: {
        armatureDisplay:{
            type:dragonBones.ArmatureDisplay,
            default:null
        }
    },
    
    getPrizeName(){
        return "Small";
    },

    showPopup(){
        alert("Small Prize Popup shows");
    }
});
//MiniPrizePopupComponent.js
cc.Class({
    extends: require('PopupComponent'),

    properties: {
        particleSystem:{
            type:cc.ParticleSystem,
            default:null
        }
    },
    
    getPrizeName(){
        return "Mini";
    },

    showPopup(){
        alert("Mini Prize Popup shows");
    }
});

What I want to do is, show either one PopupComponent depend on the input (may be from server or text field entered by user), When I try to implement the logic in the main scene:

cc.Class({
    extends: cc.Component,

    properties: {
        label: {
            default: null,
            type: cc.Label
        },
        // defaults, set visually when attaching this script to the Canvas
        text: 'Hello, World!',

        popupComponentArray:{
            type:[require('PopupComponent')],
            default:[]
        }
    },

    onLoad: function () {
        let prizeName="Big"; //some prizeName from dynamic data such as http/database in real code
        for(const popupComponent of this.popupComponentArray){
            if(popupComponent.getPrizeName() == prizeName){
                popupComponent.node.active=true;
                popupComponent.showPopup();
            }else{
                popupComponent.node.active=false;
            }
        }
    }
});

, the field in the editor:

popupComponentArray:{
    type:[require('PopupComponent')],
    default:[]
}

doesn’t allow me to put BigPrizePopupComponent into the array (but it can if the component is PopupComponent), is there any other ways to simulate type polymorphism in the properties field?

Or lets explain what “doesn’t allow me to put BigPrizePopupComponent into the array” really means : When trying to “pull” BigPrizePopupComponent into popupComponentArray, the editor refuse me to put it in:

Also I tried using cc.Node as type instead of PopupComponent:

popupComponentArray:{
    type:[cc.Node],
    default:[]
}

Now the editor allows me to put it into the array:

But when running the code, error occurs:

[Error] TypeError: popupComponent.getPrizeName is not a function. (In ‘popupComponent.getPrizeName()’, ‘popupComponent.getPrizeName’ is undefined)
(anonymous function) (cocos2d-js-for-preview.js:17549)
(anonymous function) (cocos2d-js-for-preview.js:47212)

the test project:
NewProject.zip (297.1 KB)

Is there any methods that I can implement polymorphism in the UI editor?

works fine for me on Windows, maybe a compilation issue (happens sometimes when Cocos Creator somehow fails to compile scripts). Try reopening your Cocos Creator Editor

reopen and clear cache to run again, the error still occurs instead of showing the alert (Which I expect if polymorphism success, the alert code in each sub class should be shown)…