bmc-common-resource 1.0.0 → 1.0.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.
Files changed (2) hide show
  1. package/README.md +99 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1 +1,99 @@
1
-
1
+ # bmc-common-resource
2
+
3
+ 这是一个npm包,用于定义多个项目共用的枚举、常量和资源。通过集中管理这些公共资源,可以确保在不同项目中保持一致性,减少代码重复,并简化维护工作。
4
+
5
+ ## 安装
6
+ ```bash
7
+ npm install bmc-common-resource --save
8
+ ```
9
+
10
+ ## 目前包含的资源
11
+
12
+ ### 报价清单状态 (solution_status)
13
+ ```typescript
14
+ import { solution_status, solution_status_options } from 'bmc-common-resource';
15
+
16
+ // 使用枚举
17
+ const status = solution_status.DRAFT;
18
+
19
+ // 使用选项数组(适用于下拉菜单等UI组件)
20
+ console.log(solution_status_options);
21
+ // 输出:[{name: '草稿', value: 'DRAFT'}, ...]
22
+ ```
23
+
24
+ ### 货币单位 (CURRENCY_UNIT_ENUM)
25
+ ```typescript
26
+ import { CURRENCY_UNIT_ENUM, CURRENCY_UNIT_OPTIONS } from 'bmc-common-resource';
27
+
28
+ // 使用枚举
29
+ const currency = CURRENCY_UNIT_ENUM.CNY;
30
+
31
+ // 使用选项数组
32
+ console.log(CURRENCY_UNIT_OPTIONS);
33
+ // 输出:[{name: '人民币', value: 'CNY'}, ...]
34
+ ```
35
+
36
+ ### 产品供货模式 (supply_mode)
37
+ ```typescript
38
+ import { supply_mode, supply_mode_options } from 'bmc-common-resource';
39
+
40
+ // 使用枚举
41
+ const mode = supply_mode.own_production;
42
+
43
+ // 使用选项数组
44
+ console.log(supply_mode_options);
45
+ // 输出:[{name: '自制生产', value: 'own_production'}, ...]
46
+ ```
47
+
48
+ ## 枚举值说明
49
+
50
+ ### solution_status (报价清单状态)
51
+ | 值 | 说明 |
52
+ |----|------|
53
+ | `DRAFT` | 草稿 |
54
+ | `ACTIVE` | 可用 |
55
+ | `LOCKED` | 锁定 |
56
+ | `REVOKED` | 已作废 |
57
+ | `PRE_SIGNED` | 预签 |
58
+ | `SIGNED` | 已签 |
59
+ | `SIGNED_REVOKED` | 已签作废 |
60
+
61
+ ### CURRENCY_UNIT_ENUM (货币单位)
62
+ | 值 | 说明 |
63
+ |----|------|
64
+ | `CNY` | 人民币 |
65
+ | `USD` | 美元 |
66
+ | `EUR` | 欧元 |
67
+ | `GBP` | 英镑 |
68
+ | `HKD` | 港币 |
69
+
70
+ ### supply_mode (产品供货模式)
71
+ | 值 | 说明 |
72
+ |----|------|
73
+ | `own_production` | 自制生产 |
74
+ | `brand_agency` | 品牌代理 |
75
+ | `wholesale_procur` | 批发采购 |
76
+ | `cross_border_pro` | 跨境采购 |
77
+ | `oem_contract` | OEM代工 |
78
+
79
+ ## 开发说明
80
+
81
+ ### 添加新的枚举
82
+ 1. 在 `src/enums` 目录下创建新文件
83
+ 2. 在 `src/enums/index.ts` 中导出
84
+ 3. 如需选项数组,在 `src/constants` 目录下创建对应的选项文件
85
+ 4. 运行 `npm run build` 构建
86
+
87
+ ## 使用说明
88
+ 所有枚举和常量都可以直接从包的根路径导入:
89
+
90
+ ```typescript
91
+ import {
92
+ solution_status,
93
+ CURRENCY_UNIT_ENUM,
94
+ supply_mode,
95
+ solution_status_options,
96
+ CURRENCY_UNIT_OPTIONS,
97
+ supply_mode_options
98
+ } from 'bmc-common-resource';
99
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bmc-common-resource",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "通用枚举、常量和资源的npm包",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",