types added
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
const typescript = require('@rollup/plugin-typescript')
|
||||
// import * as pkg from '../../package.json'
|
||||
const pkg = require('../../package.json')
|
||||
|
||||
const year = new Date().getFullYear()
|
||||
@@ -17,5 +16,8 @@ module.exports = {
|
||||
banner,
|
||||
name: 'adminlte'
|
||||
},
|
||||
plugins: [typescript()]
|
||||
plugins: [typescript({
|
||||
declaration: true,
|
||||
declarationDir: 'types'
|
||||
})]
|
||||
}
|
||||
|
||||
@@ -11,5 +11,3 @@ export {
|
||||
DirectChat,
|
||||
CardWidget
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -84,13 +84,11 @@ class CardWidget {
|
||||
|
||||
const elm = this._parent?.querySelectorAll(`${SELECTOR_CARD_BODY}, ${SELECTOR_CARD_FOOTER}`)
|
||||
|
||||
if (elm !== undefined) {
|
||||
for (const el of elm) {
|
||||
if (el instanceof HTMLElement) {
|
||||
slideUp(el, this._config.animationSpeed)
|
||||
}
|
||||
elm.forEach(el => {
|
||||
if (el instanceof HTMLElement) {
|
||||
slideUp(el, this._config.animationSpeed)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
if (this._parent) {
|
||||
@@ -118,13 +116,11 @@ class CardWidget {
|
||||
|
||||
const elm = this._parent?.querySelectorAll(`${SELECTOR_CARD_BODY}, ${SELECTOR_CARD_FOOTER}`)
|
||||
|
||||
if (elm !== undefined) {
|
||||
for (const el of elm) {
|
||||
if (el instanceof HTMLElement) {
|
||||
slideDown(el, this._config.animationSpeed)
|
||||
}
|
||||
elm.forEach(el => {
|
||||
if (el instanceof HTMLElement) {
|
||||
slideDown(el, this._config.animationSpeed)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
if (this._parent) {
|
||||
@@ -250,36 +246,36 @@ class CardWidget {
|
||||
domReady(() => {
|
||||
const collapseBtn = document.querySelectorAll(SELECTOR_DATA_COLLAPSE)
|
||||
|
||||
for (const btn of collapseBtn) {
|
||||
collapseBtn.forEach(btn => {
|
||||
btn.addEventListener('click', event => {
|
||||
event.preventDefault()
|
||||
const target = event.target as HTMLElement
|
||||
const data = new CardWidget(target, Default)
|
||||
data.toggle()
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const removeBtn = document.querySelectorAll(SELECTOR_DATA_REMOVE)
|
||||
|
||||
for (const btn of removeBtn) {
|
||||
removeBtn.forEach(btn => {
|
||||
btn.addEventListener('click', event => {
|
||||
event.preventDefault()
|
||||
const target = event.target as HTMLElement
|
||||
const data = new CardWidget(target, Default)
|
||||
data.remove()
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const maxBtn = document.querySelectorAll(SELECTOR_DATA_MAXIMIZE)
|
||||
|
||||
for (const btn of maxBtn) {
|
||||
maxBtn.forEach(btn => {
|
||||
btn.addEventListener('click', event => {
|
||||
event.preventDefault()
|
||||
const target = event.target as HTMLElement
|
||||
const data = new CardWidget(target, Default)
|
||||
data.toggleMaximize()
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
export default CardWidget
|
||||
|
||||
@@ -61,7 +61,7 @@ class DirectChat {
|
||||
domReady(() => {
|
||||
const button = document.querySelectorAll(SELECTOR_DATA_TOGGLE)
|
||||
|
||||
for (const btn of button) {
|
||||
button.forEach(btn => {
|
||||
btn.addEventListener('click', event => {
|
||||
event.preventDefault()
|
||||
const target = event.target as HTMLElement
|
||||
@@ -72,7 +72,7 @@ domReady(() => {
|
||||
data.toggle()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
export default DirectChat
|
||||
|
||||
@@ -63,18 +63,18 @@ class PushMenu {
|
||||
menusClose() {
|
||||
const navTreeview = document.querySelectorAll<HTMLElement>(SELECTOR_NAV_TREEVIEW)
|
||||
|
||||
for (const navTree of navTreeview) {
|
||||
navTreeview.forEach(navTree => {
|
||||
navTree.style.removeProperty('display')
|
||||
navTree.style.removeProperty('height')
|
||||
}
|
||||
})
|
||||
|
||||
const navSidebar = document.querySelector(SELECTOR_SIDEBAR_MENU)
|
||||
const navItem = navSidebar?.querySelectorAll(SELECTOR_NAV_ITEM)
|
||||
|
||||
if (navItem) {
|
||||
for (const navI of navItem) {
|
||||
navItem.forEach(navI => {
|
||||
navI.classList.remove(CLASS_NAME_MENU_OPEN)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ class PushMenu {
|
||||
|
||||
addSidebarBreakPoint() {
|
||||
const sidebarExpandList = document.querySelector(SELECTOR_SIDEBAR_EXPAND)?.classList ?? []
|
||||
const sidebarExpand = [...sidebarExpandList].find(className => className.startsWith(CLASS_NAME_SIDEBAR_EXPAND)) ?? ''
|
||||
const sidebarExpand = Array.from(sidebarExpandList).find(className => className.startsWith(CLASS_NAME_SIDEBAR_EXPAND)) ?? ''
|
||||
const sidebar = document.getElementsByClassName(sidebarExpand)[0]
|
||||
const sidebarContent = window.getComputedStyle(sidebar, '::before').getPropertyValue('content')
|
||||
this._config = { ...this._config, sidebarBreakpoint: Number(sidebarContent.replace(/[^\d.-]/g, '')) }
|
||||
@@ -177,7 +177,7 @@ domReady(() => {
|
||||
|
||||
const fullBtn = document.querySelectorAll(SELECTOR_SIDEBAR_TOGGLE)
|
||||
|
||||
for (const btn of fullBtn) {
|
||||
fullBtn.forEach(btn => {
|
||||
btn.addEventListener('click', event => {
|
||||
event.preventDefault()
|
||||
|
||||
@@ -193,8 +193,7 @@ domReady(() => {
|
||||
data.toggle()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
export default PushMenu
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ class Treeview {
|
||||
domReady(() => {
|
||||
const button = document.querySelectorAll(SELECTOR_DATA_TOGGLE)
|
||||
|
||||
for (const btn of button) {
|
||||
button.forEach(btn => {
|
||||
btn.addEventListener('click', event => {
|
||||
const target = event.target as HTMLElement
|
||||
const targetItem = target.closest(SELECTOR_NAV_ITEM) as HTMLElement | undefined
|
||||
@@ -106,7 +106,7 @@ domReady(() => {
|
||||
data.toggle()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
export default Treeview
|
||||
|
||||
Reference in New Issue
Block a user