@tddc/assign-modal 3.0.4 → 3.0.6

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.
@@ -1009,6 +1009,38 @@ var AssignModal = function AssignModal(props) {
1009
1009
  widthLimit: '100%',
1010
1010
  });
1011
1011
  };
1012
+ var canNotRemoveOrg = useMemo(
1013
+ function () {
1014
+ var _orgMapRef$current, _orgMapRef$current$ch;
1015
+ return (
1016
+ (checkedKeys === null || checkedKeys === void 0 ? void 0 : checkedKeys.length) === 1 &&
1017
+ ((_orgMapRef$current = orgMapRef.current) === null || _orgMapRef$current === void 0
1018
+ ? void 0
1019
+ : (_orgMapRef$current$ch = _orgMapRef$current[checkedKeys[0]]) === null ||
1020
+ _orgMapRef$current$ch === void 0
1021
+ ? void 0
1022
+ : _orgMapRef$current$ch.key) ===
1023
+ (rootNode === null || rootNode === void 0 ? void 0 : rootNode.key)
1024
+ );
1025
+ },
1026
+ [checkedKeys],
1027
+ );
1028
+ var canNotRemoveApp = useMemo(
1029
+ function () {
1030
+ var _appMapRef$current, _appMapRef$current$ap;
1031
+ return (
1032
+ (appKeys === null || appKeys === void 0 ? void 0 : appKeys.length) === 1 &&
1033
+ ((_appMapRef$current = appMapRef.current) === null || _appMapRef$current === void 0
1034
+ ? void 0
1035
+ : (_appMapRef$current$ap = _appMapRef$current[appKeys[0]]) === null ||
1036
+ _appMapRef$current$ap === void 0
1037
+ ? void 0
1038
+ : _appMapRef$current$ap.name) === appCode
1039
+ );
1040
+ },
1041
+ [appKeys],
1042
+ );
1043
+ console.log(canNotRemoveOrg, 'canNotRemove');
1012
1044
  return /*#__PURE__*/ React.createElement(
1013
1045
  React.Fragment,
1014
1046
  null,
@@ -1157,6 +1189,7 @@ var AssignModal = function AssignModal(props) {
1157
1189
  /*#__PURE__*/ React.createElement(
1158
1190
  'a',
1159
1191
  {
1192
+ className: canNotRemoveOrg ? 'disabeld' : '',
1160
1193
  onClick: function onClick() {
1161
1194
  return onRemoveAllOrg();
1162
1195
  },
@@ -1169,46 +1202,50 @@ var AssignModal = function AssignModal(props) {
1169
1202
  {
1170
1203
  className: 'select-menu-list',
1171
1204
  },
1172
- checkedKeys.map(function (item, index) {
1173
- var node = orgMapRef.current[item] || {};
1174
- var path = node.path,
1175
- name = node.name;
1176
- var pathDisplayName = getOrgPathDisplayName(path);
1177
- var disabled = rootNode.key === item;
1178
- return /*#__PURE__*/ React.createElement(
1179
- 'li',
1180
- {
1181
- key: item.value + index,
1182
- className: 'select-menu-list-item',
1183
- },
1184
- /*#__PURE__*/ React.createElement(
1185
- 'span',
1186
- {
1187
- className: 'org-name',
1188
- },
1189
- /*#__PURE__*/ React.createElement(_Ellipsis, {
1190
- title: name,
1191
- }),
1192
- ),
1193
- /*#__PURE__*/ React.createElement(
1194
- 'span',
1205
+ checkedKeys
1206
+ .filter(function (i) {
1207
+ return !!orgMapRef.current[i];
1208
+ })
1209
+ .map(function (item, index) {
1210
+ var node = orgMapRef.current[item] || {};
1211
+ var path = node.path,
1212
+ name = node.name;
1213
+ var pathDisplayName = getOrgPathDisplayName(path);
1214
+ var disabled = rootNode.key === item;
1215
+ return /*#__PURE__*/ React.createElement(
1216
+ 'li',
1195
1217
  {
1196
- className: 'path-name',
1218
+ key: item.value + index,
1219
+ className: 'select-menu-list-item',
1197
1220
  },
1198
- /*#__PURE__*/ React.createElement(_Ellipsis, {
1199
- title: pathDisplayName,
1200
- }),
1201
- ),
1202
- !disabled &&
1203
- /*#__PURE__*/ React.createElement(_Icon, {
1204
- type: 'close',
1205
- className: 'close-icon',
1206
- onClick: function onClick() {
1207
- return onRemoveSingleOrg(node);
1221
+ /*#__PURE__*/ React.createElement(
1222
+ 'span',
1223
+ {
1224
+ className: 'org-name',
1208
1225
  },
1209
- }),
1210
- );
1211
- }) || /*#__PURE__*/ React.createElement(_Empty, null),
1226
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
1227
+ title: name,
1228
+ }),
1229
+ ),
1230
+ /*#__PURE__*/ React.createElement(
1231
+ 'span',
1232
+ {
1233
+ className: 'path-name',
1234
+ },
1235
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
1236
+ title: pathDisplayName,
1237
+ }),
1238
+ ),
1239
+ !disabled &&
1240
+ /*#__PURE__*/ React.createElement(_Icon, {
1241
+ type: 'close',
1242
+ className: 'close-icon',
1243
+ onClick: function onClick() {
1244
+ return onRemoveSingleOrg(node);
1245
+ },
1246
+ }),
1247
+ );
1248
+ }) || /*#__PURE__*/ React.createElement(_Empty, null),
1212
1249
  ),
1213
1250
  ),
