@tddc/assign-modal 1.0.9 → 1.1.0

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.
@@ -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,23 @@ 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: allOrgChecked,
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
+ orgChecks = Array.from(new Set([].concat(_toConsumableArray(orgCodes || []), _toConsumableArray(path))));
248
248
  setCheckedKeys(orgChecks);
249
249
  onChange({
250
- appKeys: appKeys,
250
+ appKeys: allAppChecked ? ['all'] : appKeys,
251
251
  checkedKeys: orgChecks,
252
- appCheckAll: checkedKeys.length === allOrg.length,
252
+ appCheckAll: allOrgChecked,
253
253
  orgCheckAll: false,
254
254
  checkData: {
255
255
  apps: appKeys,
@@ -271,9 +271,9 @@ var AssignModal = function AssignModal(props) {
271
271
  setAppKeys(appChecks);
272
272
  onChange({
273
273
  appKeys: ['all'],
274
- checkedKeys: checkedKeys,
274
+ checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
275
275
  appCheckAll: true,
276
- orgCheckAll: checkedKeys.length === allOrg.length,
276
+ orgCheckAll: allOrgChecked,
277
277
  checkData: {
278
278
  apps: appChecks,
279
279
  orgs: checkedKeys
@@ -281,11 +281,13 @@ var AssignModal = function AssignModal(props) {
281
281
  });
282
282
  } else {
283
283
  setAllAppChecked(false);
284
+ appChecks = Array.from(new Set([].concat(_toConsumableArray(appCodes || []), [appCode])));
285
+ setAppKeys(appChecks);
284
286
  onChange({
285
287
  appKeys: appChecks,
286
- checkedKeys: checkedKeys,
288
+ checkedKeys: allOrgChecked ? ['all'] : checkedKeys,
287
289
  appCheckAll: false,
288
- orgCheckAll: checkedKeys.length === allOrg.length,
290
+ orgCheckAll: allOrgChecked,
289
291
  checkData: {
290
292
  apps: appChecks,
291
293
  orgs: checkedKeys
@@ -314,7 +316,7 @@ var AssignModal = function AssignModal(props) {
314
316
  checkedKeys: checkedKeys,
315
317
  defaultExpandAll: true,
316
318
  onCheck: onCheck,
317
- disabled: disabled
319
+ disabled: disabled || allOrgChecked
318
320
  }, loopTreeNodes(orgList))), /*#__PURE__*/_react.default.createElement("div", {
319
321
  className: "right"
320
322
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -332,7 +334,7 @@ var AssignModal = function AssignModal(props) {
332
334
  var isOwnAppCode = appCode === item.value;
333
335
  return /*#__PURE__*/_react.default.createElement(_checkbox.default, {
334
336
  checked: isCheck,
335
- disabled: disabled || isOwnAppCode,
337
+ disabled: disabled || isOwnAppCode || allAppChecked,
336
338
  onChange: assignApp,
337
339
  value: item.value,
338
340
  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.0",
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": "12ef2b028bcaddf22a2db41f05e99b6399688ca4"
22
22
  }