Merge branch 'v4' of https://github.com/primefaces/primevue into v4
commit
f91a83cf19
|
@ -1,4 +1,4 @@
|
||||||
import Theme from 'primevue/themes';
|
import Theme, { $dt } from 'primevue/themes';
|
||||||
import { useStyle } from 'primevue/usestyle';
|
import { useStyle } from 'primevue/usestyle';
|
||||||
import { ObjectUtils } from 'primevue/utils';
|
import { ObjectUtils } from 'primevue/utils';
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ const css = `
|
||||||
|
|
||||||
.p-overflow-hidden {
|
.p-overflow-hidden {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding-right: var(--scrollbar-width);
|
padding-right: ${$dt('scrollbar.width')};
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ import ConfirmationEventBus from 'primevue/confirmationeventbus';
|
||||||
import FocusTrap from 'primevue/focustrap';
|
import FocusTrap from 'primevue/focustrap';
|
||||||
import OverlayEventBus from 'primevue/overlayeventbus';
|
import OverlayEventBus from 'primevue/overlayeventbus';
|
||||||
import Portal from 'primevue/portal';
|
import Portal from 'primevue/portal';
|
||||||
|
import { $dtp } from 'primevue/themes';
|
||||||
import { ConnectedOverlayScrollHandler, DomHandler, ZIndexUtils } from 'primevue/utils';
|
import { ConnectedOverlayScrollHandler, DomHandler, ZIndexUtils } from 'primevue/utils';
|
||||||
import BaseConfirmPopup from './BaseConfirmPopup.vue';
|
import BaseConfirmPopup from './BaseConfirmPopup.vue';
|
||||||
|
|
||||||
|
@ -203,7 +204,7 @@ export default {
|
||||||
arrowLeft = targetOffset.left - containerOffset.left;
|
arrowLeft = targetOffset.left - containerOffset.left;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.container.style.setProperty('--overlayArrowLeft', `${arrowLeft}px`);
|
this.container.style.setProperty($dtp('overlay.arrow.left').name, `${arrowLeft}px`);
|
||||||
|
|
||||||
if (containerOffset.top < targetOffset.top) {
|
if (containerOffset.top < targetOffset.top) {
|
||||||
this.container.setAttribute('data-p-confirm-popup-flipped', 'true');
|
this.container.setAttribute('data-p-confirm-popup-flipped', 'true');
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
import BaseComponent from 'primevue/basecomponent';
|
import BaseComponent from 'primevue/basecomponent';
|
||||||
import KnobStyle from 'primevue/knob/style';
|
import KnobStyle from 'primevue/knob/style';
|
||||||
|
import { $dt } from 'primevue/themes';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'BaseKnob',
|
name: 'BaseKnob',
|
||||||
|
@ -36,15 +37,15 @@ export default {
|
||||||
},
|
},
|
||||||
valueColor: {
|
valueColor: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'var(--primary-color, Black)'
|
default: $dt('primary.color', 'Black')
|
||||||
},
|
},
|
||||||
rangeColor: {
|
rangeColor: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'var(--surface-border, LightGray)'
|
default: $dt('surface.border', 'LightGray')
|
||||||
},
|
},
|
||||||
textColor: {
|
textColor: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'var(--text-color-secondary, Black)'
|
default: $dt('text.color.secondary', 'Black')
|
||||||
},
|
},
|
||||||
strokeWidth: {
|
strokeWidth: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
|
|
@ -151,17 +151,17 @@ export interface KnobProps {
|
||||||
max?: number | undefined;
|
max?: number | undefined;
|
||||||
/**
|
/**
|
||||||
* Background of the value.
|
* Background of the value.
|
||||||
* @defaultValue var(--primary-color, Black)
|
* @defaultValue var(--<prefix>primary-color, Black)
|
||||||
*/
|
*/
|
||||||
valueColor?: string | undefined;
|
valueColor?: string | undefined;
|
||||||
/**
|
/**
|
||||||
* Background color of the range.
|
* Background color of the range.
|
||||||
* @defaultValue var(--surface-border, LightGray)
|
* @defaultValue var(--<prefix>surface-border, LightGray)
|
||||||
*/
|
*/
|
||||||
rangeColor?: string | undefined;
|
rangeColor?: string | undefined;
|
||||||
/**
|
/**
|
||||||
* Color of the value text.
|
* Color of the value text.
|
||||||
* @defaultValue var(--text-color-secondary, Black)
|
* @defaultValue var(--<prefix>text-color-secondary, Black)
|
||||||
*/
|
*/
|
||||||
textColor?: string | undefined;
|
textColor?: string | undefined;
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,6 +18,7 @@ import FocusTrap from 'primevue/focustrap';
|
||||||
import OverlayEventBus from 'primevue/overlayeventbus';
|
import OverlayEventBus from 'primevue/overlayeventbus';
|
||||||
import Portal from 'primevue/portal';
|
import Portal from 'primevue/portal';
|
||||||
import Ripple from 'primevue/ripple';
|
import Ripple from 'primevue/ripple';
|
||||||
|
import { $dtp } from 'primevue/themes';
|
||||||
import { ConnectedOverlayScrollHandler, DomHandler, UniqueComponentId, ZIndexUtils } from 'primevue/utils';
|
import { ConnectedOverlayScrollHandler, DomHandler, UniqueComponentId, ZIndexUtils } from 'primevue/utils';
|
||||||
import BaseOverlayPanel from './BaseOverlayPanel.vue';
|
import BaseOverlayPanel from './BaseOverlayPanel.vue';
|
||||||
|
|
||||||
|
@ -154,7 +155,7 @@ export default {
|
||||||
arrowLeft = targetOffset.left - containerOffset.left;
|
arrowLeft = targetOffset.left - containerOffset.left;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.container.style.setProperty('--overlayArrowLeft', `${arrowLeft}px`);
|
this.container.style.setProperty($dtp('overlay.arrow.left').name, `${arrowLeft}px`);
|
||||||
|
|
||||||
if (containerOffset.top < targetOffset.top) {
|
if (containerOffset.top < targetOffset.top) {
|
||||||
this.container.setAttribute('data-p-overlaypanel-flipped', 'true');
|
this.container.setAttribute('data-p-overlaypanel-flipped', 'true');
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
import Button from 'primevue/button';
|
import Button from 'primevue/button';
|
||||||
import PlusIcon from 'primevue/icons/plus';
|
import PlusIcon from 'primevue/icons/plus';
|
||||||
import Ripple from 'primevue/ripple';
|
import Ripple from 'primevue/ripple';
|
||||||
|
import { $dt, $dtp } from 'primevue/themes';
|
||||||
import Tooltip from 'primevue/tooltip';
|
import Tooltip from 'primevue/tooltip';
|
||||||
import { DomHandler, UniqueComponentId } from 'primevue/utils';
|
import { DomHandler, UniqueComponentId } from 'primevue/utils';
|
||||||
import BaseSpeedDial from './BaseSpeedDial.vue';
|
import BaseSpeedDial from './BaseSpeedDial.vue';
|
||||||
|
@ -97,8 +98,8 @@ export default {
|
||||||
const wDiff = Math.abs(button.offsetWidth - firstItem.offsetWidth);
|
const wDiff = Math.abs(button.offsetWidth - firstItem.offsetWidth);
|
||||||
const hDiff = Math.abs(button.offsetHeight - firstItem.offsetHeight);
|
const hDiff = Math.abs(button.offsetHeight - firstItem.offsetHeight);
|
||||||
|
|
||||||
this.list.style.setProperty('--item-diff-x', `${wDiff / 2}px`);
|
this.list.style.setProperty($dtp('item.diff.x').name, `${wDiff / 2}px`);
|
||||||
this.list.style.setProperty('--item-diff-y', `${hDiff / 2}px`);
|
this.list.style.setProperty($dtp('item.diff.y').name, `${hDiff / 2}px`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,14 +366,14 @@ export default {
|
||||||
const step = (2 * Math.PI) / length;
|
const step = (2 * Math.PI) / length;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
left: `calc(${radius * Math.cos(step * index)}px + var(--item-diff-x, 0px))`,
|
left: `calc(${radius * Math.cos(step * index)}px + ${$dt('item.diff.x', '0px')})`,
|
||||||
top: `calc(${radius * Math.sin(step * index)}px + var(--item-diff-y, 0px))`
|
top: `calc(${radius * Math.sin(step * index)}px + ${$dt('item.diff.y', '0px')})`
|
||||||
};
|
};
|
||||||
} else if (type === 'semi-circle') {
|
} else if (type === 'semi-circle') {
|
||||||
const direction = this.direction;
|
const direction = this.direction;
|
||||||
const step = Math.PI / (length - 1);
|
const step = Math.PI / (length - 1);
|
||||||
const x = `calc(${radius * Math.cos(step * index)}px + var(--item-diff-x, 0px))`;
|
const x = `calc(${radius * Math.cos(step * index)}px + ${$dt('item.diff.x', '0px')})`;
|
||||||
const y = `calc(${radius * Math.sin(step * index)}px + var(--item-diff-y, 0px))`;
|
const y = `calc(${radius * Math.sin(step * index)}px + ${$dt('item.diff.y', '0px')})`;
|
||||||
|
|
||||||
if (direction === 'up') {
|
if (direction === 'up') {
|
||||||
return { left: x, bottom: y };
|
return { left: x, bottom: y };
|
||||||
|
@ -386,8 +387,8 @@ export default {
|
||||||
} else if (type === 'quarter-circle') {
|
} else if (type === 'quarter-circle') {
|
||||||
const direction = this.direction;
|
const direction = this.direction;
|
||||||
const step = Math.PI / (2 * (length - 1));
|
const step = Math.PI / (2 * (length - 1));
|
||||||
const x = `calc(${radius * Math.cos(step * index)}px + var(--item-diff-x, 0px))`;
|
const x = `calc(${radius * Math.cos(step * index)}px + ${$dt('item.diff.x', '0px')})`;
|
||||||
const y = `calc(${radius * Math.sin(step * index)}px + var(--item-diff-y, 0px))`;
|
const y = `calc(${radius * Math.sin(step * index)}px + ${$dt('item.diff.y', '0px')})`;
|
||||||
|
|
||||||
if (direction === 'up-left') {
|
if (direction === 'up-left') {
|
||||||
return { right: x, bottom: y };
|
return { right: x, bottom: y };
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
import Theme, { SharedUtils } from 'primevue/themes';
|
import Theme, { SharedUtils } from 'primevue/themes';
|
||||||
|
|
||||||
export const $dt = (tokenPath, type) => {
|
const types = ['value', 'variable'];
|
||||||
|
|
||||||
|
export const $dt = (tokenPath, param1, param2) => {
|
||||||
const config = Theme.getPConfig();
|
const config = Theme.getPConfig();
|
||||||
|
|
||||||
return dt(config?.theme, tokenPath, undefined, type);
|
return types.includes(param1) ? dt(config?.theme, tokenPath, undefined, param2) : dt(config?.theme, tokenPath, param1, param2);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const dt = (theme = {}, tokenPath, fallback, type) => {
|
export const dt = (theme = {}, tokenPath, fallback, type = 'variable') => {
|
||||||
if (tokenPath) {
|
if (tokenPath) {
|
||||||
const VARIABLE = Theme.defaults.variable;
|
const VARIABLE = Theme.defaults.variable;
|
||||||
const { prefix, transform } = theme?.options || {};
|
const { prefix, transform } = theme?.options || {};
|
||||||
|
@ -19,3 +21,17 @@ export const dt = (theme = {}, tokenPath, fallback, type) => {
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const $dtp = (tokenPath) => {
|
||||||
|
const config = Theme.getPConfig();
|
||||||
|
|
||||||
|
const variable = dt(config?.theme, tokenPath, undefined, 'variable');
|
||||||
|
const name = variable.match(/--[\w-]+/g)?.[0];
|
||||||
|
const value = dt(config?.theme, tokenPath, undefined, 'value');
|
||||||
|
|
||||||
|
return {
|
||||||
|
variable,
|
||||||
|
name,
|
||||||
|
value
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -68,7 +68,7 @@ export default {
|
||||||
.p-confirm-popup:after,
|
.p-confirm-popup:after,
|
||||||
.p-confirm-popup:before {
|
.p-confirm-popup:before {
|
||||||
bottom: 100%;
|
bottom: 100%;
|
||||||
left: calc(var(--overlayArrowLeft, 0) + 1.25rem);
|
left: ${dt('{overlay.arrow.left} + 1.25rem', 0)};
|
||||||
content: " ";
|
content: " ";
|
||||||
height: 0;
|
height: 0;
|
||||||
width: 0;
|
width: 0;
|
||||||
|
|
|
@ -66,7 +66,7 @@ export default {
|
||||||
.p-overlaypanel:after,
|
.p-overlaypanel:after,
|
||||||
.p-overlaypanel:before {
|
.p-overlaypanel:before {
|
||||||
bottom: 100%;
|
bottom: 100%;
|
||||||
left: calc(var(--overlayArrowLeft, 0) + 1.25rem);
|
left: ${dt('{overlay.arrow.left} + 1.25rem', 0)};
|
||||||
content: " ";
|
content: " ";
|
||||||
height: 0;
|
height: 0;
|
||||||
width: 0;
|
width: 0;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { $dt, $dtp } from 'primevue/themes';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
innerWidth(el) {
|
innerWidth(el) {
|
||||||
if (el) {
|
if (el) {
|
||||||
|
@ -326,7 +328,7 @@ export default {
|
||||||
element.style.top = top + 'px';
|
element.style.top = top + 'px';
|
||||||
element.style.left = left + 'px';
|
element.style.left = left + 'px';
|
||||||
element.style.transformOrigin = origin;
|
element.style.transformOrigin = origin;
|
||||||
gutter && (element.style.marginTop = origin === 'bottom' ? 'calc(var(--p-anchor-gutter) * -1)' : 'calc(var(--p-anchor-gutter))');
|
gutter && (element.style.marginTop = origin === 'bottom' ? $dt('{anchor.gutter} * -1') : $dt('anchor.gutter'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -365,7 +367,7 @@ export default {
|
||||||
element.style.top = top + 'px';
|
element.style.top = top + 'px';
|
||||||
element.style.left = left + 'px';
|
element.style.left = left + 'px';
|
||||||
element.style.transformOrigin = origin;
|
element.style.transformOrigin = origin;
|
||||||
gutter && (element.style.marginTop = origin === 'bottom' ? 'calc(var(--p-anchor-gutter) * -1)' : 'calc(var(--p-anchor-gutter))');
|
gutter && (element.style.marginTop = origin === 'bottom' ? $dt('{anchor.gutter} * -1') : $dt('anchor.gutter'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -849,12 +851,12 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
blockBodyScroll(className = 'p-overflow-hidden') {
|
blockBodyScroll(className = 'p-overflow-hidden') {
|
||||||
document.body.style.setProperty('--scrollbar-width', this.calculateBodyScrollbarWidth() + 'px');
|
document.body.style.setProperty($dtp('scrollbar.width').name, this.calculateBodyScrollbarWidth() + 'px');
|
||||||
this.addClass(document.body, className);
|
this.addClass(document.body, className);
|
||||||
},
|
},
|
||||||
|
|
||||||
unblockBodyScroll(className = 'p-overflow-hidden') {
|
unblockBodyScroll(className = 'p-overflow-hidden') {
|
||||||
document.body.style.removeProperty('--scrollbar-width');
|
document.body.style.removeProperty($dtp('scrollbar.width').name);
|
||||||
this.removeClass(document.body, className);
|
this.removeClass(document.body, className);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue