@vtx/modals2 5.0.58 → 5.0.60

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.
@@ -22,6 +22,6 @@ var VmCustom = function VmCustom(_ref) {
22
22
  border: 'none',
23
23
  overflowY: 'auto'
24
24
  }
25
- });
25
+ }, url);
26
26
  };
27
27
  export default VmCustom;
@@ -106,7 +106,7 @@ var PieCharts = function PieCharts(_ref) {
106
106
  var info = dataList[index] || {};
107
107
  var value = info.value;
108
108
  var percent = getPercentValue(_.map(dataList, 'value'), index, 2);
109
- return "{name|".concat(name.slice(0, nameLength)).concat(name.length > nameLength ? '...' : '', "}{number|").concat(value || 0).concat(unit || '', "}{space|}{percent|").concat(percent, "%}");
109
+ return "{name|".concat(name.slice(0, nameLength)).concat(name.length > nameLength ? '...' : '', "}{number|").concat(value || 0).concat(unit || '', "}{space|}{percent|").concat(percent || 0, "%}");
110
110
  },
111
111
  tooltip: {
112
112
  show: true
@@ -21,6 +21,22 @@ import { getTenantById, getUmsConfig } from "./service";
21
21
  import "./style";
22
22
  import VmTabs from "./Tabs";
23
23
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
24
+ var getTabContent = function getTabContent(contents, tabKey) {
25
+ if (!tabKey) {
26
+ return undefined;
27
+ }
28
+ if (Object.prototype.hasOwnProperty.call(contents, tabKey)) {
29
+ return contents[tabKey];
30
+ }
31
+ var keyParts = "".concat(tabKey).split('-');
32
+ for (var index = 1; index < keyParts.length; index++) {
33
+ var suffixKey = keyParts.slice(index).join('-');
34
+ if (Object.prototype.hasOwnProperty.call(contents, suffixKey)) {
35
+ return contents[suffixKey];
36
+ }
37
+ }
38
+ return undefined;
39
+ };
24
40
  var VmBaseModal = function VmBaseModal(props) {
25
41
  var _props$tabs = props.tabs,
26
42
  tabs = _props$tabs === void 0 ? [] : _props$tabs,
@@ -100,6 +116,21 @@ var VmBaseModal = function VmBaseModal(props) {
100
116
  }
101
117
  }
102
118
  }, [JSON.stringify(tabs), tabChose]);
119
+ var activeTabKey = useMemo(function () {
120
+ var _tabs$;
121
+ if (currentTabKey && tabs.find(function (item) {
122
+ return item.key === currentTabKey;
123
+ })) {
124
+ return currentTabKey;
125
+ }
126
+ if (tabChose && tabs.find(function (item) {
127
+ return item.key === tabChose;
128
+ })) {
129
+ return tabChose;
130
+ }
131
+ return ((_tabs$ = tabs[0]) === null || _tabs$ === void 0 ? void 0 : _tabs$.key) || currentTabKey;
132
+ }, [currentTabKey, JSON.stringify(tabs), tabChose]);
133
+ var activeContent = getTabContent(contents, activeTabKey);
103
134
  var onCancel = function onCancel() {
104
135
  if (props.onCancel && typeof props.onCancel === 'function') {
105
136
  props.onCancel();
@@ -188,7 +219,7 @@ var VmBaseModal = function VmBaseModal(props) {
188
219
  onChange: function onChange(key) {
189
220
  setCurrentTabKey(key);
190
221
  },
191
- active: currentTabKey,
222
+ active: activeTabKey,
192
223
  theme: theme
193
224
  }), /*#__PURE__*/_jsx(VtxThemeProvider, {
194
225
  value: value,
@@ -196,7 +227,7 @@ var VmBaseModal = function VmBaseModal(props) {
196
227
  className: 'vm-base-modal-content-wrap',
197
228
  children: /*#__PURE__*/_jsx("div", {
198
229
  className: 'vm-base-modal-content',
199
- children: contents[currentTabKey]
230
+ children: activeContent
200
231
  })
201
232
  })
202
233
  })]
@@ -210,7 +241,7 @@ var VmBaseModal = function VmBaseModal(props) {
210
241
  className: 'vm-base-modal-content-wrap',
211
242
  children: /*#__PURE__*/_jsx("div", {
212
243
  className: 'vm-base-modal-content',
213
- children: contents[currentTabKey]
244
+ children: activeContent
214
245
  })
215
246
  })
216
247
  })
@@ -97,7 +97,7 @@ var Info = function Info(_ref) {
97
97
  var list = [{
98
98
  name: '今日行驶',
99
99
  unit: 'km',
100
- value: (info === null || info === void 0 ? void 0 : info.mileage) || 0,
100
+ value: (info === null || info === void 0 ? void 0 : info.accuMileage) || 0,
101
101
  img: showListImg ? isDark ? darkRunIcon : runIcon : null,
102
102
  fontType: 'blue'
103
103
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtx/modals2",
3
- "version": "5.0.58",
3
+ "version": "5.0.60",
4
4
  "description": "弹窗组件",
5
5
  "license": "MIT",
6
6
  "module": "lib/index.js",