twcpt 0.0.2 → 0.0.3

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 CHANGED
@@ -1,4 +1,4 @@
1
- # TWCPT - Vue 3 + Element-plus 组件库
1
+ # TWCPT - Vue 3 + Element-plus 组件库
2
2
 
3
3
  TWCPT 是一个基于 Vue 3、TypeScript 和 Element-plus 构建的现代企业级组件库。
4
4
 
@@ -102,18 +102,47 @@ yarn add twcpt
102
102
  pnpm add twcpt
103
103
  ```
104
104
 
105
- ### 使用
105
+ ### 基础使用
106
106
 
107
107
  ```typescript
108
108
  import { createApp } from 'vue'
109
- import TWCPT from 'twcpt'
109
+ import { twcptInit } from 'twcpt'
110
110
  import 'twcpt/dist/index.css'
111
111
 
112
112
  const app = createApp(App)
113
- app.use(TWCPT)
113
+
114
+ // 初始化 TWCPT
115
+ twcptInit({
116
+ app,
117
+ defaultLanguage: 'zh-CN', // 可选:设置默认语言
118
+ colors: {
119
+ primary: '#FF5722', // 可选:自定义主题色
120
+ blue: '#2196F3'
121
+ }
122
+ })
123
+
114
124
  app.mount('#app')
