@bit-sun/business-component 4.2.1-alpha.20-aiwei → 4.2.1-alpha.22-aiwei

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.
package/dist/index.esm.js CHANGED
@@ -38840,7 +38840,7 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
38840
38840
  });
38841
38841
  };
38842
38842
  _this.renderRuleItem = function (itemDetail, parentDetail, floorIndex, classDataIndex, relateDatas) {
38843
- var _itemDetail$subExpres, _itemDetail$params, _itemDetail$params$, _itemDetail$params2;
38843
+ var _itemDetail$subExpres, _itemDetail$params, _itemDetail$params$, _itemDetail$params2, _itemDetail$reqCondit, _itemDetail$reqCondit2, _itemDetail$reqCondit3, _itemDetail$reqCondit4;
38844
38844
  var ruleTreeData = _this.state.ruleTreeData;
38845
38845
  var _this$props3 = _this.props,
38846
38846
  callBack = _this$props3.callBack,
@@ -39111,12 +39111,13 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
39111
39111
  }
39112
39112
  }, (itemDetail === null || itemDetail === void 0 ? void 0 : itemDetail.isInsertSQL) ? '取消插入SQL' : '插入SQL')), /*#__PURE__*/React$1.createElement("div", {
39113
39113
  style: {
39114
- display: itemDetail.operationType == 'logic' && !disabled ? 'block' : 'none'
39114
+ display: itemDetail.operationType == 'logic' && (!disabled || itemDetail.reqConditionData && itemDetail.reqConditionData.reqParamName && ((_itemDetail$reqCondit = itemDetail.reqConditionData.params) === null || _itemDetail$reqCondit === void 0 ? void 0 : _itemDetail$reqCondit.length)) ? 'block' : 'none'
39115
39115
  }
39116
39116
  }, /*#__PURE__*/React$1.createElement("span", {
39117
39117
  style: {
39118
39118
  color: '#008fe0',
39119
- cursor: 'pointer'
39119
+ cursor: 'pointer',
39120
+ display: disabled ? 'none' : 'inline'
39120
39121
  },
39121
39122
  type: "link",
39122
39123
  onClick: function onClick() {
@@ -39130,10 +39131,12 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
39130
39131
  }
39131
39132
  }), "\u6DFB\u52A0\u6761\u4EF6"), needShowReqCondition && /*#__PURE__*/React$1.createElement("span", {
39132
39133
  style: {
39133
- marginLeft: 10
39134
+ marginLeft: 10,
39135
+ display: disabled ? 'none' : 'inline'
39134
39136
  }
39135
39137
  }, /*#__PURE__*/React$1.createElement(Button, {
39136
39138
  type: "link",
39139
+ disabled: disabled && (!itemDetail.reqConditionData || !itemDetail.reqConditionData.reqParamName || !((_itemDetail$reqCondit2 = itemDetail.reqConditionData.params) === null || _itemDetail$reqCondit2 === void 0 ? void 0 : _itemDetail$reqCondit2.length)),
39137
39140
  style: {
39138
39141
  padding: 0,
39139
39142
  height: 'auto'
@@ -39141,10 +39144,10 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
39141
39144
  onClick: function onClick() {
39142
39145
  return _this.handleReqConditionToggle(itemDetail);
39143
39146
  }
39144
- }, itemDetail.isReqCondition ? '取消参数条件控制' : '参数条件控制')), itemDetail.isReqCondition && itemDetail.reqConditionData && /*#__PURE__*/React$1.createElement("div", {
39147
+ }, itemDetail.isReqCondition ? '取消参数条件控制' : '参数条件控制')), (itemDetail.isReqCondition || disabled && itemDetail.reqConditionData && itemDetail.reqConditionData.reqParamName && ((_itemDetail$reqCondit3 = itemDetail.reqConditionData.params) === null || _itemDetail$reqCondit3 === void 0 ? void 0 : _itemDetail$reqCondit3.length)) && itemDetail.reqConditionData && /*#__PURE__*/React$1.createElement("div", {
39145
39148
  style: {
39146
39149
  marginTop: 10,
39147
- display: 'flex',
39150
+ display: disabled && (!itemDetail.reqConditionData.reqParamName || !((_itemDetail$reqCondit4 = itemDetail.reqConditionData.params) === null || _itemDetail$reqCondit4 === void 0 ? void 0 : _itemDetail$reqCondit4.length)) ? 'none' : 'flex',
39148
39151
  alignItems: 'center',
39149
39152
  background: '#f5f5f5',
39150
39153
  padding: '10px',
@@ -39156,6 +39159,7 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
39156
39159
  flexShrink: 0
39157
39160
  }
39158
39161
  }, "\u8BF7\u6C42\u53C2\u6570\u540D\u79F0:"), /*#__PURE__*/React$1.createElement(Input, {
39162
+ disabled: disabled,
39159
39163
  style: {
39160
39164
  width: 150,
39161
39165
  marginRight: 10
@@ -39170,6 +39174,7 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
39170
39174
  flexShrink: 0
39171
39175
  }
39172
39176
  }, "\u7C7B\u578B:"), /*#__PURE__*/React$1.createElement(Select, {
39177
+ disabled: disabled,
39173
39178
  style: {
39174
39179
  width: 120,
39175
39180
  marginRight: 10
@@ -39184,6 +39189,7 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
39184
39189
  value: code
39185
39190
  }, FIXED_DATA_TYPES[code]);
39186
39191
  })), /*#__PURE__*/React$1.createElement(Select, {
39192
+ disabled: disabled,
39187
39193
  style: {
39188
39194
  width: 120,
39189
39195
  marginRight: 10
@@ -39193,17 +39199,20 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
39193
39199
  return _this.handleReqDataChange(itemDetail, 'operationCode', val);
39194
39200
  }
39195
39201
  }, [{
39196
- 'code': 'eq',
39197
- 'name': '等于'
39202
+ 'code': '1',
39203
+ 'name': '在集合'
39198
39204
  }, {
39199
- 'code': 'cn',
39200
- 'name': '包含'
39205
+ 'code': '2',
39206
+ 'name': '不等于'
39201
39207
  }, {
39202
- code: 'gt',
39208
+ code: '3',
39209
+ name: '小于'
39210
+ }, {
39211
+ code: '4',
39203
39212
  name: '大于'
39204
39213
  }, {
39205
- code: 'lt',
39206
- name: '小于'
39214
+ code: '5',
39215
+ name: '等于'
39207
39216
  }].map(function (op) {
39208
39217
  return /*#__PURE__*/React$1.createElement(Select.Option, {
39209
39218
  key: op.code,
@@ -39670,9 +39679,9 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
39670
39679
  if (itemDetail.isReqCondition && !itemDetail.reqConditionData) {
39671
39680
  itemDetail.reqConditionData = {
39672
39681
  operationType: 'relation',
39673
- dataTypeCode: '21',
39674
- entityInputType: '21',
39675
- entityValueType: '21',
39682
+ dataTypeCode: '10',
39683
+ entityInputType: '10',
39684
+ entityValueType: '10',
39676
39685
  operationCode: '',
39677
39686
  reqParamName: '',
39678
39687
  params: [],
package/dist/index.js CHANGED
@@ -38863,7 +38863,7 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
38863
38863
  });
38864
38864
  };
38865
38865
  _this.renderRuleItem = function (itemDetail, parentDetail, floorIndex, classDataIndex, relateDatas) {
38866
- var _itemDetail$subExpres, _itemDetail$params, _itemDetail$params$, _itemDetail$params2;
38866
+ var _itemDetail$subExpres, _itemDetail$params, _itemDetail$params$, _itemDetail$params2, _itemDetail$reqCondit, _itemDetail$reqCondit2, _itemDetail$reqCondit3, _itemDetail$reqCondit4;
38867
38867
  var ruleTreeData = _this.state.ruleTreeData;
38868
38868
  var _this$props3 = _this.props,
38869
38869
  callBack = _this$props3.callBack,
@@ -39134,12 +39134,13 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
39134
39134
  }
39135
39135
  }, (itemDetail === null || itemDetail === void 0 ? void 0 : itemDetail.isInsertSQL) ? '取消插入SQL' : '插入SQL')), /*#__PURE__*/React__default['default'].createElement("div", {
39136
39136
  style: {
39137
- display: itemDetail.operationType == 'logic' && !disabled ? 'block' : 'none'
39137
+ display: itemDetail.operationType == 'logic' && (!disabled || itemDetail.reqConditionData && itemDetail.reqConditionData.reqParamName && ((_itemDetail$reqCondit = itemDetail.reqConditionData.params) === null || _itemDetail$reqCondit === void 0 ? void 0 : _itemDetail$reqCondit.length)) ? 'block' : 'none'
39138
39138
  }
39139
39139
  }, /*#__PURE__*/React__default['default'].createElement("span", {
39140
39140
  style: {
39141
39141
  color: '#008fe0',
39142
- cursor: 'pointer'
39142
+ cursor: 'pointer',
39143
+ display: disabled ? 'none' : 'inline'
39143
39144
  },
39144
39145
  type: "link",
39145
39146
  onClick: function onClick() {
@@ -39153,10 +39154,12 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
39153
39154
  }
39154
39155
  }), "\u6DFB\u52A0\u6761\u4EF6"), needShowReqCondition && /*#__PURE__*/React__default['default'].createElement("span", {
39155
39156
  style: {
39156
- marginLeft: 10
39157
+ marginLeft: 10,
39158
+ display: disabled ? 'none' : 'inline'
39157
39159
  }
39158
39160
  }, /*#__PURE__*/React__default['default'].createElement(antd.Button, {
39159
39161
  type: "link",
39162
+ disabled: disabled && (!itemDetail.reqConditionData || !itemDetail.reqConditionData.reqParamName || !((_itemDetail$reqCondit2 = itemDetail.reqConditionData.params) === null || _itemDetail$reqCondit2 === void 0 ? void 0 : _itemDetail$reqCondit2.length)),
39160
39163
  style: {
39161
39164
  padding: 0,
39162
39165
  height: 'auto'
@@ -39164,10 +39167,10 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
39164
39167
  onClick: function onClick() {
39165
39168
  return _this.handleReqConditionToggle(itemDetail);
39166
39169
  }
39167
- }, itemDetail.isReqCondition ? '取消参数条件控制' : '参数条件控制')), itemDetail.isReqCondition && itemDetail.reqConditionData && /*#__PURE__*/React__default['default'].createElement("div", {
39170
+ }, itemDetail.isReqCondition ? '取消参数条件控制' : '参数条件控制')), (itemDetail.isReqCondition || disabled && itemDetail.reqConditionData && itemDetail.reqConditionData.reqParamName && ((_itemDetail$reqCondit3 = itemDetail.reqConditionData.params) === null || _itemDetail$reqCondit3 === void 0 ? void 0 : _itemDetail$reqCondit3.length)) && itemDetail.reqConditionData && /*#__PURE__*/React__default['default'].createElement("div", {
39168
39171
  style: {
39169
39172
  marginTop: 10,
39170
- display: 'flex',
39173
+ display: disabled && (!itemDetail.reqConditionData.reqParamName || !((_itemDetail$reqCondit4 = itemDetail.reqConditionData.params) === null || _itemDetail$reqCondit4 === void 0 ? void 0 : _itemDetail$reqCondit4.length)) ? 'none' : 'flex',
39171
39174
  alignItems: 'center',
39172
39175
  background: '#f5f5f5',
39173
39176
  padding: '10px',
@@ -39179,6 +39182,7 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
39179
39182
  flexShrink: 0
39180
39183
  }
39181
39184
  }, "\u8BF7\u6C42\u53C2\u6570\u540D\u79F0:"), /*#__PURE__*/React__default['default'].createElement(antd.Input, {
39185
+ disabled: disabled,
39182
39186
  style: {
39183
39187
  width: 150,
39184
39188
  marginRight: 10
@@ -39193,6 +39197,7 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
39193
39197
  flexShrink: 0
39194
39198
  }
39195
39199
  }, "\u7C7B\u578B:"), /*#__PURE__*/React__default['default'].createElement(antd.Select, {
39200
+ disabled: disabled,
39196
39201
  style: {
39197
39202
  width: 120,
39198
39203
  marginRight: 10
@@ -39207,6 +39212,7 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
39207
39212
  value: code
39208
39213
  }, FIXED_DATA_TYPES[code]);
39209
39214
  })), /*#__PURE__*/React__default['default'].createElement(antd.Select, {
39215
+ disabled: disabled,
39210
39216
  style: {
39211
39217
  width: 120,
39212
39218
  marginRight: 10
@@ -39216,17 +39222,20 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
39216
39222
  return _this.handleReqDataChange(itemDetail, 'operationCode', val);
39217
39223
  }
39218
39224
  }, [{
39219
- 'code': 'eq',
39220
- 'name': '等于'
39225
+ 'code': '1',
39226
+ 'name': '在集合'
39221
39227
  }, {
39222
- 'code': 'cn',
39223
- 'name': '包含'
39228
+ 'code': '2',
39229
+ 'name': '不等于'
39224
39230
  }, {
39225
- code: 'gt',
39231
+ code: '3',
39232
+ name: '小于'
39233
+ }, {
39234
+ code: '4',
39226
39235
  name: '大于'
39227
39236
  }, {
39228
- code: 'lt',
39229
- name: '小于'
39237
+ code: '5',
39238
+ name: '等于'
39230
39239
  }].map(function (op) {
39231
39240
  return /*#__PURE__*/React__default['default'].createElement(antd.Select.Option, {
39232
39241
  key: op.code,
@@ -39693,9 +39702,9 @@ var RuleObjectComponent = /*#__PURE__*/function (_Component) {
39693
39702
  if (itemDetail.isReqCondition && !itemDetail.reqConditionData) {
39694
39703
  itemDetail.reqConditionData = {
39695
39704
  operationType: 'relation',
39696
- dataTypeCode: '21',
39697
- entityInputType: '21',
39698
- entityValueType: '21',
39705
+ dataTypeCode: '10',
39706
+ entityInputType: '10',
39707
+ entityValueType: '10',
39699
39708
  operationCode: '',
39700
39709
  reqParamName: '',
39701
39710
  params: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "4.2.1-alpha.20-aiwei",
3
+ "version": "4.2.1-alpha.22-aiwei",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -78,6 +78,7 @@ import { RuleComponent } from '../../../index';
78
78
 
79
79
  export default () => {
80
80
  const [ruleClassData, setRuleClassData] = useState([]);
81
+ const [disabled, setDisabled] = useState(false);
81
82
 
82
83
  // 模拟规则对象数据源
83
84
  const regularDataList = [
@@ -135,6 +136,20 @@ export default () => {
135
136
  return (
136
137
  <div style={{ background: '#f0f2f5', padding: 20, width: '1200px' }}>
137
138
  <div style={{ marginBottom: 16, textAlign: 'right' }}>
139
+ <button
140
+ onClick={() => setDisabled(!disabled)}
141
+ style={{
142
+ backgroundColor: '#faad14',
143
+ color: '#fff',
144
+ border: 'none',
145
+ padding: '6px 15px',
146
+ borderRadius: '2px',
147
+ cursor: 'pointer',
148
+ marginRight: '10px'
149
+ }}
150
+ >
151
+ {disabled ? '启用编辑' : '禁用编辑'}
152
+ </button>
138
153
  <button
139
154
  onClick={handleSave}
140
155
  style={{
@@ -156,6 +171,7 @@ export default () => {
156
171
  needShowInsertSQL={true}
157
172
  needShowReqCondition={true}
158
173
  systemVariableList={systemVariableList}
174
+ disabled={disabled}
159
175
  callBack={(newData) => {
160
176
  console.log('Rule Changed:', newData);
161
177
  setRuleClassData([...newData]);
@@ -1069,13 +1069,21 @@ class RuleObjectComponent extends Component {
1069
1069
  <div
1070
1070
  style={{
1071
1071
  display:
1072
- itemDetail.operationType == 'logic' && !disabled
1072
+ itemDetail.operationType == 'logic' &&
1073
+ (!disabled ||
1074
+ (itemDetail.reqConditionData &&
1075
+ itemDetail.reqConditionData.reqParamName &&
1076
+ itemDetail.reqConditionData.params?.length))
1073
1077
  ? 'block'
1074
1078
  : 'none',
1075
1079
  }}
1076
1080
  >
1077
1081
  <span
1078
- style={{ color: '#008fe0', cursor: 'pointer' }}
1082
+ style={{
1083
+ color: '#008fe0',
1084
+ cursor: 'pointer',
1085
+ display: disabled ? 'none' : 'inline',
1086
+ }}
1079
1087
  type="link"
1080
1088
  onClick={() => {
1081
1089
  this.addPeerRule(itemDetail);
@@ -1091,9 +1099,20 @@ class RuleObjectComponent extends Component {
1091
1099
  添加条件
1092
1100
  </span>
1093
1101
  {needShowReqCondition && (
1094
- <span style={{ marginLeft: 10 }}>
1102
+ <span
1103
+ style={{
1104
+ marginLeft: 10,
1105
+ display: disabled ? 'none' : 'inline',
1106
+ }}
1107
+ >
1095
1108
  <Button
1096
1109
  type="link"
1110
+ disabled={
1111
+ disabled &&
1112
+ (!itemDetail.reqConditionData ||
1113
+ !itemDetail.reqConditionData.reqParamName ||
1114
+ !itemDetail.reqConditionData.params?.length)
1115
+ }
1097
1116
  style={{ padding: 0, height: 'auto' }}
1098
1117
  onClick={() => this.handleReqConditionToggle(itemDetail)}
1099
1118
  >
@@ -1103,21 +1122,32 @@ class RuleObjectComponent extends Component {
1103
1122
  </Button>
1104
1123
  </span>
1105
1124
  )}
1106
- {itemDetail.isReqCondition && itemDetail.reqConditionData && (
1107
- <div
1108
- style={{
1109
- marginTop: 10,
1110
- display: 'flex',
1111
- alignItems: 'center',
1112
- background: '#f5f5f5',
1113
- padding: '10px',
1114
- borderRadius: '4px',
1115
- }}
1116
- >
1125
+ {(itemDetail.isReqCondition ||
1126
+ (disabled &&
1127
+ itemDetail.reqConditionData &&
1128
+ itemDetail.reqConditionData.reqParamName &&
1129
+ itemDetail.reqConditionData.params?.length)) &&
1130
+ itemDetail.reqConditionData && (
1131
+ <div
1132
+ style={{
1133
+ marginTop: 10,
1134
+ display:
1135
+ disabled &&
1136
+ (!itemDetail.reqConditionData.reqParamName ||
1137
+ !itemDetail.reqConditionData.params?.length)
1138
+ ? 'none'
1139
+ : 'flex',
1140
+ alignItems: 'center',
1141
+ background: '#f5f5f5',
1142
+ padding: '10px',
1143
+ borderRadius: '4px',
1144
+ }}
1145
+ >
1117
1146
  <span style={{ marginRight: 8, flexShrink: 0 }}>
1118
1147
  请求参数名称:
1119
1148
  </span>
1120
1149
  <Input
1150
+ disabled={disabled}
1121
1151
  style={{ width: 150, marginRight: 10 }}
1122
1152
  value={itemDetail.reqConditionData.reqParamName}
1123
1153
  onChange={(e) =>
@@ -1131,6 +1161,7 @@ class RuleObjectComponent extends Component {
1131
1161
 
1132
1162
  <span style={{ marginRight: 8, flexShrink: 0 }}>类型:</span>
1133
1163
  <Select
1164
+ disabled={disabled}
1134
1165
  style={{ width: 120, marginRight: 10 }}
1135
1166
  value={itemDetail.reqConditionData.dataTypeCode}
1136
1167
  onChange={(val) =>
@@ -1145,6 +1176,7 @@ class RuleObjectComponent extends Component {
1145
1176
  </Select>
1146
1177
 
1147
1178
  <Select
1179
+ disabled={disabled}
1148
1180
  style={{ width: 120, marginRight: 10 }}
1149
1181
  value={itemDetail.reqConditionData.operationCode}
1150
1182
  onChange={(val) =>
@@ -1152,10 +1184,11 @@ class RuleObjectComponent extends Component {
1152
1184
  }
1153
1185
  >
1154
1186
  {[
1155
- { 'code': 'eq', 'name': '等于' },
1156
- { 'code': 'cn', 'name': '包含' },
1157
- { code: 'gt', name: '大于' },
1158
- { code: 'lt', name: '小于' },
1187
+ { 'code': '1', 'name': '在集合' },
1188
+ { 'code': '2', 'name': '不等于' },
1189
+ { code: '3', name: '小于' },
1190
+ { code: '4', name: '大于' },
1191
+ { code: '5', name: '等于' },
1159
1192
  ].map((op) => (
1160
1193
  <Select.Option key={op.code} value={op.code}>
1161
1194
  {op.name}
@@ -1770,9 +1803,9 @@ class RuleObjectComponent extends Component {
1770
1803
  if (itemDetail.isReqCondition && !itemDetail.reqConditionData) {
1771
1804
  itemDetail.reqConditionData = {
1772
1805
  operationType: 'relation',
1773
- dataTypeCode: '21',
1774
- entityInputType: '21',
1775
- entityValueType: '21',
1806
+ dataTypeCode: '10',
1807
+ entityInputType: '10',
1808
+ entityValueType: '10',
1776
1809
  operationCode: '',
1777
1810
  reqParamName: '',
1778
1811
  params: [],