@riil-frontend/component-topology 6.0.0-alpha.57 → 6.0.0-alpha.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -91,7 +91,7 @@ function FontColorDropdown(props) {
91
91
  unit: "%",
92
92
  list: [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
93
93
  onChange: backOpacityChange,
94
- defaultValue: opacity * 100
94
+ defaultValue: opacity === undefined ? opacity : opacity * 100
95
95
  })), /*#__PURE__*/React.createElement("div", {
96
96
  style: {
97
97
  marginTop: '10px',
@@ -1,16 +1,25 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
2
2
  var _excluded = ["topo", "showLabel"];
3
3
  import React, { useEffect, useState } from "react";
4
- import { isGroup, isNode } from "../../../../../../utils/htElementUtils";
4
+ import { isGroup, isNode, isText } from "../../../../../../utils/htElementUtils";
5
5
  import DropdownButton from "../components/DropdownButton";
6
6
  import WidgetBox from "../WidgetBox";
7
7
  import BoxBackgroundSetting from "./BoxBackgroundSetting";
8
+
9
+ function isElementSetImageEnabled(element) {
10
+ if (isGroup(element)) {
11
+ return !element.isExpanded();
12
+ }
13
+
14
+ return isNode(element) && !isText(element) && element.a('type') !== 'box';
15
+ }
8
16
  /**
9
17
  * 替换图片设置
10
18
  * @param {*} props
11
19
  * @returns
12
20
  */
13
21
 
22
+
14
23
  function NodeImageButton(props) {
15
24
  var topo = props.topo,
16
25
  showLabel = props.showLabel,
@@ -27,9 +36,7 @@ function NodeImageButton(props) {
27
36
 
28
37
  var selection = topo.selectionModel.useHtSelection();
29
38
  useEffect(function () {
30
- var nodes = selection.filter(function (ele) {
31
- return isGroup(ele) || isNode(ele);
32
- });
39
+ var nodes = selection.filter(isElementSetImageEnabled);
33
40
 
34
41
  if (nodes.length > 0) {
35
42
  setDisabled(false);
@@ -44,10 +51,12 @@ function NodeImageButton(props) {
44
51
  // const gv = topo.view.topoClient.getGraphView();
45
52
  //const element = topo.getSelectionModel().getFirstData();
46
53
 
47
- var elements = topo.getSelectionModel();
54
+ var elements = selection;
48
55
  console.log("onChange-elements", elements);
49
- elements.each(function (element) {
50
- element.setImage(prop);
56
+ elements.forEach(function (element) {
57
+ if (isElementSetImageEnabled(element)) {
58
+ element.setImage(prop);
59
+ }
51
60
  }); // selection.map((element) => {
52
61
  // element.setImage(prop);
53
62
  // });
@@ -22,7 +22,7 @@ import topoFactory from "./topoFactory";
22
22
  import ElementTagTipConfig from "./tagstips/ElementTagTipConfig";
23
23
  import SelectionModel from "./SelectionModel"; // eslint-disable-next-line no-undef
24
24
 
25
- var version = typeof "6.0.0-alpha.57" === 'string' ? "6.0.0-alpha.57" : null;
25
+ var version = typeof "6.0.0-alpha.59" === 'string' ? "6.0.0-alpha.59" : null;
26
26
  console.info("\u62D3\u6251\u7248\u672C: " + version);
27
27
  /**
28
28
  * 拓扑显示和编辑
@@ -108,7 +108,7 @@ function FontColorDropdown(props) {
108
108
  unit: "%",
109
109
  list: [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
110
110
  onChange: backOpacityChange,
111
- defaultValue: opacity * 100
111
+ defaultValue: opacity === undefined ? opacity : opacity * 100
112
112
  })), /*#__PURE__*/_react["default"].createElement("div", {
113
113
  style: {
114
114
  marginTop: '10px',
@@ -23,11 +23,20 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
23
23
 
24
24
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
25
 
26
+ function isElementSetImageEnabled(element) {
27
+ if ((0, _htElementUtils.isGroup)(element)) {
28
+ return !element.isExpanded();
29
+ }
30
+
31
+ return (0, _htElementUtils.isNode)(element) && !(0, _htElementUtils.isText)(element) && element.a('type') !== 'box';
32
+ }
26
33
  /**
27
34
  * 替换图片设置
28
35
  * @param {*} props
29
36
  * @returns
30
37
  */
38
+
39
+
31
40
  function NodeImageButton(props) {
32
41
  var topo = props.topo,
33
42
  showLabel = props.showLabel,
@@ -44,9 +53,7 @@ function NodeImageButton(props) {
44
53
 
45
54
  var selection = topo.selectionModel.useHtSelection();
46
55
  (0, _react.useEffect)(function () {
47
- var nodes = selection.filter(function (ele) {
48
- return (0, _htElementUtils.isGroup)(ele) || (0, _htElementUtils.isNode)(ele);
49
- });
56
+ var nodes = selection.filter(isElementSetImageEnabled);
50
57
 
51
58
  if (nodes.length > 0) {
52
59
  setDisabled(false);
@@ -61,10 +68,12 @@ function NodeImageButton(props) {
61
68
  // const gv = topo.view.topoClient.getGraphView();
62
69
  //const element = topo.getSelectionModel().getFirstData();
63
70
 
64
- var elements = topo.getSelectionModel();
71
+ var elements = selection;
65
72
  console.log("onChange-elements", elements);
66
- elements.each(function (element) {
67
- element.setImage(prop);
73
+ elements.forEach(function (element) {
74
+ if (isElementSetImageEnabled(element)) {
75
+ element.setImage(prop);
76
+ }
68
77
  }); // selection.map((element) => {
69
78
  // element.setImage(prop);
70
79
  // });
@@ -52,7 +52,7 @@ var _ElementTagTipConfig = _interopRequireDefault(require("./tagstips/ElementTag
52
52
  var _SelectionModel = _interopRequireDefault(require("./SelectionModel"));
53
53
 
54
54
  // eslint-disable-next-line no-undef
55
- var version = typeof "6.0.0-alpha.57" === 'string' ? "6.0.0-alpha.57" : null;
55
+ var version = typeof "6.0.0-alpha.59" === 'string' ? "6.0.0-alpha.59" : null;
56
56
  console.info("\u62D3\u6251\u7248\u672C: " + version);
57
57
  /**
58
58
  * 拓扑显示和编辑
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riil-frontend/component-topology",
3
- "version": "6.0.0-alpha.57",
3
+ "version": "6.0.0-alpha.59",
4
4
  "description": "拓扑",
5
5
  "scripts": {
6
6
  "start": "build-scripts start",
@@ -116,6 +116,6 @@
116
116
  "access": "public"
117
117
  },
118
118
  "license": "MIT",
119
- "homepage": "https://unpkg.com/@riil-frontend/component-topology@6.0.0-alpha.57/build/index.html",
119
+ "homepage": "https://unpkg.com/@riil-frontend/component-topology@6.0.0-alpha.59/build/index.html",
120
120
  "gitHead": "2da19ffccbb7ca60a8acf396e39f542c68bb33f5"
121
121
  }