This commit is contained in:
dap
2025-01-01 12:57:20 +08:00
251 changed files with 619 additions and 959 deletions

View File

@@ -1,4 +1,10 @@
export default {
'*.md': ['prettier --cache --ignore-unknown --write'],
'*.vue': [
'prettier --write',
'eslint --cache --fix',
'stylelint --fix --allow-empty-input',
],
'*.{js,jsx,ts,tsx}': [
'prettier --cache --ignore-unknown --write',
'eslint --cache --fix',
@@ -7,14 +13,8 @@ export default {
'prettier --cache --ignore-unknown --write',
'stylelint --fix --allow-empty-input',
],
'*.md': ['prettier --cache --ignore-unknown --write'],
'*.vue': [
'prettier --write',
'eslint --cache --fix',
'stylelint --fix --allow-empty-input',
],
'package.json': ['prettier --cache --write'],
'{!(package)*.json,*.code-snippets,.!(browserslist)*rc}': [
'prettier --cache --write--parser json',
],
'package.json': ['prettier --cache --write'],
};

View File

@@ -4,13 +4,12 @@
*/
import type { BaseFormComponentType } from '@vben/common-ui';
import type { Component, SetupContext } from 'vue';
import { h } from 'vue';
import { Tinymce as RichTextarea } from '#/components/tinymce';
import { FileUpload, ImageUpload } from '#/components/upload';
import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui';
import { $t } from '@vben/locales';
import {
AutoComplete,
Button,
@@ -35,9 +34,7 @@ import {
TreeSelect,
Upload,
} from 'ant-design-vue';
import { Tinymce as RichTextarea } from '#/components/tinymce';
import { FileUpload, ImageUpload } from '#/components/upload';
import { h } from 'vue';
const withDefaultPlaceholder = <T extends Component>(
component: T,

View File

@@ -1,8 +1,6 @@
import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales';
import type { Locale } from 'ant-design-vue/es/locale';
import type { App } from 'vue';
import { ref } from 'vue';
import {
$t,
@@ -10,10 +8,10 @@ import {
loadLocalesMapFromDir,
} from '@vben/locales';
import { preferences } from '@vben/preferences';
import antdEnLocale from 'ant-design-vue/es/locale/en_US';
import antdDefaultLocale from 'ant-design-vue/es/locale/zh_CN';
import dayjs from 'dayjs';
import { ref } from 'vue';
const antdLocale = ref<Locale>(antdDefaultLocale);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import type { EchartsUIType } from '@vben/plugins/echarts';
import {
EchartsUI,
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue';
const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import type { EchartsUIType } from '@vben/plugins/echarts';
import {
EchartsUI,
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue';
const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import type { EchartsUIType } from '@vben/plugins/echarts';
import {
EchartsUI,
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue';
const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import type { EchartsUIType } from '@vben/plugins/echarts';
import {
EchartsUI,
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue';
const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import type { EchartsUIType } from '@vben/plugins/echarts';
import {
EchartsUI,
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue';
const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef);

View File

@@ -5,13 +5,10 @@
import type { BaseFormComponentType } from '@vben/common-ui';
import type { Recordable } from '@vben/types';
import type { Component, SetupContext } from 'vue';
import { h } from 'vue';
import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui';
import { $t } from '@vben/locales';
import {
ElButton,
ElCheckbox,
@@ -32,6 +29,7 @@ import {
ElTreeSelect,
ElUpload,
} from 'element-plus';
import { h } from 'vue';
const withDefaultPlaceholder = <T extends Component>(
component: T,

View File

@@ -1,8 +1,6 @@
import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales';
import type { Language } from 'element-plus/es/locale';
import type { App } from 'vue';
import { ref } from 'vue';
import {
$t,
@@ -10,10 +8,10 @@ import {
loadLocalesMapFromDir,
} from '@vben/locales';
import { preferences } from '@vben/preferences';
import dayjs from 'dayjs';
import enLocale from 'element-plus/es/locale/lang/en';
import defaultLocale from 'element-plus/es/locale/lang/zh-cn';
import { ref } from 'vue';
const elementLocale = ref<Language>(defaultLocale);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import type { EchartsUIType } from '@vben/plugins/echarts';
import {
EchartsUI,
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue';
const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import type { EchartsUIType } from '@vben/plugins/echarts';
import {
EchartsUI,
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue';
const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import type { EchartsUIType } from '@vben/plugins/echarts';
import {
EchartsUI,
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue';
const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import type { EchartsUIType } from '@vben/plugins/echarts';
import {
EchartsUI,
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue';
const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import type { EchartsUIType } from '@vben/plugins/echarts';
import {
EchartsUI,
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue';
const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef);

View File

@@ -4,13 +4,11 @@
*/
import type { BaseFormComponentType } from '@vben/common-ui';
import type { Component, SetupContext } from 'vue';
import { h } from 'vue';
import { message } from '#/adapter/naive';
import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui';
import { $t } from '@vben/locales';
import {
NButton,
NCheckbox,
@@ -29,8 +27,7 @@ import {
NTreeSelect,
NUpload,
} from 'naive-ui';
import { message } from '#/adapter/naive';
import { h } from 'vue';
const withDefaultPlaceholder = <T extends Component>(
component: T,

View File

@@ -1,5 +1,4 @@
import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales';
import type { App } from 'vue';
import {

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import type { EchartsUIType } from '@vben/plugins/echarts';
import {
EchartsUI,
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue';
const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import type { EchartsUIType } from '@vben/plugins/echarts';
import {
EchartsUI,
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue';
const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import type { EchartsUIType } from '@vben/plugins/echarts';
import {
EchartsUI,
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue';
const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import type { EchartsUIType } from '@vben/plugins/echarts';
import {
EchartsUI,
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue';
const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import type { EchartsUIType } from '@vben/plugins/echarts';
import {
EchartsUI,
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue';
const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { Page } from '@vben/common-ui';
import type { NotificationType } from 'naive-ui';
import { type NotificationType } from 'naive-ui';
import { Page } from '@vben/common-ui';
import { NButton, NCard, NSpace, useMessage, useNotification } from 'naive-ui';
const notification = useNotification();

View File

@@ -1,4 +1,6 @@
import { type DefaultTheme, defineConfig } from 'vitepress';
import type { DefaultTheme } from 'vitepress';
import { defineConfig } from 'vitepress';
import { version } from '../../../package.json';

View File

@@ -1,4 +1,6 @@
import { type DefaultTheme, defineConfig } from 'vitepress';
import type { DefaultTheme } from 'vitepress';
import { defineConfig } from 'vitepress';
import { version } from '../../../package.json';

View File

@@ -10,7 +10,6 @@ import {
// import { useAntdDesignTokens } from '@vben/hooks';
// import { initPreferences } from '@vben/preferences';
import { ConfigProvider, theme } from 'ant-design-vue';
import mediumZoom from 'medium-zoom';
import { useRoute } from 'vitepress';

View File

@@ -4,13 +4,10 @@
*/
import type { BaseFormComponentType } from '@vben/common-ui';
import type { Component, SetupContext } from 'vue';
import { h } from 'vue';
import { globalShareState } from '@vben/common-ui';
import { $t } from '@vben/locales';
import {
AutoComplete,
Button,
@@ -35,6 +32,7 @@ import {
TreeSelect,
Upload,
} from 'ant-design-vue';
import { h } from 'vue';
const withDefaultPlaceholder = <T extends Component>(
component: T,

View File

@@ -10,6 +10,7 @@ export async function importPluginConfig(): Promise<Linter.Config[]> {
import: pluginImport,
},
rules: {
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',

View File

@@ -1,6 +1,5 @@
import type { Linter } from 'eslint';
// @ts-expect-error - no types
import js from '@eslint/js';
import pluginUnusedImports from 'eslint-plugin-unused-imports';
import globals from 'globals';

View File

@@ -1,8 +1,13 @@
import type { Linter } from 'eslint';
import perfectionistPlugin from 'eslint-plugin-perfectionist';
import { interopDefault } from '../util';
export async function perfectionist(): Promise<Linter.Config[]> {
const perfectionistPlugin = await interopDefault(
// @ts-expect-error - no types
import('eslint-plugin-perfectionist'),
);
return [
perfectionistPlugin.configs['recommended-natural'],
{
@@ -19,21 +24,28 @@ export async function perfectionist(): Promise<Linter.Config[]> {
{
customGroups: {
type: {
vben: 'vben',
vue: 'vue',
'vben-core-type': ['^@vben-core/.+'],
'vben-type': ['^@vben/.+'],
'vue-type': ['^vue$', '^vue-.+', '^@vue/.+'],
},
value: {
vben: ['@vben*', '@vben/**/**', '@vben-core/**/**'],
vue: ['vue', 'vue-*', '@vue*'],
vben: ['^@vben/.+'],
'vben-core': ['^@vben-core/.+'],
vue: ['^vue$', '^vue-.+', '^@vue/.+'],
},
},
environment: 'node',
groups: [
['external-type', 'builtin-type', 'type'],
'vue-type',
'vben-type',
'vben-core-type',
['parent-type', 'sibling-type', 'index-type'],
['internal-type'],
'builtin',
'vue',
'vben',
'vben-core',
'external',
'internal',
['parent', 'sibling', 'index'],
@@ -43,12 +55,13 @@ export async function perfectionist(): Promise<Linter.Config[]> {
'object',
'unknown',
],
internalPattern: ['#*', '#*/**'],
internalPattern: ['^#/.+'],
newlinesBetween: 'always',
order: 'asc',
type: 'natural',
},
],
'perfectionist/sort-modules': 'off',
'perfectionist/sort-named-exports': [
'error',
{
@@ -67,42 +80,6 @@ export async function perfectionist(): Promise<Linter.Config[]> {
groups: ['unknown', 'items', 'list', 'children'],
ignorePattern: ['children'],
order: 'asc',
partitionByComment: 'Part:**',
type: 'natural',
},
],
'perfectionist/sort-vue-attributes': [
'error',
{
// Based on: https://vuejs.org/style-guide/rules-recommended.html#element-attribute-order
customGroups: {
/* eslint-disable perfectionist/sort-objects */
DEFINITION: '*(is|:is|v-is)',
LIST_RENDERING: 'v-for',
CONDITIONALS: 'v-*(else-if|if|else|show|cloak)',
RENDER_MODIFIERS: 'v-*(pre|once)',
GLOBAL: '*(:id|id)',
UNIQUE: '*(ref|key|:ref|:key)',
SLOT: '*(v-slot|slot)',
TWO_WAY_BINDING: '*(v-model|v-model:*)',
// OTHER_DIRECTIVES e.g. 'v-custom-directive'
EVENTS: '*(v-on|@*)',
CONTENT: 'v-*(html|text)',
/* eslint-enable perfectionist/sort-objects */
},
groups: [
'DEFINITION',
'LIST_RENDERING',
'CONDITIONALS',
'RENDER_MODIFIERS',
'GLOBAL',
'UNIQUE',
'SLOT',
'TWO_WAY_BINDING',
'unknown',
'EVENTS',
'CONTENT',
],
type: 'natural',
},
],

View File

@@ -1,4 +1,6 @@
import ora, { type Ora } from 'ora';
import type { Ora } from 'ora';
import ora from 'ora';
interface SpinnerOptions {
failedText?: string;

View File

@@ -1,3 +1,5 @@
import type { PluginOption } from 'vite';
import fs from 'node:fs';
import fsp from 'node:fs/promises';
import { join } from 'node:path';
@@ -5,8 +7,6 @@ import { fileURLToPath } from 'node:url';
import { readPackageJSON } from '@vben/node-utils';
import { type PluginOption } from 'vite';
/**
* 用于生成将loading样式注入到项目中
* 为多app提供loading样式无需在每个 app -> index.html单独引入

View File

@@ -4,7 +4,6 @@ import { existsSync } from 'node:fs';
import { join } from 'node:path';
import { fs } from '@vben/node-utils';
import dotenv from 'dotenv';
const getBoolean = (value: string | undefined) => value === 'true';

View File

@@ -99,7 +99,7 @@
"node": ">=20.10.0",
"pnpm": ">=9.12.0"
},
"packageManager": "pnpm@9.15.1",
"packageManager": "pnpm@9.15.2",
"pnpm": {
"peerDependencyRules": {
"allowedVersions": {

View File

@@ -45,7 +45,7 @@
"default": "./dist/store.mjs"
},
"./global-state": {
"types": "./dist/global-state.d.ts",
"types": "./src/global-state.ts",
"development": "./src/global-state.ts",
"default": "./dist/global-state.mjs"
}

View File

@@ -1,4 +1,6 @@
import { type ClassValue, clsx } from 'clsx';
import type { ClassValue } from 'clsx';
import { clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
function cn(...inputs: ClassValue[]) {

View File

@@ -1,4 +1,4 @@
import { type ComputedRef, type MaybeRef } from 'vue';
import type { ComputedRef, MaybeRef } from 'vue';
/**
* 深层递归所有属性为可选

View File

@@ -1,6 +1,5 @@
import type { RouteRecordRaw } from 'vue-router';
import type { Component } from 'vue';
import type { RouteRecordRaw } from 'vue-router';
/**
* 扩展路由原始对象

View File

@@ -1,6 +1,5 @@
import type { Router, RouteRecordRaw } from 'vue-router';
import type { Component } from 'vue';
import type { Router, RouteRecordRaw } from 'vue-router';
interface RouteMeta {
/**

View File

@@ -1,5 +1,5 @@
import type { VisibleDomRect } from '@vben-core/shared/utils';
import type { CSSProperties } from 'vue';
import { computed, onMounted, onUnmounted, ref } from 'vue';
import {
CSS_VARIABLE_LAYOUT_CONTENT_HEIGHT,
@@ -7,12 +7,9 @@ import {
CSS_VARIABLE_LAYOUT_FOOTER_HEIGHT,
CSS_VARIABLE_LAYOUT_HEADER_HEIGHT,
} from '@vben-core/shared/constants';
import {
getElementVisibleRect,
type VisibleDomRect,
} from '@vben-core/shared/utils';
import { getElementVisibleRect } from '@vben-core/shared/utils';
import { useCssVar, useDebounceFn } from '@vueuse/core';
import { computed, onMounted, onUnmounted, ref } from 'vue';
/**
* @zh_CN content style

View File

@@ -1,10 +1,10 @@
import type { ComputedRef, Ref } from 'vue';
import { computed, getCurrentInstance, unref, useAttrs, useSlots } from 'vue';
import {
getFirstNonNullOrUndefined,
kebabToCamelCase,
} from '@vben-core/shared/utils';
import { computed, getCurrentInstance, unref, useAttrs, useSlots } from 'vue';
/**
* 依次从插槽、attrs、props、state 中获取值

View File

@@ -1,8 +1,9 @@
import { computed, ref } from 'vue';
import type { Locale } from './messages';
import { createSharedComposable } from '@vueuse/core';
import { computed, ref } from 'vue';
import { getMessages, type Locale } from './messages';
import { getMessages } from './messages';
export const useSimpleLocale = createSharedComposable(() => {
const currentLocale = ref<Locale>('zh-CN');

View File

@@ -2,16 +2,14 @@ import type { DeepPartial } from '@vben-core/typings';
import type { InitialOptions, Preferences } from './types';
import { markRaw, reactive, readonly, watch } from 'vue';
import { StorageManager } from '@vben-core/shared/cache';
import { isMacOs, merge } from '@vben-core/shared/utils';
import {
breakpointsTailwind,
useBreakpoints,
useDebounceFn,
} from '@vueuse/core';
import { markRaw, reactive, readonly, watch } from 'vue';
import { defaultPreferences } from './config';
import { updateCSSVariables } from './update-css-variables';

View File

@@ -1,6 +1,5 @@
import { computed } from 'vue';
import { diff } from '@vben-core/shared/utils';
import { computed } from 'vue';
import { preferencesManager } from './preferences';
import { isDarkTheme } from './update-css-variables';
@@ -111,7 +110,8 @@ function usePreferences() {
isMixedNav.value ||
isSideMixedNav.value ||
isSideNav.value ||
isHeaderMixedNav.value
isHeaderMixedNav.value ||
isHeaderSidebarNav.value
);
});

View File

@@ -1,12 +1,11 @@
import type { Component } from 'vue';
import type {
BaseFormComponentType,
FormCommonConfig,
VbenFormAdapterOptions,
} from './types';
import type { Component } from 'vue';
import { h } from 'vue';
import {
VbenButton,
VbenCheckbox,
@@ -17,8 +16,8 @@ import {
VbenSelect,
} from '@vben-core/shadcn-ui';
import { globalShareState } from '@vben-core/shared/global-state';
import { defineRule } from 'vee-validate';
import { h } from 'vue';
const DEFAULT_MODEL_PROP_NAME = 'modelValue';

View File

@@ -8,8 +8,6 @@ import type {
import type { FormActions, FormSchema, VbenFormProps } from './types';
import { toRaw } from 'vue';
import { Store } from '@vben-core/shared/store';
import {
bindMethods,
@@ -21,6 +19,7 @@ import {
mergeWithArrayOverride,
StateHandler,
} from '@vben-core/shared/utils';
import { toRaw } from 'vue';
function getDefaultState(): VbenFormProps {
return {
@@ -112,11 +111,6 @@ export class FormApi {
}
}
// 如果需要多次更新状态,可以使用 batch 方法
batchStore(cb: () => void) {
this.store.batch(cb);
}
getLatestSubmissionValues() {
return this.latestSubmissionValues || {};
}

View File

@@ -3,8 +3,6 @@ import type { ZodType } from 'zod';
import type { FormSchema, MaybeComponentProps } from '../types';
import { computed, nextTick, useTemplateRef, watch } from 'vue';
import {
FormControl,
FormDescription,
@@ -14,9 +12,9 @@ import {
VbenRenderContent,
} from '@vben-core/shadcn-ui';
import { cn, isFunction, isObject, isString } from '@vben-core/shared/utils';
import { toTypedSchema } from '@vee-validate/zod';
import { useFieldError, useFormValues } from 'vee-validate';
import { computed, nextTick, useTemplateRef, watch } from 'vue';
import { injectRenderFormProps, useFormContext } from './context';
import useDependencies from './dependencies';

View File

@@ -1,4 +1,5 @@
<script setup lang="ts">
import type { GenericObject } from 'vee-validate';
import type { ZodTypeAny } from 'zod';
import type {
@@ -8,12 +9,9 @@ import type {
FormShape,
} from '../types';
import { computed } from 'vue';
import { Form } from '@vben-core/shadcn-ui';
import { cn, isString, mergeWithArrayOverride } from '@vben-core/shared/utils';
import { type GenericObject } from 'vee-validate';
import { computed } from 'vue';
import { provideFormRenderProps } from './context';
import { useExpandable } from './expandable';

View File

@@ -1,12 +1,11 @@
import type { VbenButtonProps } from '@vben-core/shadcn-ui';
import type { ClassType } from '@vben-core/typings';
import type { FieldOptions, FormContext, GenericObject } from 'vee-validate';
import type { Component, HtmlHTMLAttributes, Ref } from 'vue';
import type { ZodTypeAny } from 'zod';
import type { FormApi } from './form-api';
import type { Component, HtmlHTMLAttributes, Ref } from 'vue';
export type FormLayout = 'horizontal' | 'vertical';
export type BaseFormComponentType =

View File

@@ -1,12 +1,13 @@
import type { FormActions, VbenFormProps } from './types';
import type { ComputedRef } from 'vue';
import type { ZodRawShape } from 'zod';
import { computed, type ComputedRef, unref, useSlots } from 'vue';
import type { FormActions, VbenFormProps } from './types';
import { createContext } from '@vben-core/shadcn-ui';
import { isString } from '@vben-core/shared/utils';
import { useForm } from 'vee-validate';
import { object, type ZodRawShape } from 'zod';
import { computed, unref, useSlots } from 'vue';
import { object } from 'zod';
import { getDefaultsForSchema } from 'zod-defaults';
export const [injectFormProps, provideFormProps] =

View File

@@ -2,14 +2,11 @@
import type { ExtendedFormApi, VbenFormProps } from './types';
// import { toRaw, watch } from 'vue';
import { useForwardPriorityValues } from '@vben-core/composables';
import { nextTick, onMounted, watch } from 'vue';
// import { isFunction } from '@vben-core/shared/utils';
import { nextTick, onMounted, watch } from 'vue';
import { useForwardPriorityValues } from '@vben-core/composables';
import { cloneDeep } from '@vben-core/shared/utils';
import { useDebounceFn } from '@vueuse/core';
import FormActions from './components/form-actions.vue';

View File

@@ -1,11 +1,10 @@
<script setup lang="ts">
import type { ContentCompactType } from '@vben-core/typings';
import type { CSSProperties } from 'vue';
import { computed } from 'vue';
import { useLayoutContentStyle } from '@vben-core/composables';
import { Slot } from '@vben-core/shadcn-ui';
import { computed } from 'vue';
interface Props {
/**

View File

@@ -1,5 +1,6 @@
<script setup lang="ts">
import type { CSSProperties } from 'vue';
import { computed } from 'vue';
interface Props {

View File

@@ -1,5 +1,6 @@
<script setup lang="ts">
import type { CSSProperties } from 'vue';
import { computed, useSlots } from 'vue';
interface Props {

View File

@@ -1,10 +1,9 @@
<script setup lang="ts">
import type { CSSProperties } from 'vue';
import { computed, shallowRef, useSlots, watchEffect } from 'vue';
import { VbenScrollbar } from '@vben-core/shadcn-ui';
import { useScrollLock } from '@vueuse/core';
import { computed, shallowRef, useSlots, watchEffect } from 'vue';
import { SidebarCollapseButton, SidebarFixedButton } from './widgets';

View File

@@ -1,5 +1,6 @@
<script setup lang="ts">
import type { CSSProperties } from 'vue';
import { computed } from 'vue';
interface Props {

View File

@@ -1,8 +1,7 @@
<script setup lang="ts">
import type { VbenLayoutProps } from './vben-layout';
import type { CSSProperties } from 'vue';
import { computed, ref, watch } from 'vue';
import type { VbenLayoutProps } from './vben-layout';
import {
SCROLL_FIXED_CLASS,
@@ -12,8 +11,8 @@ import {
import { Menu } from '@vben-core/icons';
import { VbenIconButton } from '@vben-core/shadcn-ui';
import { ELEMENT_ID_MAIN_CONTENT } from '@vben-core/shared/constants';
import { useMouse, useScroll, useThrottleFn } from '@vueuse/core';
import { computed, ref, watch } from 'vue';
import {
LayoutContent,

View File

@@ -1,5 +1,6 @@
<script lang="ts" setup>
import type { UseResizeObserverReturn } from '@vueuse/core';
import type { VNodeArrayChildren } from 'vue';
import type {
MenuItemClicked,
@@ -8,6 +9,10 @@ import type {
MenuProvider,
} from '../types';
import { useNamespace } from '@vben-core/composables';
import { Ellipsis } from '@vben-core/icons';
import { isHttpUrl } from '@vben-core/shared/utils';
import { useResizeObserver } from '@vueuse/core';
import {
computed,
nextTick,
@@ -15,17 +20,10 @@ import {
ref,
toRef,
useSlots,
type VNodeArrayChildren,
watch,
watchEffect,
} from 'vue';
import { useNamespace } from '@vben-core/composables';
import { Ellipsis } from '@vben-core/icons';
import { isHttpUrl } from '@vben-core/shared/utils';
import { useResizeObserver } from '@vueuse/core';
import {
createMenuContext,
createSubMenuContext,

View File

@@ -1,5 +1,4 @@
import type { MenuRecordBadgeRaw, ThemeModeType } from '@vben-core/typings';
import type { Component, Ref } from 'vue';
interface MenuProps {

View File

@@ -4,6 +4,7 @@ import type {
VNodeChild,
VNodeNormalizedChildren,
} from 'vue';
import { isVNode } from 'vue';
type VNodeChildAtom = Exclude<VNodeChild, Array<any>>;

View File

@@ -100,17 +100,6 @@ describe('drawerApi', () => {
expect(onOpenChange).toHaveBeenCalledWith(true);
});
it('should batch state updates', () => {
const batchSpy = vi.spyOn(drawerApi.store, 'batch');
drawerApi.batchStore(() => {
drawerApi.setState({ title: 'Batch Title' });
drawerApi.setState({ confirmText: 'Batch Confirm' });
});
expect(batchSpy).toHaveBeenCalled();
expect(drawerApi.store.state.title).toBe('Batch Title');
expect(drawerApi.store.state.confirmText).toBe('Batch Confirm');
});
it('should call onClosed callback when provided', () => {
const onClosed = vi.fn();
const drawerApiWithHook = new DrawerApi({ onClosed });

View File

@@ -83,11 +83,6 @@ export class DrawerApi {
bindMethods(this);
}
// 如果需要多次更新状态,可以使用 batch 方法
batchStore(cb: () => void) {
this.store.batch(cb);
}
/**
* 关闭弹窗
*/

View File

@@ -1,9 +1,8 @@
import type { ClassType } from '@vben-core/typings';
import type { Component, Ref } from 'vue';
import type { DrawerApi } from './drawer-api';
import type { Component, Ref } from 'vue';
export type DrawerPlacement = 'bottom' | 'left' | 'right' | 'top';
export type CloseIconPlacement = 'left' | 'right';

View File

@@ -4,6 +4,7 @@ import type {
ExtendedDrawerApi,
} from './drawer';
import { useStore } from '@vben-core/shared/store';
import {
defineComponent,
h,
@@ -14,8 +15,6 @@ import {
ref,
} from 'vue';
import { useStore } from '@vben-core/shared/store';
import VbenDrawer from './drawer.vue';
import { DrawerApi } from './drawer-api';

View File

@@ -100,17 +100,6 @@ describe('modalApi', () => {
expect(onOpenChange).toHaveBeenCalledWith(true);
});
it('should batch state updates', () => {
const batchSpy = vi.spyOn(modalApi.store, 'batch');
modalApi.batchStore(() => {
modalApi.setState({ title: 'Batch Title' });
modalApi.setState({ confirmText: 'Batch Confirm' });
});
expect(batchSpy).toHaveBeenCalled();
expect(modalApi.store.state.title).toBe('Batch Title');
expect(modalApi.store.state.confirmText).toBe('Batch Confirm');
});
it('should call onClosed callback when provided', () => {
const onClosed = vi.fn();
const modalApiWithHook = new ModalApi({ onClosed });

View File

@@ -93,11 +93,6 @@ export class ModalApi {
bindMethods(this);
}
// 如果需要多次更新状态,可以使用 batch 方法
batchStore(cb: () => void) {
this.store.batch(cb);
}
/**
* 关闭弹窗
*/

View File

@@ -1,7 +1,7 @@
import type { ModalApi } from './modal-api';
import type { Component, Ref } from 'vue';
import type { ModalApi } from './modal-api';
export interface ModalProps {
/**
* 是否要挂载到内容区域

View File

@@ -3,10 +3,10 @@
* 调整部分细节
*/
import { onBeforeUnmount, onMounted, reactive, ref, watchEffect } from 'vue';
import type { ComputedRef, Ref } from 'vue';
import { unrefElement } from '@vueuse/core';
import { onBeforeUnmount, onMounted, reactive, ref, watchEffect } from 'vue';
export function useModalDraggable(
targetRef: Ref<HTMLElement | undefined>,

View File

@@ -1,5 +1,6 @@
import type { ExtendedModalApi, ModalApiOptions, ModalProps } from './modal';
import { useStore } from '@vben-core/shared/store';
import {
defineComponent,
h,
@@ -10,8 +11,6 @@ import {
ref,
} from 'vue';
import { useStore } from '@vben-core/shared/store';
import VbenModal from './modal.vue';
import { ModalApi } from './modal-api';

View File

@@ -10,7 +10,7 @@ import { computed } from 'vue';
import { Avatar, AvatarFallback, AvatarImage } from '../../ui';
interface Props extends AvatarRootProps, AvatarFallbackProps, AvatarImageProps {
interface Props extends AvatarFallbackProps, AvatarImageProps, AvatarRootProps {
alt?: string;
class?: ClassType;
dot?: boolean;

View File

@@ -1,5 +1,4 @@
import type { BreadcrumbStyleType } from '@vben-core/typings';
import type { Component } from 'vue';
export interface IBreadcrumb {

View File

@@ -1,9 +1,8 @@
import type { AsTag } from 'radix-vue';
import type { Component } from 'vue';
import type { ButtonVariants, ButtonVariantSize } from '../../ui';
import type { Component } from 'vue';
export interface VbenButtonProps {
/**
* The element or component this component should render as. Can be overwrite by `asChild`

View File

@@ -8,9 +8,8 @@ import type {
import type { IContextMenuItem } from './interface';
import { computed } from 'vue';
import { useForwardPropsEmits } from 'radix-vue';
import { computed } from 'vue';
import {
ContextMenu,

View File

@@ -6,9 +6,8 @@ import type {
HoverCardRootProps,
} from 'radix-vue';
import { computed } from 'vue';
import { useForwardPropsEmits } from 'radix-vue';
import { computed } from 'vue';
import { HoverCard, HoverCardContent, HoverCardTrigger } from '../../ui';

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { type Component, computed } from 'vue';
import type { Component } from 'vue';
import { IconDefault, IconifyIcon } from '@vben-core/icons';
import {
@@ -8,6 +8,7 @@ import {
isObject,
isString,
} from '@vben-core/shared/utils';
import { computed } from 'vue';
const props = defineProps<{
// 没有是否显示默认图标

View File

@@ -6,9 +6,8 @@ import type {
PopoverRootProps,
} from 'radix-vue';
import { computed } from 'vue';
import { useForwardPropsEmits } from 'radix-vue';
import { computed } from 'vue';
import {
PopoverContent,

View File

@@ -1,8 +1,8 @@
<script lang="ts">
import type { Component, PropType } from 'vue';
import { defineComponent, h } from 'vue';
import { isFunction, isObject } from '@vben-core/shared/utils';
import { defineComponent, h } from 'vue';
export default defineComponent({
name: 'RenderContent',

View File

@@ -1,11 +1,9 @@
<script setup lang="ts">
import type { TabsIndicatorProps } from 'radix-vue';
import { computed } from 'vue';
import { cn } from '@vben-core/shared/utils';
import { TabsIndicator, useForwardProps } from 'radix-vue';
import { computed } from 'vue';
const props = defineProps<{ class?: any } & TabsIndicatorProps>();

View File

@@ -1,7 +1,6 @@
<script setup lang="ts">
import type { ClassType } from '@vben-core/typings';
import type { TooltipContentProps } from 'radix-vue';
import type { StyleValue } from 'vue';
import {

View File

@@ -1,10 +1,7 @@
<script setup lang="ts">
import {
AccordionRoot,
type AccordionRootEmits,
type AccordionRootProps,
useForwardPropsEmits,
} from 'radix-vue';
import type { AccordionRootEmits, AccordionRootProps } from 'radix-vue';
import { AccordionRoot, useForwardPropsEmits } from 'radix-vue';
const props = defineProps<AccordionRootProps>();
const emits = defineEmits<AccordionRootEmits>();

View File

@@ -1,9 +1,9 @@
<script setup lang="ts">
import { computed } from 'vue';
import type { AccordionContentProps } from 'radix-vue';
import { cn } from '@vben-core/shared/utils';
import { AccordionContent, type AccordionContentProps } from 'radix-vue';
import { AccordionContent } from 'radix-vue';
import { computed } from 'vue';
const props = defineProps<{ class?: any } & AccordionContentProps>();

View File

@@ -1,13 +1,9 @@
<script setup lang="ts">
import { computed } from 'vue';
import type { AccordionItemProps } from 'radix-vue';
import { cn } from '@vben-core/shared/utils';
import {
AccordionItem,
type AccordionItemProps,
useForwardProps,
} from 'radix-vue';
import { AccordionItem, useForwardProps } from 'radix-vue';
import { computed } from 'vue';
const props = defineProps<{ class?: any } & AccordionItemProps>();

View File

@@ -1,14 +1,10 @@
<script setup lang="ts">
import { computed } from 'vue';
import type { AccordionTriggerProps } from 'radix-vue';
import { cn } from '@vben-core/shared/utils';
import { ChevronDown } from 'lucide-vue-next';
import {
AccordionHeader,
AccordionTrigger,
type AccordionTriggerProps,
} from 'radix-vue';
import { AccordionHeader, AccordionTrigger } from 'radix-vue';
import { computed } from 'vue';
const props = defineProps<{ class?: any } & AccordionTriggerProps>();

View File

@@ -1,9 +1,10 @@
<script setup lang="ts">
import { cn } from '@vben-core/shared/utils';
import type { AvatarVariants } from './avatar';
import { cn } from '@vben-core/shared/utils';
import { AvatarRoot } from 'radix-vue';
import { avatarVariant, type AvatarVariants } from './avatar';
import { avatarVariant } from './avatar';
const props = withDefaults(
defineProps<{

View File

@@ -1,5 +1,7 @@
<script setup lang="ts">
import { AvatarFallback, type AvatarFallbackProps } from 'radix-vue';
import type { AvatarFallbackProps } from 'radix-vue';
import { AvatarFallback } from 'radix-vue';
const props = defineProps<AvatarFallbackProps>();
</script>

View File

@@ -1,5 +1,7 @@
<script setup lang="ts">
import { AvatarImage, type AvatarImageProps } from 'radix-vue';
import type { AvatarImageProps } from 'radix-vue';
import { AvatarImage } from 'radix-vue';
const props = defineProps<AvatarImageProps>();
</script>

View File

@@ -1,4 +1,6 @@
import { cva, type VariantProps } from 'class-variance-authority';
import type { VariantProps } from 'class-variance-authority';
import { cva } from 'class-variance-authority';
export const avatarVariant = cva(
'inline-flex items-center justify-center font-normal text-foreground select-none shrink-0 bg-secondary overflow-hidden',

View File

@@ -1,7 +1,9 @@
<script setup lang="ts">
import type { BadgeVariants } from './badge';
import { cn } from '@vben-core/shared/utils';
import { type BadgeVariants, badgeVariants } from './badge';
import { badgeVariants } from './badge';
const props = defineProps<{
class?: any;

View File

@@ -1,4 +1,6 @@
import { cva, type VariantProps } from 'class-variance-authority';
import type { VariantProps } from 'class-variance-authority';
import { cva } from 'class-variance-authority';
export const badgeVariants = cva(
'inline-flex items-center rounded-md border border-border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',

View File

@@ -1,7 +1,8 @@
<script lang="ts" setup>
import { cn } from '@vben-core/shared/utils';
import type { PrimitiveProps } from 'radix-vue';
import { Primitive, type PrimitiveProps } from 'radix-vue';
import { cn } from '@vben-core/shared/utils';
import { Primitive } from 'radix-vue';
const props = withDefaults(defineProps<{ class?: any } & PrimitiveProps>(), {
as: 'a',

View File

@@ -1,9 +1,10 @@
<script setup lang="ts">
import type { PrimitiveProps } from 'radix-vue';
import type { ButtonVariants, ButtonVariantSize } from './types';
import { cn } from '@vben-core/shared/utils';
import { Primitive, type PrimitiveProps } from 'radix-vue';
import { Primitive } from 'radix-vue';
import { buttonVariants } from './button';

View File

@@ -1,16 +1,14 @@
<script setup lang="ts">
import type { CheckboxRootEmits, CheckboxRootProps } from 'radix-vue';
import { computed } from 'vue';
import { cn } from '@vben-core/shared/utils';
import { Check } from 'lucide-vue-next';
import {
CheckboxIndicator,
CheckboxRoot,
useForwardPropsEmits,
} from 'radix-vue';
import { computed } from 'vue';
const props = defineProps<{ class?: any } & CheckboxRootProps>();
const emits = defineEmits<CheckboxRootEmits>();

View File

@@ -1,16 +1,17 @@
<script setup lang="ts">
import { computed } from 'vue';
import type {
ContextMenuCheckboxItemEmits,
ContextMenuCheckboxItemProps,
} from 'radix-vue';
import { cn } from '@vben-core/shared/utils';
import { Check } from 'lucide-vue-next';
import {
ContextMenuCheckboxItem,
type ContextMenuCheckboxItemEmits,
type ContextMenuCheckboxItemProps,
ContextMenuItemIndicator,
useForwardPropsEmits,
} from 'radix-vue';
import { computed } from 'vue';
const props = defineProps<{ class?: any } & ContextMenuCheckboxItemProps>();
const emits = defineEmits<ContextMenuCheckboxItemEmits>();

View File

@@ -1,15 +1,16 @@
<script setup lang="ts">
import { computed } from 'vue';
import type {
ContextMenuContentEmits,
ContextMenuContentProps,
} from 'radix-vue';
import { cn } from '@vben-core/shared/utils';
import {
ContextMenuContent,
type ContextMenuContentEmits,
type ContextMenuContentProps,
ContextMenuPortal,
useForwardPropsEmits,
} from 'radix-vue';
import { computed } from 'vue';
const props = defineProps<{ class?: any } & ContextMenuContentProps>();
const emits = defineEmits<ContextMenuContentEmits>();

View File

@@ -1,5 +1,7 @@
<script setup lang="ts">
import { ContextMenuGroup, type ContextMenuGroupProps } from 'radix-vue';
import type { ContextMenuGroupProps } from 'radix-vue';
import { ContextMenuGroup } from 'radix-vue';
const props = defineProps<ContextMenuGroupProps>();
</script>

View File

@@ -1,14 +1,9 @@
<script setup lang="ts">
import { computed } from 'vue';
import type { ContextMenuItemEmits, ContextMenuItemProps } from 'radix-vue';
import { cn } from '@vben-core/shared/utils';
import {
ContextMenuItem,
type ContextMenuItemEmits,
type ContextMenuItemProps,
useForwardPropsEmits,
} from 'radix-vue';
import { ContextMenuItem, useForwardPropsEmits } from 'radix-vue';
import { computed } from 'vue';
const props = defineProps<
{ class?: any; inset?: boolean } & ContextMenuItemProps

View File

@@ -1,9 +1,9 @@
<script setup lang="ts">
import { computed } from 'vue';
import type { ContextMenuLabelProps } from 'radix-vue';
import { cn } from '@vben-core/shared/utils';
import { ContextMenuLabel, type ContextMenuLabelProps } from 'radix-vue';
import { ContextMenuLabel } from 'radix-vue';
import { computed } from 'vue';
const props = defineProps<
{ class?: any; inset?: boolean } & ContextMenuLabelProps

View File

@@ -1,5 +1,7 @@
<script setup lang="ts">
import { ContextMenuPortal, type ContextMenuPortalProps } from 'radix-vue';
import type { ContextMenuPortalProps } from 'radix-vue';
import { ContextMenuPortal } from 'radix-vue';
const props = defineProps<ContextMenuPortalProps>();
</script>

View File

@@ -1,11 +1,11 @@
<script setup lang="ts">
import {
ContextMenuRadioGroup,
type ContextMenuRadioGroupEmits,
type ContextMenuRadioGroupProps,
useForwardPropsEmits,
import type {
ContextMenuRadioGroupEmits,
ContextMenuRadioGroupProps,
} from 'radix-vue';
import { ContextMenuRadioGroup, useForwardPropsEmits } from 'radix-vue';
const props = defineProps<ContextMenuRadioGroupProps>();
const emits = defineEmits<ContextMenuRadioGroupEmits>();

View File

@@ -1,16 +1,17 @@
<script setup lang="ts">
import { computed } from 'vue';
import type {
ContextMenuRadioItemEmits,
ContextMenuRadioItemProps,
} from 'radix-vue';
import { cn } from '@vben-core/shared/utils';
import { Circle } from 'lucide-vue-next';
import {
ContextMenuItemIndicator,
ContextMenuRadioItem,
type ContextMenuRadioItemEmits,
type ContextMenuRadioItemProps,
useForwardPropsEmits,
} from 'radix-vue';
import { computed } from 'vue';
const props = defineProps<{ class?: any } & ContextMenuRadioItemProps>();
const emits = defineEmits<ContextMenuRadioItemEmits>();

Some files were not shown because too many files have changed in this diff Show More