sh-view 2.8.1 → 2.8.2
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 +25 -20
- package/other.js +8 -8
- package/package.json +9 -6
- package/packages/components/index.js +91 -91
- package/packages/components/sh-alert/alert.ts +30 -0
- package/packages/components/sh-alert/index.vue +143 -168
- package/packages/components/sh-badge/index.vue +242 -242
- package/packages/components/sh-calendar/index.vue +650 -650
- package/packages/components/sh-card/index.vue +148 -148
- package/packages/components/sh-code-editor/index.vue +19 -19
- package/packages/components/sh-col/index.vue +92 -92
- package/packages/components/sh-corner/index.vue +230 -230
- package/packages/components/sh-count-to/index.vue +131 -131
- package/packages/components/sh-date/index.vue +301 -301
- package/packages/components/sh-drawer/index.vue +579 -579
- package/packages/components/sh-drawer/scrollbar.js +78 -78
- package/packages/components/sh-empty/index.vue +42 -42
- package/packages/components/sh-form/js/props.js +76 -76
- package/packages/components/sh-form/js/useForm.js +229 -229
- package/packages/components/sh-header/index.vue +261 -260
- package/packages/components/sh-icon/css/default/ionicons.svg +869 -869
- package/packages/components/sh-icon/css/font/iconfont.json +247 -247
- package/packages/components/sh-icon/index.vue +41 -41
- package/packages/components/sh-image/index.vue +133 -133
- package/packages/components/sh-list/index.vue +146 -146
- package/packages/components/sh-loading/index.vue +53 -53
- package/packages/components/sh-modal/index.vue +188 -188
- package/packages/components/sh-noticebar/index.vue +215 -215
- package/packages/components/sh-poptip/index.vue +597 -597
- package/packages/components/sh-progress/index.vue +276 -276
- package/packages/components/sh-pull-refresh/index.vue +289 -289
- package/packages/components/sh-result/index.vue +114 -114
- package/packages/components/sh-row/index.vue +66 -66
- package/packages/components/sh-split/components/trigger.vue +33 -33
- package/packages/components/sh-split/index.vue +342 -342
- package/packages/components/sh-table/components/importModal.vue +363 -363
- package/packages/components/sh-table/components/sh-column.vue +68 -68
- package/packages/components/sh-table/js/excel_to_json.js +313 -313
- package/packages/components/sh-table/js/props.js +305 -305
- package/packages/components/sh-table/js/tableMethods.js +167 -167
- package/packages/components/sh-table/js/useTable.js +636 -636
- package/packages/components/sh-table/table.vue +217 -217
- package/packages/components/sh-tabs/index.vue +426 -426
- package/packages/components/sh-tag/index.vue +168 -168
- package/packages/components/sh-toolbar/index.vue +182 -182
- package/packages/components/sh-tree/components/table-tree.vue +289 -289
- package/packages/components/sh-tree/mixin/treeProps.js +122 -122
- package/packages/components/sh-upload/index.vue +535 -535
- package/packages/components/sh-water-fall/index.vue +80 -80
- package/packages/components/sh-water-mark/index.vue +96 -96
- package/packages/css/index.js +4 -4
- package/packages/directive/index.js +19 -19
- package/packages/directive/module/click-out.js +14 -14
- package/packages/directive/module/draggable.js +42 -42
- package/packages/directive/module/line-clamp.js +22 -22
- package/packages/directive/module/prevent-click.js +18 -18
- package/packages/directive/module/resize.js +14 -14
- package/packages/directive/module/ripple.js +166 -166
- package/packages/index.js +39 -39
- package/packages/mixin/index.js +86 -86
- package/packages/other/sh-cron-modal/components/cron-content.vue +294 -294
- package/packages/other/sh-cron-modal/index.vue +81 -81
- package/packages/other/sh-cron-modal/mixin/cron-emits.js +1 -1
- package/packages/other/sh-cron-modal/mixin/cron-props.js +9 -9
- package/packages/other/sh-cron-modal/tabs/cron-week-box.vue +126 -126
- package/packages/other/sh-menu/index.vue +326 -326
- package/packages/other/sh-menu/menu-group-content.vue +136 -136
- package/packages/other/sh-menu/menu-item-content.vue +71 -71
- package/packages/other/sh-menu-card/index.vue +250 -250
- package/packages/other/sh-menu-card/menu-box.vue +87 -87
- package/packages/other/sh-preview/components/sh-excel.vue +163 -163
- package/packages/other/sh-preview/js/data-hook.js +41 -41
- package/packages/other/sh-preview/js/data-props.js +15 -15
- package/packages/other/sh-system-tip/index.vue +115 -115
- package/packages/utils/resize.js +69 -70
- package/packages/utils/transfer-queue.js +12 -12
- package/packages/vxeTable/index.js +193 -184
- package/packages/vxeTable/plugins/export.js +450 -450
- package/packages/vxeTable/render/cell/vxe-render-img.vue +27 -27
- package/packages/vxeTable/render/cell/vxe-render-table.vue +51 -51
- package/packages/vxeTable/render/cell/vxe-render-time.vue +44 -44
- package/packages/vxeTable/render/cell/vxe-render-tree.vue +70 -70
- package/packages/vxeTable/render/filters/vxe-filter-input.vue +26 -26
- package/packages/vxeTable/render/filters/vxe-filter-time.vue +26 -26
- package/packages/vxeTable/render/globalRenders.jsx +514 -514
- package/packages/vxeTable/render/mixin/cell-hooks.js +198 -198
- package/packages/vxeTable/render/mixin/cell-props.js +23 -23
- package/packages/vxeTable/render/mixin/filter-hooks.js +46 -46
- package/tsconfig.json +25 -0
- package/types/component.d.ts +1 -0
- package/types/index.ts +0 -0
package/.eslintrc.js
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
root: true,
|
|
3
|
-
env: {
|
|
4
|
-
node: true
|
|
5
|
-
},
|
|
6
|
-
extends: ['plugin:vue/vue3-recommended', 'plugin:prettier/recommended'],
|
|
7
|
-
plugins: ['vue', 'prettier'],
|
|
8
|
-
parserOptions: {
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
rules: {
|
|
12
|
-
'prettier/prettier': 'error',
|
|
13
|
-
'
|
|
14
|
-
'no-
|
|
15
|
-
'no-
|
|
16
|
-
'no-
|
|
17
|
-
'
|
|
18
|
-
'vue/
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
env: {
|
|
4
|
+
node: true
|
|
5
|
+
},
|
|
6
|
+
extends: ['plugin:vue/vue3-essential', '@vue/typescript/recommended', 'plugin:prettier/recommended'],
|
|
7
|
+
plugins: ['vue', 'prettier'],
|
|
8
|
+
parserOptions: {
|
|
9
|
+
ecmaVersion: 2020
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
'prettier/prettier': 'error',
|
|
13
|
+
'prefer-const': 'off',
|
|
14
|
+
'no-console': 'off',
|
|
15
|
+
'no-debugger': 'off',
|
|
16
|
+
'no-unused-vars': 'off',
|
|
17
|
+
'no-empty': 'off',
|
|
18
|
+
'vue/no-v-html': 'off',
|
|
19
|
+
'vue/require-default-prop': 'off',
|
|
20
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
21
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
22
|
+
'@typescript-eslint/no-empty-interface': 'off',
|
|
23
|
+
'@typescript-eslint/no-unused-vars': 'off'
|
|
24
|
+
}
|
|
25
|
+
}
|
package/other.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineAsyncComponent } from 'vue'
|
|
2
|
-
|
|
3
|
-
export const ShCronModal = defineAsyncComponent(() => import('./packages/other/sh-cron-modal/index.vue'))
|
|
4
|
-
export const ShMarkdown = defineAsyncComponent(() => import('./packages/other/sh-markdown/index.vue'))
|
|
5
|
-
export const ShMenu = defineAsyncComponent(() => import('./packages/other/sh-menu/index.vue'))
|
|
6
|
-
export const ShMenuCard = defineAsyncComponent(() => import('./packages/other/sh-menu-card/index.vue'))
|
|
7
|
-
export const ShPreview = defineAsyncComponent(() => import('./packages/other/sh-preview/index.vue'))
|
|
8
|
-
export const ShSystemTip = defineAsyncComponent(() => import('./packages/other/sh-system-tip/index.vue'))
|
|
1
|
+
import { defineAsyncComponent } from 'vue'
|
|
2
|
+
|
|
3
|
+
export const ShCronModal = defineAsyncComponent(() => import('./packages/other/sh-cron-modal/index.vue'))
|
|
4
|
+
export const ShMarkdown = defineAsyncComponent(() => import('./packages/other/sh-markdown/index.vue'))
|
|
5
|
+
export const ShMenu = defineAsyncComponent(() => import('./packages/other/sh-menu/index.vue'))
|
|
6
|
+
export const ShMenuCard = defineAsyncComponent(() => import('./packages/other/sh-menu-card/index.vue'))
|
|
7
|
+
export const ShPreview = defineAsyncComponent(() => import('./packages/other/sh-preview/index.vue'))
|
|
8
|
+
export const ShSystemTip = defineAsyncComponent(() => import('./packages/other/sh-system-tip/index.vue'))
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sh-view",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.2",
|
|
4
4
|
"description": "基于vxe-table二次封装,更包含Alert,Badge,Card,CodeEditor,Col,Corner,CountTo,Drawer,Empty,Form,Header,Icon,List,Loading,Modal,Noticebar,Poptip,Progress,PullRefresh,Query,Result,Row,Split,Grid,Table,Tabs,Tag,Toolbar,Tree,Upload,WaterFall,WaterMark等丰富组件库",
|
|
5
5
|
"main": "packages/index.js",
|
|
6
|
+
"typings": "types/index.d.ts",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"serve": "vue-cli-service serve",
|
|
8
9
|
"build": "vue-cli-service build",
|
|
@@ -42,22 +43,24 @@
|
|
|
42
43
|
"xe-utils": "^3.5.13"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "^6.9.0",
|
|
47
|
+
"@typescript-eslint/parser": "^6.9.0",
|
|
47
48
|
"@vue/cli-plugin-babel": "~5.0.8",
|
|
48
49
|
"@vue/cli-plugin-eslint": "~5.0.8",
|
|
49
50
|
"@vue/cli-plugin-router": "~5.0.8",
|
|
51
|
+
"@vue/cli-plugin-typescript": "^5.0.8",
|
|
50
52
|
"@vue/cli-plugin-vuex": "~5.0.8",
|
|
51
53
|
"@vue/cli-service": "~5.0.8",
|
|
54
|
+
"@vue/eslint-config-typescript": "^12.0.0",
|
|
52
55
|
"babel-loader": "^9.1.2",
|
|
53
56
|
"compression-webpack-plugin": "~6.1.1",
|
|
54
57
|
"eslint": "^7.32.0",
|
|
55
58
|
"eslint-config-prettier": "^8.3.0",
|
|
56
59
|
"eslint-plugin-prettier": "^4.0.0",
|
|
57
|
-
"eslint-plugin-vue": "^
|
|
58
|
-
"node-polyfill-webpack-plugin": "^2.0.1",
|
|
60
|
+
"eslint-plugin-vue": "^9.0.0",
|
|
59
61
|
"prettier": "^2.4.1",
|
|
60
62
|
"sass": "^1.32.7",
|
|
61
|
-
"sass-loader": "^12.0.0"
|
|
63
|
+
"sass-loader": "^12.0.0",
|
|
64
|
+
"typescript": "^5.2.2"
|
|
62
65
|
}
|
|
63
66
|
}
|
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
// 全局公共封装组件
|
|
2
|
-
import ShAlert from './sh-alert/index.vue'
|
|
3
|
-
import ShBadge from './sh-badge/index.vue'
|
|
4
|
-
import ShCalendar from './sh-calendar/index.vue'
|
|
5
|
-
import ShCard from './sh-card/index.vue'
|
|
6
|
-
import ShCodeEditor from './sh-code-editor/index.vue'
|
|
7
|
-
import ShCol from './sh-col/index.vue'
|
|
8
|
-
import ShCorner from './sh-corner/index.vue'
|
|
9
|
-
import ShCountTo from './sh-count-to/index.vue'
|
|
10
|
-
import ShDate from './sh-date/index.vue'
|
|
11
|
-
import ShDrawer from './sh-drawer/index.vue'
|
|
12
|
-
import ShEmpty from './sh-empty/index.vue'
|
|
13
|
-
import ShForm from './sh-form/form.vue'
|
|
14
|
-
import ShHeader from './sh-header/index.vue'
|
|
15
|
-
import ShIcon from './sh-icon/index.vue'
|
|
16
|
-
import ShImage from './sh-image/index.vue'
|
|
17
|
-
import ShList from './sh-list/index.vue'
|
|
18
|
-
import ShLoading from './sh-loading/index.vue'
|
|
19
|
-
import ShModal from './sh-modal/index.vue'
|
|
20
|
-
import ShNoticebar from './sh-noticebar/index.vue'
|
|
21
|
-
import ShPoptip from './sh-poptip/index.vue'
|
|
22
|
-
import ShProgress from './sh-progress/index.vue'
|
|
23
|
-
import ShPullRefresh from './sh-pull-refresh/index.vue'
|
|
24
|
-
import ShQuery from './sh-form/query.vue'
|
|
25
|
-
import ShResult from './sh-result/index.vue'
|
|
26
|
-
import ShRow from './sh-row/index.vue'
|
|
27
|
-
import ShSplit from './sh-split/index.vue'
|
|
28
|
-
import ShGrid from './sh-table/grid.vue'
|
|
29
|
-
import ShTable from './sh-table/table.vue'
|
|
30
|
-
import ShTabs from './sh-tabs/index.vue'
|
|
31
|
-
import ShTag from './sh-tag/index.vue'
|
|
32
|
-
import ShToolbar from './sh-toolbar/index.vue'
|
|
33
|
-
import ShTree from './sh-tree/index.vue'
|
|
34
|
-
import ShUpload from './sh-upload/index.vue'
|
|
35
|
-
import ShWaterFall from './sh-water-fall/index.vue'
|
|
36
|
-
import ShWaterMark from './sh-water-mark/index.vue'
|
|
37
|
-
import { VxeButton, VxeInput, VxeTextarea, VxeSelect } from 'vxe-table'
|
|
38
|
-
|
|
39
|
-
const components = {
|
|
40
|
-
ShAlert,
|
|
41
|
-
ShBadge,
|
|
42
|
-
ShCalendar,
|
|
43
|
-
ShCard,
|
|
44
|
-
ShCodeEditor,
|
|
45
|
-
ShCol,
|
|
46
|
-
ShCorner,
|
|
47
|
-
ShCountTo,
|
|
48
|
-
ShDate,
|
|
49
|
-
ShDrawer,
|
|
50
|
-
ShEmpty,
|
|
51
|
-
ShForm,
|
|
52
|
-
ShHeader,
|
|
53
|
-
ShIcon,
|
|
54
|
-
ShImage,
|
|
55
|
-
ShList,
|
|
56
|
-
ShLoading,
|
|
57
|
-
ShModal,
|
|
58
|
-
ShNoticebar,
|
|
59
|
-
ShPoptip,
|
|
60
|
-
ShProgress,
|
|
61
|
-
ShPullRefresh,
|
|
62
|
-
ShQuery,
|
|
63
|
-
ShResult,
|
|
64
|
-
ShRow,
|
|
65
|
-
ShSplit,
|
|
66
|
-
ShGrid,
|
|
67
|
-
ShTable,
|
|
68
|
-
ShTabs,
|
|
69
|
-
ShTag,
|
|
70
|
-
ShToolbar,
|
|
71
|
-
ShTree,
|
|
72
|
-
ShUpload,
|
|
73
|
-
ShWaterFall,
|
|
74
|
-
ShWaterMark,
|
|
75
|
-
|
|
76
|
-
ShButton: VxeButton,
|
|
77
|
-
ShInput: VxeInput,
|
|
78
|
-
ShTextarea: VxeTextarea,
|
|
79
|
-
ShSelect: VxeSelect
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const index = {
|
|
83
|
-
install(Vue, { excludeComponents = [] }) {
|
|
84
|
-
let globalComponentKeys = Object.keys(components).filter(key => !excludeComponents.includes(key))
|
|
85
|
-
globalComponentKeys.forEach(key => {
|
|
86
|
-
Vue.component(key, components[key])
|
|
87
|
-
})
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export default index
|
|
1
|
+
// 全局公共封装组件
|
|
2
|
+
import ShAlert from './sh-alert/index.vue'
|
|
3
|
+
import ShBadge from './sh-badge/index.vue'
|
|
4
|
+
import ShCalendar from './sh-calendar/index.vue'
|
|
5
|
+
import ShCard from './sh-card/index.vue'
|
|
6
|
+
import ShCodeEditor from './sh-code-editor/index.vue'
|
|
7
|
+
import ShCol from './sh-col/index.vue'
|
|
8
|
+
import ShCorner from './sh-corner/index.vue'
|
|
9
|
+
import ShCountTo from './sh-count-to/index.vue'
|
|
10
|
+
import ShDate from './sh-date/index.vue'
|
|
11
|
+
import ShDrawer from './sh-drawer/index.vue'
|
|
12
|
+
import ShEmpty from './sh-empty/index.vue'
|
|
13
|
+
import ShForm from './sh-form/form.vue'
|
|
14
|
+
import ShHeader from './sh-header/index.vue'
|
|
15
|
+
import ShIcon from './sh-icon/index.vue'
|
|
16
|
+
import ShImage from './sh-image/index.vue'
|
|
17
|
+
import ShList from './sh-list/index.vue'
|
|
18
|
+
import ShLoading from './sh-loading/index.vue'
|
|
19
|
+
import ShModal from './sh-modal/index.vue'
|
|
20
|
+
import ShNoticebar from './sh-noticebar/index.vue'
|
|
21
|
+
import ShPoptip from './sh-poptip/index.vue'
|
|
22
|
+
import ShProgress from './sh-progress/index.vue'
|
|
23
|
+
import ShPullRefresh from './sh-pull-refresh/index.vue'
|
|
24
|
+
import ShQuery from './sh-form/query.vue'
|
|
25
|
+
import ShResult from './sh-result/index.vue'
|
|
26
|
+
import ShRow from './sh-row/index.vue'
|
|
27
|
+
import ShSplit from './sh-split/index.vue'
|
|
28
|
+
import ShGrid from './sh-table/grid.vue'
|
|
29
|
+
import ShTable from './sh-table/table.vue'
|
|
30
|
+
import ShTabs from './sh-tabs/index.vue'
|
|
31
|
+
import ShTag from './sh-tag/index.vue'
|
|
32
|
+
import ShToolbar from './sh-toolbar/index.vue'
|
|
33
|
+
import ShTree from './sh-tree/index.vue'
|
|
34
|
+
import ShUpload from './sh-upload/index.vue'
|
|
35
|
+
import ShWaterFall from './sh-water-fall/index.vue'
|
|
36
|
+
import ShWaterMark from './sh-water-mark/index.vue'
|
|
37
|
+
import { VxeButton, VxeInput, VxeTextarea, VxeSelect } from 'vxe-table'
|
|
38
|
+
|
|
39
|
+
const components = {
|
|
40
|
+
ShAlert,
|
|
41
|
+
ShBadge,
|
|
42
|
+
ShCalendar,
|
|
43
|
+
ShCard,
|
|
44
|
+
ShCodeEditor,
|
|
45
|
+
ShCol,
|
|
46
|
+
ShCorner,
|
|
47
|
+
ShCountTo,
|
|
48
|
+
ShDate,
|
|
49
|
+
ShDrawer,
|
|
50
|
+
ShEmpty,
|
|
51
|
+
ShForm,
|
|
52
|
+
ShHeader,
|
|
53
|
+
ShIcon,
|
|
54
|
+
ShImage,
|
|
55
|
+
ShList,
|
|
56
|
+
ShLoading,
|
|
57
|
+
ShModal,
|
|
58
|
+
ShNoticebar,
|
|
59
|
+
ShPoptip,
|
|
60
|
+
ShProgress,
|
|
61
|
+
ShPullRefresh,
|
|
62
|
+
ShQuery,
|
|
63
|
+
ShResult,
|
|
64
|
+
ShRow,
|
|
65
|
+
ShSplit,
|
|
66
|
+
ShGrid,
|
|
67
|
+
ShTable,
|
|
68
|
+
ShTabs,
|
|
69
|
+
ShTag,
|
|
70
|
+
ShToolbar,
|
|
71
|
+
ShTree,
|
|
72
|
+
ShUpload,
|
|
73
|
+
ShWaterFall,
|
|
74
|
+
ShWaterMark,
|
|
75
|
+
|
|
76
|
+
ShButton: VxeButton,
|
|
77
|
+
ShInput: VxeInput,
|
|
78
|
+
ShTextarea: VxeTextarea,
|
|
79
|
+
ShSelect: VxeSelect
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const index = {
|
|
83
|
+
install(Vue, { excludeComponents = [] }) {
|
|
84
|
+
let globalComponentKeys = Object.keys(components).filter(key => !excludeComponents.includes(key))
|
|
85
|
+
globalComponentKeys.forEach(key => {
|
|
86
|
+
Vue.component(key, components[key])
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export default index
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ShType } from '../../../types/component'
|
|
2
|
+
|
|
3
|
+
export const alertProps = {
|
|
4
|
+
type: {
|
|
5
|
+
type: String as () => ShType,
|
|
6
|
+
default: 'info'
|
|
7
|
+
},
|
|
8
|
+
title: {
|
|
9
|
+
type: String
|
|
10
|
+
},
|
|
11
|
+
content: {
|
|
12
|
+
type: String
|
|
13
|
+
},
|
|
14
|
+
closable: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: false
|
|
17
|
+
},
|
|
18
|
+
showIcon: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: false
|
|
21
|
+
},
|
|
22
|
+
fade: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: true
|
|
25
|
+
},
|
|
26
|
+
block: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,168 +1,143 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<transition :name="fade ? 'fade' : ''">
|
|
3
|
-
<div v-if="!closed" class="sh-alert" :class="classes">
|
|
4
|
-
<div v-if="showIcon" class="sh-alert-icon">
|
|
5
|
-
<slot name="icon">
|
|
6
|
-
<sh-icon :type="iconType"></sh-icon>
|
|
7
|
-
</slot>
|
|
8
|
-
</div>
|
|
9
|
-
<div class="sh-alert-content">
|
|
10
|
-
<slot>{{ title }}</slot>
|
|
11
|
-
<div v-if="content || $slots.content" class="sh-alert-desc">
|
|
12
|
-
<slot name="content">{{ content }}</slot>
|
|
13
|
-
</div>
|
|
14
|
-
</div>
|
|
15
|
-
<a v-if="closable" class="sh-alert-close" @click="close">
|
|
16
|
-
<slot name="close"><sh-icon type="ios-close"></sh-icon></slot>
|
|
17
|
-
</a>
|
|
18
|
-
</div>
|
|
19
|
-
</transition>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script>
|
|
23
|
-
import { defineComponent, ref, computed } from 'vue'
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
type
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
.sh-alert-icon
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
.sh-alert-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
&.info {
|
|
147
|
-
border: 1px solid var(--vxe-info-color);
|
|
148
|
-
background-color: #f0faff;
|
|
149
|
-
.sh-alert-icon {
|
|
150
|
-
color: var(--vxe-info-color);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
&.warning {
|
|
154
|
-
border: 1px solid var(--vxe-warning-color);
|
|
155
|
-
background-color: #fff9e6;
|
|
156
|
-
.sh-alert-icon {
|
|
157
|
-
color: var(--vxe-warning-color);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
&.error {
|
|
161
|
-
border: 1px solid var(--vxe-danger-color);
|
|
162
|
-
background-color: #ffefe6;
|
|
163
|
-
.sh-alert-icon {
|
|
164
|
-
color: var(--vxe-danger-color);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<transition :name="fade ? 'fade' : ''">
|
|
3
|
+
<div v-if="!closed" class="sh-alert" :class="classes">
|
|
4
|
+
<div v-if="showIcon" class="sh-alert-icon">
|
|
5
|
+
<slot name="icon">
|
|
6
|
+
<sh-icon :type="iconType"></sh-icon>
|
|
7
|
+
</slot>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="sh-alert-content">
|
|
10
|
+
<slot>{{ title }}</slot>
|
|
11
|
+
<div v-if="content || $slots.content" class="sh-alert-desc">
|
|
12
|
+
<slot name="content">{{ content }}</slot>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
<a v-if="closable" class="sh-alert-close" @click="close">
|
|
16
|
+
<slot name="close"><sh-icon type="ios-close"></sh-icon></slot>
|
|
17
|
+
</a>
|
|
18
|
+
</div>
|
|
19
|
+
</transition>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import { defineComponent, ref, computed } from 'vue'
|
|
24
|
+
import { alertProps } from './alert'
|
|
25
|
+
export default defineComponent({
|
|
26
|
+
name: 'ShAlert',
|
|
27
|
+
props: alertProps,
|
|
28
|
+
emits: ['close'],
|
|
29
|
+
setup(props, context) {
|
|
30
|
+
const { slots, emit } = context
|
|
31
|
+
const closed = ref(false)
|
|
32
|
+
|
|
33
|
+
const iconTypeMap = {
|
|
34
|
+
success: 'ios-checkmark-circle',
|
|
35
|
+
info: 'ios-information-circle',
|
|
36
|
+
warning: 'ios-alert',
|
|
37
|
+
error: 'ios-close-circle'
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const isDesc = computed(() => !!slots.content)
|
|
41
|
+
const iconType = computed(() => {
|
|
42
|
+
let type = iconTypeMap[props.type]
|
|
43
|
+
if (isDesc.value) type += '-outline'
|
|
44
|
+
return type
|
|
45
|
+
})
|
|
46
|
+
const classes = computed(() => {
|
|
47
|
+
return {
|
|
48
|
+
[`${props.type}`]: true,
|
|
49
|
+
block: props.block,
|
|
50
|
+
desc: isDesc.value
|
|
51
|
+
}
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const close = e => {
|
|
55
|
+
closed.value = true
|
|
56
|
+
emit('close', e)
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
closed,
|
|
60
|
+
classes,
|
|
61
|
+
iconType,
|
|
62
|
+
close
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<style scoped lang="scss">
|
|
69
|
+
$base-font-size: 14px;
|
|
70
|
+
$medium-font-size: 16px;
|
|
71
|
+
$large-font-size: 18px;
|
|
72
|
+
|
|
73
|
+
@mixin iconBase {
|
|
74
|
+
padding: 0 5px;
|
|
75
|
+
font-size: $medium-font-size;
|
|
76
|
+
line-height: 1;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.sh-alert {
|
|
80
|
+
position: relative;
|
|
81
|
+
border-radius: var(--vxe-border-radius);
|
|
82
|
+
color: var(--vxe-font-color);
|
|
83
|
+
display: inline-flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
padding: 5px;
|
|
86
|
+
margin-bottom: 10px;
|
|
87
|
+
&.block {
|
|
88
|
+
display: flex;
|
|
89
|
+
}
|
|
90
|
+
&.desc {
|
|
91
|
+
font-size: $large-font-size;
|
|
92
|
+
.sh-alert-icon,
|
|
93
|
+
.sh-alert-close {
|
|
94
|
+
font-size: 24px;
|
|
95
|
+
padding: 0 10px;
|
|
96
|
+
}
|
|
97
|
+
.sh-alert-content {
|
|
98
|
+
padding: 0 10px;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
&-icon {
|
|
102
|
+
@include iconBase;
|
|
103
|
+
}
|
|
104
|
+
&-content {
|
|
105
|
+
flex: 1;
|
|
106
|
+
.sh-alert-desc {
|
|
107
|
+
font-size: $base-font-size;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
&-close {
|
|
111
|
+
@include iconBase;
|
|
112
|
+
cursor: pointer;
|
|
113
|
+
}
|
|
114
|
+
&.success {
|
|
115
|
+
border: 1px solid var(--vxe-success-color);
|
|
116
|
+
background-color: #edfff3;
|
|
117
|
+
.sh-alert-icon {
|
|
118
|
+
color: var(--vxe-success-color);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
&.info {
|
|
122
|
+
border: 1px solid var(--vxe-info-color);
|
|
123
|
+
background-color: #f0faff;
|
|
124
|
+
.sh-alert-icon {
|
|
125
|
+
color: var(--vxe-info-color);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
&.warning {
|
|
129
|
+
border: 1px solid var(--vxe-warning-color);
|
|
130
|
+
background-color: #fff9e6;
|
|
131
|
+
.sh-alert-icon {
|
|
132
|
+
color: var(--vxe-warning-color);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
&.error {
|
|
136
|
+
border: 1px solid var(--vxe-danger-color);
|
|
137
|
+
background-color: #ffefe6;
|
|
138
|
+
.sh-alert-icon {
|
|
139
|
+
color: var(--vxe-danger-color);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
</style>
|