@tddc/assign-modal 1.0.9 → 1.1.2

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.
@@ -114,7 +114,7 @@ var AssignModal = function AssignModal(props) {
114
114
  setAllAppChecked(appCodes.includes('all'));
115
115
  initApps = allApp;
116
116
  } else {
117
- initApps = appCodes;
117
+ initApps = Array.from(new Set([].concat(_toConsumableArray(appCodes || []), [appCode])));
118
118
  }
119
119
 
120
120
  setCheckedKeys(initOrgs);
@@ -141,7 +141,7 @@ var AssignModal = function AssignModal(props) {
141
141
  node: item
142
142
  }),
143
143
  item: item,
144
- disabled: orgDisabled || disabled
144
+ disabled: orgDisabled || disabled || allOrgChecked
145
145
  }, loopTreeNodes(item.children, level + 1));
146
146
  }
147
147
 
@@ -183,10 +183,10 @@ var AssignModal = function AssignModal(props) {
183
183
 
184
184
  setCheckedKeys(checked);
185
185
  onChange({
186
- appKeys: appKeys,
186
+ appKeys: allAppChecked ? ['all'] : appKeys,
187
187
  checkedKeys: checked,
188
- appCheckAll: appKeys.length === allApp.length,
189
- orgCheckAll: checked.length === allOrg.length,
188
+ appCheckAll: allAppChecked,
189
+ orgCheckAll: allOrgChecked,
190
190
  checkData: {
191
191
  apps: appKeys,
192
192
  orgs: checked
@@ -214,12 +214,12 @@ var AssignModal = function AssignModal(props) {
214
214
  setAppKeys(newAppKeys);
215
215
  onChange({
216
216
  appKeys: newAppKeys,
217
- checkedKeys: checkedKeys,
218
- appCheckAll: newAppKeys.length === allApp.length,
219
- orgCheckAll: checkedKeys.length === allOrg.length,
217
+ checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
218
+ appCheckAll: allAppChecked,
219
+ orgCheckAll: allOrgChecked,
220
220
  checkData: {
221
- apps: appKeys,
222
- orgs: newAppKeys
221
+ apps: newAppKeys,
222
+ orgs: checkedKeys
223
223
  }
224
224
  });
225
225
  }; // org全局授权
@@ -233,23 +233,24 @@ var AssignModal = function AssignModal(props) {
233
233
  orgChecks = (0, _utils.preorder)(orgList[0]);
234
234
  setCheckedKeys(orgChecks);
235
235
  onChange({
236
- appKeys: appKeys,
236
+ appKeys: allAppChecked ? ['all'] : appKeys,
237
237
  checkedKeys: ['all'],
238
- appCheckAll: appKeys.length === allApp.length,
238
+ appCheckAll: allAppChecked,
239
239
  orgCheckAll: true,
240
240
  checkData: {
241
241
  apps: appKeys,
242
- orgs: orgChecks
242
+ orgs: checkedKeys
243
243
  }
244
244
  });
245
245
  } else {
246
246
  setAllOrgChecked(false);
247
- orgChecks = _toConsumableArray(path);
247
+ var arr = orgCodes.includes('all') ? allApp : orgCodes;
248
+ orgChecks = Array.from(new Set([].concat(_toConsumableArray(arr || []), _toConsumableArray(path))));
248
249
  setCheckedKeys(orgChecks);
249
250
  onChange({
250
- appKeys: appKeys,
251
+ appKeys: allAppChecked ? ['all'] : appKeys,
251
252
  checkedKeys: orgChecks,
252
- appCheckAll: checkedKeys.length === allOrg.length,
253
+ appCheckAll: allAppChecked,
253
254
  orgCheckAll: false,
254
255
  checkData: {
255
256
  apps: appKeys,
@@ -271,9 +272,9 @@ var AssignModal = function AssignModal(props) {
271
272
  setAppKeys(appChecks);
272
273
  onChange({
273
274
  appKeys: ['all'],
274
- checkedKeys: checkedKeys,
275
+ checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
275
276
  appCheckAll: true,
276
- orgCheckAll: checkedKeys.length === allOrg.length,
277
+ orgCheckAll: allOrgChecked,
277
278
  checkData: {
278
279
  apps: appChecks,
279
280
  orgs: checkedKeys
@@ -281,11 +282,14 @@ var AssignModal = function AssignModal(props) {
281
282
  });
282
283
  } else {
283
284
  setAllAppChecked(false);
285
+ var arr = appCodes.includes('all') ? allApp : appCodes;
286
+ appChecks = Array.from(new Set([].concat(_toConsumableArray(arr || []), [appCode])));
287
+ setAppKeys(appChecks);
284
288
  onChange({
285
289
  appKeys: appChecks,
286
- checkedKeys: checkedKeys,
290
+ checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
287
291
  appCheckAll: false,
288
- orgCheckAll: checkedKeys.length === allOrg.length,
292
+ orgCheckAll: allOrgChecked,
289
293
  checkData: {
290
294
  apps: appChecks,
291
295
  orgs: checkedKeys
@@ -314,8 +318,8 @@ var AssignModal = function AssignModal(props) {
314
318
  checkedKeys: checkedKeys,
315
319
  defaultExpandAll: true,
316
320
  onCheck: onCheck,
317
- disabled: disabled
318
- }, loopTreeNodes(orgList))), /*#__PURE__*/_react.default.createElement("div", {
321
+ disabled: true
322
+ }, loopTreeNodes(orgList, 0))), /*#__PURE__*/_react.default.createElement("div", {
319
323
  className: "right"
320
324
  }, /*#__PURE__*/_react.default.createElement("div", {
321
325
  className: "menu-header"
@@ -332,7 +336,7 @@ var AssignModal = function AssignModal(props) {
332
336
  var isOwnAppCode = appCode === item.value;
333
337
  return /*#__PURE__*/_react.default.createElement(_checkbox.default, {
334
338
  checked: isCheck,
335
- disabled: disabled || isOwnAppCode,
339
+ disabled: disabled || isOwnAppCode || allAppChecked,
336
340
  onChange: assignApp,
337
341
  value: item.value,
338
342
  key: index
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tddc/assign-modal",
3
- "version": "1.0.9",
3
+ "version": "1.1.2",
4
4
  "description": "Layout",
5
5
  "author": "zj <jun.zhang002383@tongdun.net>",
6
6
  "license": "ISC",
@@ -18,5 +18,5 @@
18
18
  "dependencies": {
19
19
  "jsencrypt": "^3.2.1"
20
20
  },
21
- "gitHead": "330d083d35237ef27b2187046c167e7e29ee25a4"
21
+ "gitHead": "12b2d87f0ca80cfe05cf4a23cb9cdcde8d5b752e"
22
22
  }