Add @types/bootstrap
This commit is contained in:
parent
f8844cb549
commit
6321cea0da
|
|
@ -38,6 +38,7 @@
|
|||
"@babel/preset-env": "^7.7.1",
|
||||
"@babel/preset-typescript": "^7.7.2",
|
||||
"@gplane/tsconfig": "^1.0.0",
|
||||
"@types/bootstrap": "^4.3.1",
|
||||
"@types/echarts": "^4.1.9",
|
||||
"@types/jest": "^24.0.23",
|
||||
"@types/jquery": "^3.3.29",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* eslint-disable max-params */
|
||||
import $ from 'jquery'
|
||||
import { ModalOptions } from '../shims'
|
||||
import { ModalOption as BootstrapModalOption } from 'bootstrap'
|
||||
import { trans } from './i18n'
|
||||
|
||||
export function showAjaxError(error: Error): void {
|
||||
|
|
@ -11,6 +11,12 @@ export function showAjaxError(error: Error): void {
|
|||
)
|
||||
}
|
||||
|
||||
export type ModalOptions = {
|
||||
btnText?: string
|
||||
callback?: CallableFunction
|
||||
destroyOnClose?: boolean
|
||||
} & BootstrapModalOption
|
||||
|
||||
export function showModal(
|
||||
message: string, title = 'Message',
|
||||
type = 'default',
|
||||
|
|
@ -53,7 +59,6 @@ export function showModal(
|
|||
$(this).remove()
|
||||
}
|
||||
})
|
||||
// @ts-ignore
|
||||
.modal(options)
|
||||
}
|
||||
|
||||
|
|
|
|||
9
resources/assets/src/shims.d.ts
vendored
9
resources/assets/src/shims.d.ts
vendored
|
|
@ -1,6 +1,7 @@
|
|||
/* eslint-disable camelcase */
|
||||
import Vue from 'vue'
|
||||
import * as JQuery from 'jquery'
|
||||
import { ModalOptions } from './scripts/notify'
|
||||
|
||||
type I18n = 'en' | 'zh_CN'
|
||||
|
||||
|
|
@ -37,7 +38,7 @@ declare global {
|
|||
message: string,
|
||||
title?: string,
|
||||
type?: string,
|
||||
options?: Partial<{ btnText: string, callback: string, destroyOnClose: boolean }>
|
||||
options?: ModalOptions
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -57,9 +58,3 @@ declare module 'vue/types/vue' {
|
|||
$route: RegExpExecArray | null
|
||||
}
|
||||
}
|
||||
|
||||
interface ModalOptions {
|
||||
btnText?: string
|
||||
callback?: CallableFunction
|
||||
destroyOnClose?: boolean
|
||||
}
|
||||
|
|
|
|||
17
yarn.lock
17
yarn.lock
|
|
@ -1199,6 +1199,14 @@
|
|||
dependencies:
|
||||
"@babel/types" "^7.3.0"
|
||||
|
||||
"@types/bootstrap@^4.3.1":
|
||||
version "4.3.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/bootstrap/-/bootstrap-4.3.1.tgz#15fa89a4d275b114a4eceb90909d4eb8b90d43f5"
|
||||
integrity sha512-n7Zv7Y+C98Yv4oqbyqGn3alCvNRCya2xMYzOdVEnmnFlu04MXQk1ntVrBhXzDkiwhZZYNkNfBZn2yhTnEh/mHQ==
|
||||
dependencies:
|
||||
"@types/jquery" "*"
|
||||
popper.js "^1.14.1"
|
||||
|
||||
"@types/echarts@^4.1.9":
|
||||
version "4.1.9"
|
||||
resolved "https://registry.npmjs.org/@types/echarts/-/echarts-4.1.9.tgz#86fdf7ca829879535cf3b1b1490e2f46a0ea0933"
|
||||
|
|
@ -1252,6 +1260,13 @@
|
|||
dependencies:
|
||||
jest-diff "^24.3.0"
|
||||
|
||||
"@types/jquery@*":
|
||||
version "3.3.31"
|
||||
resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-3.3.31.tgz#27c706e4bf488474e1cb54a71d8303f37c93451b"
|
||||
integrity sha512-Lz4BAJihoFw5nRzKvg4nawXPzutkv7wmfQ5121avptaSIXlDNJCUuxZxX/G+9EVidZGuO0UBlk+YjKbwRKJigg==
|
||||
dependencies:
|
||||
"@types/sizzle" "*"
|
||||
|
||||
"@types/jquery@^3.3.29":
|
||||
version "3.3.29"
|
||||
resolved "https://registry.npmjs.org/@types/jquery/-/jquery-3.3.29.tgz#680a2219ce3c9250483722fccf5570d1e2d08abd"
|
||||
|
|
@ -7694,7 +7709,7 @@ png-js@>=0.1.0:
|
|||
resolved "https://registry.yarnpkg.com/png-js/-/png-js-1.0.0.tgz#e5484f1e8156996e383aceebb3789fd75df1874d"
|
||||
integrity sha512-k+YsbhpA9e+EFfKjTCH3VW6aoKlyNYI6NYdTfDL4CIvFnvsuO84ttonmZE7rc+v23SLTH8XX+5w/Ak9v0xGY4g==
|
||||
|
||||
popper.js@^1.14.3, popper.js@^1.16.0:
|
||||
popper.js@^1.14.1, popper.js@^1.14.3, popper.js@^1.16.0:
|
||||
version "1.16.0"
|
||||
resolved "https://registry.yarnpkg.com/popper.js/-/popper.js-1.16.0.tgz#2e1816bcbbaa518ea6c2e15a466f4cb9c6e2fbb3"
|
||||
integrity sha512-+G+EkOPoE5S/zChTpmBSSDYmhXJ5PsW8eMhH8cP/CQHMFPBG/kC9Y5IIw6qNYgdJ+/COf0ddY2li28iHaZRSjw==
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user