ftdsy-attr 2.0.0 → 2.1.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.
Files changed (56) hide show
  1. package/dist/ftdsy-attr.cjs.js +1 -1
  2. package/dist/ftdsy-attr.d.ts +81 -63
  3. package/dist/ftdsy-attr.esm.js +1 -1
  4. package/dist/types/api/tb/index.d.ts +2 -2
  5. package/dist/types/category/departmentStore/departmentStore_commodity.d.ts +17 -0
  6. package/dist/types/category/departmentStore/departmentStore_holidaysupplies.d.ts +17 -0
  7. package/dist/types/category/departmentStore/departmentStore_tableware.d.ts +17 -0
  8. package/dist/types/category/numeral/numeral_game.d.ts +17 -0
  9. package/dist/types/category/numeral/numeral_smart.d.ts +17 -0
  10. package/dist/types/category/type.d.ts +18 -0
  11. package/dist/types/main.d.ts +28 -7
  12. package/dist/types/models/index.d.ts +4 -11
  13. package/dist/types/platform/albb.d.ts +6 -0
  14. package/dist/types/platform/albb.type.d.ts +27 -0
  15. package/dist/types/platform/dy.d.ts +3 -0
  16. package/dist/types/platform/dy.type.d.ts +48 -0
  17. package/dist/types/platform/jd.d.ts +3 -0
  18. package/dist/types/platform/jd.type.d.ts +30 -0
  19. package/dist/types/platform/ks.d.ts +3 -0
  20. package/dist/types/platform/ks.type.d.ts +41 -0
  21. package/dist/types/platform/pdd.d.ts +6 -0
  22. package/dist/types/platform/pdd.type.d.ts +28 -0
  23. package/dist/types/platform/shopee.d.ts +6 -0
  24. package/dist/types/platform/shopee.type.d.ts +28 -0
  25. package/dist/types/platform/tb.d.ts +7 -0
  26. package/dist/types/platform/tb.type.d.ts +63 -0
  27. package/dist/types/platform/tiktok.d.ts +6 -0
  28. package/dist/types/platform/tiktok.type.d.ts +1 -0
  29. package/dist/types/platform/tm.d.ts +5 -0
  30. package/dist/types/platform/tm.type.d.ts +1 -0
  31. package/dist/types/platform/wxsph.d.ts +6 -0
  32. package/dist/types/platform/wxsph.type.d.ts +9 -0
  33. package/dist/types/platform/xhs.d.ts +6 -0
  34. package/dist/types/platform/xhs.type.d.ts +16 -0
  35. package/dist/types/property/index.d.ts +3 -3
  36. package/dist/types/property/matchProperty.d.ts +3 -3
  37. package/dist/types/property/perpareProperty.d.ts +3 -3
  38. package/dist/types/property/predictionProperty.d.ts +2 -3
  39. package/dist/types/property/type.d.ts +69 -0
  40. package/dist/types/type.d.ts +63 -32
  41. package/dist/types/utils/is/index.d.ts +23 -0
  42. package/dist/types/utils/utils.d.ts +33 -45
  43. package/package.json +1 -1
  44. package/dist/types/platform/index.d.ts +0 -6
  45. package/dist/types/platform/platform/albb.d.ts +0 -6
  46. package/dist/types/platform/platform/dy.d.ts +0 -6
  47. package/dist/types/platform/platform/jd.d.ts +0 -6
  48. package/dist/types/platform/platform/ks.d.ts +0 -6
  49. package/dist/types/platform/platform/pdd.d.ts +0 -9
  50. package/dist/types/platform/platform/shopee.d.ts +0 -6
  51. package/dist/types/platform/platform/tb.d.ts +0 -6
  52. package/dist/types/platform/platform/tiktok.d.ts +0 -6
  53. package/dist/types/platform/platform/tm.d.ts +0 -6
  54. package/dist/types/platform/platform/wxsph.d.ts +0 -6
  55. package/dist/types/platform/platform/xhs.d.ts +0 -6
  56. package/dist/types/platform/type.d.ts +0 -70
