@@ -27,101 +27,12 @@ function createComponentObject(model, parentView) {
27
27
const isTemplateModel = model . get ( 'template' ) instanceof TemplateModel ;
28
28
const templateModel = isTemplateModel ? model . get ( 'template' ) : model ;
29
29
const template = templateModel . get ( 'template' ) ;
30
- // const vuefile = readVueFile(template);
31
- //
32
- // const css = model.get('css') || (vuefile.STYLE && vuefile.STYLE.content);
33
- // const cssId = (vuefile.STYLE && vuefile.STYLE.id);
34
- //
35
- // if (css) {
36
- // if (cssId) {
37
- // const prefixedCssId = `ipyvue-${cssId}`;
38
- // let style = document.getElementById(prefixedCssId);
39
- // if (!style) {
40
- // style = document.createElement('style');
41
- // style.id = prefixedCssId;
42
- // document.head.appendChild(style);
43
- // }
44
- // if (style.innerHTML !== css) {
45
- // style.innerHTML = css;
46
- // }
47
- // } else {
48
- // const style = document.createElement('style');
49
- // style.id = model.cid;
50
- // style.innerHTML = css;
51
- // document.head.appendChild(style);
52
- // parentView.once('remove', () => {
53
- // document.head.removeChild(style);
54
- // });
55
- // }
56
- // }
57
-
58
- // eslint-disable-next-line no-new-func
59
- // const methods = model.get('methods') ? Function(`return ${model.get('methods').replace('\n', ' ')}`)() : {};
60
- // eslint-disable-next-line no-new-func
61
- // const data = model.get('data') ? Function(`return ${model.get('data').replace('\n', ' ')}`)() : {};
62
30
63
31
const componentEntries = Object . entries ( model . get ( 'components' ) || { } ) ;
64
32
const instanceComponents = componentEntries . filter ( ( [ , v ] ) => v instanceof WidgetModel ) ;
65
33
const classComponents = componentEntries . filter ( ( [ , v ] ) => ! ( v instanceof WidgetModel ) && ! ( typeof v === 'string' ) ) ;
66
34
const fullVueComponents = componentEntries . filter ( ( [ , v ] ) => typeof v === 'string' ) ;
67
35
68
- // function callVueFn(name, this_) {
69
- // if (vuefile.SCRIPT && vuefile.SCRIPT[name]) {
70
- // vuefile.SCRIPT[name].bind(this_)();
71
- // }
72
- // }
73
- //
74
- // return {
75
- // inject: ['viewCtx'],
76
- // data() {
77
- // // data that is only used in the template, and not synced with the backend/model
78
- // const dataTemplate = (vuefile.SCRIPT && vuefile.SCRIPT.data && vuefile.SCRIPT.data()) || {};
79
- // return { ...data, ...dataTemplate, ...createDataMapping(model) };
80
- // },
81
- // beforeCreate() {
82
- // callVueFn('beforeCreate', this);
83
- // },
84
- // created() {
85
- // this.__onTemplateChange = () => {
86
- // this.$root.$forceUpdate();
87
- // };
88
- // templateModel.on('change:template', this.__onTemplateChange);
89
- // addModelListeners(model, this);
90
- // callVueFn('created', this);
91
- // },
92
- // watch: createWatches(model, parentView, vuefile.SCRIPT && vuefile.SCRIPT.watch),
93
- // methods: {
94
- // ...vuefile.SCRIPT && vuefile.SCRIPT.methods,
95
- // ...methods,
96
- // ...createMethods(model, parentView),
97
- // },
98
- // components: {
99
- // ...createInstanceComponents(instanceComponents, parentView),
100
- // ...createClassComponents(classComponents, model, parentView),
101
- // ...createFullVueComponents(fullVueComponents),
102
- // },
103
- // computed: { ...vuefile.SCRIPT && vuefile.SCRIPT.computed, ...aliasRefProps(model) },
104
- // template: vuefile.TEMPLATE || template,
105
- // beforeMount() {
106
- // callVueFn('beforeMount', this);
107
- // },
108
- // mounted() {
109
- // callVueFn('mounted', this);
110
- // },
111
- // beforeUpdate() {
112
- // callVueFn('beforeUpdate', this);
113
- // },
114
- // updated() {
115
- // callVueFn('updated', this);
116
- // },
117
- // beforeDestroy() {
118
- // templateModel.off('change:template', this.__onTemplateChange);
119
- // callVueFn('beforeDestroy', this);
120
- // },
121
- // destroyed() {
122
- // callVueFn('destroyed', this);
123
- // },
124
- // };
125
36
return getAsyncComponent (
126
37
template ,
127
38
{
0 commit comments