vue2-client 1.1.0 → 1.2.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.
- package/.eslintrc.js +81 -81
- package/README.md +4 -2
- package/babel.config.js +14 -14
- package/docs/index.md +29 -29
- package/{src/index.js → index.js} +8 -8
- package/jest.config.js +3 -3
- package/package.json +1 -1
- package/public/index.html +27 -27
- package/src/App.vue +93 -93
- package/src/base-client/all.js +26 -26
- package/src/base-client/components/common/CreateQuery/CreateQuery.vue +4 -4
- package/src/base-client/components/common/CreateQuery/index.md +42 -42
- package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +3 -3
- package/src/base-client/components/common/CreateSimpleFormQuery/index.md +42 -42
- package/src/base-client/components/common/CustomColumnsDrawer/index.md +46 -46
- package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +3 -3
- package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
- package/src/base-client/components/common/FormGroupQuery/index.md +43 -43
- package/src/base-client/components/common/XAddForm/XAddForm.vue +3 -3
- package/src/base-client/components/common/XAddForm/index.md +60 -60
- package/src/base-client/components/common/XBadge/index.md +39 -39
- package/src/base-client/components/common/XCard/index.md +43 -43
- package/src/base-client/components/common/XForm/XForm.vue +2 -2
- package/src/base-client/components/common/XForm/XFormItem.vue +1 -1
- package/src/base-client/components/common/XForm/index.md +3 -3
- package/src/base-client/components/common/XFormCol/index.md +35 -35
- package/src/base-client/components/common/XFormTable/XFormTable.vue +6 -6
- package/src/base-client/components/common/XFormTable/index.md +89 -89
- package/src/base-client/components/common/XTable/XTable.vue +3 -3
- package/src/base-client/components/common/XTable/index.md +3 -3
- package/src/base-client/components/common/XTreeOne/XTreeOne.vue +105 -105
- package/src/base-client/components/iot/CustomerDetailsView/CustomerDetailsView.vue +3 -3
- package/src/base-client/components/iot/CustomerDetailsView/index.md +41 -41
- package/src/base-client/components/iot/DataAnalysisUser/DataAnalysisUser.vue +127 -127
- package/src/base-client/components/iot/DataAnalysisViewGD/DataAnalysisViewGD.vue +5 -5
- package/src/base-client/components/iot/DeviceBrandDetailsView/DeviceBrandDetailsView.vue +3 -3
- package/src/base-client/components/iot/DeviceDetailsView/DeviceDetailsView.vue +3 -3
- package/src/base-client/components/iot/DeviceDetailsView/index.md +43 -43
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsCount.vue +1 -1
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsException.vue +57 -57
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsInstruct.vue +122 -122
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsInstructOperate.vue +4 -4
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsMain.vue +225 -225
- package/src/base-client/components/iot/DeviceDetailsView/part/DeviceDetailsRead.vue +135 -135
- package/src/base-client/components/iot/DeviceTypeDetailsView/DeviceTypeDetailsView.vue +3 -3
- package/src/base-client/components/iot/InstructDetailsView/InstructDetailsView.vue +5 -5
- package/src/base-client/components/iot/InstructDetailsView/index.md +45 -45
- package/src/base-client/components/iot/LogDetailsView/LogDetailsView.vue +3 -3
- package/src/base-client/components/iot/LogDetailsView/index.md +43 -43
- package/src/base-client/components/iot/MeterDetailsView/MeterDetailsView.vue +3 -3
- package/src/base-client/components/iot/MeterDetailsView/index.md +43 -43
- package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsCount.vue +1 -1
- package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsException.vue +3 -3
- package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsHandPlan.vue +3 -3
- package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsInstruct.vue +4 -4
- package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsMain.vue +3 -3
- package/src/base-client/components/iot/MeterDetailsView/part/MeterDetailsSellGas.vue +3 -3
- package/src/base-client/components/iot/WebmeterAnalysisView/WebmeterAnalysisView.vue +4 -4
- package/src/base-client/components/iot/WebmeterAnalysisView/index.md +48 -48
- package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +4 -4
- package/src/base-client/components/system/DictionaryDetailsView/index.md +41 -41
- package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +3 -3
- package/src/base-client/components/ticket/EmployeeDetailsView/EmployeeDetailsView.vue +5 -5
- package/src/base-client/components/ticket/TicketDetailsView/TicketDetailsView.vue +5 -5
- package/src/base-client/components/ticket/TicketDetailsView/part/TicketDetailsFlow.vue +3 -3
- package/src/base-client/components/ticket/TicketSubmitSuccessView/TicketSubmitSuccessView.vue +6 -6
- package/src/base-client/plugins/AppData.js +3 -3
- package/src/base-client/plugins/GetLoginInfoService.js +2 -2
- package/src/base-client/plugins/index.js +4 -4
- package/src/bootstrap.js +4 -4
- package/src/components/Ellipsis/Ellipsis.vue +64 -64
- package/src/components/Ellipsis/index.md +38 -38
- package/src/components/NumberInfo/index.md +43 -43
- package/src/components/STable/README.md +341 -341
- package/src/components/Trend/index.md +45 -45
- package/src/components/cache/AKeepAlive.js +172 -172
- package/src/components/checkbox/index.js +7 -7
- package/src/components/index.js +36 -36
- package/src/components/menu/menu.js +273 -273
- package/src/components/setting/Setting.vue +237 -237
- package/src/components/table/advance/AdvanceTable.vue +275 -275
- package/src/components/transition/PageToggleTransition.vue +97 -97
- package/src/config/default/setting.config.js +33 -33
- package/src/layouts/CommonLayout.vue +42 -42
- package/src/layouts/ComponentLayoutOne.vue +47 -47
- package/src/layouts/PageLayout.vue +151 -151
- package/src/layouts/SinglePageView.vue +74 -74
- package/src/layouts/header/AdminHeader.vue +109 -109
- package/src/layouts/header/HeaderAvatar.vue +60 -60
- package/src/layouts/header/HeaderNotice.vue +1 -1
- package/src/layouts/tabs/TabsHead.vue +190 -190
- package/src/layouts/tabs/TabsView.vue +355 -355
- package/src/main.js +2 -2
- package/src/mock/common/reportData.js +20 -20
- package/src/mock/goods/index.js +108 -108
- package/src/mock/index.js +12 -12
- package/src/mock/project/index.js +17 -17
- package/src/mock/user/current.js +13 -13
- package/src/mock/user/login.js +39 -39
- package/src/mock/user/routes.js +61 -61
- package/src/mock/workplace/index.js +15 -15
- package/src/pages/exception/403.vue +2 -2
- package/src/pages/exception/404.vue +2 -2
- package/src/pages/exception/500.vue +2 -2
- package/src/pages/login/Login.vue +8 -8
- package/src/pages/report/ReportTable.js +125 -125
- package/src/pages/report/ReportTableHome.vue +2 -2
- package/src/pages/resourceManage/resourceManageMain.vue +1 -1
- package/src/pages/system/applyInstallView/Core.vue +570 -570
- package/src/pages/system/applyInstallView/index.vue +34 -34
- package/src/pages/system/dictionary/index.vue +41 -41
- package/src/pages/system/queryParams/index.vue +41 -41
- package/src/router/async/config.async.js +25 -25
- package/src/router/async/router.map.js +13 -13
- package/src/router/guards.js +104 -104
- package/src/router/index.js +2 -2
- package/src/services/api/common.js +1 -1
- package/src/services/api/restTools.js +1 -1
- package/src/services/dataSource.js +12 -12
- package/src/services/user.js +34 -34
- package/src/store/index.js +5 -5
- package/src/store/modules/setting.js +114 -114
- package/src/theme/index.less +5 -5
- package/src/theme/reportTable.less +58 -58
- package/src/utils/i18n.js +80 -80
- package/src/utils/indexedDB.js +1 -1
- package/src/utils/request.js +1 -1
- package/src/utils/routerUtil.js +3 -3
- package/tests/unit/ReportTable.spec.js +2 -2
- package/vue.config.js +1 -0
- package/webpack.config.js +1 -1
- package/src/router/config.js +0 -23
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
# Trend 趋势标记
|
|
2
|
-
|
|
3
|
-
趋势符号,标记上升和下降趋势。通常用绿色代表“好”,红色代表“不好”,股票涨跌场景除外。
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
引用方式:
|
|
8
|
-
|
|
9
|
-
```javascript
|
|
10
|
-
import Trend from '
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
components: {
|
|
14
|
-
Trend
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## 代码演示 [demo](https://pro.loacg.com/test/home)
|
|
22
|
-
|
|
23
|
-
```html
|
|
24
|
-
<trend flag="up">5%</trend>
|
|
25
|
-
```
|
|
26
|
-
或
|
|
27
|
-
```html
|
|
28
|
-
<trend flag="up">
|
|
29
|
-
<span slot="term">工资</span>
|
|
30
|
-
5%
|
|
31
|
-
</trend>
|
|
32
|
-
```
|
|
33
|
-
或
|
|
34
|
-
```html
|
|
35
|
-
<trend flag="up" term="工资">5%</trend>
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
## API
|
|
40
|
-
|
|
41
|
-
| 参数 | 说明 | 类型 | 默认值 |
|
|
42
|
-
|----------|------------------------------------------|-------------|-------|
|
|
43
|
-
| flag | 上升下降标识:`up|down` | string | - |
|
|
44
|
-
| reverseColor | 颜色反转 | Boolean | false |
|
|
45
|
-
|
|
1
|
+
# Trend 趋势标记
|
|
2
|
+
|
|
3
|
+
趋势符号,标记上升和下降趋势。通常用绿色代表“好”,红色代表“不好”,股票涨跌场景除外。
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
引用方式:
|
|
8
|
+
|
|
9
|
+
```javascript
|
|
10
|
+
import Trend from '@vue2-client/components/Trend'
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
components: {
|
|
14
|
+
Trend
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## 代码演示 [demo](https://pro.loacg.com/test/home)
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<trend flag="up">5%</trend>
|
|
25
|
+
```
|
|
26
|
+
或
|
|
27
|
+
```html
|
|
28
|
+
<trend flag="up">
|
|
29
|
+
<span slot="term">工资</span>
|
|
30
|
+
5%
|
|
31
|
+
</trend>
|
|
32
|
+
```
|
|
33
|
+
或
|
|
34
|
+
```html
|
|
35
|
+
<trend flag="up" term="工资">5%</trend>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## API
|
|
40
|
+
|
|
41
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
42
|
+
|----------|------------------------------------------|-------------|-------|
|
|
43
|
+
| flag | 上升下降标识:`up|down` | string | - |
|
|
44
|
+
| reverseColor | 颜色反转 | Boolean | false |
|
|
45
|
+
|
|
@@ -1,172 +1,172 @@
|
|
|
1
|
-
import { isDef, isRegExp, remove } from '
|
|
2
|
-
|
|
3
|
-
const patternTypes = [String, RegExp, Array]
|
|
4
|
-
|
|
5
|
-
function matches (pattern, name) {
|
|
6
|
-
if (Array.isArray(pattern)) {
|
|
7
|
-
if (pattern.indexOf(name) > -1) {
|
|
8
|
-
return true
|
|
9
|
-
} else {
|
|
10
|
-
for (const item of pattern) {
|
|
11
|
-
if (isRegExp(item) && item.test(name)) {
|
|
12
|
-
return true
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return false
|
|
16
|
-
}
|
|
17
|
-
} else if (typeof pattern === 'string') {
|
|
18
|
-
return pattern.split(',').indexOf(name) > -1
|
|
19
|
-
} else if (isRegExp(pattern)) {
|
|
20
|
-
return pattern.test(name)
|
|
21
|
-
}
|
|
22
|
-
/* istanbul ignore next */
|
|
23
|
-
return false
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function getComponentName (opts) {
|
|
27
|
-
return opts && (opts.Ctor.options.name || opts.tag)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function getComponentKey (vnode) {
|
|
31
|
-
const { componentOptions, key } = vnode
|
|
32
|
-
return key == null
|
|
33
|
-
? componentOptions.Ctor.cid + (componentOptions.tag ? `::${componentOptions.tag}` : '')
|
|
34
|
-
: key + componentOptions.Ctor.cid
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function getFirstComponentChild (children) {
|
|
38
|
-
if (Array.isArray(children)) {
|
|
39
|
-
for (let i = 0; i < children.length; i++) {
|
|
40
|
-
const c = children[i]
|
|
41
|
-
if (isDef(c) && (isDef(c.componentOptions) || c.isAsyncPlaceholder)) {
|
|
42
|
-
return c
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function pruneCache (keepAliveInstance, filter) {
|
|
49
|
-
const { cache, keys, _vnode } = keepAliveInstance
|
|
50
|
-
for (const key in cache) {
|
|
51
|
-
const cachedNode = cache[key]
|
|
52
|
-
if (cachedNode) {
|
|
53
|
-
const name = getComponentName(cachedNode.componentOptions)
|
|
54
|
-
const componentKey = getComponentKey(cachedNode)
|
|
55
|
-
if (name && !filter(name, componentKey)) {
|
|
56
|
-
pruneCacheEntry(cache, key, keys, _vnode)
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function pruneCacheEntry2 (cache, key, keys) {
|
|
63
|
-
const cached = cache[key]
|
|
64
|
-
if (cached) {
|
|
65
|
-
cached.componentInstance.$destroy()
|
|
66
|
-
}
|
|
67
|
-
cache[key] = null
|
|
68
|
-
remove(keys, key)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function pruneCacheEntry (cache, key, keys, current) {
|
|
72
|
-
const cached = cache[key]
|
|
73
|
-
if (cached && (!current || cached.tag !== current.tag)) {
|
|
74
|
-
cached.componentInstance.$destroy()
|
|
75
|
-
}
|
|
76
|
-
cache[key] = null
|
|
77
|
-
remove(keys, key)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export default {
|
|
81
|
-
name: 'AKeepAlive',
|
|
82
|
-
abstract: true,
|
|
83
|
-
model: {
|
|
84
|
-
prop: 'clearCaches',
|
|
85
|
-
event: 'clear'
|
|
86
|
-
},
|
|
87
|
-
props: {
|
|
88
|
-
include: patternTypes,
|
|
89
|
-
exclude: patternTypes,
|
|
90
|
-
excludeKeys: patternTypes,
|
|
91
|
-
max: [String, Number],
|
|
92
|
-
clearCaches: Array
|
|
93
|
-
},
|
|
94
|
-
watch: {
|
|
95
|
-
clearCaches: function (val) {
|
|
96
|
-
if (val && val.length > 0) {
|
|
97
|
-
const { cache, keys } = this
|
|
98
|
-
val.forEach(key => {
|
|
99
|
-
pruneCacheEntry2(cache, key, keys)
|
|
100
|
-
})
|
|
101
|
-
this.$emit('clear', [])
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
created () {
|
|
107
|
-
this.cache = Object.create(null)
|
|
108
|
-
this.keys = []
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
destroyed () {
|
|
112
|
-
for (const key in this.cache) {
|
|
113
|
-
pruneCacheEntry(this.cache, key, this.keys)
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
mounted () {
|
|
118
|
-
this.$watch('include', val => {
|
|
119
|
-
pruneCache(this, (name) => matches(val, name))
|
|
120
|
-
})
|
|
121
|
-
this.$watch('exclude', val => {
|
|
122
|
-
pruneCache(this, (name) => !matches(val, name))
|
|
123
|
-
})
|
|
124
|
-
this.$watch('excludeKeys', val => {
|
|
125
|
-
pruneCache(this, (name, key) => !matches(val, key))
|
|
126
|
-
})
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
render () {
|
|
130
|
-
const slot = this.$slots.default
|
|
131
|
-
const vnode = getFirstComponentChild(slot)
|
|
132
|
-
const componentOptions = vnode && vnode.componentOptions
|
|
133
|
-
if (componentOptions) {
|
|
134
|
-
// check pattern
|
|
135
|
-
const name = getComponentName(componentOptions)
|
|
136
|
-
const componentKey = getComponentKey(vnode)
|
|
137
|
-
const { include, exclude, excludeKeys } = this
|
|
138
|
-
if (
|
|
139
|
-
// not included
|
|
140
|
-
(include && (!name || !matches(include, name))) ||
|
|
141
|
-
// excluded
|
|
142
|
-
(exclude && name && matches(exclude, name)) ||
|
|
143
|
-
(excludeKeys && componentKey && matches(excludeKeys, componentKey))
|
|
144
|
-
) {
|
|
145
|
-
return vnode
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const { cache, keys } = this
|
|
149
|
-
const key = vnode.key == null
|
|
150
|
-
// same constructor may get registered as different local components
|
|
151
|
-
// so cid alone is not enough (#3269)
|
|
152
|
-
? componentOptions.Ctor.cid + (componentOptions.tag ? `::${componentOptions.tag}` : '')
|
|
153
|
-
: vnode.key + componentOptions.Ctor.cid
|
|
154
|
-
if (cache[key]) {
|
|
155
|
-
vnode.componentInstance = cache[key].componentInstance
|
|
156
|
-
// make current key freshest
|
|
157
|
-
remove(keys, key)
|
|
158
|
-
keys.push(key)
|
|
159
|
-
} else {
|
|
160
|
-
cache[key] = vnode
|
|
161
|
-
keys.push(key)
|
|
162
|
-
// prune oldest entry
|
|
163
|
-
if (this.max && keys.length > parseInt(this.max)) {
|
|
164
|
-
pruneCacheEntry(cache, keys[0], keys, this._vnode)
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
vnode.data.keepAlive = true
|
|
169
|
-
}
|
|
170
|
-
return vnode || (slot && slot[0])
|
|
171
|
-
}
|
|
172
|
-
}
|
|
1
|
+
import { isDef, isRegExp, remove } from '@vue2-client/utils/util'
|
|
2
|
+
|
|
3
|
+
const patternTypes = [String, RegExp, Array]
|
|
4
|
+
|
|
5
|
+
function matches (pattern, name) {
|
|
6
|
+
if (Array.isArray(pattern)) {
|
|
7
|
+
if (pattern.indexOf(name) > -1) {
|
|
8
|
+
return true
|
|
9
|
+
} else {
|
|
10
|
+
for (const item of pattern) {
|
|
11
|
+
if (isRegExp(item) && item.test(name)) {
|
|
12
|
+
return true
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return false
|
|
16
|
+
}
|
|
17
|
+
} else if (typeof pattern === 'string') {
|
|
18
|
+
return pattern.split(',').indexOf(name) > -1
|
|
19
|
+
} else if (isRegExp(pattern)) {
|
|
20
|
+
return pattern.test(name)
|
|
21
|
+
}
|
|
22
|
+
/* istanbul ignore next */
|
|
23
|
+
return false
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function getComponentName (opts) {
|
|
27
|
+
return opts && (opts.Ctor.options.name || opts.tag)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function getComponentKey (vnode) {
|
|
31
|
+
const { componentOptions, key } = vnode
|
|
32
|
+
return key == null
|
|
33
|
+
? componentOptions.Ctor.cid + (componentOptions.tag ? `::${componentOptions.tag}` : '')
|
|
34
|
+
: key + componentOptions.Ctor.cid
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function getFirstComponentChild (children) {
|
|
38
|
+
if (Array.isArray(children)) {
|
|
39
|
+
for (let i = 0; i < children.length; i++) {
|
|
40
|
+
const c = children[i]
|
|
41
|
+
if (isDef(c) && (isDef(c.componentOptions) || c.isAsyncPlaceholder)) {
|
|
42
|
+
return c
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function pruneCache (keepAliveInstance, filter) {
|
|
49
|
+
const { cache, keys, _vnode } = keepAliveInstance
|
|
50
|
+
for (const key in cache) {
|
|
51
|
+
const cachedNode = cache[key]
|
|
52
|
+
if (cachedNode) {
|
|
53
|
+
const name = getComponentName(cachedNode.componentOptions)
|
|
54
|
+
const componentKey = getComponentKey(cachedNode)
|
|
55
|
+
if (name && !filter(name, componentKey)) {
|
|
56
|
+
pruneCacheEntry(cache, key, keys, _vnode)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function pruneCacheEntry2 (cache, key, keys) {
|
|
63
|
+
const cached = cache[key]
|
|
64
|
+
if (cached) {
|
|
65
|
+
cached.componentInstance.$destroy()
|
|
66
|
+
}
|
|
67
|
+
cache[key] = null
|
|
68
|
+
remove(keys, key)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function pruneCacheEntry (cache, key, keys, current) {
|
|
72
|
+
const cached = cache[key]
|
|
73
|
+
if (cached && (!current || cached.tag !== current.tag)) {
|
|
74
|
+
cached.componentInstance.$destroy()
|
|
75
|
+
}
|
|
76
|
+
cache[key] = null
|
|
77
|
+
remove(keys, key)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default {
|
|
81
|
+
name: 'AKeepAlive',
|
|
82
|
+
abstract: true,
|
|
83
|
+
model: {
|
|
84
|
+
prop: 'clearCaches',
|
|
85
|
+
event: 'clear'
|
|
86
|
+
},
|
|
87
|
+
props: {
|
|
88
|
+
include: patternTypes,
|
|
89
|
+
exclude: patternTypes,
|
|
90
|
+
excludeKeys: patternTypes,
|
|
91
|
+
max: [String, Number],
|
|
92
|
+
clearCaches: Array
|
|
93
|
+
},
|
|
94
|
+
watch: {
|
|
95
|
+
clearCaches: function (val) {
|
|
96
|
+
if (val && val.length > 0) {
|
|
97
|
+
const { cache, keys } = this
|
|
98
|
+
val.forEach(key => {
|
|
99
|
+
pruneCacheEntry2(cache, key, keys)
|
|
100
|
+
})
|
|
101
|
+
this.$emit('clear', [])
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
created () {
|
|
107
|
+
this.cache = Object.create(null)
|
|
108
|
+
this.keys = []
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
destroyed () {
|
|
112
|
+
for (const key in this.cache) {
|
|
113
|
+
pruneCacheEntry(this.cache, key, this.keys)
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
mounted () {
|
|
118
|
+
this.$watch('include', val => {
|
|
119
|
+
pruneCache(this, (name) => matches(val, name))
|
|
120
|
+
})
|
|
121
|
+
this.$watch('exclude', val => {
|
|
122
|
+
pruneCache(this, (name) => !matches(val, name))
|
|
123
|
+
})
|
|
124
|
+
this.$watch('excludeKeys', val => {
|
|
125
|
+
pruneCache(this, (name, key) => !matches(val, key))
|
|
126
|
+
})
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
render () {
|
|
130
|
+
const slot = this.$slots.default
|
|
131
|
+
const vnode = getFirstComponentChild(slot)
|
|
132
|
+
const componentOptions = vnode && vnode.componentOptions
|
|
133
|
+
if (componentOptions) {
|
|
134
|
+
// check pattern
|
|
135
|
+
const name = getComponentName(componentOptions)
|
|
136
|
+
const componentKey = getComponentKey(vnode)
|
|
137
|
+
const { include, exclude, excludeKeys } = this
|
|
138
|
+
if (
|
|
139
|
+
// not included
|
|
140
|
+
(include && (!name || !matches(include, name))) ||
|
|
141
|
+
// excluded
|
|
142
|
+
(exclude && name && matches(exclude, name)) ||
|
|
143
|
+
(excludeKeys && componentKey && matches(excludeKeys, componentKey))
|
|
144
|
+
) {
|
|
145
|
+
return vnode
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const { cache, keys } = this
|
|
149
|
+
const key = vnode.key == null
|
|
150
|
+
// same constructor may get registered as different local components
|
|
151
|
+
// so cid alone is not enough (#3269)
|
|
152
|
+
? componentOptions.Ctor.cid + (componentOptions.tag ? `::${componentOptions.tag}` : '')
|
|
153
|
+
: vnode.key + componentOptions.Ctor.cid
|
|
154
|
+
if (cache[key]) {
|
|
155
|
+
vnode.componentInstance = cache[key].componentInstance
|
|
156
|
+
// make current key freshest
|
|
157
|
+
remove(keys, key)
|
|
158
|
+
keys.push(key)
|
|
159
|
+
} else {
|
|
160
|
+
cache[key] = vnode
|
|
161
|
+
keys.push(key)
|
|
162
|
+
// prune oldest entry
|
|
163
|
+
if (this.max && keys.length > parseInt(this.max)) {
|
|
164
|
+
pruneCacheEntry(cache, keys[0], keys, this._vnode)
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
vnode.data.keepAlive = true
|
|
169
|
+
}
|
|
170
|
+
return vnode || (slot && slot[0])
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import ColorCheckbox from '
|
|
2
|
-
import ImgCheckbox from '
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
ColorCheckbox,
|
|
6
|
-
ImgCheckbox
|
|
7
|
-
}
|
|
1
|
+
import ColorCheckbox from '@vue2-client/components/checkbox/ColorCheckbox'
|
|
2
|
+
import ImgCheckbox from '@vue2-client/components/checkbox/ImgCheckbox'
|
|
3
|
+
|
|
4
|
+
export {
|
|
5
|
+
ColorCheckbox,
|
|
6
|
+
ImgCheckbox
|
|
7
|
+
}
|
package/src/components/index.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
// chart
|
|
2
|
-
import Bar from '
|
|
3
|
-
import ChartCard from '
|
|
4
|
-
import Liquid from '
|
|
5
|
-
import MiniArea from '
|
|
6
|
-
import MiniSmoothArea from '
|
|
7
|
-
import MiniBar from '
|
|
8
|
-
import MiniProgress from '
|
|
9
|
-
import Radar from '
|
|
10
|
-
import RankList from '
|
|
11
|
-
import TransferBar from '
|
|
12
|
-
import TagCloud from '
|
|
13
|
-
|
|
14
|
-
// pro components
|
|
15
|
-
import Ellipsis from '
|
|
16
|
-
import NumberInfo from '
|
|
17
|
-
import STable from '
|
|
18
|
-
import Trend from '
|
|
19
|
-
|
|
20
|
-
export {
|
|
21
|
-
Bar,
|
|
22
|
-
ChartCard,
|
|
23
|
-
Liquid,
|
|
24
|
-
MiniArea,
|
|
25
|
-
MiniSmoothArea,
|
|
26
|
-
MiniBar,
|
|
27
|
-
MiniProgress,
|
|
28
|
-
Radar,
|
|
29
|
-
TagCloud,
|
|
30
|
-
RankList,
|
|
31
|
-
TransferBar,
|
|
32
|
-
Ellipsis,
|
|
33
|
-
NumberInfo,
|
|
34
|
-
STable,
|
|
35
|
-
Trend
|
|
36
|
-
}
|
|
1
|
+
// chart
|
|
2
|
+
import Bar from '@vue2-client/components/Charts/Bar'
|
|
3
|
+
import ChartCard from '@vue2-client/components/Charts/ChartCard'
|
|
4
|
+
import Liquid from '@vue2-client/components/Charts/Liquid'
|
|
5
|
+
import MiniArea from '@vue2-client/components/Charts/MiniArea'
|
|
6
|
+
import MiniSmoothArea from '@vue2-client/components/Charts/MiniSmoothArea'
|
|
7
|
+
import MiniBar from '@vue2-client/components/Charts/MiniBar'
|
|
8
|
+
import MiniProgress from '@vue2-client/components/Charts/MiniProgress'
|
|
9
|
+
import Radar from '@vue2-client/components/Charts/Radar'
|
|
10
|
+
import RankList from '@vue2-client/components/Charts/RankList'
|
|
11
|
+
import TransferBar from '@vue2-client/components/Charts/TransferBar'
|
|
12
|
+
import TagCloud from '@vue2-client/components/Charts/TagCloud'
|
|
13
|
+
|
|
14
|
+
// pro components
|
|
15
|
+
import Ellipsis from '@vue2-client/components/Ellipsis'
|
|
16
|
+
import NumberInfo from '@vue2-client/components/NumberInfo'
|
|
17
|
+
import STable from '@vue2-client/components/STable'
|
|
18
|
+
import Trend from '@vue2-client/components/Trend'
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
Bar,
|
|
22
|
+
ChartCard,
|
|
23
|
+
Liquid,
|
|
24
|
+
MiniArea,
|
|
25
|
+
MiniSmoothArea,
|
|
26
|
+
MiniBar,
|
|
27
|
+
MiniProgress,
|
|
28
|
+
Radar,
|
|
29
|
+
TagCloud,
|
|
30
|
+
RankList,
|
|
31
|
+
TransferBar,
|
|
32
|
+
Ellipsis,
|
|
33
|
+
NumberInfo,
|
|
34
|
+
STable,
|
|
35
|
+
Trend
|
|
36
|
+
}
|