@@ -0,0 +1,69 @@
1
+ import type { DsyAttr, Pt, PropertyComponent } from "../type";
2
+ export type MatchInfo = {
3
+ cate_id: string;
4
+ cate_path: string;
5
+ platform: Pt;
6
+ is_prediction: boolean;
7
+ is_required_force: boolean;
8
+ is_other_force: boolean;
9
+ };
10
+ export type MatchGoods = {
11
+ title?: string;
12
+ goods_sn?: string;
13
+ ccc_code?: string;
14
+ remark?: string;
15
+ specs?: MatchGoodsSpec[];
16
+ };
17
+ export type MatchGoodsSpec = {
18
+ spec_id: string;
19
+ spec_name: string;
20
+ is_upload_image: number;
21
+ list: MatchGoodsSpecValue[];
22
+ };
23
+ export type MatchGoodsSpecValue = {
24
+ value_id: string;
25
+ value: string;
26
+ };
27
+ export type MatchAttr = DsyAttr & {
28
+ show: boolean;
29
+ property_value?: number | string | MatchSelectOption[] | MatchSelectOption;
30
+ select_values: MatchSelectOption[];
31
+ select_max_num?: number;
32
+ input_values: MatchInputOption[];
33
+ input_units?: string[];
34
+ input_operator?: string;
35
+ date_format?: string;
36
+ };
37
+ export type MatchSelectOption = {
38
+ name: string;
39
+ value_id: string;
40
+ value: string;
41
+ parent_value?: string[];
42
+ value_path?: string;
43
+ disableContent?: boolean;
44
+ content?: number;
45
+ similarity?: number;
46
+ };
47
+ export type MatchInputOption = PropertyComponent & {
48
+ value: string;
49
+ };
50
+ export interface PropertiesData {
51
+ list: MatchAttr[];
52
+ require_total: number;
53
+ require_count: number;
54
+ required_list: MatchAttr[];
55
+ other_list: MatchAttr[];
56
+ children_list: MatchAttr[];
57
+ brand_property: MatchAttr;
58
+ material_quality_property: MatchAttr;
59
+ }
60
+ export interface MaterialInfo {
61
+ material: string;
62
+ percentage: number;
63
+ }
64
+ export type PercentageRange = {
65
+ min: number | null;
66
+ max: number | null;
67
+ includeMin: boolean;
68
+ includeMax: boolean;
69
+ };
@@ -1,36 +1,67 @@
1
- import { Platform, PropertyItem } from "./platform/type";
2
- export interface MatchInfo {
3
- cate_id: string;
4
- cate_path: string;
5
- platform: Platform;
6
- is_prediction: boolean;
7
- is_required_force: boolean;
8
- is_other_force: boolean;
9
- }
10
- export interface MatchGoods {
1
+ export type Pt = 'pdd' | 'tb' | 'jd' | 'dy' | 'shopee' | 'xhs' | 'ks' | 'dsy' | 'albb' | 'shopeebt' | 'tgc' | 'wxsph' | 'tiktok' | 'tm' | 'tiktokUs';
2
+ export type PropertyType = 'unknown' | 'input' | 'singleSelect' | 'multiSelect' | 'treeSingleSelect' | 'inputComponent' | 'multiComplex' | 'date' | 'image';
3
+ export type RuleName = 'requiredRule' | 'maxLengthRule' | 'valueTypeRule' | 'maxItemsRule' | 'format' | 'regexRule';
4
+ export type ComponentType = 'input' | 'unit' | 'select';
5
+ export type goodsAttr = {
6
+ id?: string;
7
+ attr_name: string;
8
+ value: string | string[];
9
+ value_id?: string | string[];
10
+ };
11
+ export 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
+ export type PropertyComponent = {
20
+ type: string;
21
+ name?: string;
22
+ placeholder?: string;
23
+ options: propertyOption[];
24
+ text?: string;
25
+ precision?: number;
26
+ };
27
+ export type Rule = {
28
+ name: RuleName;
29
+ value: string;
30
+ exProperty?: string;
31
+ };
32
+ export 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
+ export type Condition = {
48
+ parent_id: string;
49
+ parent_value_ids: string[];
50
+ };
51
+ export type DsyAttrValue = {
52
+ valueId: string | string[];
53
+ value: string | string[];
54
+ };
55
+ export type DsyAttrWithValue = DsyAttr & DsyAttrValue;
56
+ export type MatchDatas = {
57
+ cate_id: string | number;
58
+ cate_path: string | string[];
59
+ platform: string;
60
+ properties: any[];
61
+ attrs?: any[];
11
62
  title?: string;
12
63
  goods_sn?: string;
13
64
  ccc_code?: string;
14
65
  remark?: string;
15
- }
16
- export interface MatchDatas extends MatchGoods {
17
- cate_id: string;
18
- cate_path: string;
19
- platform: Platform;
20
- properties: any[];
21
- attrs?: any[];
22
- }
23
- export interface PropertiesData {
24
- list: PropertyItem[];
25
- require_total: number;
26
- require_count: number;
27
- required_list: PropertyItem[];
28
- other_list: PropertyItem[];
29
- children_list: PropertyItem[];
30
- brand_property: PropertyItem | object;
31
- material_quality_property: PropertyItem | object;
32
- }
33
- export interface MaterialInfo {
34
- material: string;
35
- percentage: number;
36
- }
66
+ specs?: any;
67
+ };
@@ -0,0 +1,23 @@
1
+ export declare function is(val: unknown, type: string): boolean;
2
+ export declare function isDef<T = unknown>(val?: T): val is T;
3
+ export declare function isUnDef<T = unknown>(val?: T): val is T;
4
+ export declare function isObject(val: any): val is Record<any, any>;
5
+ export declare function isEmpty<T = unknown>(val: T): val is T;
6
+ export declare function isDate(val: unknown): val is Date;
7
+ export declare function isNull(val: unknown): val is null;
8
+ export declare function isNullAndUnDef(val: unknown): val is null | undefined;
9
+ export declare function isNullOrUnDef(val: unknown): val is null | undefined;
10
+ export declare function isNumber(val: unknown): val is number;
11
+ export declare function isPromise<T = any>(val: unknown): val is Promise<T>;
12
+ export declare function isString(val: unknown): val is string;
13
+ export declare function isFunction(val: unknown): val is Function;
14
+ export declare function isAsyncFunction(val: unknown): val is Function;
15
+ export declare function isBoolean(val: unknown): val is boolean;
16
+ export declare function isRegExp(val: unknown): val is RegExp;
17
+ export declare function isArray(val: any): val is Array<any>;
18
+ export declare function isWindow(val: any): val is Window;
19
+ export declare function isElement(val: unknown): val is Element;
20
+ export declare function isMap(val: unknown): val is Map<any, any>;
21
+ export declare const isServer: boolean;
22
+ export declare const isClient: boolean;
23
+ export declare function isUrl(path: string): boolean;
@@ -1,46 +1,34 @@
1
- import { MaterialInfo } from '@/type';
2
- type PercentageRange = {
3
- min: number | null;
4
- max: number | null;
5
- includeMin: boolean;
6
- includeMax: boolean;
1
+ /**
2
+ * 检测值是否为空值,true: 已选,false: 未选
3
+ * */
4
+ export declare function checkValue(value: unknown): boolean;
5
+ /**
6
+ * 获取2个字符串的相似度
7
+ * @param {string} str1 字符串1
8
+ * @param {string} str2 字符串2
9
+ * @returns {number} 相似度
10
+ */
11
+ export declare function getStringSimilarity(str1: string, str2: string): number;
12
+ /**
13
+ * 判断字符串中是否包含某些字符
14
+ *
15
+ * @param {String} text 检测字符串
16
+ * @param {Array} arr 检测内容字符串数组
17
+ * @param {string} type 检测方式,includeOne:包含一个,includeAll:包含全部,默认为 includeOne
18
+ * */
19
+ export declare function isTextInclude(text: string, arr: string[], type?: string): boolean;
20
+ /**
21
+ * 获取文本长度
22
+ *
23
+ * @param {String} text 待检查的字符串
24
+ * @param {Number} max 当text不是字符时返回的数字
25
+ * */
26
+ export declare function getTextLength(text: string, max?: number): number;
27
+ export declare function getCurrentTime(cate_path?: string): {
28
+ year: number;
29
+ month: number;
30
+ day: number;
31
+ season: string;
32
+ lastSeason: string;
7
33
  };
8
- declare const _default: {
9
- checkValue(value: unknown): boolean;
10
- /**
11
- * 获取2个字符串的相似度
12
- * @param {string} str1 字符串1
13
- * @param {string} str2 字符串2
14
- * @returns {number} 相似度
15
- */
16
- getStringSimilarity(str1: string, str2: string): number;
17
- /**
18
- * 判断字符串中是否包含某些字符
19
- *
20
- * @param {String} text 检测字符串
21
- * @param {Array} arr 检测内容字符串数组
22
- * @param {string} type 检测方式,includeOne:包含一个,includeAll:包含全部,默认为 includeOne
23
- * */
24
- isTextInclude(text: string, arr: string[], type?: string): boolean;
25
- /**
26
- * 获取文本长度
27
- *
28
- * @param {String} text 待检查的字符串
29
- * @param {Number} max 当text不是字符时返回的数字
30
- * */
31
- getTextLength(text: string, max?: number): number;
32
- getCurrentTime(cate_path?: string): {
33
- year: number;
34
- month: number;
35
- day: number;
36
- season: string;
37
- lastSeason: string;
38
- };
39
- parsePercentage(str: string | null | undefined): number;
40
- parseMaterial(str: string): MaterialInfo;
41
- parsePercentageRange(str: string): PercentageRange;
42
- isMatchNumberRange(userMin: number, userMax: number, option: any): boolean;
43
- mathRoundNumber(num: number): number;
44
- mathRandomNumber(num: number): number;
45
- };
46
- export default _default;
34
+ export declare function mathRandomNumber(num: number): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ftdsy-attr",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "main": "dist/ftdsy-attr.cjs.js",
5
5
  "module": "dist/ftdsy-attr.esm.js",
6
6
  "types": "dist/ftdsy-attr.d.ts",
@@ -1,6 +0,0 @@
1
- import { Platform, PropertyItem } from "./type";
2
- /**
3
- * 生成自定义属性列表
4
- * 对目标平台的属性列表进行处理,获取转换后的自定义属性列表
5
- * */
6
- export declare function createCategoryProperties(platform: Platform, pt_attrs: any[]): PropertyItem[];
@@ -1,6 +0,0 @@
1
- import { PropertyItem } from "../type";
2
- declare const _default: {
3
- createCategoryProperties: typeof createCategoryProperties;
4
- };
5
- export default _default;
6
- declare function createCategoryProperties(categoryProperties: any[]): PropertyItem[];
@@ -1,6 +0,0 @@
1
- import { PropertyItem } from "../type";
2
- declare const _default: {
3
- createCategoryProperties: typeof createCategoryProperties;
4
- };
5
- export default _default;
6
- declare function createCategoryProperties(categoryProperties: any[]): PropertyItem[];
@@ -1,6 +0,0 @@
1
- import { PropertyItem } from "../type";
2
- declare const _default: {
3
- createCategoryProperties: typeof createCategoryProperties;
4
- };
5
- export default _default;
6
- declare function createCategoryProperties(categoryProperties: any[]): PropertyItem[];
@@ -1,6 +0,0 @@
1
- import { PropertyItem } from "../type";
2
- declare const _default: {
3
- createCategoryProperties: typeof createCategoryProperties;
4
- };
5
- export default _default;
6
- declare function createCategoryProperties(categoryProperties: any[]): PropertyItem[];
@@ -1,9 +0,0 @@
1
- import { PropertyItem } from "../type";
2
- declare const _default: {
3
- createCategoryProperties: typeof createCategoryProperties;
4
- };
5
- export default _default;
6
- /**
7
- * 根据拼多多分类规则与属性,生成自定义 上货属性
8
- * */
9
- declare function createCategoryProperties(categoryProperties: any[]): PropertyItem[];
@@ -1,6 +0,0 @@
1
- import { PropertyItem } from "../type";
2
- declare const _default: {
3
- createCategoryProperties: typeof createCategoryProperties;
4
- };
5
- export default _default;
6
- declare function createCategoryProperties(categoryProperties: any[]): PropertyItem[];
@@ -1,6 +0,0 @@
1
- import { PropertyItem } from "../type";
2
- declare const _default: {
3
- createCategoryProperties: typeof createCategoryProperties;
4
- };
5
- export default _default;
6
- declare function createCategoryProperties(categoryProperties: any[]): PropertyItem[];
@@ -1,6 +0,0 @@
1
- import { PropertyItem } from "../type";
2
- declare const _default: {
3
- createCategoryProperties: typeof createCategoryProperties;
4
- };
5
- export default _default;
6
- declare function createCategoryProperties(categoryProperties: any[]): PropertyItem[];
@@ -1,6 +0,0 @@
1
- import { PropertyItem } from "../type";
2
- declare const _default: {
3
- createCategoryProperties: typeof createCategoryProperties;
4
- };
5
- export default _default;
6
- declare function createCategoryProperties(categoryProperties: any[]): PropertyItem[];
@@ -1,6 +0,0 @@
1
- import { PropertyItem } from "../type";
2
- declare const _default: {
3
- createCategoryProperties: typeof createCategoryProperties;
4
- };
5
- export default _default;
6
- declare function createCategoryProperties(categoryProperties: any[]): PropertyItem[];
@@ -1,6 +0,0 @@
1
- import { PropertyItem } from "../type";
2
- declare const _default: {
3
- createCategoryProperties: typeof createCategoryProperties;
4
- };
5
- export default _default;
6
- declare function createCategoryProperties(categoryProperties: any[]): PropertyItem[];
@@ -1,70 +0,0 @@
1
- export type Platform = 'pdd' | 'tb' | 'jd' | 'dy' | 'shopee' | 'xhs' | 'ks' | 'dsy' | 'albb' | 'shopeebt' | 'tgc' | 'wxsph' | 'tiktok' | 'tm' | 'tiktokUs';
2
- export type Category = {
3
- title: string;
4
- path?: string;
5
- dsy?: string;
6
- pdd: string;
7
- tb: string;
8
- tm: string;
9
- jd: string;
10
- dy: string;
11
- shopee: string;
12
- shopeebt?: string;
13
- xhs: string;
14
- ks: string;
15
- albb: string;
16
- wxsph: string;
17
- tiktok: string;
18
- tiktokUs: string;
19
- };
20
- export type GoodsAttr = {
21
- id?: string | number;
22
- attr_name: string;
23
- value: string | string[];
24
- value_id?: string | number | string[];
25
- };
26
- export type PropertyItem = {
27
- property_id: string | number;
28
- property_name: string;
29
- property_required: boolean;
30
- property_type: number;
31
- property_value?: number | string | PropertySelectOption[] | PropertySelectOption | object;
32
- property_values: PropertySelectOption[];
33
- select_max_num: number;
34
- select_custom: boolean;
35
- input_num: number;
36
- input_max_num: number;
37
- input_type: string;
38
- property_unit: string;
39
- property_units: string[];
40
- input_operator?: string;
41
- input_values?: PropertyInputOption[];
42
- date_format: string;
43
- has_children: boolean;
44
- show?: boolean;
45
- show_condition: PropertyShowCondition[];
46
- condition_values: PropertySelectOption[];
47
- property_tips?: string;
48
- measure_templates?: any;
49
- property_cstore?: boolean;
50
- };
51
- export type PropertySelectOption = {
52
- name: string;
53
- value_id: string;
54
- value: string;
55
- parent_value?: string[];
56
- parent_id?: string;
57
- parent_name?: string;
58
- children_values?: PropertySelectOption[];
59
- disableContent?: boolean;
60
- content?: number;
61
- similarity?: number;
62
- };
63
- export type PropertyInputOption = {
64
- title: string;
65
- value: string;
66
- };
67
- export type PropertyShowCondition = {
68
- parent_property_id: string;
69
- parent_property_value: string[];
70
- };