forked from TencentBlueKing/bk-nodeman
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 接入点改造(closed TencentBlueKing#852)
- Loading branch information
1 parent
f14f01b
commit 3ddad6a
Showing
28 changed files
with
1,101 additions
and
626 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { ref } from 'vue'; | ||
|
||
export default function useFormLabelWidth() { | ||
const minWidth = ref(0); | ||
|
||
const initLabelWidth = (form: Vue) => { | ||
const el = form ? form.$el : null; | ||
if (!el) return; | ||
let max = 0; | ||
const leftPadding = 28; | ||
const safePadding = 8; | ||
const $labelEleList = el.querySelectorAll('.bk-label'); | ||
$labelEleList.forEach((item) => { | ||
const spanEle = item.querySelector('span'); | ||
if (spanEle) { | ||
const { width } = spanEle.getBoundingClientRect(); | ||
max = Math.max(minWidth.value, max, width); | ||
} | ||
}); | ||
const width = Math.ceil(max + leftPadding + safePadding); | ||
$labelEleList.forEach((item) => { | ||
(item as HTMLElement).style.width = `${width}px`; | ||
}); | ||
el.querySelectorAll('.bk-form-content').forEach((item) => { | ||
(item as HTMLElement).style.marginLeft = `${width}px`; | ||
}); | ||
return width; | ||
}; | ||
|
||
return { | ||
minWidth, | ||
initLabelWidth, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.