qidian-vue-ui 0.0.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-present QiDian
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # qidian-vue-ui
2
+
3
+ 基于 TDesign 的 QiDian Vue UI 组件库。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ npm install qidian-vue-ui
9
+ ```
10
+
11
+ ## 使用
12
+
13
+ ```ts
14
+ // main.ts
15
+ import { createApp } from 'vue'
16
+ import App from './app.vue'
17
+
18
+ // 导入组件样式
19
+ import 'qidian-vue-ui/dist/qidian-vue-ui.css'
20
+ ```
21
+
22
+ ```vue
23
+ <template>
24
+ <qd-button>按钮</qd-button>
25
+ </template>
26
+
27
+ <script setup lang="ts">
28
+ // 导入组件、工具和 hooks
29
+ import { QdButton } from 'qidian-vue-ui'
30
+ </script>
31
+ ```
32
+
33
+ ## LICENSE
34
+
35
+ [MIT](LICENSE)
@@ -0,0 +1,10 @@
1
+ import type { Ref } from 'vue';
2
+ import type { QdComputeFunction, QdAsyncComputeOptions } from './types';
3
+ export declare function qdCompute<T = unknown>(fn: QdComputeFunction<T>): QdComputeFunction<T>;
4
+ export declare function qdAsyncCompute<T = unknown>(options: QdAsyncComputeOptions<T>): QdAsyncComputeOptions<T>;
5
+ export declare function qdUseComputeValue<T = unknown>(computeFn: QdComputeFunction<T> | QdAsyncComputeOptions<T>, context: Ref<Record<string, unknown>> | {
6
+ value: Record<string, unknown>;
7
+ }): {
8
+ result: Ref<T>;
9
+ loading: Ref<boolean>;
10
+ };
@@ -0,0 +1,4 @@
1
+ export { default as QdConfigRenderer } from './index.vue';
2
+ export { qdCompute, qdAsyncCompute, qdUseComputeValue } from './compute';
3
+ export { resolveVModelBinding, parseVModelPath, getValueByPath, setValueByPath } from './utils';
4
+ export type { QdComponentResolver, QdComputeFunction, QdAsyncFunction, QdWatchFunction, QdAsyncComputeOptions, QdConfigValue, QdConfigSlotProps, QdComponentConfig, QdConfigRendererProps } from './types';
@@ -0,0 +1,3 @@
1
+ import type { QdConfigRendererProps } from './types';
2
+ declare const _default: import("vue").DefineComponent<QdConfigRendererProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<QdConfigRendererProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
3
+ export default _default;
@@ -0,0 +1,32 @@
1
+ import type { Component, VNode } from 'vue';
2
+ export type QdComponentResolver = string | Component | VNode;
3
+ export type QdComputeFunction<T = unknown> = ((context: Record<string, unknown>) => T) & {
4
+ __qdCompute?: true;
5
+ __qdId?: string;
6
+ };
7
+ export type QdAsyncFunction<T = unknown> = (watchValue: unknown, context: Record<string, unknown>) => Promise<T>;
8
+ export type QdWatchFunction<T = unknown> = (context: Record<string, unknown>) => T;
9
+ export interface QdAsyncComputeOptions<T = unknown> {
10
+ asyncFn: QdAsyncFunction<T>;
11
+ watch?: QdWatchFunction<T>;
12
+ immediate?: boolean;
13
+ __qdAsyncCompute?: true;
14
+ __qdExecuted?: boolean;
15
+ __qdId?: string;
16
+ }
17
+ export type QdConfigValue<T = unknown> = T | QdComputeFunction<T> | QdAsyncComputeOptions<T>;
18
+ export interface QdConfigSlotProps {
19
+ [slotName: string]: QdComponentConfig;
20
+ }
21
+ export interface QdComponentConfig {
22
+ is?: QdComponentResolver;
23
+ context?: Record<string, unknown>;
24
+ options?: QdConfigValue;
25
+ slots?: QdConfigSlotProps;
26
+ [key: `vModel${string}`]: string;
27
+ [key: string]: QdConfigValue;
28
+ }
29
+ export interface QdConfigRendererProps {
30
+ config: QdComponentConfig;
31
+ context?: Record<string, unknown>;
32
+ }
@@ -0,0 +1,15 @@
1
+ export interface VModelPath {
2
+ path: string;
3
+ keys: string[];
4
+ }
5
+ export declare function parseVModelPath(path: string): VModelPath;
6
+ export declare function getValueByPath(obj: Record<string, unknown>, path: string): unknown;
7
+ export declare function setValueByPath(obj: Record<string, unknown>, path: string, value: unknown): void;
8
+ export declare function createVModelBinding(context: Record<string, unknown>, vModelPath?: string): {
9
+ modelValue: undefined;
10
+ 'onUpdate:modelValue': undefined;
11
+ } | {
12
+ modelValue: unknown;
13
+ 'onUpdate:modelValue': (value: unknown) => void;
14
+ };
15
+ export declare function resolveVModelBinding(context: Record<string, unknown>, vModel?: string, vModelValue?: string): Record<string, unknown>;
@@ -0,0 +1 @@
1
+ export { default as QdCrudTable } from './table.vue';
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { InjectionKey } from 'vue';
2
+ import type { QdFormBeforeSubmitQueueItem } from './types';
3
+ export declare const PROVIDE_FORM_ADD_BEFORE_SUBMIT_QUEUE: InjectionKey<(item: QdFormBeforeSubmitQueueItem) => void>;
@@ -0,0 +1,4 @@
1
+ export { default as QdForm } from './index.vue';
2
+ export { default as QdFormItem } from './item.vue';
3
+ export { PROVIDE_FORM_ADD_BEFORE_SUBMIT_QUEUE } from './config';
4
+ export type { QdFormBeforeSubmitQueueResult, QdFormBeforeSubmitQueueItem, QdFormProps, QdFormItemProps } from './types';
@@ -0,0 +1,50 @@
1
+ import type { Data } from 'tdesign-vue-next';
2
+ import type { QdFormProps } from './types';
3
+ type __VLS_Props = QdFormProps;
4
+ type __VLS_PublicProps = __VLS_Props & {
5
+ 'data'?: Data;
6
+ };
7
+ declare var __VLS_15: {
8
+ context: Data;
9
+ gutterStyle: {
10
+ gap?: undefined;
11
+ } | {
12
+ gap: string;
13
+ };
14
+ };
15
+ type __VLS_Slots = {} & {
16
+ default?: (props: typeof __VLS_15) => any;
17
+ };
18
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, {
19
+ clearValidate: (fields?: (string | number)[] | undefined) => void;
20
+ reset: (params?: import("tdesign-vue-next").FormResetParams<Data> | undefined) => void;
21
+ setValidateMessage: (message: import("tdesign-vue-next").FormValidateMessage<Data>) => void;
22
+ submit: (params?: {
23
+ showErrorMessage?: boolean;
24
+ }) => void;
25
+ validate: (params?: import("tdesign-vue-next").FormValidateParams) => Promise<import("tdesign-vue-next").FormValidateResult<Data>>;
26
+ validateOnly: (params?: Pick<import("tdesign-vue-next").FormValidateParams, "fields" | "trigger">) => Promise<import("tdesign-vue-next").FormValidateResult<Data>>;
27
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
28
+ "update:data": (value: Data) => any;
29
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
30
+ "onUpdate:data"?: ((value: Data) => any) | undefined;
31
+ }>, {
32
+ labelAlign: "left" | "right" | "top";
33
+ labelWidth: string | number;
34
+ requiredMark: boolean;
35
+ showErrorMessage: boolean;
36
+ statusIcon: boolean | import("tdesign-vue-next").TNode<import("tdesign-vue-next").TdFormItemProps>;
37
+ disabled: boolean;
38
+ preventSubmitDefault: boolean;
39
+ readonly: boolean;
40
+ requiredMarkPosition: "left" | "right";
41
+ resetType: "empty" | "initial";
42
+ scrollToFirstError: "" | "smooth" | "auto";
43
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
44
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
45
+ export default _default;
46
+ type __VLS_WithSlots<T, S> = T & {
47
+ new (): {
48
+ $slots: S;
49
+ };
50
+ };
@@ -0,0 +1,20 @@
1
+ import type { QdFormItemProps } from './types';
2
+ declare var __VLS_10: {
3
+ context: Record<string, unknown> | undefined;
4
+ };
5
+ type __VLS_Slots = {} & {
6
+ default?: (props: typeof __VLS_10) => any;
7
+ };
8
+ declare const __VLS_component: import("vue").DefineComponent<QdFormItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<QdFormItemProps> & Readonly<{}>, {
9
+ requiredMark: boolean;
10
+ showErrorMessage: boolean;
11
+ statusIcon: boolean | import("tdesign-vue-next").TNode;
12
+ successBorder: boolean;
13
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
15
+ export default _default;
16
+ type __VLS_WithSlots<T, S> = T & {
17
+ new (): {
18
+ $slots: S;
19
+ };
20
+ };
@@ -0,0 +1,17 @@
1
+ import type { TdFormProps, Data, TdFormItemProps, LoadingProps } from 'tdesign-vue-next';
2
+ import type { QdGridItemProps, QdGridProps } from '../grid';
3
+ import type { QdConfigRendererProps } from '../config-renderer';
4
+ export type QdFormBeforeSubmitQueueResult = boolean | {
5
+ success: boolean;
6
+ message?: string;
7
+ };
8
+ export type QdFormBeforeSubmitQueueItem = () => Promise<QdFormBeforeSubmitQueueResult> | QdFormBeforeSubmitQueueResult;
9
+ export interface QdFormItemProps extends TdFormItemProps, QdGridItemProps {
10
+ context?: QdConfigRendererProps['context'];
11
+ component: QdConfigRendererProps['config'];
12
+ }
13
+ export interface QdFormProps<FD extends Data = Data> extends Omit<TdFormProps<FD>, 'data' | 'layout'>, QdGridProps {
14
+ items?: QdFormItemProps[];
15
+ loading?: boolean;
16
+ loadingProps?: LoadingProps;
17
+ }
@@ -0,0 +1,15 @@
1
+ import type { InjectionKey, Ref } from 'vue';
2
+ import type { QdGridItemProps } from './types';
3
+ export declare const PROVIDE_GRID_WIDTH_KEY: InjectionKey<Ref<number>>;
4
+ export declare const PROVIDE_GRID_ITEM_PROPS_KEY: InjectionKey<QdGridItemProps>;
5
+ export declare const DEFAULT_GRID_WIDTH = 1920;
6
+ export declare const DEFAULT_BREAKPOINTS: {
7
+ xs: number;
8
+ sm: number;
9
+ md: number;
10
+ lg: number;
11
+ xl: number;
12
+ xxl: number;
13
+ };
14
+ export declare const DEFAULT_COL = 1;
15
+ export declare const DEFAULT_ROW = 1;
@@ -0,0 +1,4 @@
1
+ export { default as QdGrid } from './index.vue';
2
+ export { default as QdGridItem } from './item.vue';
3
+ export { PROVIDE_GRID_WIDTH_KEY, PROVIDE_GRID_ITEM_PROPS_KEY } from './config';
4
+ export type { QdGridProps, QdGridItemProps } from './types';
@@ -0,0 +1,19 @@
1
+ import type { QdGridProps } from './types';
2
+ declare var __VLS_1: {
3
+ gutterStyle: {
4
+ gap?: undefined;
5
+ } | {
6
+ gap: string;
7
+ };
8
+ };
9
+ type __VLS_Slots = {} & {
10
+ default?: (props: typeof __VLS_1) => any;
11
+ };
12
+ declare const __VLS_component: import("vue").DefineComponent<QdGridProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<QdGridProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
14
+ export default _default;
15
+ type __VLS_WithSlots<T, S> = T & {
16
+ new (): {
17
+ $slots: S;
18
+ };
19
+ };
@@ -0,0 +1,18 @@
1
+ import type { QdGridItemProps } from './types';
2
+ declare var __VLS_1: {
3
+ itemStyle: {
4
+ gridColumn: string;
5
+ gridRow: string;
6
+ };
7
+ };
8
+ type __VLS_Slots = {} & {
9
+ default?: (props: typeof __VLS_1) => any;
10
+ };
11
+ declare const __VLS_component: import("vue").DefineComponent<QdGridItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<QdGridItemProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
13
+ export default _default;
14
+ type __VLS_WithSlots<T, S> = T & {
15
+ new (): {
16
+ $slots: S;
17
+ };
18
+ };
@@ -0,0 +1,12 @@
1
+ import type { GutterObject, TdRowProps } from 'tdesign-vue-next';
2
+ export type GridGutterValue = number | (GutterObject & {
3
+ span?: number;
4
+ });
5
+ export interface QdGridProps {
6
+ gutter?: TdRowProps['gutter'];
7
+ grid?: QdGridItemProps;
8
+ }
9
+ export interface QdGridItemProps {
10
+ col?: GridGutterValue;
11
+ row?: GridGutterValue;
12
+ }
@@ -0,0 +1,5 @@
1
+ export * from './config-renderer';
2
+ export * from './crud';
3
+ export * from './form';
4
+ export * from './grid';
5
+ export * from './service-table';
@@ -0,0 +1,2 @@
1
+ export { default as QdServiceTable } from './index.vue';
2
+ export type { QdServiceTableProps } from './types';
@@ -0,0 +1,62 @@
1
+ import type { TdEnhancedTableProps } from 'tdesign-vue-next';
2
+ import type { QdServiceTableProps } from './types';
3
+ type __VLS_Props = QdServiceTableProps;
4
+ type __VLS_PublicProps = __VLS_Props & {
5
+ 'list'?: TdEnhancedTableProps['data'];
6
+ 'selectedRowKeys'?: TdEnhancedTableProps['selectedRowKeys'];
7
+ 'activeRowKeys'?: TdEnhancedTableProps['activeRowKeys'];
8
+ 'columnControllerVisible'?: TdEnhancedTableProps['columnControllerVisible'];
9
+ 'displayColumns'?: TdEnhancedTableProps['displayColumns'];
10
+ 'expandedRowKeys'?: TdEnhancedTableProps['expandedRowKeys'];
11
+ 'filterValue'?: TdEnhancedTableProps['filterValue'];
12
+ 'sort'?: TdEnhancedTableProps['sort'];
13
+ 'expandedTreeNodes'?: TdEnhancedTableProps['expandedTreeNodes'];
14
+ };
15
+ declare var __VLS_7: string | number, __VLS_8: any;
16
+ type __VLS_Slots = {} & {
17
+ [K in NonNullable<typeof __VLS_7>]?: (props: typeof __VLS_8) => any;
18
+ };
19
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
+ "update:list": (value: import("tdesign-vue-next").TableRowData[] | undefined) => any;
21
+ "update:selectedRowKeys": (value: (string | number)[] | undefined) => any;
22
+ "update:activeRowKeys": (value: (string | number)[] | undefined) => any;
23
+ "update:columnControllerVisible": (value: boolean | undefined) => any;
24
+ "update:displayColumns": (value: import("tdesign-vue-next").CheckboxGroupValue | undefined) => any;
25
+ "update:expandedRowKeys": (value: (string | number)[] | undefined) => any;
26
+ "update:filterValue": (value: import("tdesign-vue-next").FilterValue | undefined) => any;
27
+ "update:sort": (value: import("tdesign-vue-next").TableSort | undefined) => any;
28
+ "update:expandedTreeNodes": (value: (string | number)[] | undefined) => any;
29
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
30
+ "onUpdate:list"?: ((value: import("tdesign-vue-next").TableRowData[] | undefined) => any) | undefined;
31
+ "onUpdate:selectedRowKeys"?: ((value: (string | number)[] | undefined) => any) | undefined;
32
+ "onUpdate:activeRowKeys"?: ((value: (string | number)[] | undefined) => any) | undefined;
33
+ "onUpdate:columnControllerVisible"?: ((value: boolean | undefined) => any) | undefined;
34
+ "onUpdate:displayColumns"?: ((value: import("tdesign-vue-next").CheckboxGroupValue | undefined) => any) | undefined;
35
+ "onUpdate:expandedRowKeys"?: ((value: (string | number)[] | undefined) => any) | undefined;
36
+ "onUpdate:filterValue"?: ((value: import("tdesign-vue-next").FilterValue | undefined) => any) | undefined;
37
+ "onUpdate:sort"?: ((value: import("tdesign-vue-next").TableSort | undefined) => any) | undefined;
38
+ "onUpdate:expandedTreeNodes"?: ((value: (string | number)[] | undefined) => any) | undefined;
39
+ }>, {
40
+ bordered: boolean;
41
+ disableSpaceInactiveRow: boolean;
42
+ horizontalScrollAffixedBottom: boolean | Partial<import("tdesign-vue-next").AffixProps>;
43
+ keyboardRowHover: boolean;
44
+ lazyLoad: boolean;
45
+ maxHeight: string | number;
46
+ paginationAffixedBottom: boolean | Partial<import("tdesign-vue-next").AffixProps>;
47
+ rowKey: string;
48
+ showHeader: boolean;
49
+ expandIcon: boolean | ((h: typeof import("vue").h, props: import("tdesign-vue-next").ExpandArrowRenderParams<import("tdesign-vue-next").TableRowData>) => import("tdesign-vue-next").TNodeReturnValue);
50
+ expandOnRowClick: boolean;
51
+ hideSortTips: boolean;
52
+ multipleSort: boolean;
53
+ rowSelectionAllowUncheck: boolean;
54
+ selectOnRowClick: boolean;
55
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
56
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
57
+ export default _default;
58
+ type __VLS_WithSlots<T, S> = T & {
59
+ new (): {
60
+ $slots: S;
61
+ };
62
+ };
@@ -0,0 +1,6 @@
1
+ import type { ServicePaginationOptions, ServicePagination } from 'qidian-shared';
2
+ import type { Ref } from 'vue';
3
+ import type { TableRowData, TdEnhancedTableProps } from 'tdesign-vue-next';
4
+ export interface QdServiceTableProps<D extends TableRowData = TableRowData> extends Omit<TdEnhancedTableProps<D>, 'pagination' | 'data' | 'selectedRowKeys' | 'activeRowKeys' | 'columnControllerVisible' | 'displayColumns' | 'expandedRowKeys' | 'filterValue' | 'sort' | 'expandedTreeNodes'>, Omit<ServicePaginationOptions<D>, 'pagination'> {
5
+ pagination?: Extract<ServicePagination, Ref<unknown>> extends Ref<infer T> ? T : never;
6
+ }
File without changes
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,12 @@
1
+
2
+ .qd-crud-table[data-v-60a1b268] {
3
+ }
4
+
5
+ .qd-grid[data-v-a1334224] {
6
+ display: grid;
7
+ grid-template-columns: repeat(12, 1fr);
8
+ }
9
+
10
+ .qd-grid-item[data-v-09679121] {
11
+ min-width: 0;
12
+ }