Commit 3afea5ed0ddf6fa7c35c5f3b6fcf5b966a796a20

Authored by ww
1 parent 9f18ee65

perf: 优化更多图形库,无法隐藏已开启的图形库

... ... @@ -520,14 +520,12 @@
520 520 entries: [
521 521 { title: mxResources.get('general'), id: 'general', image: IMAGE_PATH + '/sidebar-general.png' },
522 522 { title: mxResources.get('arrows'), id: 'arrows2', image: IMAGE_PATH + '/sidebar-arrows2.png' },
523   - { title: mxResources.get('basicComponents'), id: 'basicComponents', image: IMAGE_PATH + '/sidebar-basic.png' },
524   - { title: mxResources.get('controlComponents'), id: 'controlComponents', image: IMAGE_PATH + '/sidebar-basic.png' },
525   - { title: mxResources.get('chartComponents'), id: 'chartComponents', image: IMAGE_PATH + '/sidebar-basic.png' },
526   - { title: '控制元件', id: 'control', image: IMAGE_PATH + '/thingskit/控制元件.png' },
  523 + { title: mxResources.get('basicComponents'), id: 'basicComponents', image: IMAGE_PATH + '/thingskit/基础元件.png' },
  524 + { title: mxResources.get('controlComponents'), id: 'controlComponents', image: IMAGE_PATH + '/thingskit/控制元件.png' },
  525 + { title: mxResources.get('chartComponents'), id: 'chartComponents', image: IMAGE_PATH + '/thingskit/图表元件.png' },
527 526 { title: "风机", id: 'fan', image: IMAGE_PATH + '/thingskit/风机.png' },
528 527 { title: "发动机", id: 'engine', image: IMAGE_PATH + '/thingskit/发动机.png' },
529 528 { title: "阀门", id: 'valve', image: IMAGE_PATH + '/thingskit/阀门.png' },
530   - { title: "基础组件", id: 'basicComponent', image: IMAGE_PATH + '/thingskit/基础元件.png' },
531 529 { title: "污水处理", id: 'sewage', image: IMAGE_PATH + '/thingskit/污水处理.png' },
532 530 { title: "管道", id: 'conduit', image: IMAGE_PATH + '/thingskit/管道.png' },
533 531 { title: "灯", id: 'light', image: IMAGE_PATH + '/thingskit/灯.png' },
... ... @@ -552,7 +550,6 @@
552 550 return
553 551
554 552 var stdEntries = [
555   - { title: mxResources.get('basicComponents'), id: 'basicComponents', image: IMAGE_PATH + '/sidebar-basic.png' },
556 553 { title: mxResources.get('general'), id: 'general', image: IMAGE_PATH + '/sidebar-general.png' },
557 554 { title: mxResources.get('basic'), id: 'basic', image: IMAGE_PATH + '/sidebar-basic.png' },
558 555 { title: mxResources.get('arrows'), id: 'arrows2', image: IMAGE_PATH + '/sidebar-arrows2.png' },
... ...
... ... @@ -5,6 +5,7 @@
5 5
6 6 const { COMPONENT_KEY, CATEGORY } = window.CellAttributeKeyEnum
7 7
  8 + const dt = 'basicComponents'
8 9
9 10 Sidebar.prototype.addBasicComponentsPalette = function () {
10 11
... ... @@ -18,9 +19,9 @@
18 19 return xmlElement
19 20 }
20 21
21   - this.setCurrentSearchEntryLibrary('basicComponents');
  22 + this.setCurrentSearchEntryLibrary(dt);
22 23
23   - this.addPaletteFunctions('basicComponents', mxResources.get('basicComponents'), true,
  24 + this.addPaletteFunctions(dt, mxResources.get(dt), true,
24 25 [
25 26 // Title组件
26 27 this.createVertexTemplateEntry("text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=16;", 40, 20, createUserObject({ label: 'Title', [COMPONENT_KEY]: 'Title', [CATEGORY]: 'BASIC' }), "Title", null, !0, "text textbox textarea label"),
... ... @@ -47,6 +48,8 @@
47 48 this.createVertexTemplateEntry('shape=mxgraph.thingskit/imageComponent;text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=top;whiteSpace=wrap;rounded=0;fontSize=16;', 200, 200, createUserObject({ label: '', [COMPONENT_KEY]: 'Image', [CATEGORY]: 'BASIC' }), '图片', null, !0, 'image'),
48 49 ]
49 50 );
  51 +
  52 + this.setCurrentSearchEntryLibrary();
50 53 };
51 54
52 55 })();
... ...
... ... @@ -5,6 +5,8 @@
5 5
6 6 const { COMPONENT_KEY, CATEGORY } = window.CellAttributeKeyEnum
7 7
  8 + const dt = 'chartComponents'
  9 +
8 10 Sidebar.prototype.addChartComponentsPalette = function () {
9 11
10 12 function createUserObject(attribute) {
... ... @@ -17,9 +19,9 @@
17 19 return xmlElement
18 20 }
19 21
20   - this.setCurrentSearchEntryLibrary('chartComponents');
  22 + this.setCurrentSearchEntryLibrary(dt);
21 23
22   - this.addPaletteFunctions('chartComponents', mxResources.get('chartComponents'), false,
  24 + this.addPaletteFunctions(dt, mxResources.get(dt), false,
23 25 [
24 26 // 折线图
25 27 this.createVertexTemplateEntry("shape=mxgraph.thingskit/lineChartComponent;verticalLabelPosition=bottom;verticalAlign=top;html=1;shadow=0;strokeColor=none;fontColor=#000000;align=center;textOpacity=100;fillColor=none;fontSize=16;", 300, 300, createUserObject({ [COMPONENT_KEY]: 'Line', [CATEGORY]: 'CHART' }), '折线图', true, "text textbox textarea label"),
... ...
... ... @@ -5,6 +5,7 @@
5 5
6 6 const { COMPONENT_KEY, CATEGORY } = window.CellAttributeKeyEnum
7 7
  8 + const dt = 'controlComponents'
8 9
9 10 Sidebar.prototype.addControlComponentsPalette = function () {
10 11
... ... @@ -18,9 +19,9 @@
18 19 return xmlElement
19 20 }
20 21
21   - this.setCurrentSearchEntryLibrary('controlComponents');
  22 + this.setCurrentSearchEntryLibrary(dt);
22 23
23   - this.addPaletteFunctions('basicComponents', mxResources.get('controlComponents'), false,
  24 + this.addPaletteFunctions(dt, mxResources.get(dt), false,
24 25 [
25 26 // 开关
26 27 this.createVertexTemplateEntry("shape=mxgraph.thingskit/switchComponent;text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=12;", 60, 60, createUserObject({ label: '', [COMPONENT_KEY]: 'Switch', [CATEGORY]: 'CONTROL' }), "开关", null, !0, "text textbox textarea label"),
... ...