-
-
Notifications
You must be signed in to change notification settings - Fork 381
feat(Mask): add AppendToBody parameter #7834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
208e495
a93b7b4
6429c13
3ea322a
8876a12
bba9f41
53f4cbc
fef04dd
3581d9a
33c0eba
ee1814d
3218f64
cfac638
127d2be
f720080
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,30 @@ | ||
| export function update(id, options) { | ||
| export function update(id, options) { | ||
| const mask = document.getElementById(id); | ||
| if (mask) { | ||
| const { show } = options; | ||
| const { show, appendToBody } = options; | ||
| const el = document.querySelector(`[data-bb-mask="${id}"]`); | ||
| const container = getContainerBySelector(options); | ||
| if (container) { | ||
| const position = container.style.getPropertyValue('position'); | ||
| if (position === '' || position === 'static') { | ||
| container.style.setProperty('position', 'relative'); | ||
| } | ||
| if (show) { | ||
| el.style.setProperty('--bb-mask-position', 'absolute'); | ||
| container.appendChild(el); | ||
| } | ||
| reset(el, mask, container, show); | ||
| } | ||
| else { | ||
| document.body.appendChild(el); | ||
| else if (appendToBody === true) { | ||
| reset(el, mask, document.body, show); | ||
| } | ||
|
Comment on lines
+14
to
16
|
||
| } | ||
| } | ||
|
|
||
| if (show) { | ||
| el.classList.add('show'); | ||
| } | ||
| else { | ||
| el.classList.remove('show'); | ||
| el.style.removeProperty('--bb-mask-position'); | ||
| mask.appendChild(el); | ||
| } | ||
| const reset = (el, mask, container, status) => { | ||
| if (status) { | ||
| container.appendChild(el); | ||
| el.classList.add('show'); | ||
| } | ||
| else { | ||
| el.classList.remove('show'); | ||
| mask.appendChild(el); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -46,4 +46,11 @@ public class MaskOption | |||||||||||||||||||||
| /// <para lang="en">Gets or sets Mask Parent Container Selector. Default null</para> | ||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||
| public string? Selector { get; set; } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||
| /// <para lang="zh">获得/设置 是否将遮罩追加到 body 元素 默认 true</para> | ||||||||||||||||||||||
| /// <para lang="en">Gets or sets whether to append the mask to the body element. Default true</para> | ||||||||||||||||||||||
| /// <para>v<vesion>10.5.1</vesion></para> | ||||||||||||||||||||||
|
||||||||||||||||||||||
| /// <para>v<vesion>10.5.1</vesion></para> | |
| /// <para>v<version>10.5.1</version></para> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (typo): Fix the <vesion> tag typo and redundant leading v in the XML doc.
The vesion tag appears to be a typo, and the leading v makes the XML odd. Use a proper tag (e.g. <version>10.5.1</version>) that your tooling recognizes so XML parsers and doc generators can handle it correctly.
| /// <para lang="zh">获得/设置 是否将遮罩追加到 body 元素 默认 true</para> | |
| /// <para lang="en">Gets or sets whether to append the mask to the body element. Default true</para> | |
| /// <para>v<vesion>10.5.1</vesion></para> | |
| /// </summary> | |
| public bool AppendToBody { get; set; } = true; | |
| /// <para lang="zh">获得/设置 是否将遮罩追加到 body 元素 默认 true</para> | |
| /// <para lang="en">Gets or sets whether to append the mask to the body element. Default true</para> | |
| /// <para><version>10.5.1</version></para> | |
| /// </summary> | |
| public bool AppendToBody { get; set; } = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR title/linked issue indicate a documentation-only change, but this PR also introduces behavioral changes (new
AppendToBodyoption, JS logic changes) and bumps the package version. Please align the PR metadata/title/description with the actual scope, or split version bump/behavior changes into a separate PR.