@deepinnet-components/pc 0.0.33 → 0.0.35

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.
@@ -16,6 +16,7 @@ export interface MainProps {
16
16
  hideMemberType?: Boolean;
17
17
  showMemberPilot?: Boolean;
18
18
  canEditPassword?: Boolean;
19
+ orgSortConfig?: any;
19
20
  }
20
21
  declare const Index: React.FC<MainProps>;
21
22
  export default Index;
@@ -73,7 +73,9 @@ var Index = function Index(props) {
73
73
  _props$showMemberPilo = props.showMemberPilot,
74
74
  showMemberPilot = _props$showMemberPilo === void 0 ? false : _props$showMemberPilo,
75
75
  _props$canEditPasswor = props.canEditPassword,
76
- canEditPassword = _props$canEditPasswor === void 0 ? false : _props$canEditPasswor;
76
+ canEditPassword = _props$canEditPasswor === void 0 ? false : _props$canEditPasswor,
77
+ _props$orgSortConfig = props.orgSortConfig,
78
+ orgSortConfig = _props$orgSortConfig === void 0 ? false : _props$orgSortConfig;
77
79
  var _useState = useState(),
78
80
  _useState2 = _slicedToArray(_useState, 2),
79
81
  value = _useState2[0],
@@ -231,7 +233,8 @@ var Index = function Index(props) {
231
233
  hideDeleteAccountBtn: hideDeleteAccountBtn,
232
234
  hideMemberType: hideMemberType,
233
235
  showMemberPilot: showMemberPilot,
234
- canEditPassword: canEditPassword
236
+ canEditPassword: canEditPassword,
237
+ orgSortConfig: orgSortConfig
235
238
  });
236
239
  }, []);
237
240
  if (!value) return null;
@@ -93,7 +93,8 @@ var OrgList = function OrgList() {
93
93
  var ApiService = contextValue.ApiService,
94
94
  Components = contextValue.Components,
95
95
  hideMemberType = contextValue.hideMemberType,
96
- showMemberPilot = contextValue.showMemberPilot;
96
+ showMemberPilot = contextValue.showMemberPilot,
97
+ orgSortConfig = contextValue.orgSortConfig;
97
98
  var _getUrlQuery = getUrlQuery(),
98
99
  id = _getUrlQuery.id;
99
100
  var _useState = useState([]),
@@ -113,7 +114,7 @@ var OrgList = function OrgList() {
113
114
  }
114
115
  function _getOrgList() {
115
116
  _getOrgList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
116
- var _getUrlQuery2, id, params, _ref, success, data, list, _breadcrumb, arr;
117
+ var _getUrlQuery2, id, params, _ref, success, data, _list, bList, list, orderMap, _breadcrumb, arr;
117
118
  return _regeneratorRuntime().wrap(function _callee$(_context) {
118
119
  while (1) switch (_context.prev = _context.next) {
119
120
  case 0:
@@ -129,8 +130,24 @@ var OrgList = function OrgList() {
129
130
  success = _ref.success;
130
131
  data = _ref.data;
131
132
  if (success) {
132
- list = data || [];
133
- if (list !== null && list !== void 0 && list.length) {
133
+ bList = data || [];
134
+ if (orgSortConfig) {
135
+ // 创建 id 到排序权重的映射
136
+ orderMap = new Map();
137
+ orgSortConfig.forEach(function (id, index) {
138
+ orderMap.set(id, index);
139
+ });
140
+ // 排序
141
+ bList.sort(function (a, b) {
142
+ var aOrder = orderMap.has(a.id) ? orderMap.get(a.id) : Infinity;
143
+ var bOrder = orderMap.has(b.id) ? orderMap.get(b.id) : Infinity;
144
+ return aOrder - bOrder;
145
+ });
146
+ list = bList;
147
+ } else {
148
+ list = bList;
149
+ }
150
+ if ((_list = list) !== null && _list !== void 0 && _list.length) {
134
151
  if (id) {
135
152
  list[0].showType = 1;
136
153
  list[0].isFirst = true;
@@ -464,24 +481,23 @@ var OrgList = function OrgList() {
464
481
  rowKey: "key",
465
482
  scroll: {
466
483
  x: 1200
467
- }
468
- // expandable={{
469
- // defaultExpandAllRows: true, // 为啥不生效
470
- // defaultExpandedRowKeys: expandedRowKeys,
471
- // expandedRowKeys,
472
- // onExpand: (flag, row) => {
473
- // if (flag) {
474
- // setExpandedRowKeys([...expandedRowKeys, row.key]);
475
- // } else {
476
- // setExpandedRowKeys(
477
- // [...expandedRowKeys].filter((item) => item !== row.key),
478
- // );
479
- // }
480
- // },
481
- // childrenColumnName: 'listChildren',
482
- // indentSize: 50,
483
- // }}
484
- ,
484
+ },
485
+ expandable: {
486
+ // defaultExpandAllRows: true, // 为啥不生效
487
+ // defaultExpandedRowKeys: expandedRowKeys,
488
+ // expandedRowKeys,
489
+ // onExpand: (flag, row) => {
490
+ // if (flag) {
491
+ // setExpandedRowKeys([...expandedRowKeys, row.key]);
492
+ // } else {
493
+ // setExpandedRowKeys(
494
+ // [...expandedRowKeys].filter((item) => item !== row.key),
495
+ // );
496
+ // }
497
+ // },
498
+ childrenColumnName: 'listChildren',
499
+ indentSize: 50
500
+ },
485
501
  loading: loading
486
502
  })), /*#__PURE__*/React.createElement(CreateOrg, {
487
503
  isStart: orgModalInfo.isStart,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepinnet-components/pc",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",