代码拉取完成,页面将自动刷新
一个基于cimcube.js的组件库
CIMCUBE Web-components是CIM平台前端通用组件库,依赖于广联达CIMCUBE引擎,实现对引擎功能的组件化封装,为CIM平台搭建提供开箱即用的开发体验。CIMCUBE Web-components包含普通UI组件、引擎基础组件和引擎高级组件三个部分,用户可根据实际需求选用部分或全部组件快速搭建基于广联达CIMCUBE引擎的CIM应用。
编译之前您需先确保环境中已安装node.js 16及以上版本,npm 2.5.3及以上版本
在vs code中打开项目并执行 npm run build
,项目将开始构建,构建完成后将在dist
中生成components.js
和components.css
两个主要文件及其他文件,您可以在CIM前端应用中引入这两个文件便可使用该组件库。
<link rel="stylesheet" href="components.css" type="text/css">
<script src="components.js"></script>
在开发环境中,如您想查看示例demo或基于组件库开发属于自己的组件,需要在config
目录下的CIMCUBEConfig.js
中配置属于您的广联达CIMCUBE引擎地址,否则示例demo可能不生效。
Windows、macOS、Linux
const mockData = [{
name: 'root',
props1: 'root1',
children: [{
name: 'level one 1',
props1: '1111',
children: [{
name: 'level two 1-1',
props1: 'eeee',
children: [{
name: 'level three 1-1-1',
props1: 'eeee',
children: [{
name: 'level four 1-1-1-1',
props1: 'eeee',
}]
}]
}, {
name: 'level two 1-2',
props1: 'eeee'
}]
}, {
name: 'level one 2',
props1: '2222',
children: [{
name: 'level two 2-1',
props1: 'eeee'
}, {
name: 'level two 2-2',
props1: 'eeee'
}]
}, {
name: 'level one 3',
props1: '3333',
children: [{
name: 'level two 3-1',
props1: 'eeee'
}, {
name: 'level two 3-2',
props1: 'eeee'
}]
}]
}]
const { CIM_SDKManager = null, CIM_UIManager, CIM_WIDGET_ID } = window.Glodon.CIMCube.Components
const uiManager = new CIM_UIManager()
const properties = {
data: mockData,
key: 'name',
label: 'name',
parentId: 'container',
defaultExpandKeys: ['root', 'level one 1', 'level one 3'], // 设置lazy后不生效
defaultCheckedKeys:['level one 1', 'level one 2'], // 设置lazy后不生效
lazy: false,
showCheckbox: true,
className: 'custom-tree',
icon: (data) => {
if (data.name === 'root') {
return 'cim-yuanshujuguanli'
} else {
return 'cim-wenjian'
}
},
disabled: (data) => {
return false
},
nodeExpand: function(data, evt) {
console.log('props node expand', data, evt)
},
nodeCollapse: function(data, evt) {
console.log('props node collapse', data, evt)
},
nodeClick: (data, evt) => {
console.log('props node click', data, evt)
},
nodeCheck: (checkStatus, data, checkNodes) => {
console.log('props node check', checkStatus, data, checkNodes)
},
filterNodeMethod: (data) => {
return true
}
}
const tree = uiManager.loadComponent(CIM_WIDGET_ID.CIM_TREE, properties)
const { CIM_SDKManager = null, CIM_UIManager, CIM_WIDGET_ID } = window.Glodon.CIMCube.Components
const map = await CIM_SDKManager.initMap('map-container') // map-container是地图容器ID
const uiManager = new CIM_UIManager(map)
const properties = { parentId: 'toolbar' }
let zoomInCom = uiManager.loadComponent(CIM_WIDGET_ID.CIM_ZOOM_IN, properties)
let zoomOutCom = uiManager.loadComponent(CIM_WIDGET_ID.CIM_ZOOM_OUT, properties)
uiManager.loadComponent(CIM_WIDGET_ID.CIM_MODE_SWITCH, properties)
const { CIM_SDKManager = null, CIM_UIManager, CIM_WIDGET_ID } = window.Glodon.CIMCube.Components
const map = await CIM_SDKManager.initMap('map-container')
const uiManager = new CIM_UIManager(map)
const properties = { parentId: 'icon-switch-toolbar' }
uiManager.loadComponent(CIM_WIDGET_ID.CIM_GLOBAL_SWITCH_PANEL, {
terrain: {
active: true
},
sunlight: {
active: true,
},
fog: {
params: {
darkness: 0.3,
lightAttenuation: 1,
visualDistance: 5000
}
},
change: (name, active) => {
console.log('switch change', name, active)
},
beforeClose: () => {
console.log('close panel')
}
})
}
其他组件的使用方法参照test
目录下的示例
如您在使用中有任何问题可联系广联达CIM平台:heart:感谢您提供的建议:pray:
MIT 许可证,详细信息请查阅LICENSE
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。