1214
1251
  ),
@@ -1311,6 +1348,7 @@ var AssignModal = function AssignModal(props) {
1311
1348
  /*#__PURE__*/ React.createElement(
1312
1349
  'a',
1313
1350
  {
1351
+ className: canNotRemoveApp ? 'disabeld' : '',
1314
1352
  onClick: function onClick() {
1315
1353
  return onRemoveAllApp();
1316
1354
  },
@@ -239,6 +239,41 @@ var AssignModal = function AssignModal(props) {
239
239
  // 渲染Org列表
240
240
  var orgListDomRender = useMemo(
241
241
  function () {
242
+ var renderOrgItem = function renderOrgItem(item, lang) {
243
+ console.log(item, 'item');
244
+ var mapResult = {
245
+ 1: {
246
+ cn: '职能部门',
247
+ en: 'Func. Dept.',
248
+ icon: 'crowd',
249
+ },
250
+ 2: {
251
+ icon: 'corporation',
252
+ },
253
+ };
254
+ var result = mapResult[item === null || item === void 0 ? void 0 : item.orgAttribute] || {};
255
+ return /*#__PURE__*/ React.createElement(
256
+ 'div',
257
+ {
258
+ className: 'org-item-wrapper',
259
+ style: {
260
+ width: '100%',
261
+ },
262
+ },
263
+ /*#__PURE__*/ React.createElement(_Ellipsis, {
264
+ title: item.name,
265
+ widthLimit: String(item.orgAttribute) === '1' ? 'calc(100% - 90px}' : '100%',
266
+ }),
267
+ String(item.orgAttribute) === '1' &&
268
+ /*#__PURE__*/ React.createElement(
269
+ 'span',
270
+ {
271
+ className: 'org-functional-departemt-marker',
272
+ },
273
+ result[lang] || '职能部门',
274
+ ),
275
+ );
276
+ };
242
277
  return (
243
278
  checkedKeys
244
279
  .filter(function (i) {
@@ -289,7 +324,10 @@ var AssignModal = function AssignModal(props) {
289
324
  className: 'org-name',
290
325
  },
291
326
  /*#__PURE__*/ React.createElement(_Ellipsis, {
292
- title: name,
327
+ title: renderOrgItem(
328
+ node,
329
+ props === null || props === void 0 ? void 0 : props.lang,
330
+ ),
293
331
  }),
294
332
  ),
295
333
  /*#__PURE__*/ React.createElement(
@@ -26,7 +26,7 @@
26
26
  display: flex;
27
27
  width: 100%;
28
28
  height: calc(100% - 36px);
29
- padding: 16px;
29
+ padding: 16px 0 16px 16px;
30
30
  background: @fill-color-quaternary;
31
31
  border-radius: @border-radius-base;
32
32
  }
@@ -59,6 +59,7 @@
59
59
  display: flex;
60
60
  align-items: flex-start;
61
61
  justify-content: space-between;
62
+ margin-right: 16px;
62
63
  margin-bottom: 16px;
63
64
  }
64
65
 
@@ -81,6 +82,7 @@
81
82
  display: flex;
82
83
  flex-direction: column;
83
84
  height: 50px;
85
+ margin-right: 8px;
84
86
  margin-bottom: 4px;
85
87
  padding: 4px 16px 4px 8px;
86
88
  border-radius: @border-radius-base;
@@ -206,6 +208,11 @@
206
208
  content: '';
207
209
  }
208
210
  }
211
+
212
+ .disabeld {
213
+ color: rgba(0, 0, 0, 0.25);
214
+ cursor: not-allowed;
215
+ }
209
216
  }
210
217
 
211
218
  .assign-box-container.view-mode {
@@ -295,6 +302,7 @@
295
302
  display: flex;
296
303
  flex-direction: column;
297
304
  height: 50px;
305
+ margin-right: 16px;
298
306
  margin-bottom: 4px !important;
299
307
  padding: 0px;
300
308
  border-radius: @border-radius-base;
@@ -94,7 +94,16 @@ var _dataFormat = function dataFormat(root, cb) {
94
94
  root.path = _toConsumableArray(path);
95
95
  root.show = true;
96
96
  cb && cb(root.key, root);
97
- for (var i = 0; i < root.children.length; i++) {
97
+ for (
98
+ var i = 0;
99
+ i <
100
+ ((_ref = (root === null || root === void 0 ? void 0 : root.children) || []) === null ||
101
+ _ref === void 0
102
+ ? void 0
103
+ : _ref.length);
104
+ i++
105
+ ) {
106
+ var _ref;
98
107
  _dataFormat(root.children[i], path, cb);
99
108
  }
100
109
  };
@@ -108,7 +117,16 @@ export var findSameCodePath = function findSameCodePath(root, code) {
108
117
  return;
109
118
  }
110
119
  if (root.code === code) res = root;
111
- for (var i = 0; i < root.children.length; i++) {
120
+ for (
121
+ var i = 0;
122
+ i <
123
+ ((_ref2 = (root === null || root === void 0 ? void 0 : root.children) || []) === null ||
124
+ _ref2 === void 0
125
+ ? void 0
126
+ : _ref2.length);
127
+ i++
128
+ ) {
129
+ var _ref2;
112
130
  _dfs(root.children[i], code);
113
131
  }
114
132
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tddc/assign-modal",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "description": "assign-modal",
5
5
  "author": "zj <jun.zhang002383@tongdun.net>",
6
6
  "license": "ISC",