jgy-public-component 0.0.21 → 0.0.22
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/README.md +42 -0
- package/dist/components/JProductDetail/JProductDetailDialog.d.ts +41 -0
- package/dist/components/JProductDetail/JSkuLink.d.ts +36 -0
- package/dist/components/JProductDetail/index.d.ts +4 -0
- package/dist/components/JProductDetail/types.d.ts +38 -0
- package/dist/components/JProductDetail/useProductDetailDialog.d.ts +16 -0
- package/dist/components/JSearchInputDialog/JSearchInputDialog.d.ts +112 -0
- package/dist/components/JSearchInputDialog/index.d.ts +2 -0
- package/dist/components/JSearchInputDialog/types.d.ts +33 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +1979 -634
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +2 -1
- package/dist/index.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,6 +41,48 @@ import 'jgy-public-component/dist/style.css'
|
|
|
41
41
|
| 组件名 | 说明 |
|
|
42
42
|
|--------|------|
|
|
43
43
|
| JButton | 按钮 |
|
|
44
|
+
| JSearchHeader | 搜索头部 |
|
|
45
|
+
| JImportExcel | Excel 导入 |
|
|
46
|
+
| JSearchInputDialog | 关键词搜索(类型下拉 + 输入 + 批量弹窗) |
|
|
47
|
+
| JUploadImg | 图片上传 |
|
|
48
|
+
| JSidebar / JSideMenuItem | 侧边栏菜单 |
|
|
49
|
+
| JAdminLayout | 后台布局 |
|
|
50
|
+
| JProductDetailDialog / JSkuLink | 产品详情 / SKU 链接 |
|
|
51
|
+
| JIconRender | 图标渲染 |
|
|
52
|
+
|
|
53
|
+
### JSearchInputDialog 快速示例
|
|
54
|
+
|
|
55
|
+
```vue
|
|
56
|
+
<template>
|
|
57
|
+
<JSearchInputDialog
|
|
58
|
+
v-model:type="filters.keywordType"
|
|
59
|
+
v-model:keyword="filters.keyword"
|
|
60
|
+
:options="[
|
|
61
|
+
{ label: 'SKU', value: 'sku' },
|
|
62
|
+
{ label: '品名', value: 'product_name' },
|
|
63
|
+
]"
|
|
64
|
+
@confirm="handleSearch"
|
|
65
|
+
@search="handleSearch"
|
|
66
|
+
/>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<script setup lang="ts">
|
|
70
|
+
import { reactive } from 'vue'
|
|
71
|
+
import { JSearchInputDialog } from 'jgy-public-component'
|
|
72
|
+
|
|
73
|
+
const filters = reactive({
|
|
74
|
+
keywordType: 'sku',
|
|
75
|
+
keyword: '',
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
const handleSearch = () => {
|
|
79
|
+
const params: Record<string, any> = {}
|
|
80
|
+
if (filters.keyword) {
|
|
81
|
+
params[filters.keywordType] = filters.keyword // { sku: 'sku1,sku2' }
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
</script>
|
|
85
|
+
```
|
|
44
86
|
|
|
45
87
|
## 本地开发
|
|
46
88
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { JProductDetailDialogProps } from './types';
|
|
2
|
+
import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, PropType } from 'vue';
|
|
3
|
+
|
|
4
|
+
declare const _default: DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<JProductDetailDialogProps>, {
|
|
5
|
+
visible: boolean;
|
|
6
|
+
code: string;
|
|
7
|
+
type: string;
|
|
8
|
+
id: undefined;
|
|
9
|
+
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
10
|
+
"update:visible": (args_0: boolean) => void;
|
|
11
|
+
}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<JProductDetailDialogProps>, {
|
|
12
|
+
visible: boolean;
|
|
13
|
+
code: string;
|
|
14
|
+
type: string;
|
|
15
|
+
id: undefined;
|
|
16
|
+
}>>> & Readonly<{
|
|
17
|
+
"onUpdate:visible"?: ((args_0: boolean) => any) | undefined;
|
|
18
|
+
}>, {
|
|
19
|
+
type: "sku" | "spu";
|
|
20
|
+
id: number | string;
|
|
21
|
+
code: string;
|
|
22
|
+
visible: boolean;
|
|
23
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
24
|
+
export default _default;
|
|
25
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
26
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
27
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
28
|
+
type: PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
29
|
+
} : {
|
|
30
|
+
type: PropType<T[K]>;
|
|
31
|
+
required: true;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
type __VLS_WithDefaults<P, D> = {
|
|
35
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
36
|
+
default: D[K];
|
|
37
|
+
}> : P[K];
|
|
38
|
+
};
|
|
39
|
+
type __VLS_Prettify<T> = {
|
|
40
|
+
[K in keyof T]: T[K];
|
|
41
|
+
} & {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions, PropType } from 'vue';
|
|
2
|
+
declare const _default: DefineComponent<ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
code?: string | null;
|
|
4
|
+
emptyText?: string;
|
|
5
|
+
}>, {
|
|
6
|
+
emptyText: string;
|
|
7
|
+
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
8
|
+
open: (code: string) => void;
|
|
9
|
+
}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
10
|
+
code?: string | null;
|
|
11
|
+
emptyText?: string;
|
|
12
|
+
}>, {
|
|
13
|
+
emptyText: string;
|
|
14
|
+
}>>> & Readonly<{
|
|
15
|
+
onOpen?: ((code: string) => any) | undefined;
|
|
16
|
+
}>, {
|
|
17
|
+
emptyText: string;
|
|
18
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
21
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
22
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
23
|
+
type: PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
24
|
+
} : {
|
|
25
|
+
type: PropType<T[K]>;
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
type __VLS_WithDefaults<P, D> = {
|
|
30
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
31
|
+
default: D[K];
|
|
32
|
+
}> : P[K];
|
|
33
|
+
};
|
|
34
|
+
type __VLS_Prettify<T> = {
|
|
35
|
+
[K in keyof T]: T[K];
|
|
36
|
+
} & {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as JProductDetailDialog } from './JProductDetailDialog';
|
|
2
|
+
export { default as JSkuLink } from './JSkuLink';
|
|
3
|
+
export { useProductDetailDialog } from './useProductDetailDialog';
|
|
4
|
+
export type { JProductDetailDialogProps, JSkuLinkProps, JProductRequestFn, JProductRequestConfig, } from './types';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JProductDetail 相关类型
|
|
3
|
+
*
|
|
4
|
+
* 该组件依赖宿主项目注入 request 函数(各 *_front 项目 `@/api` 的默认导出),
|
|
5
|
+
* 组件内部不直接依赖任何具体项目的 request 封装。
|
|
6
|
+
*/
|
|
7
|
+
/** request 请求配置(与各项目 axios 实例调用签名对齐) */
|
|
8
|
+
export interface JProductRequestConfig {
|
|
9
|
+
url: string;
|
|
10
|
+
method?: string;
|
|
11
|
+
data?: any;
|
|
12
|
+
params?: any;
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 注入式 request 函数类型。
|
|
17
|
+
* 传入 `@/api` 的默认导出即可:`(config) => Promise<res>`,
|
|
18
|
+
* 其中 res 已被拦截器解包为后端返回体(含 code/data/msg)。
|
|
19
|
+
*/
|
|
20
|
+
export type JProductRequestFn = (config: JProductRequestConfig) => Promise<any>;
|
|
21
|
+
export interface JProductDetailDialogProps {
|
|
22
|
+
/** 弹窗显隐,配合 v-model:visible 使用 */
|
|
23
|
+
visible?: boolean;
|
|
24
|
+
/** sku_code 或 spu_code,弹窗打开时自动请求详情 */
|
|
25
|
+
code?: string;
|
|
26
|
+
/** sku 走 /sku/doDetail,spu 走 /spu/doDetail */
|
|
27
|
+
type?: 'sku' | 'spu';
|
|
28
|
+
/** 行 id,可选 */
|
|
29
|
+
id?: number | string;
|
|
30
|
+
/** 注入的 request 函数(必传),传入宿主 `@/api` 默认导出 */
|
|
31
|
+
request: JProductRequestFn;
|
|
32
|
+
}
|
|
33
|
+
export interface JSkuLinkProps {
|
|
34
|
+
/** 编码,有值时渲染为可点击链接 */
|
|
35
|
+
code?: string | null;
|
|
36
|
+
/** 无编码时展示的占位文本 */
|
|
37
|
+
emptyText?: string;
|
|
38
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* 产品详情弹窗状态管理。
|
|
4
|
+
*
|
|
5
|
+
* 用法:
|
|
6
|
+
* const { productDetailDialogVisible, productDetailDialogCode, openProductDetailDialog }
|
|
7
|
+
* = useProductDetailDialog()
|
|
8
|
+
* // <JSkuLink :code="row.sku_code" @open="openProductDetailDialog" />
|
|
9
|
+
* // <JProductDetailDialog v-model:visible="productDetailDialogVisible"
|
|
10
|
+
* // :code="productDetailDialogCode" :request="request" />
|
|
11
|
+
*/
|
|
12
|
+
export declare function useProductDetailDialog(): {
|
|
13
|
+
productDetailDialogVisible: Ref<boolean, boolean>;
|
|
14
|
+
productDetailDialogCode: Ref<string, string>;
|
|
15
|
+
openProductDetailDialog: (code: string) => void;
|
|
16
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { SearchInputModel, SearchInputOption } from './types';
|
|
2
|
+
import { DefineComponent, ExtractPropTypes, PropType, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
|
+
|
|
4
|
+
declare const _default: DefineComponent<ExtractPropTypes<{
|
|
5
|
+
type: PropType<string>;
|
|
6
|
+
keyword: PropType<string>;
|
|
7
|
+
width: {
|
|
8
|
+
type: PropType<string>;
|
|
9
|
+
default: string;
|
|
10
|
+
};
|
|
11
|
+
placeholder: {
|
|
12
|
+
type: PropType<string>;
|
|
13
|
+
default: string;
|
|
14
|
+
};
|
|
15
|
+
options: {
|
|
16
|
+
type: PropType<SearchInputOption[]>;
|
|
17
|
+
default: () => never[];
|
|
18
|
+
};
|
|
19
|
+
selectWidth: {
|
|
20
|
+
type: PropType<string>;
|
|
21
|
+
default: string;
|
|
22
|
+
};
|
|
23
|
+
separator: {
|
|
24
|
+
type: PropType<string>;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
27
|
+
dialogTitle: {
|
|
28
|
+
type: PropType<string>;
|
|
29
|
+
default: string;
|
|
30
|
+
};
|
|
31
|
+
dialogWidth: {
|
|
32
|
+
type: PropType<string | number>;
|
|
33
|
+
default: string;
|
|
34
|
+
};
|
|
35
|
+
rows: {
|
|
36
|
+
type: PropType<number>;
|
|
37
|
+
default: number;
|
|
38
|
+
};
|
|
39
|
+
textareaPlaceholder: {
|
|
40
|
+
type: PropType<string>;
|
|
41
|
+
default: string;
|
|
42
|
+
};
|
|
43
|
+
clearOnTypeChange: {
|
|
44
|
+
type: PropType<boolean>;
|
|
45
|
+
default: boolean;
|
|
46
|
+
};
|
|
47
|
+
}>, {
|
|
48
|
+
reset: (defaultType?: string) => void;
|
|
49
|
+
toParams: () => Record<string, string>;
|
|
50
|
+
openDialog: () => void;
|
|
51
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
52
|
+
search: () => void;
|
|
53
|
+
confirm: (payload: SearchInputModel) => void;
|
|
54
|
+
}, string, PublicProps, Readonly< ExtractPropTypes<{
|
|
55
|
+
type: PropType<string>;
|
|
56
|
+
keyword: PropType<string>;
|
|
57
|
+
width: {
|
|
58
|
+
type: PropType<string>;
|
|
59
|
+
default: string;
|
|
60
|
+
};
|
|
61
|
+
placeholder: {
|
|
62
|
+
type: PropType<string>;
|
|
63
|
+
default: string;
|
|
64
|
+
};
|
|
65
|
+
options: {
|
|
66
|
+
type: PropType<SearchInputOption[]>;
|
|
67
|
+
default: () => never[];
|
|
68
|
+
};
|
|
69
|
+
selectWidth: {
|
|
70
|
+
type: PropType<string>;
|
|
71
|
+
default: string;
|
|
72
|
+
};
|
|
73
|
+
separator: {
|
|
74
|
+
type: PropType<string>;
|
|
75
|
+
default: string;
|
|
76
|
+
};
|
|
77
|
+
dialogTitle: {
|
|
78
|
+
type: PropType<string>;
|
|
79
|
+
default: string;
|
|
80
|
+
};
|
|
81
|
+
dialogWidth: {
|
|
82
|
+
type: PropType<string | number>;
|
|
83
|
+
default: string;
|
|
84
|
+
};
|
|
85
|
+
rows: {
|
|
86
|
+
type: PropType<number>;
|
|
87
|
+
default: number;
|
|
88
|
+
};
|
|
89
|
+
textareaPlaceholder: {
|
|
90
|
+
type: PropType<string>;
|
|
91
|
+
default: string;
|
|
92
|
+
};
|
|
93
|
+
clearOnTypeChange: {
|
|
94
|
+
type: PropType<boolean>;
|
|
95
|
+
default: boolean;
|
|
96
|
+
};
|
|
97
|
+
}>> & Readonly<{
|
|
98
|
+
onSearch?: (() => any) | undefined;
|
|
99
|
+
onConfirm?: ((payload: SearchInputModel) => any) | undefined;
|
|
100
|
+
}>, {
|
|
101
|
+
width: string;
|
|
102
|
+
placeholder: string;
|
|
103
|
+
options: SearchInputOption[];
|
|
104
|
+
selectWidth: string;
|
|
105
|
+
separator: string;
|
|
106
|
+
dialogTitle: string;
|
|
107
|
+
dialogWidth: string | number;
|
|
108
|
+
rows: number;
|
|
109
|
+
textareaPlaceholder: string;
|
|
110
|
+
clearOnTypeChange: boolean;
|
|
111
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
112
|
+
export default _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** 下拉选项:label 展示文案,value 作为请求字段 key / 类型标识 */
|
|
2
|
+
export interface SearchInputOption {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
6
|
+
/** 组件当前选中状态快照(confirm 事件会带上) */
|
|
7
|
+
export interface SearchInputModel {
|
|
8
|
+
type: string;
|
|
9
|
+
keyword: string;
|
|
10
|
+
}
|
|
11
|
+
/** JSearchInputDialog Props */
|
|
12
|
+
export interface JSearchInputDialogProps {
|
|
13
|
+
/** 前置类型选项,如 [{ label: 'SKU', value: 'sku' }, { label: '品名', value: 'product_name' }] */
|
|
14
|
+
options?: SearchInputOption[];
|
|
15
|
+
/** 主输入框占位文案 */
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
/** 组件整体宽度 */
|
|
18
|
+
width?: string;
|
|
19
|
+
/** 左侧类型下拉宽度 */
|
|
20
|
+
selectWidth?: string;
|
|
21
|
+
/** 多值拼接分隔符;textarea 确定后用它合并,默认 ',' */
|
|
22
|
+
separator?: string;
|
|
23
|
+
/** 弹窗标题;不传则自动生成「批量输入{当前类型 label}」 */
|
|
24
|
+
dialogTitle?: string;
|
|
25
|
+
/** 批量输入弹窗宽度 */
|
|
26
|
+
dialogWidth?: string | number;
|
|
27
|
+
/** textarea 默认行数 */
|
|
28
|
+
rows?: number;
|
|
29
|
+
/** textarea 占位提示 */
|
|
30
|
+
textareaPlaceholder?: string;
|
|
31
|
+
/** 切换左侧类型时是否清空 keyword,默认 false */
|
|
32
|
+
clearOnTypeChange?: boolean;
|
|
33
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,12 +6,15 @@ import { JSearchHeader } from './components/JSearchHeader';
|
|
|
6
6
|
import { JImportExcel } from './components/JImportExcel';
|
|
7
7
|
import { JSidebar, JSideMenuItem } from './components/JSidebar';
|
|
8
8
|
import { JAdminLayout } from './components/JAdminLayout';
|
|
9
|
+
import { JProductDetailDialog, JSkuLink } from './components/JProductDetail';
|
|
10
|
+
import { JSearchInputDialog } from './components/JSearchInputDialog';
|
|
9
11
|
|
|
10
12
|
declare const _default: {
|
|
11
13
|
install: (app: App) => void;
|
|
12
14
|
};
|
|
13
15
|
export default _default;
|
|
14
|
-
export { JButton, JUploadImg, JIconRender, JSearchHeader, JImportExcel, JSidebar, JSideMenuItem, JAdminLayout };
|
|
16
|
+
export { JButton, JUploadImg, JIconRender, JSearchHeader, JImportExcel, JSidebar, JSideMenuItem, JAdminLayout, JProductDetailDialog, JSkuLink, JSearchInputDialog, };
|
|
17
|
+
export { useProductDetailDialog } from './components/JProductDetail';
|
|
15
18
|
export { toSnakeCase, toCamelCase, pick, omit, deepClone, filterEmpty, flatten, unflatten, toTableColumns } from './utils';
|
|
16
19
|
export { createRouterGuard, buildRouteTree, transformBackendRoutes, findFirstAllowedRoute, getComponentImport } from './router';
|
|
17
20
|
export type { BackendRoute, RouteStoreAdapter, PermissionStoreAdapter, UserStoreAdapter, RouterGuardOptions } from './router';
|
|
@@ -22,3 +25,5 @@ export type { JSearchHeaderProps } from './components/JSearchHeader';
|
|
|
22
25
|
export type { JImportExcelProps, ApiFn } from './components/JImportExcel';
|
|
23
26
|
export type { SidebarMenuItem, JSidebarProps, JSideMenuItemProps } from './components/JSidebar';
|
|
24
27
|
export type { AdminLayoutMenuItem, JAdminLayoutProps } from './components/JAdminLayout';
|
|
28
|
+
export type { JProductDetailDialogProps, JSkuLinkProps, JProductRequestFn, JProductRequestConfig } from './components/JProductDetail';
|
|
29
|
+
export type { JSearchInputDialogProps, SearchInputOption, SearchInputModel, } from './components/JSearchInputDialog';
|