1/* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16var cardNativeTag = { 17 'div': { 18 events: [], 19 attrs: {} 20 }, 21 'stack': { 22 events: [], 23 attrs: {} 24 }, 25 'image': { 26 alias: ['img'], 27 atomic: true, 28 selfClosing: true, 29 events: ['error', 'complete'], 30 attrs: { 31 src: {}, 32 alt: {} 33 } 34 }, 35 'progress': { 36 atomic: true, 37 selfClosing: true, 38 events: [], 39 attrs: { 40 type: { 41 def: 'horizontal', 42 enum: ['horizontal', 'circular', 'ring', 'scale-ring', 'arc', 'eclipse'] 43 }, 44 percent: { 45 def: 0, 46 checkFunc: 'number' 47 }, 48 secondarypercent: { 49 def: 0, 50 checkFunc: 'number' 51 }, 52 clockwise: { 53 def: 'true', 54 enum: ['true', 'false'] 55 }, 56 }, 57 }, 58 'text': { 59 textContent: true, 60 events: [], 61 children: ['span'], 62 attrs: {} 63 }, 64 'span': { 65 textContent: true, 66 excludeRoot: true, 67 parents: ['text', 'span'], 68 events: [], 69 children: ['span'], 70 attrs: {}, 71 }, 72 'chart': { 73 atomic: true, 74 selfClosing: true, 75 events: [], 76 attrs: { 77 type: { 78 def: 'line', 79 enum: ['line', 'bar', 'gauge', 'progress', 'loading', 'rainbow'], 80 required: true 81 }, 82 options: {}, 83 datasets: {}, 84 percent: { 85 def: 0, 86 checkFunc: 'number' 87 }, 88 segments: {}, 89 effects: { 90 def: 'true', 91 enum: ['true', 'false'] 92 }, 93 } 94 }, 95 'button': { 96 textContent: true, 97 atomic: true, 98 selfClosing: true, 99 attrs: { 100 type: { 101 enum: ['capsule', 'circle', 'text', 'arc'] 102 }, 103 value: {}, 104 icon: {}, 105 waiting: { 106 def: 'false', 107 enum: ['false', 'true'] 108 }, 109 placement: { 110 def: 'end', 111 enum: ['end', 'start', 'top', 'bottom'], 112 }, 113 } 114 }, 115 'badge': { 116 attrs: { 117 placement: { 118 def: 'rightTop', 119 enum: ['rightTop', 'right', 'left'] 120 }, 121 count: { 122 def: 0, 123 checkFunc: 'number' 124 }, 125 visible: { 126 def: 'false', 127 enum: ["false", "true"] 128 }, 129 maxcount: { 130 def: 99, 131 checkFunc: 'number', 132 }, 133 config: {}, 134 }, 135 }, 136 'list': { 137 children: ['list-item'], 138 attrs: { 139 cachedcount: { 140 def: 0, 141 checkFunc: 'number', 142 }, 143 scrollbar: { 144 def: 'off', 145 enum: ['off', 'auto', 'on'], 146 }, 147 scrolleffect: { 148 def: 'spring', 149 enum: ['spring', 'fade', 'no'], 150 }, 151 divider: { 152 def: 'false', 153 enum: ['false', 'true'], 154 }, 155 shapemode: { 156 def: 'default', 157 enum: ['default', 'rect', 'round'], 158 }, 159 updateeffect: { 160 def: 'false', 161 enum: ['false', 'true'], 162 }, 163 initialindex: { 164 def: 0, 165 checkFunc: 'number', 166 }, 167 initialoffset: { 168 def: 0, 169 checkFunc: 'length', 170 }, 171 selected: {} 172 }, 173 }, 174 'list-item': { 175 excludeRoot: true, 176 parents: ['list'], 177 attrs: { 178 for: {}, 179 type: { 180 def: 'default', 181 }, 182 section: {}, 183 sticky: { 184 def: 'none', 185 enum: ['none', 'normal', 'opacity'], 186 }, 187 }, 188 }, 189 'block': { 190 excludeRoot: true, 191 attrs: {}, 192 }, 193 'swiper': { 194 unSupportedChildren: ['list'], 195 attrs: { 196 indicator: { 197 def: 'true', 198 enum: ['true', 'false'], 199 }, 200 index: { 201 def: 0, 202 checkFunc: 'number', 203 }, 204 duration: { 205 checkFunc: 'number', 206 }, 207 vertical: { 208 def: 'false', 209 enum: ['false', 'true'], 210 }, 211 digital: { 212 def: 'false', 213 enum: ['false', 'true'], 214 }, 215 loop: { 216 def: 'true', 217 enum: ['true', 'false'], 218 }, 219 animationopacity: { 220 def: 'true', 221 enum: ['true', 'false'], 222 } 223 }, 224 }, 225 'calendar': { 226 atomic: true, 227 events: [ 228 'selectedchange', 229 'requestdata' 230 ], 231 attrs: { 232 date: {}, 233 cardcalendar: { 234 def: 'false', 235 enum: ['false', 'true'], 236 }, 237 startdayofweek: { 238 def: 6, 239 }, 240 offdays: {}, 241 calendardata: {}, 242 showholiday: { 243 def: 'true', 244 enum: ['true', 'false'], 245 }, 246 }, 247 }, 248 'clock': { 249 atomic: true, 250 attrs: { 251 clockconfig: { 252 required: true 253 }, 254 showdigit: { 255 def: 'true', 256 enum: ['true', 'false'], 257 }, 258 hourswest: { 259 checkFunc: 'number', 260 }, 261 }, 262 }, 263 'divider': { 264 atomic: true, 265 selfClosing: true, 266 attrs: { 267 vertical: { 268 def: 'false', 269 enum: ['false', 'true'], 270 }, 271 }, 272 }, 273 'input': { 274 atomic: true, 275 selfClosing: true, 276 events: ['change'], 277 attrs: { 278 checked: { 279 def: 'false', 280 enum: ['false', 'true'], 281 }, 282 type: { 283 def: 'radio', 284 enum: ['radio'], 285 required: true, 286 }, 287 name: {}, 288 value: {}, 289 }, 290 }, 291} 292 293var cardCommonTag = { 294 'events': [ 295 'click' 296 ], 297 'attrs': { 298 id: {}, 299 style: {}, 300 class: {}, 301 disabled: { 302 def: 'false', 303 enum: ['false', 'true'] 304 }, 305 if: { 306 excludeRoot: true, 307 def: 'true' 308 }, 309 elif: { 310 def: 'true' 311 }, 312 else: { 313 excludeRoot: true 314 }, 315 show: { 316 excludeRoot: true, 317 def: 'true' 318 }, 319 accessibilitygroup: { 320 enum: ['false', 'true'], 321 }, 322 accessibilitytext: {}, 323 accessibilitydescription: {}, 324 accessibilityimportance: { 325 enum: ['auto', 'yes', 'no', 'no-hide-descendants'], 326 }, 327 for: {}, 328 tid: {} 329 }, 330 'children': ['block', 'slot'], 331 'parents': ['block'] 332} 333 334module.exports = { 335 cardCommonTag: cardCommonTag, 336 cardNativeTag: cardNativeTag 337} 338