@gm-pc/react 1.12.0 → 1.12.3
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.
- package/package.json +3 -3
- package/src/component/price/price.tsx +4 -0
- package/src/component/v_browser/ui/index.tsx +1 -1
- package/src/component/v_browser/ui/style.less +1 -0
- package/src/component/v_browser/ui/window_wrapper.tsx +23 -15
- package/src/component/v_browser/v_browser.stories.mdx +3 -5
- package/src/component/v_browser/v_browser.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gm-pc/react",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.3",
|
|
4
4
|
"description": "观麦前端基础组件库",
|
|
5
5
|
"author": "liyatang <liyatang@qq.com>",
|
|
6
6
|
"homepage": "https://github.com/gmfe/gm-pc#readme",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@gm-common/hooks": "^2.10.0",
|
|
26
26
|
"@gm-common/tool": "^2.10.0",
|
|
27
|
-
"@gm-pc/locales": "^1.12.
|
|
27
|
+
"@gm-pc/locales": "^1.12.3",
|
|
28
28
|
"big.js": "^6.0.1",
|
|
29
29
|
"classnames": "^2.2.5",
|
|
30
30
|
"lodash": "^4.17.19",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"react-router-dom": "^5.2.0",
|
|
49
49
|
"react-window": "^1.8.5"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "6d41c2327367cc74256512fdf7bc247419ad0afa"
|
|
52
52
|
}
|
|
@@ -101,6 +101,10 @@ class Price extends Component<PriceProps> {
|
|
|
101
101
|
keepZero: boolean,
|
|
102
102
|
isFenUnit: boolean
|
|
103
103
|
): string => {
|
|
104
|
+
if (isNaN(value)) {
|
|
105
|
+
console.trace('value can not be NaN')
|
|
106
|
+
return ''
|
|
107
|
+
}
|
|
104
108
|
const divRatio = isFenUnit ? 100 : 1
|
|
105
109
|
const result = Big(Math.abs(value)).div(divRatio).toFixed(precision)
|
|
106
110
|
return keepZero ? result : `${parseFloat(result)}`
|
|
@@ -169,7 +169,7 @@ const VBrowserContainer: FC<{ className?: string }> = observer(
|
|
|
169
169
|
|
|
170
170
|
<div
|
|
171
171
|
className={classNames('v-browser-tabs-right tw-font-sm tw-px-2.5', {
|
|
172
|
-
disabled: state.scrollWidth - state.width - state.scrollLeft
|
|
172
|
+
disabled: state.scrollWidth - state.width - state.scrollLeft < 1,
|
|
173
173
|
'tw-hidden': state.width === state.scrollWidth,
|
|
174
174
|
})}
|
|
175
175
|
// onClick={(e) => {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { get } from 'lodash'
|
|
3
3
|
import { observer } from 'mobx-react'
|
|
4
4
|
import React, { createRef, FC, useContext, useEffect } from 'react'
|
|
5
|
+
import { NProgress } from '../../n_progress'
|
|
5
6
|
import BrowserContext from '../context/browser'
|
|
6
7
|
import { CacheItem } from '../types'
|
|
7
8
|
import { pages } from '../v_browser'
|
|
@@ -32,21 +33,28 @@ const WindowWrapper: FC<WindowWrapperProps> = ({ path }) => {
|
|
|
32
33
|
// 创建缓存
|
|
33
34
|
const page = pages.find((p) => p.path === path)
|
|
34
35
|
if (!page) throw new Error('[VBrowser] page not found: ' + path)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
36
|
+
|
|
37
|
+
NProgress.start()
|
|
38
|
+
page
|
|
39
|
+
.loader()
|
|
40
|
+
.then((module) => {
|
|
41
|
+
const Component = module.default
|
|
42
|
+
const vNode = (
|
|
43
|
+
<div
|
|
44
|
+
className='v-browser-window-content'
|
|
45
|
+
data-vbrowser-window={path}
|
|
46
|
+
ref={createRef()}
|
|
47
|
+
>
|
|
48
|
+
<Component />
|
|
49
|
+
</div>
|
|
50
|
+
) as CacheItem['vNode']
|
|
51
|
+
browser['_setCache'](path, { vNode })
|
|
52
|
+
browser['_fire']('show', w!)
|
|
53
|
+
return null
|
|
54
|
+
})
|
|
55
|
+
.finally(() => {
|
|
56
|
+
NProgress.done()
|
|
57
|
+
})
|
|
50
58
|
return
|
|
51
59
|
}
|
|
52
60
|
|
|
@@ -34,6 +34,8 @@ const vbrowser = new VBrowser({
|
|
|
34
34
|
onError?: (error: { code: number; message: string }) => void
|
|
35
35
|
/** 打开窗口如果没有传入标题,则使用此方法取标题 */
|
|
36
36
|
autoTitle?: (path: string) => string
|
|
37
|
+
/** 不以子窗口形式展示的页面名单(视觉上), 这些页面会子窗口形式打开,但是视觉上会隐藏子窗口标签栏,且在离开页面时自动close掉,以达到子页面不在vbrowser中的视觉效果 */
|
|
38
|
+
ignoredPath?: Array<string | RegExp>
|
|
37
39
|
})
|
|
38
40
|
```
|
|
39
41
|
|
|
@@ -43,7 +45,7 @@ vbrowser 暴露了以下属性和方法,详细信息见类型声明/代码提
|
|
|
43
45
|
|
|
44
46
|
- `props`
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
实例化传入的参数;
|
|
47
49
|
|
|
48
50
|
- `windows`
|
|
49
51
|
|
|
@@ -65,10 +67,6 @@ vbrowser 暴露了以下属性和方法,详细信息见类型声明/代码提
|
|
|
65
67
|
|
|
66
68
|
`ui`是否已挂载;
|
|
67
69
|
|
|
68
|
-
- `ignoredPath`
|
|
69
|
-
|
|
70
|
-
不以子窗口形式展示的页面名单(视觉上), 这些页面会子窗口形式打开,但是视觉上会隐藏子窗口标签栏,且在离开页面时自动 close 掉,以达到子页面不在 vbrowser 中的视觉效果
|
|
71
|
-
|
|
72
70
|
方法
|
|
73
71
|
|
|
74
72
|
- `open`
|
|
@@ -172,7 +172,7 @@ class VBrowser implements VBrowser {
|
|
|
172
172
|
const originWindows = this.windows.slice()
|
|
173
173
|
const activeWindow = this.activeWindow
|
|
174
174
|
this.windows.splice(i, 1)
|
|
175
|
-
delete this._cache[i]
|
|
175
|
+
delete this._cache[originWindows[i].path]
|
|
176
176
|
if (this.activeIndex === i) {
|
|
177
177
|
const left = originWindows.slice(0, i).reverse()[0]
|
|
178
178
|
const right = originWindows.slice(i + 1, originWindows.length)[0]
|