Sidebar-Plant.js 4.41 KB

(function () {
	// Adds Atlassian shapes
	// plant label
	Sidebar.prototype.addPlantPalette = function () {
		const { COMPONENT_TYPE } = this.enumCellBasicAttribute
		const { DEFAULT } = this.enumComponentType
		const gn = 'mxgraph.plant';
		const dt = 'plant';
		const label = '植物'
		const width = 66;
		const height = 74;
		const staticPath = `${Proxy_Prefix}/img/lib/thingskit/`
		const prefix = 'image;image=img/lib/thingskit/'
		const defaultStyle = ';imageAspect=0;'
		this.setCurrentSearchEntryLibrary(dt);

		// 自定义属性
		const cellAttribute = {
			[ COMPONENT_TYPE ]: DEFAULT
		}

		const graphPathLib = [
			{ name: '植物 1.svg', path: 'plant/植物 1.svg' },
			{ name: '植物 10.svg', path: 'plant/植物 10.svg' },
			{ name: '植物 11.svg', path: 'plant/植物 11.svg' },
			{ name: '植物 12.svg', path: 'plant/植物 12.svg' },
			{ name: '植物 13.svg', path: 'plant/植物 13.svg' },
			{ name: '植物 14.svg', path: 'plant/植物 14.svg' },
			{ name: '植物 15.svg', path: 'plant/植物 15.svg' },
			{ name: '植物 16.svg', path: 'plant/植物 16.svg' },
			{ name: '植物 17.svg', path: 'plant/植物 17.svg' },
			{ name: '植物 18.svg', path: 'plant/植物 18.svg' },
			{ name: '植物 19.svg', path: 'plant/植物 19.svg' },
			{ name: '植物 2.svg', path: 'plant/植物 2.svg' },
			{ name: '植物 20.svg', path: 'plant/植物 20.svg' },
			{ name: '植物 21.svg', path: 'plant/植物 21.svg' },
			{ name: '植物 22.svg', path: 'plant/植物 22.svg' },
			{ name: '植物 23.svg', path: 'plant/植物 23.svg' },
			{ name: '植物 24.svg', path: 'plant/植物 24.svg' },
			{ name: '植物 25.svg', path: 'plant/植物 25.svg' },
			{ name: '植物 26.svg', path: 'plant/植物 26.svg' },
			{ name: '植物 27.svg', path: 'plant/植物 27.svg' },
			{ name: '植物 28.svg', path: 'plant/植物 28.svg' },
			{ name: '植物 29.svg', path: 'plant/植物 29.svg' },
			{ name: '植物 3.svg', path: 'plant/植物 3.svg' },
			{ name: '植物 30.svg', path: 'plant/植物 30.svg' },
			{ name: '植物 31.svg', path: 'plant/植物 31.svg' },
			{ name: '植物 32.svg', path: 'plant/植物 32.svg' },
			{ name: '植物 33.svg', path: 'plant/植物 33.svg' },
			{ name: '植物 34.svg', path: 'plant/植物 34.svg' },
			{ name: '植物 35.svg', path: 'plant/植物 35.svg' },
			{ name: '植物 36.svg', path: 'plant/植物 36.svg' },
			{ name: '植物 37.svg', path: 'plant/植物 37.svg' },
			{ name: '植物 38.svg', path: 'plant/植物 38.svg' },
			{ name: '植物 39.svg', path: 'plant/植物 39.svg' },
			{ name: '植物 4.svg', path: 'plant/植物 4.svg' },
			{ name: '植物 40.svg', path: 'plant/植物 40.svg' },
			{ name: '植物 41.svg', path: 'plant/植物 41.svg' },
			{ name: '植物 42.svg', path: 'plant/植物 42.svg' },
			{ name: '植物 43.svg', path: 'plant/植物 43.svg' },
			{ name: '植物 44.svg', path: 'plant/植物 44.svg' },
			{ name: '植物 45.svg', path: 'plant/植物 45.svg' },
			{ name: '植物 46.svg', path: 'plant/植物 46.svg' },
			{ name: '植物 47.svg', path: 'plant/植物 47.svg' },
			{ name: '植物 48.svg', path: 'plant/植物 48.svg' },
			{ name: '植物 49.svg', path: 'plant/植物 49.svg' },
			{ name: '植物 5.svg', path: 'plant/植物 5.svg' },
			{ name: '植物 50.svg', path: 'plant/植物 50.svg' },
			{ name: '植物 51.svg', path: 'plant/植物 51.svg' },
			{ name: '植物 52.svg', path: 'plant/植物 52.svg' },
			{ name: '植物 53.svg', path: 'plant/植物 53.svg' },
			{ name: '植物 54.svg', path: 'plant/植物 54.svg' },
			{ name: '植物 6.svg', path: 'plant/植物 6.svg' },
			{ name: '植物 7.svg', path: 'plant/植物 7.svg' },
			{ name: '植物 8.svg', path: 'plant/植物 8.svg' },
			{ name: '植物 9.svg', path: 'plant/植物 9.svg' },
		]

		const lib = graphPathLib.map(item => {
			item.staticPath = staticPath + item.path
			return item
		})

		const fns = graphPathLib.map(item => {
			return this.addEntry(this.getTagsForStencil(gn, item.name, dt).join(' '), mxUtils.bind(this, function () {
				const cell = new mxCell('', new mxGeometry(0, 0, width, height), `${ prefix }${ item.path }${ defaultStyle }`);
				cell.setVertex(true)
				this.setCellAttributes(cell, cellAttribute)
				return this.createVertexTemplateFromCells([ cell ], cell.geometry.width, cell.geometry.height, item.name);
			}));
		})

		this.setVariableImageLib(dt, label, lib)

		this.addPaletteFunctions(dt, label, false, fns);

		this.setCurrentSearchEntryLibrary();
	};
})();