ftdsy-attr 2.0.1 → 2.1.1
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/dist/ftdsy-attr.cjs.js +2 -0
- package/dist/ftdsy-attr.cjs.js.map +1 -0
- package/dist/ftdsy-attr.d.ts +111 -0
- package/dist/ftdsy-attr.esm.js +2 -0
- package/dist/ftdsy-attr.esm.js.map +1 -0
- package/dist/types/api/tb/index.d.ts +3 -0
- package/dist/types/category/bags/bags_leather.d.ts +16 -0
- package/dist/types/category/bags/bags_motion.d.ts +16 -0
- package/dist/types/category/clothing/clothing_accessory.d.ts +16 -0
- package/dist/types/category/clothing/clothing_children.d.ts +16 -0
- package/dist/types/category/clothing/clothing_jewelry.d.ts +16 -0
- package/dist/types/category/clothing/clothing_men.d.ts +16 -0
- package/dist/types/category/clothing/clothing_motion.d.ts +16 -0
- package/dist/types/category/clothing/clothing_underwear.d.ts +16 -0
- package/dist/types/category/clothing/clothing_women.d.ts +16 -0
- package/dist/types/category/departmentStore/departmentStore_bedding.d.ts +16 -0
- package/dist/types/category/departmentStore/departmentStore_commodity.d.ts +17 -0
- package/dist/types/category/departmentStore/departmentStore_flower.d.ts +16 -0
- package/dist/types/category/departmentStore/departmentStore_holidaysupplies.d.ts +17 -0
- package/dist/types/category/departmentStore/departmentStore_homefabric.d.ts +16 -0
- package/dist/types/category/departmentStore/departmentStore_petanimal.d.ts +16 -0
- package/dist/types/category/departmentStore/departmentStore_storage.d.ts +16 -0
- package/dist/types/category/departmentStore/departmentStore_tableware.d.ts +17 -0
- package/dist/types/category/index.d.ts +7 -0
- package/dist/types/category/motherBaby/motherBaby_bady.d.ts +16 -0
- package/dist/types/category/motherBaby/motherBaby_gravida.d.ts +16 -0
- package/dist/types/category/numeral/numeral_accessory.d.ts +16 -0
- package/dist/types/category/numeral/numeral_camera.d.ts +16 -0
- package/dist/types/category/numeral/numeral_computer.d.ts +16 -0
- package/dist/types/category/numeral/numeral_game.d.ts +17 -0
- package/dist/types/category/numeral/numeral_smart.d.ts +17 -0
- package/dist/types/category/shoes/shoes_children.d.ts +16 -0
- package/dist/types/category/shoes/shoes_men.d.ts +16 -0
- package/dist/types/category/shoes/shoes_motion.d.ts +16 -0
- package/dist/types/category/shoes/shoes_women.d.ts +16 -0
- package/dist/types/category/sportsOutdoor/sportsOutdoor_outdoors.d.ts +16 -0
- package/dist/types/category/sportsOutdoor/sportsOutdoor_sports.d.ts +16 -0
- package/dist/types/category/type.d.ts +18 -0
- package/dist/types/category/vehicle/vehicle_cycling.d.ts +16 -0
- package/dist/types/category/vehicle/vehicle_electricvehicle.d.ts +16 -0
- package/dist/types/category/vehicle/vehicle_motorcycle.d.ts +16 -0
- package/dist/types/main.d.ts +42 -0
- package/dist/types/models/defaultModel.d.ts +16 -0
- package/dist/types/models/index.d.ts +4 -0
- package/dist/types/models/modal.d.ts +11 -0
- package/dist/types/platform/albb.d.ts +6 -0
- package/dist/types/platform/albb.type.d.ts +27 -0
- package/dist/types/platform/dy.d.ts +3 -0
- package/dist/types/platform/dy.type.d.ts +48 -0
- package/dist/types/platform/jd.d.ts +3 -0
- package/dist/types/platform/jd.type.d.ts +30 -0
- package/dist/types/platform/ks.d.ts +3 -0
- package/dist/types/platform/ks.type.d.ts +41 -0
- package/dist/types/platform/pdd.d.ts +6 -0
- package/dist/types/platform/pdd.type.d.ts +28 -0
- package/dist/types/platform/shopee.d.ts +6 -0
- package/dist/types/platform/shopee.type.d.ts +28 -0
- package/dist/types/platform/tb.d.ts +7 -0
- package/dist/types/platform/tb.type.d.ts +63 -0
- package/dist/types/platform/tiktok.d.ts +6 -0
- package/dist/types/platform/tiktok.type.d.ts +1 -0
- package/dist/types/platform/tm.d.ts +5 -0
- package/dist/types/platform/tm.type.d.ts +1 -0
- package/dist/types/platform/wxsph.d.ts +6 -0
- package/dist/types/platform/wxsph.type.d.ts +9 -0
- package/dist/types/platform/xhs.d.ts +6 -0
- package/dist/types/platform/xhs.type.d.ts +16 -0
- package/dist/types/property/index.d.ts +10 -0
- package/dist/types/property/matchProperty.d.ts +6 -0
- package/dist/types/property/perpareProperty.d.ts +9 -0
- package/dist/types/property/predictionProperty.d.ts +8 -0
- package/dist/types/property/type.d.ts +69 -0
- package/dist/types/type.d.ts +67 -0
- package/dist/types/utils/axios.d.ts +15 -0
- package/dist/types/utils/error.d.ts +12 -0
- package/dist/types/utils/is/index.d.ts +23 -0
- package/dist/types/utils/utils.d.ts +34 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ftdsy-attr.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
type Pt = 'pdd' | 'tb' | 'jd' | 'dy' | 'shopee' | 'xhs' | 'ks' | 'dsy' | 'albb' | 'shopeebt' | 'tgc' | 'wxsph' | 'tiktok' | 'tm' | 'tiktokUs';
|
|
2
|
+
type PropertyType = 'unknown' | 'input' | 'singleSelect' | 'multiSelect' | 'treeSingleSelect' | 'inputComponent' | 'multiComplex' | 'date' | 'image';
|
|
3
|
+
type RuleName = 'requiredRule' | 'maxLengthRule' | 'valueTypeRule' | 'maxItemsRule' | 'format' | 'regexRule';
|
|
4
|
+
type ComponentType = 'input' | 'unit' | 'select';
|
|
5
|
+
type goodsAttr = {
|
|
6
|
+
id?: string;
|
|
7
|
+
attr_name: string;
|
|
8
|
+
value: string | string[];
|
|
9
|
+
value_id?: string | string[];
|
|
10
|
+
};
|
|
11
|
+
type propertyOption = {
|
|
12
|
+
label: string;
|
|
13
|
+
value: string;
|
|
14
|
+
parent_value?: string[];
|
|
15
|
+
value_path?: string;
|
|
16
|
+
value_ids_path?: string[];
|
|
17
|
+
children?: propertyOption[];
|
|
18
|
+
};
|
|
19
|
+
type PropertyComponent = {
|
|
20
|
+
type: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
options: propertyOption[];
|
|
24
|
+
text?: string;
|
|
25
|
+
precision?: number;
|
|
26
|
+
};
|
|
27
|
+
type Rule = {
|
|
28
|
+
name: RuleName;
|
|
29
|
+
value: string;
|
|
30
|
+
exProperty?: string;
|
|
31
|
+
};
|
|
32
|
+
type DsyAttr = {
|
|
33
|
+
property_id: string;
|
|
34
|
+
property_required: boolean;
|
|
35
|
+
property_name: string;
|
|
36
|
+
property_type: PropertyType;
|
|
37
|
+
property_values: propertyOption[];
|
|
38
|
+
property_component?: PropertyComponent[];
|
|
39
|
+
property_tips?: string;
|
|
40
|
+
rules: Rule[];
|
|
41
|
+
has_children: boolean;
|
|
42
|
+
select_custom?: boolean;
|
|
43
|
+
show_condition?: Condition[];
|
|
44
|
+
measure_templates?: any;
|
|
45
|
+
isCStore?: boolean;
|
|
46
|
+
};
|
|
47
|
+
type Condition = {
|
|
48
|
+
parent_id: string;
|
|
49
|
+
parent_value_ids: string[];
|
|
50
|
+
};
|
|
51
|
+
type DsyAttrValue = {
|
|
52
|
+
valueId: string | string[];
|
|
53
|
+
value: string | string[];
|
|
54
|
+
};
|
|
55
|
+
type DsyAttrWithValue = DsyAttr & DsyAttrValue;
|
|
56
|
+
type MatchDatas = {
|
|
57
|
+
cate_id: string | number;
|
|
58
|
+
cate_path: string | string[];
|
|
59
|
+
platform: string;
|
|
60
|
+
properties: any[];
|
|
61
|
+
attrs?: any[];
|
|
62
|
+
title?: string;
|
|
63
|
+
goods_sn?: string;
|
|
64
|
+
ccc_code?: string;
|
|
65
|
+
remark?: string;
|
|
66
|
+
specs?: any;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
declare const _default: {
|
|
70
|
+
version: string;
|
|
71
|
+
createCategoryProperties: typeof createCategoryProperties;
|
|
72
|
+
matchCategoryProperties: typeof matchCategoryProperties;
|
|
73
|
+
createCategoryPropertyTemplate: typeof createCategoryPropertyTemplate;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* 转换自定义属性列表,
|
|
78
|
+
* */
|
|
79
|
+
declare function createCategoryProperties(platform: Pt, ptAttrs: any): DsyAttr[] | null;
|
|
80
|
+
/**
|
|
81
|
+
* 匹配属性值
|
|
82
|
+
* @param matchDatas 匹配数据
|
|
83
|
+
* @param matchLevel 匹配等级
|
|
84
|
+
* @param outType 匹配结果输出类型 group: 分组(已去除),template: 模板, list: 自定义属性列表(不含’品牌‘)
|
|
85
|
+
* */
|
|
86
|
+
declare function matchCategoryProperties(matchDatas: MatchDatas, matchLevel?: number, outType?: 'template' | 'list'): Promise<{
|
|
87
|
+
msg: string;
|
|
88
|
+
data: DsyAttrWithValue[];
|
|
89
|
+
code: number;
|
|
90
|
+
} | {
|
|
91
|
+
msg: string;
|
|
92
|
+
data: goodsAttr[];
|
|
93
|
+
code: number;
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* 创建分类属性模板
|
|
97
|
+
*
|
|
98
|
+
* 返回案例如下:
|
|
99
|
+
* input: { attr_name: '货号', value: 'abc' };
|
|
100
|
+
* date: { attr_name: '日期', value: '2025-8-1' };
|
|
101
|
+
* inputComponent: { attr_name: '含量', value: '100%' };
|
|
102
|
+
* singleSelect: { attr_name: '材质', value: '聚酯纤维' };
|
|
103
|
+
* singleSelect: { attr_name: '材质', value: '聚酯纤维' };
|
|
104
|
+
* multiSelect: { attr_name: '材质', value: '[聚酯纤维, 棉]' };
|
|
105
|
+
* multiComplex: { attr_name: '材质', value: '[聚酯纤维[80%], 棉[20%]]' };
|
|
106
|
+
* treeSingleSelect: { attr_name: '风格', value: '休闲风-简约风' };
|
|
107
|
+
* */
|
|
108
|
+
declare function createCategoryPropertyTemplate(properties: (DsyAttrWithValue | goodsAttr)[]): goodsAttr[];
|
|
109
|
+
|
|
110
|
+
export { _default as default };
|
|
111
|
+
export type { ComponentType, Condition, DsyAttr, DsyAttrValue, DsyAttrWithValue, MatchDatas, PropertyComponent, PropertyType, Pt, Rule, RuleName, goodsAttr, propertyOption };
|