115
125
  ```
116
126
 
127
+ ### 样式隔离
128
+
129
+ 为了避免 TWCPT 的颜色配置影响外部项目,所有 TWCPT 组件必须包裹在 `.twcpt-container` 容器内:
130
+
131
+ ```vue
132
+ <template>
133
+ <div class="twcpt-container">
134
+ <!-- TWCPT 组件只在此容器内生效 -->
135
+ <JTWButton type="primary">按钮</JTWButton>
136
+ <JTWTable :data="tableData" />
137
+ </div>
138
+ </template>
139
+ ```
140
+
141
+ **重要说明:**
142
+ - `.twcpt-container` 确保 TWCPT 的颜色变量不会影响外部项目
143
+ - 如果 A 项目引用了 B 组件(TWCPT),两者的颜色配置互不影响
144
+ - 每个使用 TWCPT 的区域都需要包裹 `.twcpt-container`
145
+
117
146
  ### 按需引入
118
147
 
119
148
  ```typescript
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./charts-DIdINgA4.cjs");exports.JChBar=e.index;exports.JChBarLine=e.index$1;exports.JChBubble=e.index$2;exports.JChLine=e.index$3;exports.JChPieDoughnut=e.index$4;exports.JChRadar=e.index$5;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./charts-lTMiYKQB.cjs");exports.JChBar=e.index;exports.JChBarLine=e.index$1;exports.JChBubble=e.index$2;exports.JChLine=e.index$3;exports.JChPieDoughnut=e.index$4;exports.JChRadar=e.index$5;
package/dist/charts.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as e, a as s, b as C, c as J, d as r, e as i } from "./charts-CKv8I1ye.js";
1
+ import { i as e, a as s, b as C, c as J, d as r, e as i } from "./charts-BRqaKjiE.js";
2
2
  export {
3
3
  e as JChBar,
4
4
  s as JChBarLine,
@@ -8,14 +8,26 @@ import { Arrayable } from 'element-plus/es/utils/typescript.mjs';
8
8
  declare const _default: DefineComponent<ExtractPropTypes<{
9
9
  size: {
10
10
  type: PropType<JTWBtnSizeType>;
11
- default: "large";
11
+ default: "normal";
12
12
  validator: (value: JTWBtnSizeType) => boolean;
13
13
  };
14
14
  type: {
15
15
  type: PropType<JTWBtnTypeType>;
16
- default: "primary";
16
+ default: "button";
17
17
  validator: (value: JTWBtnTypeType) => boolean;
18
18
  };
19
+ color: {
20
+ type: StringConstructor;
21
+ default: string;
22
+ };
23
+ outline: {
24
+ type: BooleanConstructor;
25
+ default: boolean;
26
+ };
27
+ flat: {
28
+ type: BooleanConstructor;
29
+ default: boolean;
30
+ };
19
31
  label: {
20
32
  type: StringConstructor;
21
33
  default: string;
@@ -250,10 +262,20 @@ declare const _default: DefineComponent<ExtractPropTypes<{
250
262
  'j-tw-btn--large': boolean;
251
263
  'j-tw-btn--normal': boolean;
252
264
  'j-tw-btn--small': boolean;
253
- 'j-tw-btn--primary': boolean;
254
- 'j-tw-btn--secondary': boolean;
265
+ 'j-tw-btn--button': boolean;
266
+ 'j-tw-btn--outline': boolean;
267
+ 'j-tw-btn--flat': boolean;
255
268
  'j-tw-btn--text': boolean;
256
269
  }>;
270
+ computedStyle: ComputedRef<{
271
+ '--j-btn-color': string;
272
+ '--j-btn-color-1': string;
273
+ '--j-btn-color-2': string;
274
+ '--j-btn-color-3': string;
275
+ '--j-btn-color-4': string;
276
+ '--j-btn-color-5': string;
277
+ '--j-btn-color-6': string;
278
+ }>;
257
279
  mergedTooltipConfig: ComputedRef<{
258
280
  placement: "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end";
259
281
  effect: "dark" | "light";
@@ -269,14 +291,26 @@ declare const _default: DefineComponent<ExtractPropTypes<{
269
291
  }, string, PublicProps, Readonly< ExtractPropTypes<{
270
292
  size: {
271
293
  type: PropType<JTWBtnSizeType>;
272
- default: "large";
294
+ default: "normal";
273
295
  validator: (value: JTWBtnSizeType) => boolean;
274
296
  };
275
297
  type: {
276
298
  type: PropType<JTWBtnTypeType>;
277
- default: "primary";
299
+ default: "button";
278
300
  validator: (value: JTWBtnTypeType) => boolean;
279
301
  };
302
+ color: {
303
+ type: StringConstructor;
304
+ default: string;
305
+ };
306
+ outline: {
307
+ type: BooleanConstructor;
308
+ default: boolean;
309
+ };
310
+ flat: {
311
+ type: BooleanConstructor;
312
+ default: boolean;
313
+ };
280
314
  label: {
281
315
  type: StringConstructor;
282
316
  default: string;
@@ -297,9 +331,12 @@ declare const _default: DefineComponent<ExtractPropTypes<{
297
331
  onClick?: ((_e: MouseEvent) => any) | undefined;
298
332
  }>, {
299
333
  type: JTWBtnTypeType;
334
+ flat: boolean;
300
335
  label: string;
301
336
  size: JTWBtnSizeType;
337
+ color: string;
302
338
  loading: boolean;
339
+ outline: boolean;
303
340
  tips: string | number;
304
341
  tooltipConfig: JTWBtnTooltipConfig;
305
342
  }, {}, {
@@ -7,8 +7,7 @@ export declare const JTWBtnSize: {
7
7
  };
8
8
  /** 按钮类型常量 */
9
9
  export declare const JTWBtnType: {
10
- readonly PRIMARY: "primary";
11
- readonly SECONDARY: "secondary";
10
+ readonly BUTTON: "button";
12
11
  readonly TEXT: "text";
13
12
  };
14
13
  /** 按钮尺寸类型 */
@@ -44,10 +43,26 @@ export interface JTWBtnProps {
44
43
  size?: JTWBtnSizeType;
45
44
  /**
46
45
  * 按钮类型
47
- * @default 'primary'
48
- * @values 'primary' | 'secondary' | 'text'
46
+ * @default 'button'
47
+ * @values 'button' | 'text'
49
48
  */
50
49
  type?: JTWBtnTypeType;
50
+ /**
51
+ * 按钮颜色
52
+ * @default 'primary'
53
+ * @values 'primary' | 'green' | 'orange' | 'red' | 'cyan' | 'brown' | 'yellow' | 'blue' | 'purple' | 'lime' | 'magenta' | 'pink'
54
+ */
55
+ color?: string;
56
+ /**
57
+ * 是否为 outline 样式
58
+ * @default false
59
+ */
60
+ outline?: boolean;
61
+ /**
62
+ * 是否为 flat 样式(浅灰色背景,黑色文字)
63
+ * @default false
64
+ */
65
+ flat?: boolean;
51
66
  /**
52
67
  * 按钮文本
53
68
  * @default ''