Browse Source

chore: fix lint and typecheck issues

pull/7645/head
xingyu4j 2 weeks ago
parent
commit
a850d426ef
  1. 3
      apps/web-antd/src/views/_core/authentication/code-login.vue
  2. 3
      apps/web-antd/src/views/_core/authentication/forget-password.vue
  3. 3
      apps/web-antd/src/views/_core/authentication/register.vue
  4. 3
      apps/web-antdv-next/src/views/_core/authentication/code-login.vue
  5. 3
      apps/web-antdv-next/src/views/_core/authentication/forget-password.vue
  6. 3
      apps/web-antdv-next/src/views/_core/authentication/register.vue
  7. 3
      apps/web-ele/src/views/_core/authentication/code-login.vue
  8. 3
      apps/web-ele/src/views/_core/authentication/forget-password.vue
  9. 3
      apps/web-ele/src/views/_core/authentication/register.vue
  10. 3
      apps/web-naive/src/views/_core/authentication/code-login.vue
  11. 3
      apps/web-naive/src/views/_core/authentication/forget-password.vue
  12. 3
      apps/web-naive/src/views/_core/authentication/register.vue
  13. 3
      apps/web-tdesign/src/views/_core/authentication/code-login.vue
  14. 3
      apps/web-tdesign/src/views/_core/authentication/forget-password.vue
  15. 3
      apps/web-tdesign/src/views/_core/authentication/register.vue
  16. 6
      packages/@core/base/shared/src/utils/__tests__/resources.test.ts
  17. 1
      packages/@core/base/shared/src/utils/inference.ts
  18. 6
      packages/@core/ui-kit/form-ui/src/form-render/dependencies.ts
  19. 14
      packages/@core/ui-kit/form-ui/src/form-render/form-field.vue
  20. 339
      packages/effects/common-ui/src/components/resize/resize.vue
  21. 5
      packages/effects/layouts/src/widgets/global-search/global-search.vue
  22. 11
      packages/effects/layouts/src/widgets/user-dropdown/user-dropdown.vue
  23. 1
      packages/effects/plugins/src/vxe-table/use-vxe-grid.vue
  24. 3
      playground/src/views/_core/authentication/code-login.vue
  25. 3
      playground/src/views/_core/authentication/forget-password.vue
  26. 3
      playground/src/views/_core/authentication/register.vue

3
apps/web-antd/src/views/_core/authentication/code-login.vue

