Best JavaScript code snippet using playwright-internal
android.content.pm.ComponentInfo.js
Source:android.content.pm.ComponentInfo.js
1/**2 * Hyperloop3 * Generated code is Copyright (c) 2017 Appcelerator, Inc. and subject to the4 * Appcelerator Platform Subscription agreement.5 *6 * WARNING: This is generated code. Modify at your own risk and without support7 *8 * @module android.content.pm.ComponentInfo9 */10var Hyperloop = require('hyperloop');11var parentPackage = require('android.content.pm');12/**13 * @class android.content.pm.ComponentInfo14 * @extends android.content.pm.PackageItemInfo 15 * @constructor16 * @see {@link http://developer.android.com/reference/android/content/pm/ComponentInfo.html}17 **/18var ComponentInfo = function() {19 var result;20 // Allow the constructor to either invoke the real java constructor, or function as a "wrapping" method that will take21 // a single argument that is a native hyperloop proxy for this class type and just wraps it in our JS type.22 if (arguments.length == 1 && arguments[0].isNativeProxy && arguments[0].isInstanceProxy && arguments[0].isInstanceOf('android.content.pm.ComponentInfo')) {23 result = arguments[0];24 }25 else {26 result = ComponentInfo.class.newInstance(arguments);27 }28 this.$native = result;29 this._hasPointer = result != null;30 this._private = {};31};32var SuperClass = require('android.content.pm.PackageItemInfo');33ComponentInfo.prototype = Object.create(SuperClass.prototype);34ComponentInfo.prototype.constructor = ComponentInfo;35Object.defineProperty(ComponentInfo.prototype, 'super', {36 get: function() {37 if (!this._hasPointer) return null;38 return new ComponentInfo(this.$native.super);39 },40 enumerable: true41});42ComponentInfo.className = 'android.content.pm.ComponentInfo';43ComponentInfo.prototype.className = 'android.content.pm.ComponentInfo';44// class property45Object.defineProperty(ComponentInfo, 'class', {46 get: function() {47 return Hyperloop.getClass('android.content.pm.ComponentInfo');48 },49 enumerable: true,50 configurable: false51});52// Allow subclassing53ComponentInfo.extend = function (overrides) {54 var subclassProxy = Hyperloop.extend('android.content.pm.ComponentInfo');55 // Generate a JS wrapper for our dynamic subclass56 var SubClass = function() {57 var result = subclassProxy.newInstance(arguments),58 instance = this,59 copy = overrides,60 modified = {};61 function _wrapArg(arg) {62 if (arg.apiName && arg.isNativeProxy && arg.isInstanceProxy) { // Assume hyperloop proxy, wrap in JS wrapper63 var other = require(arg.apiName);64 return new other(arg);65 }66 return arg;67 }68 function _wrapArgs() {69 var newArgs = [];70 for (var i = 0; i < arguments.length; i++) {71 newArgs[i] = _wrapArg(arguments[i]);72 }73 return newArgs;74 };75 Object.keys(copy).forEach(function (each) {76 // Hang the original override method on the JS wrapper object77 instance[each] = function() {78 return copy[each].apply(instance, arguments);79 };80 // Hang a delegate on the "overrides" object we pass into Java.81 // This one wraps hyperloop proxies from Java in their JS wrapper before forwarding on82 modified[each] = function() {83 return instance[each].apply(instance, _wrapArgs.apply(this, arguments));84 }85 });86 result.setOverrides(modified);87 this.$native = result;88 this._hasPointer = result != null;89 this._private = {};90 };91 // it extends the JS wrapper for the parent type92 SubClass.prototype = Object.create(ComponentInfo.prototype);93 SubClass.prototype.constructor = SubClass;94 return SubClass;95};96// Cast97ComponentInfo.cast = function(object) {98 if (!object.$native || !object.$native.isInstanceProxy) return object;99 return new ComponentInfo(Hyperloop.cast('android.content.pm.ComponentInfo', object.$native));100};101// Constants102// Inner classes103// Static fields104// Instance Fields105// http://developer.android.com/reference/android/content/pm/ComponentInfo.html#exported106Object.defineProperty(ComponentInfo.prototype, 'exported', {107 get: function() {108 if (!this._hasPointer) return null;109 var result = this.$native.getNativeField('exported');110 if (result == null) {111 return null;112 }113 // Wrap result if it's not a primitive type?114 if (result.apiName) {115 if (result.apiName === 'android.content.pm.ComponentInfo') {116 return new ComponentInfo(result);117 } else {118 var ctor = require(result.apiName);119 return new ctor(result);120 }121 }122 return result;123 },124 set: function(newValue) {125 if (!this._hasPointer) return;126 this.$native.setNativeField('exported', newValue);127 },128 enumerable: true129});130// http://developer.android.com/reference/android/content/pm/ComponentInfo.html#processName131Object.defineProperty(ComponentInfo.prototype, 'processName', {132 get: function() {133 if (!this._hasPointer) return null;134 var result = this.$native.getNativeField('processName');135 if (result == null) {136 return null;137 }138 // Wrap result if it's not a primitive type?139 if (result.apiName) {140 if (result.apiName === 'android.content.pm.ComponentInfo') {141 return new ComponentInfo(result);142 } else {143 var ctor = require(result.apiName);144 return new ctor(result);145 }146 }147 return result;148 },149 set: function(newValue) {150 if (!this._hasPointer) return;151 this.$native.setNativeField('processName', newValue);152 },153 enumerable: true154});155// http://developer.android.com/reference/android/content/pm/ComponentInfo.html#applicationInfo156Object.defineProperty(ComponentInfo.prototype, 'applicationInfo', {157 get: function() {158 if (!this._hasPointer) return null;159 var result = this.$native.getNativeField('applicationInfo');160 if (result == null) {161 return null;162 }163 // Wrap result if it's not a primitive type?164 if (result.apiName) {165 if (result.apiName === 'android.content.pm.ComponentInfo') {166 return new ComponentInfo(result);167 } else {168 var ctor = require(result.apiName);169 return new ctor(result);170 }171 }172 return result;173 },174 set: function(newValue) {175 if (!this._hasPointer) return;176 this.$native.setNativeField('applicationInfo', newValue);177 },178 enumerable: true179});180// http://developer.android.com/reference/android/content/pm/ComponentInfo.html#enabled181Object.defineProperty(ComponentInfo.prototype, 'enabled', {182 get: function() {183 if (!this._hasPointer) return null;184 var result = this.$native.getNativeField('enabled');185 if (result == null) {186 return null;187 }188 // Wrap result if it's not a primitive type?189 if (result.apiName) {190 if (result.apiName === 'android.content.pm.ComponentInfo') {191 return new ComponentInfo(result);192 } else {193 var ctor = require(result.apiName);194 return new ctor(result);195 }196 }197 return result;198 },199 set: function(newValue) {200 if (!this._hasPointer) return;201 this.$native.setNativeField('enabled', newValue);202 },203 enumerable: true204});205// http://developer.android.com/reference/android/content/pm/ComponentInfo.html#descriptionRes206Object.defineProperty(ComponentInfo.prototype, 'descriptionRes', {207 get: function() {208 if (!this._hasPointer) return null;209 var result = this.$native.getNativeField('descriptionRes');210 if (result == null) {211 return null;212 }213 // Wrap result if it's not a primitive type?214 if (result.apiName) {215 if (result.apiName === 'android.content.pm.ComponentInfo') {216 return new ComponentInfo(result);217 } else {218 var ctor = require(result.apiName);219 return new ctor(result);220 }221 }222 return result;223 },224 set: function(newValue) {225 if (!this._hasPointer) return;226 this.$native.setNativeField('descriptionRes', newValue);227 },228 enumerable: true229});230// Static methods231// Instance methods232/**233 * TODO Fill out docs more...234 * @function loadLabel235 * @memberof236 * @instance237 * @see {@link http://developer.android.com/reference/android/content/pm/ComponentInfo.html#loadLabel(android.content.pm.PackageManager)}238 **/239ComponentInfo.prototype.loadLabel = function() {240 if (!this._hasPointer) return null;241 var result = this.$native.callNativeFunction({242 func: 'loadLabel',243 instanceMethod: true,244 args: Array.prototype.slice.call(arguments)245 });246 if (result == null) {247 return null;248 }249 // Wrap result if it's not a primitive type?250 if (result.apiName) {251 if (result.apiName === 'android.content.pm.ComponentInfo') {252 return new ComponentInfo(result);253 } else {254 var ctor = require(result.apiName);255 return new ctor(result);256 }257 }258 return result;259};260/**261 * TODO Fill out docs more...262 * @function getLogoResource263 * @memberof264 * @instance265 * @see {@link http://developer.android.com/reference/android/content/pm/ComponentInfo.html#getLogoResource()}266 **/267ComponentInfo.prototype.getLogoResource = function() {268 if (!this._hasPointer) return null;269 var result = this.$native.callNativeFunction({270 func: 'getLogoResource',271 instanceMethod: true,272 args: Array.prototype.slice.call(arguments)273 });274 if (result == null) {275 return null;276 }277 // Wrap result if it's not a primitive type?278 if (result.apiName) {279 if (result.apiName === 'android.content.pm.ComponentInfo') {280 return new ComponentInfo(result);281 } else {282 var ctor = require(result.apiName);283 return new ctor(result);284 }285 }286 return result;287};288/**289 * TODO Fill out docs more...290 * @function dumpBack291 * @memberof292 * @instance293 * @see {@link http://developer.android.com/reference/android/content/pm/ComponentInfo.html#dumpBack(android.util.Printer, java.lang.String)}294 **/295ComponentInfo.prototype.dumpBack = function() {296 if (!this._hasPointer) return null;297 var result = this.$native.callNativeFunction({298 func: 'dumpBack',299 instanceMethod: true,300 args: Array.prototype.slice.call(arguments)301 });302 if (result == null) {303 return null;304 }305 // Wrap result if it's not a primitive type?306 if (result.apiName) {307 if (result.apiName === 'android.content.pm.ComponentInfo') {308 return new ComponentInfo(result);309 } else {310 var ctor = require(result.apiName);311 return new ctor(result);312 }313 }314 return result;315};316/**317 * TODO Fill out docs more...318 * @function isEnabled319 * @memberof320 * @instance321 * @see {@link http://developer.android.com/reference/android/content/pm/ComponentInfo.html#isEnabled()}322 **/323ComponentInfo.prototype.isEnabled = function() {324 if (!this._hasPointer) return null;325 var result = this.$native.callNativeFunction({326 func: 'isEnabled',327 instanceMethod: true,328 args: Array.prototype.slice.call(arguments)329 });330 if (result == null) {331 return null;332 }333 // Wrap result if it's not a primitive type?334 if (result.apiName) {335 if (result.apiName === 'android.content.pm.ComponentInfo') {336 return new ComponentInfo(result);337 } else {338 var ctor = require(result.apiName);339 return new ctor(result);340 }341 }342 return result;343};344/**345 * TODO Fill out docs more...346 * @function getBannerResource347 * @memberof348 * @instance349 * @see {@link http://developer.android.com/reference/android/content/pm/ComponentInfo.html#getBannerResource()}350 **/351ComponentInfo.prototype.getBannerResource = function() {352 if (!this._hasPointer) return null;353 var result = this.$native.callNativeFunction({354 func: 'getBannerResource',355 instanceMethod: true,356 args: Array.prototype.slice.call(arguments)357 });358 if (result == null) {359 return null;360 }361 // Wrap result if it's not a primitive type?362 if (result.apiName) {363 if (result.apiName === 'android.content.pm.ComponentInfo') {364 return new ComponentInfo(result);365 } else {366 var ctor = require(result.apiName);367 return new ctor(result);368 }369 }370 return result;371};372/**373 * TODO Fill out docs more...374 * @function getIconResource375 * @memberof376 * @instance377 * @see {@link http://developer.android.com/reference/android/content/pm/ComponentInfo.html#getIconResource()}378 **/379ComponentInfo.prototype.getIconResource = function() {380 if (!this._hasPointer) return null;381 var result = this.$native.callNativeFunction({382 func: 'getIconResource',383 instanceMethod: true,384 args: Array.prototype.slice.call(arguments)385 });386 if (result == null) {387 return null;388 }389 // Wrap result if it's not a primitive type?390 if (result.apiName) {391 if (result.apiName === 'android.content.pm.ComponentInfo') {392 return new ComponentInfo(result);393 } else {394 var ctor = require(result.apiName);395 return new ctor(result);396 }397 }398 return result;399};400/**401 * TODO Fill out docs more...402 * @function writeToParcel403 * @memberof404 * @instance405 * @see {@link http://developer.android.com/reference/android/content/pm/ComponentInfo.html#writeToParcel(android.os.Parcel, int)}406 **/407ComponentInfo.prototype.writeToParcel = function() {408 if (!this._hasPointer) return null;409 var result = this.$native.callNativeFunction({410 func: 'writeToParcel',411 instanceMethod: true,412 args: Array.prototype.slice.call(arguments)413 });414 if (result == null) {415 return null;416 }417 // Wrap result if it's not a primitive type?418 if (result.apiName) {419 if (result.apiName === 'android.content.pm.ComponentInfo') {420 return new ComponentInfo(result);421 } else {422 var ctor = require(result.apiName);423 return new ctor(result);424 }425 }426 return result;427};428/**429 * TODO Fill out docs more...430 * @function dumpFront431 * @memberof432 * @instance433 * @see {@link http://developer.android.com/reference/android/content/pm/ComponentInfo.html#dumpFront(android.util.Printer, java.lang.String)}434 **/435ComponentInfo.prototype.dumpFront = function() {436 if (!this._hasPointer) return null;437 var result = this.$native.callNativeFunction({438 func: 'dumpFront',439 instanceMethod: true,440 args: Array.prototype.slice.call(arguments)441 });442 if (result == null) {443 return null;444 }445 // Wrap result if it's not a primitive type?446 if (result.apiName) {447 if (result.apiName === 'android.content.pm.ComponentInfo') {448 return new ComponentInfo(result);449 } else {450 var ctor = require(result.apiName);451 return new ctor(result);452 }453 }454 return result;455};456// export the class...
index.js
Source:index.js
1import './index.less'2import {3 getElementAxis,4 getElementWidthAndHeight,5 judgePointInScale,6 } from "@/utils/scale";7export default {8 data() {9 return {10 // width: 0,11 // height: 0,12 // x: 0,13 // y: 0,14 new_component: null,15 materialComponents_moveIn_workPlace:false,16 components_array:[],17 componentsElement:[],18 workPlaceAxis:[]19 }20 },21 components: {},22 props: {},23 watch: {},24 created() { },25 mounted() {26 this.workPlaceAxis = getElementAxis(document.querySelector('.work-place'))27 this.$event.on("place_components", this.receiveComponent);28 this.$event.on("materialComponents_moveIn_workPlace", this.componentsInWorkPlace);29 },30 beforeDestroy() {31 this.$event.$off("place_components", this.receiveComponent);32 this.$event.$off("materialComponents_moveIn_workPlace", this.componentsInWorkPlace);33 },34 methods: {35 receiveComponent(info) {36 // console.log(info) 37 this.materialComponents_moveIn_workPlace = false38 info.axis = this.rectityComponentAxis(info)39 this.components_array.push(info)40 this.createElements(this.components_array)41 },42 componentsInWorkPlace(state){43 this.materialComponents_moveIn_workPlace = state; 44 45 },46 onResize: function (x, y, width, height) {47 // this.x = x;48 // this.y = y;49 // this.width = width;50 // this.height = height;51 },52 onDrag: function (x, y) {53 // this.x = x;54 // this.y = y;55 // console.log(7777)56 },57 createElements(components_array){58 // console.log("components_array:",components_array)59 let element = []60 components_array.forEach((componentElement,index)=>{61 if(componentElement.type=='input'){62 const input_component = (63 <vue-draggable-resizable64 class="test-input"65 w={componentElement.width}66 h={componentElement.height}67 on-dragging={this.onDrag}68 on-resizing={this.onResize}69 parent={true} 70 x={componentElement.axis[0].x - this.workPlaceAxis[0].x}71 y={componentElement.axis[0].y - this.workPlaceAxis[0].y} >72 <el-input placeholder="请è¾å
¥å
容"></el-input>73 </vue-draggable-resizable>74 )75 element.push(input_component)76 }77 })78 this.componentsElement = [...element]79 },80 // è°æ´ç»ä»¶çåæ 81 rectityComponentAxis(componentInfo){82 // console.log(componentInfo)83 this.workPlaceAxis = getElementAxis(document.querySelector('.work-place'))84 85 let componentLeft = componentInfo.axis[0].x;86 let componentRight = componentInfo.axis[1].x;87 let componentTop = componentInfo.axis[0].y;88 let componentBottom = componentInfo.axis[3].y;89 let workPlaceLeft = this.workPlaceAxis[0].x;90 let workPlaceRight = this.workPlaceAxis[1].x;91 let workPlaceTop = this.workPlaceAxis[0].y;92 let workPlaceBottom = this.workPlaceAxis[3].y;93 let newAxis = [...componentInfo.axis]94 // I95 if(componentLeft < workPlaceLeft && componentRight > workPlaceLeft){96 // console.log("I")97 // console.log(componentBottom,workPlaceBottom)98 if(componentTop < workPlaceTop && componentBottom > workPlaceTop){99 // console.log(1)100 newAxis = [101 { 102 x: this.workPlaceAxis[0].x, 103 y: this.workPlaceAxis[0].y 104 },105 {106 x: this.workPlaceAxis[0].x + componentInfo.width,107 y: this.workPlaceAxis[0].y ,108 },109 {110 x: this.workPlaceAxis[0].x,111 y: this.workPlaceAxis[0].y + componentInfo.height,112 },113 {114 x: this.workPlaceAxis[0].x + componentInfo.width,115 y: this.workPlaceAxis[0].y + componentInfo.height,116 },117 ]118 return newAxis119 }120 if(componentTop > workPlaceTop && componentBottom < workPlaceBottom){121 //console.log(2)122 newAxis = [123 { 124 x: this.workPlaceAxis[0].x, 125 y: componentInfo.axis[0].y 126 },127 {128 x: this.workPlaceAxis[0].x + componentInfo.width,129 y: componentInfo.axis[1].y ,130 },131 {132 x: this.workPlaceAxis[0].x,133 y: componentInfo.axis[2].y ,134 },135 {136 x: this.workPlaceAxis[0].x + componentInfo.width,137 y: componentInfo.axis[3].y,138 },139 ]140 return newAxis141 }142 if(componentTop < componentBottom && componentBottom > workPlaceBottom){143 //console.log(3)144 newAxis = [145 { 146 x: this.workPlaceAxis[2].x, 147 y: this.workPlaceAxis[2].y - componentInfo.height148 },149 {150 x: this.workPlaceAxis[2].x + componentInfo.width,151 y: this.workPlaceAxis[2].y - componentInfo.height ,152 },153 {154 x: this.workPlaceAxis[2].x,155 y: this.workPlaceAxis[2].y,156 },157 {158 x: this.workPlaceAxis[2].x + componentInfo.width,159 y: this.workPlaceAxis[2].y,160 },161 ]162 return newAxis163 }164 }165 // II166 if(componentLeft > workPlaceLeft && componentRight < workPlaceRight){167 // console.log("II")168 if(componentTop < workPlaceTop && componentBottom > workPlaceTop){169 console.log(4)170 newAxis = [171 { 172 x: componentInfo.axis[0].x, 173 y: this.workPlaceAxis[0].y 174 },175 {176 x: componentInfo.axis[1].x + componentInfo.width,177 y: this.workPlaceAxis[0].y ,178 },179 {180 x: componentInfo.axis[1].x,181 y: this.workPlaceAxis[0].y + componentInfo.height,182 },183 {184 x: componentInfo.axis[1].x + componentInfo.width,185 y: this.workPlaceAxis[0].y + componentInfo.height,186 },187 ]188 return newAxis189 }190 if(componentTop > workPlaceTop && componentBottom < workPlaceBottom){191 //console.log(5)192 return newAxis193 }194 if(componentTop < componentBottom && componentBottom > workPlaceBottom){195 console.log(6)196 newAxis = [197 { 198 x: componentInfo.axis[0].x, 199 y: this.workPlaceAxis[2].y - componentInfo.height,200 },201 {202 x: componentInfo.axis[1].x + componentInfo.width,203 y: this.workPlaceAxis[2].y - componentInfo.height,204 },205 {206 x: componentInfo.axis[1].x,207 y: this.workPlaceAxis[2].y,208 },209 {210 x: componentInfo.axis[1].x + componentInfo.width,211 y: this.workPlaceAxis[2].y,212 },213 ]214 return newAxis215 }216 }217 // III218 if(componentLeft > workPlaceLeft && componentRight > workPlaceRight){219 // console.log("III")220 if(componentTop < workPlaceTop && componentBottom > workPlaceTop){221 //console.log(7)222 newAxis = [223 { 224 x: this.workPlaceAxis[1].x - componentInfo.width, 225 y: this.workPlaceAxis[1].y,226 },227 {228 x: componentInfo.axis[1].x,229 y: this.workPlaceAxis[1].y,230 },231 {232 x: this.workPlaceAxis[1].x - componentInfo.width,233 y: this.workPlaceAxis[1].y + componentInfo.height,234 },235 {236 x: componentInfo.axis[1].x,237 y: this.workPlaceAxis[1].y + componentInfo.height,238 },239 ]240 return newAxis241 }242 if(componentTop > workPlaceTop && componentBottom < workPlaceBottom){243 //console.log(8)244 newAxis = [245 { 246 x: this.workPlaceAxis[1].x - componentInfo.width, 247 y: componentInfo.axis[0].y,248 },249 {250 x: componentInfo.axis[1].x,251 y: componentInfo.axis[1].y,252 },253 {254 x: this.workPlaceAxis[1].x - componentInfo.width,255 y: componentInfo.axis[2].y,256 },257 {258 x: componentInfo.axis[1].x,259 y: componentInfo.axis[3].y,260 },261 ]262 return newAxis263 }264 if(componentTop < componentBottom && componentBottom > workPlaceBottom){265 //console.log(9)266 newAxis = [267 { 268 x: this.workPlaceAxis[1].x - componentInfo.width, 269 y: this.workPlaceAxis[3].y - componentInfo.height,270 },271 {272 x: componentInfo.axis[1].x,273 y: this.workPlaceAxis[3].y - componentInfo.height,274 },275 {276 x: this.workPlaceAxis[1].x - componentInfo.width,277 y: this.workPlaceAxis[3].y,278 },279 {280 x: componentInfo.axis[1].x,281 y: this.workPlaceAxis[3].y,282 },283 ]284 return newAxis285 }286 }287 return componentInfo.axis288 }289 },290 render() {291 return (292 <div class={'work-place',this.materialComponents_moveIn_workPlace&&'activeBackground'} >293 {this.componentsElement}294 </div >295 )296 }...
component.js
Source:component.js
1import React, {Component} from 'react';2import PropTypes from 'prop-types';3import _ from 'lodash';4import Link from 'gatsby-link';5import classnames from 'classnames';6import Slider from 'react-slick';7import 'slick-carousel/slick/slick.css';8import 'slick-carousel/slick/slick-theme.css';9import './components.scss';10import importantIcon from '../images/important.svg';11export default class ComponentTemplate extends Component {12 static propTypes = {13 pageContext: PropTypes.object14 };15 extractComponentsInfo(component) {16 const splitPattern = /([\s\S]*?):([\s\S]*)/; //eslint-disable-line17 const info = {18 description: _.get(component, 'description.text')19 };20 if (component.docblock) {21 const infoRaw = _.split(component.docblock, /(^@|\n@)/);22 _.forEach(infoRaw, statement => {23 const match = splitPattern.exec(statement);24 if (statement && match) {25 const key = match[1];26 info[key] = match[2];27 }28 });29 }30 return info;31 }32 renderLink(componentInfo) {33 const {pageContext} = this.props;34 const allComponents = pageContext.components;35 const extendedComponents = _.flow(36 text => _.replace(text, / /g, ''),37 text => _.split(text, ',')38 )(componentInfo.extends);39 return _.map(extendedComponents, (component, index) => {40 const isLast = index === _.size(extendedComponents) - 1;41 const text = `${component}${!isLast ? ', ' : ''}`;42 const extendedComponent = _.find(allComponents, c => c.node.displayName.trim() === component.trim());43 const path = !extendedComponent && componentInfo.extendsLink ? componentInfo.extendsLink : `/docs/${component}`;44 return (45 <span className="inline" key={component}>46 {extendedComponent && componentInfo.extendsLink ? (47 <a href={componentInfo.extendsLink} rel="noopener noreferrer" target="_blank">48 {text}49 </a>50 ) : (51 <Link to={path}>{text}</Link>52 )}53 {componentInfo.extendsnotes}54 <br />55 </span>56 );57 });58 }59 renderModifiers(componentInfo) {60 const modifiers = componentInfo.modifiers ? _.split(componentInfo.modifiers, ',') : [];61 if (!_.isEmpty(modifiers)) {62 return (63 <div className="modifiers">64 <span className="title">65 Supported <Link to="/foundation/modifiers">Modifiers</Link>66 <span className="tooltip">67 Quick useful props that help with styling your component. Read more at the link.68 {/* Read more about modifiers <Link to="/foundation/modifiers">here</Link>. */}69 </span>70 </span>71 <ul className="modifiers-list">72 {_.map(modifiers, modifier => (73 <li>{modifier}</li>74 ))}75 </ul>76 </div>77 );78 }79 }80 renderExtends(componentInfo, selectedComponent) {81 const extendLinks = this.renderLink(componentInfo);82 if (!_.isEmpty(extendLinks)) {83 return (84 <div className="extend-section">85 <span className="title">86 Extends87 <span className="tooltip">88 {selectedComponent.displayName} support passing these components' props as well.89 </span>90 </span>91 <ul>92 {_.map(extendLinks, link => (93 <li className="link" key={link}>94 {link}95 </li>96 ))}97 </ul>98 {/* {this.renderLink(componentInfo)} */}99 {/* <div>(meaning you can pass the super component's props as well).</div> */}100 </div>101 );102 }103 }104 renderImportant(componentInfo) {105 if (componentInfo.important) {106 return (107 <div alt={''} style={{marginBottom: 10}}>108 {componentInfo.important}109 {componentInfo.importantLink && (110 <a target="_blank" rel="noopener noreferrer" href={componentInfo.importantLink}>111 here112 </a>113 )}114 </div>115 );116 }117 }118 renderNotes(componentInfo) {119 const notes = componentInfo.notes ? componentInfo.notes.split(';') : undefined;120 const shouldRenderNotes = !_.isEmpty(notes) || componentInfo.important;121 if (shouldRenderNotes) {122 return (123 <div className="notes">124 <span className="title">125 <img src={importantIcon} alt="important" /> Important126 </span>127 {_.map(notes, (note, i) => (128 <div key={i}>{note}</div>129 ))}130 {this.renderImportant(componentInfo)}131 </div>132 );133 }134 }135 renderVisuals(componentInfo, forMobile) {136 const gifs = componentInfo.gif ? componentInfo.gif.split(',') : [];137 const imgs = componentInfo.image ? componentInfo.image.split(',') : [];138 const visuals = [...imgs, ...gifs];139 const useAutoPlay = imgs?.length > 0;140 if (!_.isEmpty(visuals)) {141 return (142 <div className={classnames('visuals', {mobile: forMobile})}>143 {forMobile ? <h3>Showcase</h3> : <div className="list-header">Showcase</div>}144 <div className="carousel">145 <Slider arrows dots infinite autoplay={useAutoPlay}>146 {_.map(visuals, (image, i) => {147 return <img key={i} alt={''} src={image} />;148 })}149 </Slider>150 </div>151 </div>152 );153 }154 }155 renderSidebar(componentInfo, componentProps) {156 return (157 <div className="sidebar">158 {this.renderVisuals(componentInfo)}159 <TableOfContent props={componentProps} />160 </div>161 );162 }163 renderComponentPage() {164 const {pageContext} = this.props;165 const href = this.props?.location?.href;166 const selectedComponent = pageContext.componentNode;167 const componentInfo = this.extractComponentsInfo(selectedComponent);168 const componentProps = _.orderBy(_.get(selectedComponent, 'props'), prop => prop.name.toLowerCase());169 const examples = _.split(componentInfo.example, ',');170 const shouldRenderRightPart = componentInfo.modifiers || componentInfo.extends;171 return (172 <div className="docs-page">173 <div className="docs-page__content">174 {this.renderSidebar(componentInfo, componentProps)}175 <div className="component-header">176 <div>177 <h2 className="title inline">{selectedComponent.displayName}</h2>178 {_.map(examples, example => {179 return (180 <span key={example} className="code-example">181 (182 <a className="inline" target="_blank" rel="noopener noreferrer" href={example}>183 code example184 </a>185 )186 </span>187 );188 })}189 <p className="description">{componentInfo.description}</p>190 </div>191 {shouldRenderRightPart && (192 <div>193 {this.renderModifiers(componentInfo)}194 {this.renderExtends(componentInfo, selectedComponent)}195 </div>196 )}197 </div>198 {this.renderNotes(componentInfo)}199 {this.renderVisuals(componentInfo, true)}200 <ComponentAPI props={componentProps} href={href} />201 </div>202 </div>203 );204 }205 render() {206 const isIntro = !_.get(this.props, 'pageContext.componentNode');207 return (208 <div style={{width: '100%'}}>209 {isIntro && (210 <div className="docs-page">211 <div className="docs-page__content">212 <div>Select a component from the left sidebar</div>213 </div>214 </div>215 )}216 {!isIntro && this.renderComponentPage()}217 </div>218 );219 }220}221const ComponentAPI = ({props, href = ''}) => {222 return (223 <div className="component-api">224 <h3>API</h3>225 {_.map(props, prop => {226 const description = _.get(prop, 'description.text');227 const defaultValue = _.get(prop, 'defaultValue.value');228 const isFocused = _.includes(href, `#${prop.name}`);229 const titleClassname = classnames('title', {focused: isFocused});230 return (231 <div key={prop.name} className="prop-info">232 <a name={prop.name}>233 <h5 className={titleClassname}>{prop.name}</h5>234 </a>235 <p className="description default-size">{description}</p>236 <p className="type">{_.get(prop, 'type.name')}</p>237 {defaultValue && <p className="default-value">default: {_.get(prop, 'defaultValue.value')}</p>}238 </div>239 );240 })}241 </div>242 );243};244const TableOfContent = ({props}) => {245 return (246 <div className="table-of-content">247 <ul>248 <div className="list-header">Props</div>249 {_.map(props, prop => {250 return (251 <li key={prop.name}>252 <a href={`#${prop.name}`}>{prop.name}</a>253 </li>254 );255 })}256 </ul>257 </div>258 );...
main.js
Source:main.js
1// 代ç å¯å¨è¿ç¨2const { readDir, isTsOrJs } = require('./util/handler_file');3const { getCodeTreeByfile, getInterFaceAllByFile, getComponentAllByFile } = require('./util/babel_util');4const { mdToHtml, mdToVueHtml, getComponentMDByInfo, getInterFaceMdStr } = require('./util/marked_html')5const { generateMDTable } = require('./util/marked_html')6const { gettocRouterLink } = require('./util/vue_html');7const fs = require('fs-extra');8const path = require('path')9const chalk = require('chalk');10const logSymbols = require('log-symbols');11const ora = require('ora');12function getPath(str) {13 return path.resolve(__dirname, '../', str);14}15function generateMain(fileDirPath) {16 const timeHeader = new Date().getTime();17 fs.ensureDirSync(getPath(`./app${timeHeader}`))18 fs.copySync(getPath('app'), getPath(`./app${timeHeader}`))19 const files = readDir(fileDirPath)20 let interFaceAllArr = []21 let componentAllArr = []22 let spinnerStart = ora(`æ£ç´¢æ件ä¸...`).start();23 files.forEach(file => {24 if (isTsOrJs(file)) {25 const codeTree = getCodeTreeByfile(file);26 const fileName = file.split('\\')[file.split('\\').length - 1].split('.')[0];27 // 解ææ¥å£æ°æ®28 const interFaceAll = getInterFaceAllByFile(codeTree, file);29 interFaceAllArr = [...interFaceAllArr, ...interFaceAll]30 // 解æç»ä»¶æ°æ®31 const componentInfo = getComponentAllByFile(codeTree, file);32 componentInfo.key = fileName;33 if (componentInfo.dec && componentInfo.dec.title && componentInfo.dec.type) {34 spinnerStart.succeed(`æ£ç´¢å°${fileName}`)35 const spinner = ora(`æ£å¨è§£æ${fileName}...`).start();36 if (componentInfo.inputArr.length > 0) {37 componentInfo.inputMarkTable = generateMDTable(['å±æ§å¼', 'æè¿°', 'ç±»å', 'é»è®¤å¼'], componentInfo.inputArr, ['key', 'dec', ['type', 'interfaceTypesLink'], 'default'])38 }39 if (componentInfo.outputArr.length > 0) {40 componentInfo.outputMarkTable = generateMDTable(['å±æ§å¼', 'æè¿°', 'ç±»å'], componentInfo.outputArr, ['key', 'dec', 'type'])41 }42 const componentDecMDA = path.resolve(path.dirname(file), `${fileName}.component.md`);43 const componentDecMDB = path.resolve(path.dirname(file), `${fileName}.md`);44 const readmeDecMD = path.resolve(path.dirname(file), `readme.md`);45 componentInfo.componentDecMD = ''46 if (fs.existsSync(componentDecMDA)) {47 componentInfo.componentDecMD = componentInfo.componentDecMD + fs.readFileSync(componentDecMDA).toString() + '\n'48 }49 if (fs.existsSync(componentDecMDB)) {50 componentInfo.componentDecMD = componentInfo.componentDecMD + fs.readFileSync(componentDecMDB).toString() + '\n'51 }52 if (fs.existsSync(readmeDecMD)) {53 componentInfo.componentDecMD = componentInfo.componentDecMD + fs.readFileSync(readmeDecMD).toString() + '\n'54 }55 const mdFileContent = getComponentMDByInfo(componentInfo);56 fs.ensureFileSync(getPath(`./app${timeHeader}/dist_json/${fileName}.json`))57 fs.writeFileSync(getPath(`./app${timeHeader}/dist_json/${fileName}.json`), JSON.stringify(codeTree))58 fs.ensureFileSync(getPath(`./app${timeHeader}/dist_markdown/${fileName}.md`))59 fs.writeFileSync(getPath(`./app${timeHeader}/dist_markdown/${fileName}.md`), mdFileContent)60 fs.ensureFileSync(getPath(`./app${timeHeader}/dist_html/${fileName}.html`))61 fs.writeFileSync(getPath(`./app${timeHeader}/dist_html/${fileName}.html`), mdToHtml(mdFileContent))62 componentInfo.markdown = mdFileContent63 componentInfo.vuehtml = mdToVueHtml(mdFileContent)64 componentAllArr.push(componentInfo)65 spinner.succeed(`${fileName}解ææå`);66 spinnerStart = ora(`æ£ç´¢æ件ä¸...`).start();67 }68 }69 })70 spinnerStart.succeed(`æ£ç´¢å°å®æ`)71 // æ¥å£çmdï¼ html72 const spinner1 = ora(`æ£å¨è§£ææ¥å£æ°æ®æ¨¡å解æ...`).start();73 const interFaceMd = getInterFaceMdStr(interFaceAllArr);74 fs.ensureFileSync(getPath(`./app${timeHeader}/dist_json/interface.json`))75 fs.writeFileSync(getPath(`./app${timeHeader}/dist_json/interface.json`), JSON.stringify(interFaceAllArr))76 fs.ensureFileSync(getPath(`./app${timeHeader}/dist_markdown/interface.md`))77 fs.writeFileSync(getPath(`./app${timeHeader}/dist_markdown/interface.md`), interFaceMd)78 fs.ensureFileSync(getPath(`./app${timeHeader}/dist_html/interface.html`))79 fs.writeFileSync(getPath(`./app${timeHeader}/dist_html/interface.html`), mdToHtml(interFaceMd))80 spinner1.succeed(`æ¥å£æ°æ®æ¨¡å解ææå`);81 // 项ç®æ
åµä¿¡æ¯82 const spinner2 = ora(`æ£å¨çæç¼è¯æ件...`).start();83 fs.ensureFileSync(getPath(`./README.md`));84 const currentReadmeMd = fs.readFileSync(getPath(`./README.md`)).toString();85 fs.ensureFileSync(`./README.md`);86 const projectReadmeMd = fs.readFileSync(`./README.md`).toString();87 const nvaContet = [88 {89 dec: {90 type: 'interface',91 title: 'æ°æ®æ¨¡å'92 },93 vuehtml: mdToVueHtml(interFaceMd),94 markdown: interFaceMd,95 key: 'component-interface'96 },97 ...componentAllArr,98 {99 dec: {100 type: '项ç®æ»è§',101 title: 'å·¥å
·ææ¡£ä»ç»'102 },103 vuehtml: mdToVueHtml(currentReadmeMd),104 markdown: currentReadmeMd,105 key: '_dfb-ng-component'106 },107 {108 dec: {109 type: '项ç®æ»è§',110 title: '项ç®ææ¡£ä»ç»'111 },112 vuehtml: mdToVueHtml(projectReadmeMd),113 markdown: projectReadmeMd,114 key: '_project-readme'115 },116 ]117 const { appComponent, componentData } = gettocRouterLink(nvaContet);118 fs.ensureFileSync(getPath(`./app${timeHeader}/dist_json/interface.json`))119 fs.writeFileSync(getPath(`./app${timeHeader}/dist_json/component.json`), JSON.stringify(componentAllArr))120 fs.ensureFileSync(getPath(`./app${timeHeader}/vue/data/appcomponent.data.js`))121 fs.writeFileSync(getPath(`./app${timeHeader}/vue/data/appcomponent.data.js`), appComponent)122 fs.ensureFileSync(getPath(`./app${timeHeader}/vue/data/componentdata.js`))123 fs.writeFileSync(getPath(`./app${timeHeader}/vue/data/componentdata.js`), componentData)124 // å¨å½åæ§è¡ç®å½ä¸çæç¼è¯æ件125 fs.emptyDirSync('./dfb_dist')126 fs.copySync(getPath(`./app${timeHeader}`), './dfb_dist')127 fs.removeSync(getPath(`./app${timeHeader}`))128 spinner2.succeed(`çæç¼è¯æ件æå`);129}130const testPath = 'C:/F_code/work/CxCloud/cxcloud-app/cxcloud-portal-webapp/src'131generateMain(testPath)132module.exports = {133 generateMain...
BaseComponentFactory.js
Source:BaseComponentFactory.js
1Ext.define('WebSystemsBuilder.utils.controlTypes.BaseComponentFactory', {2 extend: 'WebSystemsBuilder.utils.operands.BaseControlHandler',3 alternateClassName: ['BaseComponentFactory'],4 requires: [5 'WebSystemsBuilder.utils.mapping.EventTypes',6 'WebSystemsBuilder.utils.mapping.ValueTypes'7 ],8 focusEvent: 'focus',9 isDocked: false,10 isColumn: false,1112 addComponent: function (win, parentComponent, componentInfo) {13 var component = this.get(win, parentComponent, componentInfo);1415 if (this.isDocked) {16 parentComponent.addDocked(component);17 } else if (this.isColumn) {18 parentComponent.headerCt.insert(parentComponent.columns.length, component);19 parentComponent.getView().refresh();20 } else {21 parentComponent.add(component);22 }2324 Ext.Component.updateLayout(component);25 Ext.Component.updateLayout(parentComponent);2627 if (componentInfo.EventTypesList) {28 componentInfo.EventTypesList.forEach(function(currentEventType) {29 var event = {30 Event: {31 EventID: null,32 EventTypeControlTypeID: currentEventType.EventTypeControlType.EventTypeControlTypeID,33 ControlID: componentInfo.ControlID,34 EventUniqueID: RandomIDE.get(),35 ControlUniqueID: component.uniqueID36 },37 EventType: currentEventType.EventType,38 EventTypeControlType: currentEventType.EventTypeControlType,39 EventActions: []40 };41 EventsIDE.addEvent(event);42 });43 }4445 win.fireEvent('ComponentAdded', win, parentComponent, component);46 return component;47 },4849 get: function (win, parentComponent, componentInfo) {50 var _this = this;51 var body = parentComponent.body || parentComponent;52 var form = win.down('form[name=mainPanel]');53 var propertiesGrid = win.down('propertygrid[name=properties]');5455 var component = _this.createComponent();5657 component.uniqueID = componentInfo.uniqueID ? componentInfo.uniqueID : RandomIDE.get();58 componentInfo.uniqueID = component.uniqueID;59 component.ControlID = componentInfo.ControlID;60 component.OperandID = componentInfo.OperandID;61 component.name = 'sencha' + componentInfo.Name.toLowerCase() + component.uniqueID;62 component.dataIndex = component.name;63 component.componentInfo = componentInfo;64 component.focusable = true;65 component.tabIndex = -1;6667 component.on('afterrender', function (currentComponent) {68 var mouseEventsEl = _this.getMouseEventsElement(currentComponent);69 mouseEventsEl.on('mouseover', function () {70 MousedComponentsIDE.pushMousedComponent(currentComponent);71 });72 mouseEventsEl.on('mouseout', function () {73 MousedComponentsIDE.popMousedComponent(currentComponent);74 });75 var focusEventElement = _this.getFocusEventElement(component);76 focusEventElement.on(_this.focusEvent, function (item, event, eOpts) {77 win.fireEvent('IDEComponentFocused', win, component);78 });79 });8081 component.on('resize', function (item, width, height, eOpts) {82 item.componentInfo.Properties['width'] = width;83 item.componentInfo.Properties['height'] = height;84 var focusedCmp = Focused.getFocusedCmp();85 if (focusedCmp && focusedCmp.name == item.name) {86 propertiesGrid.setSource(item.componentInfo.Properties);87 }88 });8990 component.on('render', function (item) {91 _this.onRender(win, item);92 });9394 return component;95 },9697 onRender: function (win, component) {98 ComponentFactoryUtils.afterFirstLayout(win, component);99 },100101 onRemoveComponent: function (parentComponent, component) {102 parentComponent.remove(component, true);103 },104105 createComponent: function () {106 return null;107 },108109 getFocusEventElement: function (currentComponent) {110 return currentComponent;111 },112113 getMouseEventsElement: function (currentComponent) {114 if (currentComponent.body) return currentComponent.body;115 if (currentComponent.el) return currentComponent.el;116 return currentComponent;117 }
...
analysis.js
Source:analysis.js
1/**2* analysis.js3*/4'use strict';5var _ = require('lodash');6// Private functions7var componentList = {};8var addComponent = function (filename, componentInfo) {9 componentList[componentInfo.name] = componentInfo;10 componentList[componentInfo.name].filename = filename;11 componentList[componentInfo.name].dependencies = _.compact(_.map(componentInfo.dependencies.split(','), function (dep) {12 return dep.trim();13 }));14 delete componentInfo.undefined;15 return componentList[componentInfo.name];16};17var sortComponentList = function () {18 return _.sortBy(componentList, ['module', 'name']);19};20// http://stackoverflow.com/questions/4009756/how-to-count-string-occurrence-in-string21var countStringOccurrences = function occurrences(string, subString, allowOverlapping) {22 string += "";23 subString += "";24 if (subString.length <= 0) return (string.length + 1);25 var n = 0,26 pos = 0,27 step = allowOverlapping ? 1 : subString.length;28 while (true) {29 pos = string.indexOf(subString, pos);30 if (pos >= 0) {31 ++n;32 pos += step;33 } else break;34 }35 return n;36};37var reportExternalModules = function (compList) {38 console.log('\n----- REPORT: EXTERNAL MODULES -----\n');39 _.forEach(compList, function (componentInfo, key) {40 let hasOutsideDependency = false;41 let depList = '';42 _.forEach(componentInfo.dependencies, function (dep) {43 let depModule = _.get(componentList, dep + '.module');44 if (depModule && depModule !== componentInfo.module) {45 hasOutsideDependency = true;46 depList += ` external module: ${dep} (${depModule}) from ${componentInfo.module}\n`;47 }48 });49 if (hasOutsideDependency) {50 console.log('%s: %s (dependencies: %d)', componentInfo.module, componentInfo.name, componentInfo.dependencies.length);51 console.log(depList);52 }53 });54};55var analyzeDependencyOccurrence = function (componentInfo, str) {56 componentInfo.dependenciesCount = {};57 _.forEach(componentInfo.dependencies, function (dep) {58 componentInfo.dependenciesCount[dep] = countStringOccurrences(str, dep);59 });60 return componentInfo;61};62var reportUnusedDependencies = function (compList) {63 console.log('\n----- REPORT: UNUSED DEPENDENCIES -----\n');64 _.forEach(compList, function (componentInfo, key) {65 let hasUnusedDependency = false;66 let depList = '';67 _.forEach(componentInfo.dependenciesCount, function (depCount, depName) {68 if (depCount < 2) {69 hasUnusedDependency = true;70 depList += ` unused dependency: ${depName}\n`;71 }72 });73 if (hasUnusedDependency) {74 console.log('%s: %s (dependencies: %d)', componentInfo.module, componentInfo.name, componentInfo.dependencies.length);75 console.log(depList);76 }77 });78};79var reportModuleFileLocations = function (compList) {80 console.log('\n----- REPORT: MODULE FILE LOCATIONS -----\n');81 _.forEach(compList, function (componentInfo, key) {82 var moduleDerivedByLocation = getModuleNameFromFilename(componentInfo.filename);83 //console.log(componentInfo.name, componentInfo.module, getModuleNameFromFilename(componentInfo.filename));84 if (componentInfo.module !== moduleDerivedByLocation) {85 console.log('Wrong module: %s: is %s, should be %s\n', componentInfo.name, componentInfo.module, moduleDerivedByLocation);86 }87 });88};89var getModuleNameFromFilename = function (filename) {90 var parts = filename.split('/');91 var moduleName = 'weld';92 for (var i = 0; i < parts.length - 2; i++) {93 moduleName += '.' + parts[i];94 }95 return moduleName;96};97// Public API98module.exports = {99 analyze: function (filename, str) {100 // https://regex101.com/r/WJIQLE/2101 const regex = /angular\.module\('(.*)'\)\.(.*)\('(.*)',\s?function\s?\((.*)\)\s?\{/g;102 let m;103 while ((m = regex.exec(str)) !== null) {104 // This is necessary to avoid infinite loops with zero-width matches105 if (m.index === regex.lastIndex) {106 regex.lastIndex++;107 }108 // The result can be accessed through the `m`-variable.109 let variableMapping = {110 1: 'module',111 2: 'type',112 3: 'name',113 4: 'dependencies',114 }115 let componentInfo = {};116 m.forEach((match, groupIndex) => {117 componentInfo[variableMapping[groupIndex]] = match;118 //console.log(groupIndex, componentInfo);119 if (groupIndex === 4) {120 let comp = addComponent(filename, componentInfo);121 analyzeDependencyOccurrence(comp, str);122 }123 });124 }125 },126 report: function (options) {127 var sortedComps = sortComponentList();128 reportUnusedDependencies(sortedComps);129 reportExternalModules(sortedComps);130 reportModuleFileLocations(sortedComps);131 },...
component-dialog.controller.js
Source:component-dialog.controller.js
1/*2 * Copyright © 2016-2017 The Thingsboard Authors3 *4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 *8 * http://www.apache.org/licenses/LICENSE-2.09 *10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16/*@ngInject*/17export default function ComponentDialogController($mdDialog, $q, $scope, componentDescriptorService, types, utils, helpLinks, isAdd, isReadOnly, componentInfo) {18 var vm = this;19 vm.isReadOnly = isReadOnly;20 vm.isAdd = isAdd;21 vm.componentInfo = componentInfo;22 if (isAdd) {23 vm.componentInfo.component = {};24 }25 vm.componentHasSchema = false;26 vm.componentDescriptors = [];27 if (vm.componentInfo.component && !vm.componentInfo.component.configuration) {28 vm.componentInfo.component.configuration = {};29 }30 vm.helpLinkIdForComponent = helpLinkIdForComponent;31 vm.save = save;32 vm.cancel = cancel;33 $scope.$watch("vm.componentInfo.component.clazz", function (newValue, prevValue) {34 if (newValue != prevValue) {35 if (newValue && prevValue) {36 vm.componentInfo.component.configuration = {};37 }38 loadComponentDescriptor();39 }40 });41 var componentDescriptorsPromise =42 vm.componentInfo.type === types.componentType.action43 ? componentDescriptorService.getPluginActionsByPluginClazz(vm.componentInfo.pluginClazz)44 : componentDescriptorService.getComponentDescriptorsByType(vm.componentInfo.type);45 componentDescriptorsPromise.then(46 function success(componentDescriptors) {47 vm.componentDescriptors = componentDescriptors;48 if (vm.componentDescriptors.length === 1 && isAdd && !vm.componentInfo.component.clazz) {49 vm.componentInfo.component.clazz = vm.componentDescriptors[0].clazz;50 }51 },52 function fail() {53 }54 );55 loadComponentDescriptor();56 function loadComponentDescriptor () {57 if (vm.componentInfo.component.clazz) {58 componentDescriptorService.getComponentDescriptorByClazz(vm.componentInfo.component.clazz).then(59 function success(componentDescriptor) {60 vm.componentDescriptor = componentDescriptor;61 vm.componentHasSchema = utils.isDescriptorSchemaNotEmpty(vm.componentDescriptor.configurationDescriptor);62 },63 function fail() {64 }65 );66 } else {67 vm.componentHasSchema = false;68 }69 }70 function helpLinkIdForComponent() {71 switch (vm.componentInfo.type) {72 case types.componentType.filter: {73 return helpLinks.getFilterLink(vm.componentInfo.component);74 }75 case types.componentType.processor: {76 return helpLinks.getProcessorLink(vm.componentInfo.component);77 }78 case types.componentType.action: {79 return helpLinks.getPluginActionLink(vm.componentInfo.component);80 }81 }82 }83 function cancel () {84 $mdDialog.cancel();85 }86 function save () {87 $mdDialog.hide(vm.componentInfo.component);88 }...
ActionHandler.js
Source:ActionHandler.js
1Ext.define('WebSystemsBuilder.model.IDE.event.ActionHandler', {2 extend: 'Ext.data.Model',3 fields: []4});56Ext.define('WebSystemsBuilder.model.IDE.event.Handler', {7 extend: 'Ext.data.Model',8 fields: [9 'ID',10 'name',11 'actionKindID'12 ]13});1415Ext.define('WebSystemsBuilder.model.IDE.event.HandlerParams', {16 extend: 'Ext.data.Model',17 fields: [18 'ID',19 'name',20 'value',21 'actionTypeID',22 'domainValueTypeID',23 'controlName'24 ]25});2627Ext.define('WebSystemsBuilder.model.IDE.event.Control', {28 extend: 'Ext.data.Model',29 fields: [30 'componentInfo' ,31 {32 name: 'Name',33 convert: function (v, record) {34 var componentInfo = record.get('componentInfo');35 if (!componentInfo) return null;36 return componentInfo.Name + '[id=' + componentInfo.uniqueID + ']';37 }38 },39 {40 name: 'UniqueID',41 convert: function (v, record) {42 var componentInfo = record.get('componentInfo');43 if (!componentInfo) return null;44 return componentInfo.uniqueID;45 }46 }47 ]48});4950Ext.define('WebSystemsBuilder.model.IDE.event.FormParameter', {51 extend: 'Ext.data.Model',52 fields: [53 'formParameter' ,54 {55 name: 'Name',56 convert: function (v, record) {57 var formParameter = record.get('formParameter');58 if (!formParameter) return null;59 return formParameter.FormParameter.Name;60 }61 },62 {63 name: 'UniqueID',64 convert: function (v, record) {65 var formParameter = record.get('formParameter');66 if (!formParameter) return null;67 return formParameter.FormParameter.UniqueID;68 }69 },70 'Value'71 ]72});7374Ext.define('WebSystemsBuilder.model.IDE.event.ClientActionType', {75 extend: 'Ext.data.Model',76 fields: [77 'ClientActionTypeID',78 'Name'79 ]
...
Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch({ headless: false });4 const context = await browser.newContext();5 const page = await context.newPage();6 const componentInfo = await page.evaluate(() => {7 return window.playwright.internal.componentInfo();8 });9 console.log(componentInfo);10 await browser.close();11})();12{ '0': { name: 'Chromium', version: '91.0.4472.0' } }
Using AI Code Generation
1const {chromium} = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 const element = await page.$('body');7 const info = await element.componentInfo();8 console.log(info);9 await browser.close();10})();11{12 attributes: {13 },14}
Using AI Code Generation
1const { chromium } = require('playwright');2const { componentInfo } = require('playwright/lib/internal');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 const info = componentInfo(page);8 console.log(info);9 await browser.close();10})();11{ browser: { type: 'chromium', version: '80.0.3987.0' },12 context: { type: 'default' },13 page: { type: 'page' } }14const { chromium } = require('playwright');15const { componentInfo } = require('playwright/lib/internal');16(async () => {17 const browser = await chromium.launch();18 const context = await browser.newContext();19 const page = await context.newPage();20 const info = componentInfo(page);21 console.log(info.type);22 await browser.close();23})();24const { chromium } = require('playwright');25const { componentInfo } = require('playwright/lib/internal');26(async () => {27 const browser = await chromium.launch();28 const context = await browser.newContext();29 const page = await context.newPage();30 const info = componentInfo(page);31 console.log(info.version);32 await browser.close();33})();34const { chromium } = require('playwright');35const { componentInfo } = require('playwright/lib/internal');36(async () => {37 const browser = await chromium.launch();38 const context = await browser.newContext();39 const page = await context.newPage();40 await page.goto('https
Using AI Code Generation
1const {chromium} = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const page = await browser.newPage();5 const componentInfo = await page._componentInfo();6 console.log(componentInfo);7 await browser.close();8})();9{ componentInfo: { '
Using AI Code Generation
1const { componentInfo } = require('@playwright/test/lib/server/browserContext');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 await page.click('text=Get started');8 await page.waitForLoadState();9 const componentInfoObject = await componentInfo(page, 'text=Get started');10 console.log(componentInfoObject);11 await browser.close();12})();13{14 'attributes': {15 'data-analytics': '{"name":"getstarted"}',16 },17}18const componentInfoObject = await componentInfo(page, 'text=Show');19console.log(componentInfoObject);20{21 'attributes': {
Using AI Code Generation
1const {chromium} = require('playwright');2const browser = await chromium.launch();3const context = await browser.newContext();4const page = await context.newPage();5const {componentInfo} = require('playwright/lib/server/chromium/crBrowser');6const crPage = page._delegate;7const crBrowser = crPage.browser();8const crBrowserContext = crPage.browserContext();9const crTarget = crPage.target();10const crSession = crPage.mainFrame()._client;11const crBrowserInfo = componentInfo(crBrowser);12const crBrowserContextInfo = componentInfo(crBrowserContext);13const crTargetInfo = componentInfo(crTarget);14const crSessionInfo = componentInfo(crSession);15console.log(crBrowserInfo, crBrowserContextInfo, crTargetInfo, crSessionInfo);16{ name: 'Browser', id: 3 } { name: 'BrowserContext', id: 4 } { name: 'Target', id: 5 } { name: 'CDPSession', id: 6 }17const {chromium} = require('playwright');18const browser = await chromium.launch();19const context = await browser.newContext();20const page = await context.newPage();21const {componentInfo} = require('playwright/lib/server/chromium/crBrowser');22const crPage = page._delegate;23const crBrowser = crPage.browser();24const crBrowserContext = crPage.browserContext();25const crTarget = crPage.target();26const crSession = crPage.mainFrame()._client;27const crBrowserInfo = componentInfo(crBrowser);28const crBrowserContextInfo = componentInfo(crBrowserContext);29const crTargetInfo = componentInfo(crTarget);30const crSessionInfo = componentInfo(crSession);31console.log(crBrowserInfo, crBrowserContextInfo, crTargetInfo, crSessionInfo);32{ name: 'Browser', id: 3 } { name: 'BrowserContext', id: 4 } { name: 'Target', id: 5 } { name: 'CDPSession', id: 6 }33const {chromium} = require('playwright');34const browser = await chromium.launch();35const context = await browser.newContext();36const page = await context.newPage();37const {componentInfo} = require('play
Using AI Code Generation
1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 const componentInfo = await page._client.send('Playwright.getComponentInfo', {7 });8 console.log(componentInfo);9 await browser.close();10})();11{12 attributes: {
Using AI Code Generation
1const { componentInfo } = require('playwright/lib/server/frames');2const frame = page.mainFrame();3const info = await componentInfo(frame, 'button');4console.log(info);5{ name: 'button',6 invalid: false }7const { componentInfo } = require('playwright/lib/server/frames');8const frame = page.mainFrame();9const button = await frame.$('button');10const info = await componentInfo(frame, button);11console.log(info);12{ name: 'button',13 invalid: false }14const { componentInfo } = require('playwright/lib/server/frames');15const frame = page.mainFrame();16const info = await componentInfo(frame);17console.log(info);18{ name: 'html',19 invalid: false }
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!