jgy-public-component 0.0.21 → 0.0.23
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 +154 -0
- package/dist/components/JProductDetail/JProductDetailDialog.d.ts +44 -0
- package/dist/components/JProductDetail/JSkuLink.d.ts +36 -0
- package/dist/components/JProductDetail/index.d.ts +5 -0
- package/dist/components/JProductDetail/request.d.ts +28 -0
- package/dist/components/JProductDetail/types.d.ts +46 -0
- package/dist/components/JProductDetail/useProductDetailDialog.d.ts +29 -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 +2009 -645
- 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,160 @@ 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 链接(需注入 request) |
|
|
51
|
+
| JIconRender | 图标渲染 |
|
|
52
|
+
|
|
53
|
+
### JSkuLink + JProductDetailDialog(点击 SKU 弹产品详情)
|
|
54
|
+
|
|
55
|
+
列表场景:**多行 `JSkuLink` + 页面底部一个 `JProductDetailDialog`**,不要每行挂一个弹窗。
|
|
56
|
+
|
|
57
|
+
#### 1. 入口注入 request(推荐,全项目一次)
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
// main.ts
|
|
61
|
+
import { createApp } from 'vue'
|
|
62
|
+
import App from './App.vue'
|
|
63
|
+
import request from '@/api'
|
|
64
|
+
import JgyComponents, { provideProductRequest } from 'jgy-public-component'
|
|
65
|
+
import 'jgy-public-component/dist/style.css'
|
|
66
|
+
|
|
67
|
+
const app = createApp(App)
|
|
68
|
+
app.use(JgyComponents)
|
|
69
|
+
|
|
70
|
+
// 把项目统一的 axios 封装注入给产品详情组件
|
|
71
|
+
provideProductRequest(app, (config) => request(config))
|
|
72
|
+
|
|
73
|
+
app.mount('#app')
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
#### 2. 页面用法
|
|
77
|
+
|
|
78
|
+
```vue
|
|
79
|
+
<template>
|
|
80
|
+
<!-- 表格里:只放链接 -->
|
|
81
|
+
<JSkuLink :code="row.sku" @open="openProductDetailDialog" />
|
|
82
|
+
|
|
83
|
+
<!-- 页面底部:只挂一个弹窗 -->
|
|
84
|
+
<JProductDetailDialog
|
|
85
|
+
v-model:visible="productDetailDialogVisible"
|
|
86
|
+
:code="productDetailDialogCode"
|
|
87
|
+
type="sku"
|
|
88
|
+
/>
|
|
89
|
+
<!-- 若未在 main.ts provide,需额外传 :request="request" -->
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<script setup lang="ts">
|
|
93
|
+
import {
|
|
94
|
+
JSkuLink,
|
|
95
|
+
JProductDetailDialog,
|
|
96
|
+
useProductDetailDialog,
|
|
97
|
+
} from 'jgy-public-component'
|
|
98
|
+
|
|
99
|
+
const {
|
|
100
|
+
productDetailDialogVisible,
|
|
101
|
+
productDetailDialogCode,
|
|
102
|
+
openProductDetailDialog,
|
|
103
|
+
} = useProductDetailDialog()
|
|
104
|
+
</script>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
#### 3. 单页传入 request(不全局 provide 时)
|
|
108
|
+
|
|
109
|
+
```vue
|
|
110
|
+
<script setup lang="ts">
|
|
111
|
+
import request from '@/api'
|
|
112
|
+
import { JProductDetailDialog, JSkuLink, useProductDetailDialog } from 'jgy-public-component'
|
|
113
|
+
// ...
|
|
114
|
+
</script>
|
|
115
|
+
|
|
116
|
+
<template>
|
|
117
|
+
<JSkuLink :code="row.sku" @open="openProductDetailDialog" />
|
|
118
|
+
<JProductDetailDialog
|
|
119
|
+
v-model:visible="productDetailDialogVisible"
|
|
120
|
+
:code="productDetailDialogCode"
|
|
121
|
+
type="sku"
|
|
122
|
+
:request="request"
|
|
123
|
+
/>
|
|
124
|
+
</template>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### 4. Props / 事件
|
|
128
|
+
|
|
129
|
+
**JSkuLink**
|
|
130
|
+
|
|
131
|
+
| 属性 | 类型 | 默认 | 说明 |
|
|
132
|
+
|------|------|------|------|
|
|
133
|
+
| code | `string \| null` | - | SKU/编码 |
|
|
134
|
+
| emptyText | `string` | `'-'` | 无编码时展示 |
|
|
135
|
+
|
|
136
|
+
| 事件 | 参数 | 说明 |
|
|
137
|
+
|------|------|------|
|
|
138
|
+
| open | `(code: string)` | 有编码且点击时触发 |
|
|
139
|
+
|
|
140
|
+
**JProductDetailDialog**
|
|
141
|
+
|
|
142
|
+
| 属性 | 类型 | 默认 | 说明 |
|
|
143
|
+
|------|------|------|------|
|
|
144
|
+
| visible / v-model:visible | `boolean` | `false` | 显隐 |
|
|
145
|
+
| code | `string` | `''` | sku_code / spu_code |
|
|
146
|
+
| type | `'sku' \| 'spu'` | `'sku'` | 详情接口类型 |
|
|
147
|
+
| id | `number \| string` | - | 可选行 id |
|
|
148
|
+
| request | `JProductRequestFn` | - | 可选;未传则用全局 provide |
|
|
149
|
+
|
|
150
|
+
**主题色(可选)**
|
|
151
|
+
|
|
152
|
+
```css
|
|
153
|
+
:root {
|
|
154
|
+
--j-sku-link-color: #409eff;
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
#### 5. 宿主前置条件
|
|
159
|
+
|
|
160
|
+
1. 已安装 `element-plus`(peerDependency)
|
|
161
|
+
2. vite 已代理 `/bis-app` 到后端
|
|
162
|
+
3. 后端具备同一套 bis 产品详情接口(`/bis-app/comm/sku/doDetail` 等)
|
|
163
|
+
4. `request` 返回体已被拦截器解包为 `{ code, data, msg }`
|
|
164
|
+
|
|
165
|
+
### JSearchInputDialog 快速示例
|
|
166
|
+
|
|
167
|
+
```vue
|
|
168
|
+
<template>
|
|
169
|
+
<JSearchInputDialog
|
|
170
|
+
v-model:type="filters.keywordType"
|
|
171
|
+
v-model:keyword="filters.keyword"
|
|
172
|
+
:options="[
|
|
173
|
+
{ label: 'SKU', value: 'sku' },
|
|
174
|
+
{ label: '品名', value: 'product_name' },
|
|
175
|
+
]"
|
|
176
|
+
@confirm="handleSearch"
|
|
177
|
+
@search="handleSearch"
|
|
178
|
+
/>
|
|
179
|
+
</template>
|
|
180
|
+
|
|
181
|
+
<script setup lang="ts">
|
|
182
|
+
import { reactive } from 'vue'
|
|
183
|
+
import { JSearchInputDialog } from 'jgy-public-component'
|
|
184
|
+
|
|
185
|
+
const filters = reactive({
|
|
186
|
+
keywordType: 'sku',
|
|
187
|
+
keyword: '',
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
const handleSearch = () => {
|
|
191
|
+
const params: Record<string, any> = {}
|
|
192
|
+
if (filters.keyword) {
|
|
193
|
+
params[filters.keywordType] = filters.keyword // { sku: 'sku1,sku2' }
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
</script>
|
|
197
|
+
```
|
|
44
198
|
|
|
45
199
|
## 本地开发
|
|
46
200
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { JProductRequestFn, 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
|
+
request: undefined;
|
|
10
|
+
}>>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
11
|
+
"update:visible": (args_0: boolean) => void;
|
|
12
|
+
}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<JProductDetailDialogProps>, {
|
|
13
|
+
visible: boolean;
|
|
14
|
+
code: string;
|
|
15
|
+
type: string;
|
|
16
|
+
id: undefined;
|
|
17
|
+
request: undefined;
|
|
18
|
+
}>>> & Readonly<{
|
|
19
|
+
"onUpdate:visible"?: ((args_0: boolean) => any) | undefined;
|
|
20
|
+
}>, {
|
|
21
|
+
type: "sku" | "spu";
|
|
22
|
+
id: number | string;
|
|
23
|
+
code: string;
|
|
24
|
+
visible: boolean;
|
|
25
|
+
request: JProductRequestFn;
|
|
26
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
27
|
+
export default _default;
|
|
28
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
29
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
30
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
31
|
+
type: PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
32
|
+
} : {
|
|
33
|
+
type: PropType<T[K]>;
|
|
34
|
+
required: true;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
type __VLS_WithDefaults<P, D> = {
|
|
38
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
39
|
+
default: D[K];
|
|
40
|
+
}> : P[K];
|
|
41
|
+
};
|
|
42
|
+
type __VLS_Prettify<T> = {
|
|
43
|
+
[K in keyof T]: T[K];
|
|
44
|
+
} & {};
|
|
@@ -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,5 @@
|
|
|
1
|
+
export { default as JProductDetailDialog } from './JProductDetailDialog';
|
|
2
|
+
export { default as JSkuLink } from './JSkuLink';
|
|
3
|
+
export { useProductDetailDialog } from './useProductDetailDialog';
|
|
4
|
+
export { provideProductRequest, resolveProductRequest, useInjectedProductRequest, J_PRODUCT_REQUEST_KEY, } from './request';
|
|
5
|
+
export type { JProductDetailDialogProps, JSkuLinkProps, JProductRequestFn, JProductRequestConfig, } from './types';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { App, InjectionKey } from 'vue';
|
|
2
|
+
import { JProductRequestFn } from './types';
|
|
3
|
+
|
|
4
|
+
/** provide/inject 用的 key,业务方一般无需直接使用 */
|
|
5
|
+
export declare const J_PRODUCT_REQUEST_KEY: InjectionKey<JProductRequestFn>;
|
|
6
|
+
/**
|
|
7
|
+
* 在应用入口注入 request(推荐,全项目只需一次)。
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { createApp } from 'vue'
|
|
12
|
+
* import request from '@/api'
|
|
13
|
+
* import { provideProductRequest } from 'jgy-public-component'
|
|
14
|
+
*
|
|
15
|
+
* const app = createApp(App)
|
|
16
|
+
* provideProductRequest(app, (config) => request(config))
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function provideProductRequest(app: App, request: JProductRequestFn): void;
|
|
20
|
+
/**
|
|
21
|
+
* 在 setup 中读取全局注入的 request(必须在 setup 同步阶段调用 inject)。
|
|
22
|
+
*/
|
|
23
|
+
export declare function useInjectedProductRequest(): JProductRequestFn | null;
|
|
24
|
+
/**
|
|
25
|
+
* 解析最终 request:prop 优先,否则用全局 provide。
|
|
26
|
+
* 可在 setup 外调用,但需把 setup 阶段拿到的 injected 传进来。
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveProductRequest(propRequest?: JProductRequestFn | null, injectedRequest?: JProductRequestFn | null): JProductRequestFn;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JProductDetail 相关类型
|
|
3
|
+
*
|
|
4
|
+
* 该组件依赖宿主项目注入 request 函数(各 *_front 项目 `@/api` 的默认导出),
|
|
5
|
+
* 组件内部不直接依赖任何具体项目的 request 封装。
|
|
6
|
+
*
|
|
7
|
+
* 注入方式二选一(推荐 1):
|
|
8
|
+
* 1. main.ts: provideProductRequest(app, request)
|
|
9
|
+
* 2. 组件 prop: <JProductDetailDialog :request="request" ... />
|
|
10
|
+
*/
|
|
11
|
+
/** request 请求配置(与各项目 axios 实例调用签名对齐) */
|
|
12
|
+
export interface JProductRequestConfig {
|
|
13
|
+
url: string;
|
|
14
|
+
method?: string;
|
|
15
|
+
data?: any;
|
|
16
|
+
params?: any;
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 注入式 request 函数类型。
|
|
21
|
+
* 传入 `@/api` 的默认导出即可:`(config) => Promise<res>`,
|
|
22
|
+
* 其中 res 已被拦截器解包为后端返回体(含 code/data/msg)。
|
|
23
|
+
*/
|
|
24
|
+
export type JProductRequestFn = (config: JProductRequestConfig) => Promise<any>;
|
|
25
|
+
export interface JProductDetailDialogProps {
|
|
26
|
+
/** 弹窗显隐,配合 v-model:visible 使用 */
|
|
27
|
+
visible?: boolean;
|
|
28
|
+
/** sku_code 或 spu_code,弹窗打开时自动请求详情 */
|
|
29
|
+
code?: string;
|
|
30
|
+
/** sku 走 /sku/doDetail,spu 走 /spu/doDetail */
|
|
31
|
+
type?: 'sku' | 'spu';
|
|
32
|
+
/** 行 id,可选 */
|
|
33
|
+
id?: number | string;
|
|
34
|
+
/**
|
|
35
|
+
* request 函数。可选:
|
|
36
|
+
* - 未传时使用 provideProductRequest 注入的全局 request
|
|
37
|
+
* - 传入时优先使用 prop(便于单页覆盖)
|
|
38
|
+
*/
|
|
39
|
+
request?: JProductRequestFn;
|
|
40
|
+
}
|
|
41
|
+
export interface JSkuLinkProps {
|
|
42
|
+
/** 编码,有值时渲染为可点击链接 */
|
|
43
|
+
code?: string | null;
|
|
44
|
+
/** 无编码时展示的占位文本 */
|
|
45
|
+
emptyText?: string;
|
|
46
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* 产品详情弹窗状态管理(页面级:多个 JSkuLink 共用一个 Dialog)。
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* const {
|
|
8
|
+
* productDetailDialogVisible,
|
|
9
|
+
* productDetailDialogCode,
|
|
10
|
+
* openProductDetailDialog,
|
|
11
|
+
* } = useProductDetailDialog()
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* ```vue
|
|
15
|
+
* <JSkuLink :code="row.sku" @open="openProductDetailDialog" />
|
|
16
|
+
* <JProductDetailDialog
|
|
17
|
+
* v-model:visible="productDetailDialogVisible"
|
|
18
|
+
* :code="productDetailDialogCode"
|
|
19
|
+
* type="sku"
|
|
20
|
+
* />
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* 注意:列表中每行只用 JSkuLink,Dialog 放页面底部只挂一次,不要每行一个 Dialog。
|
|
24
|
+
*/
|
|
25
|
+
export declare function useProductDetailDialog(): {
|
|
26
|
+
productDetailDialogVisible: Ref<boolean, boolean>;
|
|
27
|
+
productDetailDialogCode: Ref<string, string>;
|
|
28
|
+
openProductDetailDialog: (code: string) => void;
|
|
29
|
+
};
|
|
@@ -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, provideProductRequest, resolveProductRequest, useInjectedProductRequest, J_PRODUCT_REQUEST_KEY, } 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';
|