@ -55,8 +55,7 @@ const formSchema = computed((): VbenFormSchema[] => {
* @param values 登录表单数据
*/
async function handleLogin(values: Recordable<any>) {
// eslint-disable-next-line no-console
console.log(values);
void values;
}
</script>

3
apps/web-antd/src/views/_core/authentication/forget-password.vue

@ -29,8 +29,7 @@ const formSchema = computed((): VbenFormSchema[] => {
});
function handleSubmit(value: Recordable<any>) {
// eslint-disable-next-line no-console
console.log('reset email:', value);
void value;
}
</script>

3
apps/web-antd/src/views/_core/authentication/register.vue

@ -82,8 +82,7 @@ const formSchema = computed((): VbenFormSchema[] => {
});
function handleSubmit(value: Recordable<any>) {
// eslint-disable-next-line no-console
console.log('register submit:', value);
void value;
}
</script>

3
apps/web-antdv-next/src/views/_core/authentication/code-login.vue

@ -55,8 +55,7 @@ const formSchema = computed((): VbenFormSchema[] => {
* @param values 登录表单数据
*/
async function handleLogin(values: Recordable<any>) {
// eslint-disable-next-line no-console
console.log(values);
void values;
}
</script>

3
apps/web-antdv-next/src/views/_core/authentication/forget-password.vue

@ -29,8 +29,7 @@ const formSchema = computed((): VbenFormSchema[] => {
});
function handleSubmit(value: Recordable<any>) {
// eslint-disable-next-line no-console
console.log('reset email:', value);
void value;
}
</script>

3
apps/web-antdv-next/src/views/_core/authentication/register.vue

@ -82,8 +82,7 @@ const formSchema = computed((): VbenFormSchema[] => {
});
function handleSubmit(value: Recordable<any>) {
// eslint-disable-next-line no-console
console.log('register submit:', value);
void value;
}
</script>

3
apps/web-ele/src/views/_core/authentication/code-login.vue

@ -59,8 +59,7 @@ const formSchema = computed((): VbenFormSchema[] => {
* @param values 登录表单数据
*/
async function handleLogin(values: Recordable<any>) {
// eslint-disable-next-line no-console
console.log(values);
void values;
}
</script>

3
apps/web-ele/src/views/_core/authentication/forget-password.vue

@ -29,8 +29,7 @@ const formSchema = computed((): VbenFormSchema[] => {
});
function handleSubmit(value: Recordable<any>) {
// eslint-disable-next-line no-console
console.log('reset email:', value);
void value;
}
</script>

3
apps/web-ele/src/views/_core/authentication/register.vue

@ -82,8 +82,7 @@ const formSchema = computed((): VbenFormSchema[] => {
});
function handleSubmit(value: Recordable<any>) {
// eslint-disable-next-line no-console
console.log('register submit:', value);
void value;
}
</script>

3
apps/web-naive/src/views/_core/authentication/code-login.vue

@ -55,8 +55,7 @@ const formSchema = computed((): VbenFormSchema[] => {
* @param values 登录表单数据
*/
async function handleLogin(values: Recordable<any>) {
// eslint-disable-next-line no-console
console.log(values);
void values;
}
</script>

3
apps/web-naive/src/views/_core/authentication/forget-password.vue

@ -29,8 +29,7 @@ const formSchema = computed((): VbenFormSchema[] => {
});
function handleSubmit(value: Recordable<any>) {
// eslint-disable-next-line no-console
console.log('reset email:', value);
void value;
}
</script>

3
apps/web-naive/src/views/_core/authentication/register.vue

@ -82,8 +82,7 @@ const formSchema = computed((): VbenFormSchema[] => {
});
function handleSubmit(value: Recordable<any>) {
// eslint-disable-next-line no-console
console.log('register submit:', value);
void value;
}
</script>

3
apps/web-tdesign/src/views/_core/authentication/code-login.vue

@ -55,8 +55,7 @@ const formSchema = computed((): VbenFormSchema[] => {
* @param values 登录表单数据
*/
async function handleLogin(values: Recordable<any>) {
// eslint-disable-next-line no-console
console.log(values);
void values;
}
</script>

3
apps/web-tdesign/src/views/_core/authentication/forget-password.vue

@ -29,8 +29,7 @@ const formSchema = computed((): VbenFormSchema[] => {
});
function handleSubmit(value: Recordable<any>) {
// eslint-disable-next-line no-console
console.log('reset email:', value);
void value;
}
</script>

3
apps/web-tdesign/src/views/_core/authentication/register.vue

@ -82,8 +82,7 @@ const formSchema = computed((): VbenFormSchema[] => {
});
async function handleSubmit(value: Recordable<any>) {
// eslint-disable-next-line no-console
console.log('register submit:', value);
void value;
}
</script>

6
packages/@core/base/shared/src/utils/__tests__/resources.test.ts

@ -57,8 +57,10 @@ describe('loadScript', () => {
appendSpy.mockRestore();
expect(capturedScript).toBeTruthy();
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
capturedScript!.dispatchEvent(new Event('error'));
if (!capturedScript) {
throw new Error('Expected the captured script element to exist');
}
capturedScript.dispatchEvent(new Event('error'));
await expect(promise).rejects.toThrow('Failed to load script: error.js');
});

1
packages/@core/base/shared/src/utils/inference.ts

@ -1,4 +1,3 @@
// eslint-disable-next-line vue/prefer-import-from-vue
import { isFunction, isObject, isString } from '@vue/shared';
/**

6
packages/@core/ui-kit/form-ui/src/form-render/dependencies.ts

@ -36,9 +36,11 @@ export default function useDependencies(
const values = useFormValues();
const formRenderProps = injectRenderFormProps();
const formApi = formRenderProps.form;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const formApi = formRenderProps.form!;
if (!formApi) {
throw new Error('Form api is required in useDependencies');
}
if (!values) {
throw new Error('useDependencies should be used within <VbenForm>');

14
packages/@core/ui-kit/form-ui/src/form-render/form-field.vue

@ -1,7 +1,7 @@
<script setup lang="ts">
import type { ZodType } from 'zod';
import type { FormSchema, MaybeComponentProps } from '../types';
import type { FormActions, FormSchema, MaybeComponentProps } from '../types';
import { computed, nextTick, onUnmounted, useTemplateRef, watch } from 'vue';
@ -63,6 +63,14 @@ const formApi = formRenderProps.form;
const compact = computed(() => formRenderProps.compact);
const isInValid = computed(() => errors.value?.length > 0);
function getFormApi(): FormActions {
if (!formApi) {
throw new Error('Form api is required in <FormField />');
}
return formApi;
}
const FieldComponent = computed(() => {
const finalComponent = isString(component)
? componentMap.value[component]
@ -156,7 +164,7 @@ const fieldRules = computed(() => {
const computedProps = computed(() => {
const finalComponentProps = isFunction(componentProps)
? componentProps(values.value, formApi!)
? componentProps(values.value, getFormApi())
: componentProps;
return {
@ -186,7 +194,7 @@ const customContentRender = computed(() => {
if (!isFunction(renderComponentContent)) {
return {};
}
return renderComponentContent(values.value, formApi!);
return renderComponentContent(values.value, getFormApi());
});
const renderContentKey = computed(() => {

339
packages/effects/common-ui/src/components/resize/resize.vue

@ -264,13 +264,64 @@ const currentStick = ref<null | string>(null);
const parentElement = ref<HTMLElement | null>(null);
const width = computed(() => parentWidth.value! - left.value! - right.value!);
function getPointerPosition(
ev: Partial<{
pageX: number;
pageY: number;
touches: ArrayLike<{ pageX: number; pageY: number }>;
}>,
): null | { pointerX: number; pointerY: number } {
const touch = ev.touches?.[0];
const pointerX = ev.pageX ?? touch?.pageX;
const pointerY = ev.pageY ?? touch?.pageY;
const height = computed(() => parentHeight.value! - top.value! - bottom.value!);
if (
pointerX === null ||
pointerX === undefined ||
pointerY === null ||
pointerY === undefined
) {
return null;
}
return { pointerX, pointerY };
}
const width = computed(() => {
const currentParentWidth = parentWidth.value;
const currentLeft = left.value;
const currentRight = right.value;
if (
currentParentWidth === null ||
currentLeft === null ||
currentRight === null
) {
return 0;
}
return currentParentWidth - currentLeft - currentRight;
});
const height = computed(() => {
const currentParentHeight = parentHeight.value;
const currentTop = top.value;
const currentBottom = bottom.value;
if (
currentParentHeight === null ||
currentTop === null ||
currentBottom === null
) {
return 0;
}
return currentParentHeight - currentTop - currentBottom;
});
const rect = computed(() => ({
left: Math.round(left.value!),
top: Math.round(top.value!),
left: Math.round(left.value ?? 0),
top: Math.round(top.value ?? 0),
width: Math.round(width.value),
height: Math.round(height.value),
}));
@ -348,36 +399,48 @@ const rectCorrectionByAspectRatio = (rect: {
newTop: number;
}) => {
let { newLeft, newRight, newTop, newBottom } = rect;
// const { parentWidth, parentHeight, currentStick, aspectFactor, dimensionsBeforeMove } = this;
const currentParentWidth = parentWidth.value;
const currentParentHeight = parentHeight.value;
const stick = currentStick.value;
const factor = aspectFactor.value;
if (
currentParentWidth === null ||
currentParentHeight === null ||
!stick ||
factor === null
) {
return { newLeft, newRight, newTop, newBottom };
}
let newWidth = parentWidth.value! - newLeft - newRight;
let newHeight = parentHeight.value! - newTop - newBottom;
let newWidth = currentParentWidth - newLeft - newRight;
let newHeight = currentParentHeight - newTop - newBottom;
if (currentStick.value![1] === 'm') {
if (stick[1] === 'm') {
const deltaHeight = newHeight - dimensionsBeforeMove.value.height;
newLeft -= (deltaHeight * aspectFactor.value!) / 2;
newRight -= (deltaHeight * aspectFactor.value!) / 2;
} else if (currentStick.value![0] === 'm') {
newLeft -= (deltaHeight * factor) / 2;
newRight -= (deltaHeight * factor) / 2;
} else if (stick[0] === 'm') {
const deltaWidth = newWidth - dimensionsBeforeMove.value.width;
newTop -= deltaWidth / aspectFactor.value! / 2;
newBottom -= deltaWidth / aspectFactor.value! / 2;
} else if (newWidth / newHeight > aspectFactor.value!) {
newWidth = aspectFactor.value! * newHeight;
newTop -= deltaWidth / factor / 2;
newBottom -= deltaWidth / factor / 2;
} else if (newWidth / newHeight > factor) {
newWidth = factor * newHeight;
if (currentStick.value![1] === 'l') {
newLeft = parentWidth.value! - newRight - newWidth;
if (stick[1] === 'l') {
newLeft = currentParentWidth - newRight - newWidth;
} else {
newRight = parentWidth.value! - newLeft - newWidth;
newRight = currentParentWidth - newLeft - newWidth;
}
} else {
newHeight = newWidth / aspectFactor.value!;
newHeight = newWidth / factor;
if (currentStick.value![0] === 't') {
newTop = parentHeight.value! - newBottom - newHeight;
if (stick[0] === 't') {
newTop = currentParentHeight - newBottom - newHeight;
} else {
newBottom = parentHeight.value! - newTop - newHeight;
newBottom = currentParentHeight - newTop - newHeight;
}
}
@ -385,11 +448,17 @@ const rectCorrectionByAspectRatio = (rect: {
};
const stickMove = (delta: { x: number; y: number }) => {
const stick = currentStick.value;
if (!stick) {
return;
}
let newTop = dimensionsBeforeMove.value.top;
let newBottom = dimensionsBeforeMove.value.bottom;
let newLeft = dimensionsBeforeMove.value.left;
let newRight = dimensionsBeforeMove.value.right;
switch (currentStick.value![0]) {
switch (stick[0]) {
case 'b': {
newBottom = dimensionsBeforeMove.value.bottom + delta.y;
@ -419,7 +488,7 @@ const stickMove = (delta: { x: number; y: number }) => {
}
}
switch (currentStick.value![1]) {
switch (stick[1]) {
case 'l': {
newLeft = dimensionsBeforeMove.value.left - delta.x;
@ -512,89 +581,121 @@ const calcDragLimitation = () => {
};
const calcResizeLimits = () => {
// const { aspectFactor, width, height, bottom, top, left, right } = this;
const parentLim = parentLimitation.value ? 0 : null;
const currentAspectFactor = aspectFactor.value;
const currentLeft = left.value;
const currentRight = right.value;
const currentTop = top.value;
const currentBottom = bottom.value;
const stick = currentStick.value;
if (aspectRatio.value) {
if (minw.value / minh.value > (aspectFactor.value as number)) {
minh.value = minw.value / (aspectFactor.value as number);
if (
currentLeft === null ||
currentRight === null ||
currentTop === null ||
currentBottom === null
) {
return {
left: { min: parentLim, max: parentLim },
right: { min: parentLim, max: parentLim },
top: { min: parentLim, max: parentLim },
bottom: { min: parentLim, max: parentLim },
};
}
let minWidth = minw.value;
let minHeight = minh.value;
if (aspectRatio.value && currentAspectFactor) {
if (minWidth / minHeight > currentAspectFactor) {
minHeight = minWidth / currentAspectFactor;
} else {
minw.value = ((aspectFactor.value as number) * minh.value) as number;
minWidth = currentAspectFactor * minHeight;
}
}
const limits = {
left: {
min: parentLim,
max: (left.value as number) + (width.value - minw.value),
max: currentLeft + (width.value - minWidth),
},
right: {
min: parentLim,
max: (right.value as number) + (width.value - minw.value),
max: currentRight + (width.value - minWidth),
},
top: {
min: parentLim,
max: (top.value as number) + (height.value - minh.value),
max: currentTop + (height.value - minHeight),
},
bottom: {
min: parentLim,
max: (bottom.value as number) + (height.value - minh.value),
max: currentBottom + (height.value - minHeight),
},
};
if (aspectRatio.value) {
if (aspectRatio.value && currentAspectFactor) {
const aspectLimits = {
left: {
min:
left.value! -
Math.min(top.value!, bottom.value!) * aspectFactor.value! * 2,
currentLeft -
Math.min(currentTop, currentBottom) * currentAspectFactor * 2,
max:
left.value! +
((height.value - minh.value!) / 2) * aspectFactor.value! * 2,
currentLeft +
((height.value - minHeight) / 2) * currentAspectFactor * 2,
},
right: {
min:
right.value! -
Math.min(top.value!, bottom.value!) * aspectFactor.value! * 2,
currentRight -
Math.min(currentTop, currentBottom) * currentAspectFactor * 2,
max:
right.value! +
((height.value - minh.value!) / 2) * aspectFactor.value! * 2,
currentRight +
((height.value - minHeight) / 2) * currentAspectFactor * 2,
},
top: {
min:
top.value! -
(Math.min(left.value!, right.value!) / aspectFactor.value!) * 2,
currentTop -
(Math.min(currentLeft, currentRight) / currentAspectFactor) * 2,
max:
top.value! +
((width.value - minw.value) / 2 / aspectFactor.value!) * 2,
currentTop + ((width.value - minWidth) / 2 / currentAspectFactor) * 2,
},
bottom: {
min:
bottom.value! -
(Math.min(left.value!, right.value!) / aspectFactor.value!) * 2,
currentBottom -
(Math.min(currentLeft, currentRight) / currentAspectFactor) * 2,
max:
bottom.value! +
((width.value - minw.value) / 2 / aspectFactor.value!) * 2,
currentBottom +
((width.value - minWidth) / 2 / currentAspectFactor) * 2,
},
};
if (currentStick.value![0] === 'm') {
if (stick?.[0] === 'm') {
limits.left = {
min: Math.max(limits.left.min!, aspectLimits.left.min),
min: Math.max(
limits.left.min ?? aspectLimits.left.min,
aspectLimits.left.min,
),
max: Math.min(limits.left.max, aspectLimits.left.max),
};
limits.right = {
min: Math.max(limits.right.min!, aspectLimits.right.min),
min: Math.max(
limits.right.min ?? aspectLimits.right.min,
aspectLimits.right.min,
),
max: Math.min(limits.right.max, aspectLimits.right.max),
};
} else if (currentStick.value![1] === 'm') {
} else if (stick?.[1] === 'm') {
limits.top = {
min: Math.max(limits.top.min!, aspectLimits.top.min),
min: Math.max(
limits.top.min ?? aspectLimits.top.min,
aspectLimits.top.min,
),
max: Math.min(limits.top.max, aspectLimits.top.max),
};
limits.bottom = {
min: Math.max(limits.bottom.min!, aspectLimits.bottom.min),
min: Math.max(
limits.bottom.min ?? aspectLimits.bottom.min,
aspectLimits.bottom.min,
),
max: Math.min(limits.bottom.max, aspectLimits.bottom.max),
};
}
@ -604,9 +705,9 @@ const calcResizeLimits = () => {
};
const positionStyle = computed(() => ({
top: `${top.value}px`,
left: `${left.value}px`,
zIndex: zIndex.value!,
top: `${top.value ?? 0}px`,
left: `${left.value ?? 0}px`,
zIndex: zIndex.value ?? 'auto',
}));
const sizeStyle = computed(() => ({
@ -719,10 +820,13 @@ const stickDown = (
stickDrag.value = true;
const pointerX = ev.pageX === undefined ? ev.touches[0].pageX : ev.pageX;
const pointerY = ev.pageY === undefined ? ev.touches[0].pageY : ev.pageY;
const pointerPosition = getPointerPosition(ev);
if (!pointerPosition) {
return;
}
saveDimensionsBeforeMove({ pointerX, pointerY });
saveDimensionsBeforeMove(pointerPosition);
currentStick.value = stick;
@ -736,13 +840,19 @@ const move = (ev: MouseEvent & TouchEvent) => {
ev.stopPropagation();
// touches
const pageX = ev.pageX === undefined ? ev.touches![0]!.pageX : ev.pageX;
const pageY = ev.pageY === undefined ? ev.touches![0]!.pageY : ev.pageY;
const pointerPosition = getPointerPosition(ev);
if (!pointerPosition) {
return;
}
const delta = {
x: (dimensionsBeforeMove.value.pointerX - pageX) / parentScaleX.value,
y: (dimensionsBeforeMove.value.pointerY - pageY) / parentScaleY.value,
x:
(dimensionsBeforeMove.value.pointerX - pointerPosition.pointerX) /
parentScaleX.value,
y:
(dimensionsBeforeMove.value.pointerY - pointerPosition.pointerY) /
parentScaleY.value,
};
if (stickDrag.value) {
@ -810,12 +920,17 @@ onMounted(() => {
left.value = x.value;
top.value = y.value;
right.value = (parentWidth.value -
(w.value === 'auto' ? container.value!.scrollWidth : (w.value as number)) -
left.value) as number;
bottom.value = (parentHeight.value -
(h.value === 'auto' ? container.value!.scrollHeight : (h.value as number)) -
top.value) as number;
const containerElement = container.value;
const contentWidth =
w.value === 'auto'
? (containerElement?.scrollWidth ?? 0)
: (w.value as number);
const contentHeight =
h.value === 'auto'
? (containerElement?.scrollHeight ?? 0)
: (h.value as number);
right.value = (parentWidth.value ?? 0) - contentWidth - (left.value ?? 0);
bottom.value = (parentHeight.value ?? 0) - contentHeight - (top.value ?? 0);
addEvents(domEvents.value);
@ -839,13 +954,14 @@ onMounted(() => {
);
}
});
onBeforeUnmount(() => {
removeEvents(domEvents.value);
});
const bodyDown = (ev: MouseEvent & TouchEvent) => {
const { target, button } = ev;
const targetElement = target instanceof HTMLElement ? target : null;
const uid = getCurrentInstance()?.uid.toString();
if (!preventActiveBehavior.value) {
active.value = true;
@ -863,17 +979,13 @@ const bodyDown = (ev: MouseEvent & TouchEvent) => {
if (
dragHandle.value &&
(target! as HTMLElement).dataset.dragHandle !==
getCurrentInstance()?.uid.toString()
targetElement &&
targetElement.dataset.dragHandle !== uid
) {
return;
}
if (
dragCancel.value &&
(target! as HTMLElement).dataset.dragCancel ===
getCurrentInstance()?.uid.toString()
) {
if (dragCancel.value && targetElement?.dataset.dragCancel === uid) {
return;
}
@ -889,10 +1001,13 @@ const bodyDown = (ev: MouseEvent & TouchEvent) => {
bodyDrag.value = true;
}
const pointerX = ev.pageX === undefined ? ev.touches[0]!.pageX : ev.pageX;
const pointerY = ev.pageY === undefined ? ev.touches[0]!.pageY : ev.pageY;
const pointerPosition = getPointerPosition(ev);
if (!pointerPosition) {
return;
}
saveDimensionsBeforeMove({ pointerX, pointerY });
saveDimensionsBeforeMove(pointerPosition);
if (parentLimitation.value) {
limits.value = calcDragLimitation();
@ -921,8 +1036,10 @@ watch(
watch(
() => z.value,
(val) => {
if ((val as number) >= 0 || val === 'auto') {
zIndex.value = val as number;
if (typeof val === 'number' && val >= 0) {
zIndex.value = val;
} else if (val === 'auto') {
zIndex.value = null;
}
},
{ immediate: true },
@ -931,13 +1048,22 @@ watch(
watch(
() => x.value,
(newVal, oldVal) => {
if (stickDrag.value || bodyDrag.value || newVal === left.value) {
const currentLeft = left.value;
const currentTop = top.value;
if (
stickDrag.value ||
bodyDrag.value ||
currentLeft === null ||
currentTop === null ||
newVal === currentLeft
) {
return;
}
const delta = oldVal - newVal;
bodyDown({ pageX: left.value!, pageY: top.value! } as MouseEvent &
bodyDown({ pageX: currentLeft, pageY: currentTop } as MouseEvent &
TouchEvent);
bodyMove({ x: delta, y: 0 });
@ -950,13 +1076,22 @@ watch(
watch(
() => y.value,
(newVal, oldVal) => {
if (stickDrag.value || bodyDrag.value || newVal === top.value) {
const currentLeft = left.value;
const currentTop = top.value;
if (
stickDrag.value ||
bodyDrag.value ||
currentLeft === null ||
currentTop === null ||
newVal === currentTop
) {
return;
}
const delta = oldVal - newVal;
bodyDown({ pageX: left.value, pageY: top.value } as MouseEvent &
bodyDown({ pageX: currentLeft, pageY: currentTop } as MouseEvent &
TouchEvent);
bodyMove({ x: 0, y: delta });
@ -969,16 +1104,23 @@ watch(
watch(
() => w.value,
(newVal, oldVal) => {
const currentRight = right.value;
const currentTop = top.value;
if (stickDrag.value || bodyDrag.value || newVal === width.value) {
return;
}
if (currentRight === null || currentTop === null) {
return;
}
const stick = 'mr';
const delta = (oldVal as number) - (newVal as number);
stickDown(
stick,
{ pageX: right.value, pageY: top.value! + height.value / 2 },
{ pageX: currentRight, pageY: currentTop + height.value / 2 },
true,
);
stickMove({ x: delta, y: 0 });
@ -992,16 +1134,23 @@ watch(
watch(
() => h.value,
(newVal, oldVal) => {
const currentLeft = left.value;
const currentBottom = bottom.value;
if (stickDrag.value || bodyDrag.value || newVal === height.value) {
return;
}
if (currentLeft === null || currentBottom === null) {
return;
}
const stick = 'bm';
const delta = (oldVal as number) - (newVal as number);
stickDown(
stick,
{ pageX: left.value! + width.value / 2, pageY: bottom.value },
{ pageX: currentLeft + width.value / 2, pageY: currentBottom },
true,
);
stickMove({ x: 0, y: delta });
@ -1015,7 +1164,7 @@ watch(
watch(
() => parentW.value,
(val) => {
right.value = val - width.value - left.value!;
right.value = val - width.value - (left.value ?? 0);
parentWidth.value = val;
},
);
@ -1023,7 +1172,7 @@ watch(
watch(
() => parentH.value,
(val) => {
bottom.value = val - height.value - top.value!;
bottom.value = val - height.value - (top.value ?? 0);
parentHeight.value = val;
},
);

5
packages/effects/layouts/src/widgets/global-search/global-search.vue

@ -53,11 +53,13 @@ function handleClose() {
const keys = useMagicKeys();
const cmd = isWindowsOs() ? keys['ctrl+k'] : keys['cmd+k'];
whenever(cmd!, () => {
if (cmd) {
whenever(cmd, () => {
if (props.enableShortcutKey) {
modalApi.open();
}
});
}
whenever(open, () => {
nextTick(() => {
@ -80,6 +82,7 @@ const toggleKeydownListener = () => {
};
const toggleOpen = () => {
// oxlint-disable-next-line no-unused-expressions
open.value ? modalApi.close() : modalApi.open();
};

11
packages/effects/layouts/src/widgets/user-dropdown/user-dropdown.vue

@ -153,18 +153,25 @@ function handleSubmitLogout() {
if (enableShortcutKey.value) {
const keys = useMagicKeys();
whenever(keys['Alt+KeyQ']!, () => {
const logoutKey = keys['Alt+KeyQ'];
const lockKey = keys['Alt+KeyL'];
if (logoutKey) {
whenever(logoutKey, () => {
if (enableLogoutShortcutKey.value) {
handleLogout();
}
});
}
whenever(keys['Alt+KeyL']!, () => {
if (lockKey) {
whenever(lockKey, () => {
if (enableLockScreenShortcutKey.value) {
handleOpenLock();
}
});
}
}
</script>
<template>

1
packages/effects/plugins/src/vxe-table/use-vxe-grid.vue

@ -316,7 +316,6 @@ async function init() {
'[Vben Vxe Table]: The formConfig in the grid is not supported, please use the `formOptions` props',
);
}
// @ts-expect-error: setState is injected by the extended grid api wrapper at runtime
props.api?.setState?.({ gridOptions: defaultGridOptions });
// form vben-form query
extendProxyOptions(props.api, defaultGridOptions, () =>

3
playground/src/views/_core/authentication/code-login.vue

@ -94,8 +94,7 @@ const formSchema = computed((): VbenFormSchema[] => {
* @param values 登录表单数据
*/
async function handleLogin(values: Recordable<any>) {
// eslint-disable-next-line no-console
console.log(values);
void values;
}
</script>

3
playground/src/views/_core/authentication/forget-password.vue

@ -28,8 +28,7 @@ const formSchema = computed((): VbenFormSchema[] => {
});
function handleSubmit(value: Record<string, any>) {
// eslint-disable-next-line no-console
console.log('reset email:', value);
void value;
}
</script>

3
playground/src/views/_core/authentication/register.vue

@ -82,8 +82,7 @@ const formSchema = computed((): VbenFormSchema[] => {
});
function handleSubmit(value: Recordable<any>) {
// eslint-disable-next-line no-console
console.log('register submit:', value);
void value;
}
</script>

Loading…
Cancel
Save