@aiot-toolkit/parser 2.0.5-widget-provider-beta.2 → 2.0.5
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.
- package/README.md +11 -11
- package/lib/utils/ParserUtil.js +15 -15
- package/lib/ux/config/ExtensionConfig.js +2 -2
- package/lib/ux/config/FeatureConfig.js +19 -19
- package/lib/ux/config/vela/ElementConfig.js +0 -8
- package/lib/ux/config/vela/StyleAttributeConfig.js +134 -88
- package/lib/ux/enum/StyleSelectorType.js +6 -6
- package/lib/ux/enum/TemplateNodeType.js +2 -2
- package/lib/ux/enum/android/StyleSelectorName.js +2 -2
- package/lib/ux/interface/IUxAst.d.ts +2 -0
- package/lib/ux/parser/ScriptParser.js +2 -2
- package/lib/ux/parser/StyleParser.js +79 -72
- package/lib/ux/parser/TemplateValueParser.js +49 -49
- package/lib/ux/parser/UxParser.js +18 -12
- package/lib/ux/translate/android/StyleToTypescript.js +51 -51
- package/lib/ux/translate/android/TemplateToTypescript.js +51 -51
- package/lib/ux/translate/android/UxToTypescript.js +14 -14
- package/lib/ux/translate/android/attributeTranslate/ForTranslate.js +17 -17
- package/lib/ux/translate/android/attributeTranslate/IfTranslate.js +9 -9
- package/lib/ux/translate/vela/ScriptToTypescript.js +10 -10
- package/lib/ux/translate/vela/StyleToTypescript.js +10 -10
- package/lib/ux/translate/vela/TemplateToTypescript.js +74 -74
- package/lib/ux/translate/vela/TranslateCache.js +2 -2
- package/lib/ux/translate/vela/UxToTypescript.js +6 -6
- package/lib/ux/translate/vela/VelaContext.js +2 -2
- package/lib/ux/translate/vela/plugins/e2e.js +63 -62
- package/lib/ux/translate/vela/plugins/startPage.js +1 -1
- package/lib/ux/translate/vela/protobuf/BinaryPlugin.js +172 -172
- package/lib/ux/translate/vela/protobuf/protobuf.js +235 -235
- package/lib/ux/translate/vela/protobuf/protobufControl.js +159 -159
- package/lib/ux/translate/vela/protobuf/vdom_pb.js +2374 -2374
- package/lib/ux/translate/vela/runtime/velaTestLibrary.js +104 -104
- package/lib/ux/translate/vela/utils/AttributeConfig.js +15 -15
- package/lib/ux/translate/vela/utils/ExtendedBoxStyle.js +38 -38
- package/lib/ux/translate/vela/utils/SourceMapUtil.d.ts +0 -4
- package/lib/ux/translate/vela/utils/SourceMapUtil.js +30 -36
- package/lib/ux/translate/vela/utils/TemplateUtil.js +180 -180
- package/lib/ux/translate/vela/wrap/CbTranslate.js +8 -8
- package/lib/ux/translate/vela/wrap/CfTranslate.js +14 -14
- package/lib/ux/translate/vela/wrap/CiTranslate.js +11 -11
- package/lib/ux/utils/BabelUtil.js +35 -35
- package/lib/ux/utils/ElementConfigUtil.js +24 -24
- package/lib/ux/utils/StyleMapUtil.js +15 -15
- package/lib/ux/utils/StyleUtil.d.ts +1 -1
- package/lib/ux/utils/StyleUtil.js +192 -248
- package/lib/ux/utils/UxUtil.js +32 -32
- package/lib/ux/validate/ElementValidate.js +2 -2
- package/lib/ux/validate/UxFileValidate.js +2 -2
- package/package.json +4 -4
|
@@ -1,235 +1,235 @@
|
|
|
1
|
-
const vdom_pb = require('./vdom_pb')
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
class AIOT {
|
|
5
|
-
constructor(aiotf) {
|
|
6
|
-
this.funcArr = []
|
|
7
|
-
this.chld = []
|
|
8
|
-
this.idCount = -1
|
|
9
|
-
this.expCell = new vdom_pb.ExportCell()
|
|
10
|
-
this.aiotf = aiotf
|
|
11
|
-
this.optArr = []
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
init(expName) {
|
|
15
|
-
this.expCell.setTagname(expName)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
parseObj(opts) {
|
|
19
|
-
let styVaA = new vdom_pb.StyleValueArr()
|
|
20
|
-
|
|
21
|
-
for (let key in opts) {
|
|
22
|
-
let sKey = new vdom_pb.StyleKey()
|
|
23
|
-
let onesvl = new vdom_pb.OneStyleValue()
|
|
24
|
-
|
|
25
|
-
sKey.setValue(key)
|
|
26
|
-
onesvl.setKey(sKey)
|
|
27
|
-
|
|
28
|
-
let typ = Object.prototype.toString.call(opts[key])
|
|
29
|
-
if (typ === '[object Number]') {
|
|
30
|
-
// TODO:double
|
|
31
|
-
onesvl.setDoublevl(opts[key])
|
|
32
|
-
} else if (typ === '[object String]') {
|
|
33
|
-
// console.log(`String ${opts[key]}`)
|
|
34
|
-
onesvl.setStringvl(opts[key])
|
|
35
|
-
} else if (typ === '[object Function]') {
|
|
36
|
-
if (this.aiotf == undefined) {
|
|
37
|
-
this.funcArr.push(opts[key])
|
|
38
|
-
onesvl.setFuncid(this.funcArr.length - 1)
|
|
39
|
-
} else {
|
|
40
|
-
this.aiotf.funcArr.push(opts[key])
|
|
41
|
-
onesvl.setFuncid(this.aiotf.funcArr.length - 1)
|
|
42
|
-
}
|
|
43
|
-
} else if (typ === '[object Object]') {
|
|
44
|
-
// console.log(`object ${opts[key]}`)
|
|
45
|
-
let styVaA_ = new vdom_pb.StyleValueArr()
|
|
46
|
-
styVaA_ = this.parseObj(opts[key])
|
|
47
|
-
onesvl.setStylevlarr(styVaA_)
|
|
48
|
-
} else if (typ === '[object Array]') {
|
|
49
|
-
//TODO:default string arr
|
|
50
|
-
// console.log(`Array ${opts[key]}`)
|
|
51
|
-
let strarr = new vdom_pb.StringArr()
|
|
52
|
-
strarr.setStringvlarrList(opts[key])
|
|
53
|
-
onesvl.setStringarr(strarr)
|
|
54
|
-
} else if (typ === '[object Boolean]') {
|
|
55
|
-
onesvl.setBoolvl(opts[key])
|
|
56
|
-
}
|
|
57
|
-
styVaA.addVlarr(onesvl)
|
|
58
|
-
}
|
|
59
|
-
return styVaA
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
__cdc__(tagName, opts, childsArr) {
|
|
63
|
-
return this.__ce__(tagName, opts, childsArr, '__cdc__')
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
__ce__(tagName, opts, childsArr, type = '__ce__') {
|
|
67
|
-
let tempOne = new vdom_pb.TemplateOne()
|
|
68
|
-
let ce = new vdom_pb.TemplateUnit()
|
|
69
|
-
|
|
70
|
-
ce.setType(type)
|
|
71
|
-
ce.setTag(tagName)
|
|
72
|
-
if (Array.isArray(childsArr) && childsArr.length > 0) {
|
|
73
|
-
let arr = []
|
|
74
|
-
for (let key in childsArr) {
|
|
75
|
-
arr.push(childsArr[key].id_)
|
|
76
|
-
}
|
|
77
|
-
tempOne.setChldsidList(arr)
|
|
78
|
-
}
|
|
79
|
-
tempOne.setId(++this.idCount)
|
|
80
|
-
|
|
81
|
-
let styVaA_ = this.parseObj(opts.__opts__)
|
|
82
|
-
ce.setOptsarrList(styVaA_.getVlarrList())
|
|
83
|
-
|
|
84
|
-
tempOne.setCv(ce)
|
|
85
|
-
this.expCell.addTemplatearr(tempOne)
|
|
86
|
-
|
|
87
|
-
return { id_: this.idCount, aiot_: this }
|
|
88
|
-
}
|
|
89
|
-
__ci__(opts, renderFunc) {
|
|
90
|
-
let tempOne = new vdom_pb.TemplateOne()
|
|
91
|
-
let ci = new vdom_pb.TemplateUnit()
|
|
92
|
-
|
|
93
|
-
ci.setType('__ci__')
|
|
94
|
-
tempOne.setId(++this.idCount)
|
|
95
|
-
|
|
96
|
-
let styVaA_ = this.parseObj(opts.__opts__)
|
|
97
|
-
ci.setOptsarrList(styVaA_.getVlarrList())
|
|
98
|
-
|
|
99
|
-
// function(aiot) {
|
|
100
|
-
|
|
101
|
-
let aiotif = new AIOT(this)
|
|
102
|
-
aiotif.funcArr = this.funcArr
|
|
103
|
-
aiotif.optArr = this.optArr
|
|
104
|
-
|
|
105
|
-
let renderArr = renderFunc(aiotif)
|
|
106
|
-
let typ = Object.prototype.toString.call(renderArr)
|
|
107
|
-
if (typ === '[object Object]') {
|
|
108
|
-
ci.setTemplaterenderList(renderArr.aiot_.expCell.getTemplatearrList())
|
|
109
|
-
} else if (typ === '[object Array]') {
|
|
110
|
-
for (let key in renderArr) {
|
|
111
|
-
ci.setTemplaterenderList(renderArr[key].aiot_.expCell.getTemplatearrList())
|
|
112
|
-
break
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
this.funcArr = aiotif.aiotf.funcArr
|
|
117
|
-
|
|
118
|
-
tempOne.setCv(ci)
|
|
119
|
-
this.expCell.addTemplatearr(tempOne)
|
|
120
|
-
|
|
121
|
-
return { id_: this.idCount, aiot_: this }
|
|
122
|
-
}
|
|
123
|
-
__cf__(opts, renderFunc) {
|
|
124
|
-
let tempOne = new vdom_pb.TemplateOne()
|
|
125
|
-
let cf = new vdom_pb.TemplateUnit()
|
|
126
|
-
|
|
127
|
-
cf.setType('__cf__')
|
|
128
|
-
tempOne.setId(++this.idCount)
|
|
129
|
-
|
|
130
|
-
let styVaA_ = this.parseObj(opts.__opts__)
|
|
131
|
-
cf.setOptsarrList(styVaA_.getVlarrList())
|
|
132
|
-
|
|
133
|
-
let aiotfor = new AIOT()
|
|
134
|
-
aiotfor.optArr = this.optArr
|
|
135
|
-
let key_, value_
|
|
136
|
-
|
|
137
|
-
let renderArr = renderFunc(key_, value_, aiotfor)
|
|
138
|
-
let typ = Object.prototype.toString.call(renderArr)
|
|
139
|
-
if (typ === '[object Object]') {
|
|
140
|
-
cf.setTemplaterenderList(renderArr.aiot_.expCell.getTemplatearrList())
|
|
141
|
-
} else if (typ === '[object Array]') {
|
|
142
|
-
for (let key in renderArr) {
|
|
143
|
-
cf.setTemplaterenderList(renderArr[key].aiot_.expCell.getTemplatearrList())
|
|
144
|
-
break
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (aiotfor.funcArr.length > 0) {
|
|
149
|
-
const fun = function($idx, $item) {
|
|
150
|
-
return aiotfor.aiotf.funcArr
|
|
151
|
-
}
|
|
152
|
-
fun.aiotfor = aiotfor
|
|
153
|
-
fun.aiotfor.key = opts.__opts__['key']
|
|
154
|
-
fun.aiotfor.value = opts.__opts__['value']
|
|
155
|
-
this.funcArr.push(fun)
|
|
156
|
-
cf.setFuncrender(this.funcArr.length - 1)
|
|
157
|
-
} else {
|
|
158
|
-
cf.setFuncrender(-1)
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
tempOne.setCv(cf)
|
|
162
|
-
this.expCell.addTemplatearr(tempOne)
|
|
163
|
-
|
|
164
|
-
return { id_: this.idCount, aiot_: this }
|
|
165
|
-
}
|
|
166
|
-
__cc__(tagName, opts) {
|
|
167
|
-
let tempOne = new vdom_pb.TemplateOne()
|
|
168
|
-
let cc = new vdom_pb.TemplateUnit()
|
|
169
|
-
|
|
170
|
-
cc.setType('__cc__')
|
|
171
|
-
cc.setTag(tagName)
|
|
172
|
-
tempOne.setId(++this.idCount)
|
|
173
|
-
|
|
174
|
-
// 设置__opts__在数组中得索引
|
|
175
|
-
// if (Object.keys(opts.__opts__).length > 0) {
|
|
176
|
-
// this.optArr.push(opts.__opts__) //save to js
|
|
177
|
-
// cc.setOptsid(this.optArr.length - 1)
|
|
178
|
-
// } else {
|
|
179
|
-
// cc.setOptsid(-1)
|
|
180
|
-
// }
|
|
181
|
-
|
|
182
|
-
let styVaA_ = this.parseObj(opts.__opts__)
|
|
183
|
-
cc.setOptsarrList(styVaA_.getVlarrList())
|
|
184
|
-
|
|
185
|
-
tempOne.setCv(cc)
|
|
186
|
-
this.expCell.addTemplatearr(tempOne)
|
|
187
|
-
|
|
188
|
-
return { id_: this.idCount, aiot_: this }
|
|
189
|
-
}
|
|
190
|
-
__cb__(opts, renderFunc) {
|
|
191
|
-
let tempOne = new vdom_pb.TemplateOne()
|
|
192
|
-
let cb = new vdom_pb.TemplateUnit()
|
|
193
|
-
|
|
194
|
-
cb.setType('__cb__')
|
|
195
|
-
tempOne.setId(++this.idCount)
|
|
196
|
-
|
|
197
|
-
let styVaA_ = this.parseObj(opts.__opts__)
|
|
198
|
-
cb.setOptsarrList(styVaA_.getVlarrList())
|
|
199
|
-
|
|
200
|
-
let aiotcb = new AIOT()
|
|
201
|
-
aiotcb.optArr = this.optArr
|
|
202
|
-
|
|
203
|
-
let $data
|
|
204
|
-
let renderArr = renderFunc($data, aiotcb)
|
|
205
|
-
let typ = Object.prototype.toString.call(renderArr)
|
|
206
|
-
if (typ === '[object Object]') {
|
|
207
|
-
cb.setTemplaterenderList(renderArr.aiot_.expCell.getTemplatearrList())
|
|
208
|
-
} else if (typ === '[object Array]') {
|
|
209
|
-
for (let key in renderArr) {
|
|
210
|
-
cb.setTemplaterenderList(renderArr[key].aiot_.expCell.getTemplatearrList())
|
|
211
|
-
break
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
if (aiotcb.funcArr.length > 0) {
|
|
216
|
-
const fun = function($data) {
|
|
217
|
-
return aiotcb.aiotf.funcArr
|
|
218
|
-
}
|
|
219
|
-
fun.aiotcb = aiotcb
|
|
220
|
-
this.funcArr.push(fun)
|
|
221
|
-
cb.setFuncrender(this.funcArr.length - 1)
|
|
222
|
-
} else {
|
|
223
|
-
cb.setFuncrender(-1)
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// this.funcArr = aiotcb.aiotf.funcArr
|
|
227
|
-
|
|
228
|
-
tempOne.setCv(cb)
|
|
229
|
-
this.expCell.addTemplatearr(tempOne)
|
|
230
|
-
|
|
231
|
-
return { id_: this.idCount, aiot_: this }
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
module.exports = AIOT
|
|
1
|
+
const vdom_pb = require('./vdom_pb')
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
class AIOT {
|
|
5
|
+
constructor(aiotf) {
|
|
6
|
+
this.funcArr = []
|
|
7
|
+
this.chld = []
|
|
8
|
+
this.idCount = -1
|
|
9
|
+
this.expCell = new vdom_pb.ExportCell()
|
|
10
|
+
this.aiotf = aiotf
|
|
11
|
+
this.optArr = []
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
init(expName) {
|
|
15
|
+
this.expCell.setTagname(expName)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
parseObj(opts) {
|
|
19
|
+
let styVaA = new vdom_pb.StyleValueArr()
|
|
20
|
+
|
|
21
|
+
for (let key in opts) {
|
|
22
|
+
let sKey = new vdom_pb.StyleKey()
|
|
23
|
+
let onesvl = new vdom_pb.OneStyleValue()
|
|
24
|
+
|
|
25
|
+
sKey.setValue(key)
|
|
26
|
+
onesvl.setKey(sKey)
|
|
27
|
+
|
|
28
|
+
let typ = Object.prototype.toString.call(opts[key])
|
|
29
|
+
if (typ === '[object Number]') {
|
|
30
|
+
// TODO:double
|
|
31
|
+
onesvl.setDoublevl(opts[key])
|
|
32
|
+
} else if (typ === '[object String]') {
|
|
33
|
+
// console.log(`String ${opts[key]}`)
|
|
34
|
+
onesvl.setStringvl(opts[key])
|
|
35
|
+
} else if (typ === '[object Function]') {
|
|
36
|
+
if (this.aiotf == undefined) {
|
|
37
|
+
this.funcArr.push(opts[key])
|
|
38
|
+
onesvl.setFuncid(this.funcArr.length - 1)
|
|
39
|
+
} else {
|
|
40
|
+
this.aiotf.funcArr.push(opts[key])
|
|
41
|
+
onesvl.setFuncid(this.aiotf.funcArr.length - 1)
|
|
42
|
+
}
|
|
43
|
+
} else if (typ === '[object Object]') {
|
|
44
|
+
// console.log(`object ${opts[key]}`)
|
|
45
|
+
let styVaA_ = new vdom_pb.StyleValueArr()
|
|
46
|
+
styVaA_ = this.parseObj(opts[key])
|
|
47
|
+
onesvl.setStylevlarr(styVaA_)
|
|
48
|
+
} else if (typ === '[object Array]') {
|
|
49
|
+
//TODO:default string arr
|
|
50
|
+
// console.log(`Array ${opts[key]}`)
|
|
51
|
+
let strarr = new vdom_pb.StringArr()
|
|
52
|
+
strarr.setStringvlarrList(opts[key])
|
|
53
|
+
onesvl.setStringarr(strarr)
|
|
54
|
+
} else if (typ === '[object Boolean]') {
|
|
55
|
+
onesvl.setBoolvl(opts[key])
|
|
56
|
+
}
|
|
57
|
+
styVaA.addVlarr(onesvl)
|
|
58
|
+
}
|
|
59
|
+
return styVaA
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
__cdc__(tagName, opts, childsArr) {
|
|
63
|
+
return this.__ce__(tagName, opts, childsArr, '__cdc__')
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
__ce__(tagName, opts, childsArr, type = '__ce__') {
|
|
67
|
+
let tempOne = new vdom_pb.TemplateOne()
|
|
68
|
+
let ce = new vdom_pb.TemplateUnit()
|
|
69
|
+
|
|
70
|
+
ce.setType(type)
|
|
71
|
+
ce.setTag(tagName)
|
|
72
|
+
if (Array.isArray(childsArr) && childsArr.length > 0) {
|
|
73
|
+
let arr = []
|
|
74
|
+
for (let key in childsArr) {
|
|
75
|
+
arr.push(childsArr[key].id_)
|
|
76
|
+
}
|
|
77
|
+
tempOne.setChldsidList(arr)
|
|
78
|
+
}
|
|
79
|
+
tempOne.setId(++this.idCount)
|
|
80
|
+
|
|
81
|
+
let styVaA_ = this.parseObj(opts.__opts__)
|
|
82
|
+
ce.setOptsarrList(styVaA_.getVlarrList())
|
|
83
|
+
|
|
84
|
+
tempOne.setCv(ce)
|
|
85
|
+
this.expCell.addTemplatearr(tempOne)
|
|
86
|
+
|
|
87
|
+
return { id_: this.idCount, aiot_: this }
|
|
88
|
+
}
|
|
89
|
+
__ci__(opts, renderFunc) {
|
|
90
|
+
let tempOne = new vdom_pb.TemplateOne()
|
|
91
|
+
let ci = new vdom_pb.TemplateUnit()
|
|
92
|
+
|
|
93
|
+
ci.setType('__ci__')
|
|
94
|
+
tempOne.setId(++this.idCount)
|
|
95
|
+
|
|
96
|
+
let styVaA_ = this.parseObj(opts.__opts__)
|
|
97
|
+
ci.setOptsarrList(styVaA_.getVlarrList())
|
|
98
|
+
|
|
99
|
+
// function(aiot) {
|
|
100
|
+
|
|
101
|
+
let aiotif = new AIOT(this)
|
|
102
|
+
aiotif.funcArr = this.funcArr
|
|
103
|
+
aiotif.optArr = this.optArr
|
|
104
|
+
|
|
105
|
+
let renderArr = renderFunc(aiotif)
|
|
106
|
+
let typ = Object.prototype.toString.call(renderArr)
|
|
107
|
+
if (typ === '[object Object]') {
|
|
108
|
+
ci.setTemplaterenderList(renderArr.aiot_.expCell.getTemplatearrList())
|
|
109
|
+
} else if (typ === '[object Array]') {
|
|
110
|
+
for (let key in renderArr) {
|
|
111
|
+
ci.setTemplaterenderList(renderArr[key].aiot_.expCell.getTemplatearrList())
|
|
112
|
+
break
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
this.funcArr = aiotif.aiotf.funcArr
|
|
117
|
+
|
|
118
|
+
tempOne.setCv(ci)
|
|
119
|
+
this.expCell.addTemplatearr(tempOne)
|
|
120
|
+
|
|
121
|
+
return { id_: this.idCount, aiot_: this }
|
|
122
|
+
}
|
|
123
|
+
__cf__(opts, renderFunc) {
|
|
124
|
+
let tempOne = new vdom_pb.TemplateOne()
|
|
125
|
+
let cf = new vdom_pb.TemplateUnit()
|
|
126
|
+
|
|
127
|
+
cf.setType('__cf__')
|
|
128
|
+
tempOne.setId(++this.idCount)
|
|
129
|
+
|
|
130
|
+
let styVaA_ = this.parseObj(opts.__opts__)
|
|
131
|
+
cf.setOptsarrList(styVaA_.getVlarrList())
|
|
132
|
+
|
|
133
|
+
let aiotfor = new AIOT()
|
|
134
|
+
aiotfor.optArr = this.optArr
|
|
135
|
+
let key_, value_
|
|
136
|
+
|
|
137
|
+
let renderArr = renderFunc(key_, value_, aiotfor)
|
|
138
|
+
let typ = Object.prototype.toString.call(renderArr)
|
|
139
|
+
if (typ === '[object Object]') {
|
|
140
|
+
cf.setTemplaterenderList(renderArr.aiot_.expCell.getTemplatearrList())
|
|
141
|
+
} else if (typ === '[object Array]') {
|
|
142
|
+
for (let key in renderArr) {
|
|
143
|
+
cf.setTemplaterenderList(renderArr[key].aiot_.expCell.getTemplatearrList())
|
|
144
|
+
break
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (aiotfor.funcArr.length > 0) {
|
|
149
|
+
const fun = function($idx, $item) {
|
|
150
|
+
return aiotfor.aiotf.funcArr
|
|
151
|
+
}
|
|
152
|
+
fun.aiotfor = aiotfor
|
|
153
|
+
fun.aiotfor.key = opts.__opts__['key']
|
|
154
|
+
fun.aiotfor.value = opts.__opts__['value']
|
|
155
|
+
this.funcArr.push(fun)
|
|
156
|
+
cf.setFuncrender(this.funcArr.length - 1)
|
|
157
|
+
} else {
|
|
158
|
+
cf.setFuncrender(-1)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
tempOne.setCv(cf)
|
|
162
|
+
this.expCell.addTemplatearr(tempOne)
|
|
163
|
+
|
|
164
|
+
return { id_: this.idCount, aiot_: this }
|
|
165
|
+
}
|
|
166
|
+
__cc__(tagName, opts) {
|
|
167
|
+
let tempOne = new vdom_pb.TemplateOne()
|
|
168
|
+
let cc = new vdom_pb.TemplateUnit()
|
|
169
|
+
|
|
170
|
+
cc.setType('__cc__')
|
|
171
|
+
cc.setTag(tagName)
|
|
172
|
+
tempOne.setId(++this.idCount)
|
|
173
|
+
|
|
174
|
+
// 设置__opts__在数组中得索引
|
|
175
|
+
// if (Object.keys(opts.__opts__).length > 0) {
|
|
176
|
+
// this.optArr.push(opts.__opts__) //save to js
|
|
177
|
+
// cc.setOptsid(this.optArr.length - 1)
|
|
178
|
+
// } else {
|
|
179
|
+
// cc.setOptsid(-1)
|
|
180
|
+
// }
|
|
181
|
+
|
|
182
|
+
let styVaA_ = this.parseObj(opts.__opts__)
|
|
183
|
+
cc.setOptsarrList(styVaA_.getVlarrList())
|
|
184
|
+
|
|
185
|
+
tempOne.setCv(cc)
|
|
186
|
+
this.expCell.addTemplatearr(tempOne)
|
|
187
|
+
|
|
188
|
+
return { id_: this.idCount, aiot_: this }
|
|
189
|
+
}
|
|
190
|
+
__cb__(opts, renderFunc) {
|
|
191
|
+
let tempOne = new vdom_pb.TemplateOne()
|
|
192
|
+
let cb = new vdom_pb.TemplateUnit()
|
|
193
|
+
|
|
194
|
+
cb.setType('__cb__')
|
|
195
|
+
tempOne.setId(++this.idCount)
|
|
196
|
+
|
|
197
|
+
let styVaA_ = this.parseObj(opts.__opts__)
|
|
198
|
+
cb.setOptsarrList(styVaA_.getVlarrList())
|
|
199
|
+
|
|
200
|
+
let aiotcb = new AIOT()
|
|
201
|
+
aiotcb.optArr = this.optArr
|
|
202
|
+
|
|
203
|
+
let $data
|
|
204
|
+
let renderArr = renderFunc($data, aiotcb)
|
|
205
|
+
let typ = Object.prototype.toString.call(renderArr)
|
|
206
|
+
if (typ === '[object Object]') {
|
|
207
|
+
cb.setTemplaterenderList(renderArr.aiot_.expCell.getTemplatearrList())
|
|
208
|
+
} else if (typ === '[object Array]') {
|
|
209
|
+
for (let key in renderArr) {
|
|
210
|
+
cb.setTemplaterenderList(renderArr[key].aiot_.expCell.getTemplatearrList())
|
|
211
|
+
break
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (aiotcb.funcArr.length > 0) {
|
|
216
|
+
const fun = function($data) {
|
|
217
|
+
return aiotcb.aiotf.funcArr
|
|
218
|
+
}
|
|
219
|
+
fun.aiotcb = aiotcb
|
|
220
|
+
this.funcArr.push(fun)
|
|
221
|
+
cb.setFuncrender(this.funcArr.length - 1)
|
|
222
|
+
} else {
|
|
223
|
+
cb.setFuncrender(-1)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// this.funcArr = aiotcb.aiotf.funcArr
|
|
227
|
+
|
|
228
|
+
tempOne.setCv(cb)
|
|
229
|
+
this.expCell.addTemplatearr(tempOne)
|
|
230
|
+
|
|
231
|
+
return { id_: this.idCount, aiot_: this }
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
module.exports = AIOT
|