yswk-ui 0.1.0 → 0.1.2

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 (103) hide show
  1. package/dist/component/live/script/type.d.ts +2 -2
  2. package/dist/component/scan/ScanTobaResult/type.d.ts +3 -0
  3. package/dist/component/scan/ScanTobaResultV2/type.d.ts +3 -0
  4. package/dist/index.es.js +3545 -3449
  5. package/dist/utils/busiHelper.d.ts +1 -0
  6. package/dist/wkc-ui/component/address/AddressForm/index.vue.d.ts +5 -0
  7. package/dist/wkc-ui/component/address/AddressForm/type.d.ts +58 -0
  8. package/dist/wkc-ui/component/address/AddressList/index.vue.d.ts +7 -0
  9. package/dist/wkc-ui/component/address/AddressList/type.d.ts +100 -0
  10. package/dist/wkc-ui/component/address/script/index.vue.d.ts +29 -0
  11. package/dist/wkc-ui/component/address/script/type.d.ts +28 -0
  12. package/dist/wkc-ui/component/base/btn/BtnLink/index.vue.d.ts +6 -0
  13. package/dist/wkc-ui/component/base/btn/BtnLink/type.d.ts +89 -0
  14. package/dist/wkc-ui/component/base/btn/CountdownButton/type.d.ts +34 -0
  15. package/dist/wkc-ui/component/base/media/AudioPlayer/index.vue.d.ts +36 -0
  16. package/dist/wkc-ui/component/base/media/BlockBackground/index.vue.d.ts +6 -0
  17. package/dist/wkc-ui/component/base/media/BlockBackground/type.d.ts +171 -0
  18. package/dist/wkc-ui/component/base/media/ImgCommon/data.d.ts +1 -0
  19. package/dist/wkc-ui/component/base/media/ImgCommon/index.vue.d.ts +10 -0
  20. package/dist/wkc-ui/component/base/media/ImgCommon/type.d.ts +77 -0
  21. package/dist/wkc-ui/component/base/media/PageBackground/index.vue.d.ts +33 -0
  22. package/dist/wkc-ui/component/base/media/UserImg/index.vue.d.ts +6 -0
  23. package/dist/wkc-ui/component/base/media/UserImg/type.d.ts +55 -0
  24. package/dist/wkc-ui/component/base/media/VideoPlayer/index.vue.d.ts +49 -0
  25. package/dist/wkc-ui/component/base/text/ActTimeAlert/index.vue.d.ts +13 -0
  26. package/dist/wkc-ui/component/base/text/ActTimeAlert/type.d.ts +25 -0
  27. package/dist/wkc-ui/component/base/text/TextCommon/data.d.ts +1 -0
  28. package/dist/wkc-ui/component/base/text/TextCommon/index.vue.d.ts +6 -0
  29. package/dist/wkc-ui/component/base/text/TextCommon/type.d.ts +179 -0
  30. package/dist/wkc-ui/component/base/time/Countdown/index.vue.d.ts +35 -0
  31. package/dist/wkc-ui/component/index.d.ts +76 -0
  32. package/dist/wkc-ui/component/live/LiveEnter/index.vue.d.ts +6 -0
  33. package/dist/wkc-ui/component/live/LiveEnter/type.d.ts +38 -0
  34. package/dist/wkc-ui/component/live/LivePassword/index.vue.d.ts +6 -0
  35. package/dist/wkc-ui/component/live/LivePassword/type.d.ts +31 -0
  36. package/dist/wkc-ui/component/live/LiveStream/components/Tabs/Chat/MsgInput.vue.d.ts +25 -0
  37. package/dist/wkc-ui/component/live/LiveStream/components/Tabs/Chat/TabChat.vue.d.ts +12 -0
  38. package/dist/wkc-ui/component/live/LiveStream/components/Tabs/TabEvaluate.vue.d.ts +2 -0
  39. package/dist/wkc-ui/component/live/LiveStream/components/Tabs/TabGIftRank.vue.d.ts +2 -0
  40. package/dist/wkc-ui/component/live/LiveStream/components/Tabs/TabImg.vue.d.ts +6 -0
  41. package/dist/wkc-ui/component/live/LiveStream/components/Tabs/TabInfo.vue.d.ts +2 -0
  42. package/dist/wkc-ui/component/live/LiveStream/components/Tabs/TabSign.vue.d.ts +2 -0
  43. package/dist/wkc-ui/component/live/LiveStream/components/Tabs/TabsIndex.vue.d.ts +9 -0
  44. package/dist/wkc-ui/component/live/LiveStream/components/VideoPlay/VideoPlay.vue.d.ts +10 -0
  45. package/dist/wkc-ui/component/live/LiveStream/index.vue.d.ts +9 -0
  46. package/dist/wkc-ui/component/live/LiveStream/type.d.ts +137 -0
  47. package/dist/wkc-ui/component/live/LiveText/index.vue.d.ts +7 -0
  48. package/dist/wkc-ui/component/live/LiveText/type.d.ts +46 -0
  49. package/dist/wkc-ui/component/live/script/type.d.ts +247 -0
  50. package/dist/wkc-ui/component/lucky/BlindBox/index.vue.d.ts +6 -0
  51. package/dist/wkc-ui/component/lucky/BlindBox/type.d.ts +66 -0
  52. package/dist/wkc-ui/component/lucky/FlipCard/index.vue.d.ts +6 -0
  53. package/dist/wkc-ui/component/lucky/FlipCard/type.d.ts +47 -0
  54. package/dist/wkc-ui/component/lucky/LuckyBag/index.vue.d.ts +3 -0
  55. package/dist/wkc-ui/component/lucky/LuckyBag/type.d.ts +153 -0
  56. package/dist/wkc-ui/component/lucky/NineGrid/index.d.ts +6 -0
  57. package/dist/wkc-ui/component/lucky/NineGrid/index.vue.d.ts +6 -0
  58. package/dist/wkc-ui/component/lucky/NineGrid/type.d.ts +54 -0
  59. package/dist/wkc-ui/component/lucky/PasswordLottery/index.vue.d.ts +3 -0
  60. package/dist/wkc-ui/component/lucky/PasswordLottery/type.d.ts +47 -0
  61. package/dist/wkc-ui/component/lucky/PlateLottery/index.d.ts +6 -0
  62. package/dist/wkc-ui/component/lucky/PlateLottery/index.vue.d.ts +6 -0
  63. package/dist/wkc-ui/component/lucky/PlateLottery/type.d.ts +66 -0
  64. package/dist/wkc-ui/component/lucky/PrizeDisplay/index.vue.d.ts +3 -0
  65. package/dist/wkc-ui/component/lucky/PrizeDisplay/type.d.ts +50 -0
  66. package/dist/wkc-ui/component/lucky/RedPacketRain/index.vue.d.ts +3 -0
  67. package/dist/wkc-ui/component/lucky/RedPacketRain/type.d.ts +28 -0
  68. package/dist/wkc-ui/component/lucky/ScratchCard/index.d.ts +6 -0
  69. package/dist/wkc-ui/component/lucky/ScratchCard/index.vue.d.ts +8 -0
  70. package/dist/wkc-ui/component/lucky/ScratchCard/type.d.ts +47 -0
  71. package/dist/wkc-ui/component/lucky/script/index.vue.d.ts +46 -0
  72. package/dist/wkc-ui/component/lucky/script/type.d.ts +37 -0
  73. package/dist/wkc-ui/component/point/script/type.d.ts +20 -0
  74. package/dist/wkc-ui/component/pop/PopNotice/index.vue.d.ts +2 -0
  75. package/dist/wkc-ui/component/pop/PopOverlay/index.vue.d.ts +9 -0
  76. package/dist/wkc-ui/component/pop/PopOverlay/type.d.ts +11 -0
  77. package/dist/wkc-ui/component/prize/MyPrizeList/index.vue.d.ts +3 -0
  78. package/dist/wkc-ui/component/prize/MyPrizeList/type.d.ts +115 -0
  79. package/dist/wkc-ui/component/prize/WinRecordBarrage/index.vue.d.ts +6 -0
  80. package/dist/wkc-ui/component/prize/WinRecordBarrage/type.d.ts +41 -0
  81. package/dist/wkc-ui/component/prize/WinRecordList/index.vue.d.ts +8 -0
  82. package/dist/wkc-ui/component/prize/WinRecordList/type.d.ts +54 -0
  83. package/dist/wkc-ui/component/register.d.ts +8 -0
  84. package/dist/wkc-ui/component/scan/ScanTobaInput/index.vue.d.ts +18 -0
  85. package/dist/wkc-ui/component/scan/ScanTobaInput/type.d.ts +187 -0
  86. package/dist/wkc-ui/component/scan/ScanTobaResult/index.vue.d.ts +10 -0
  87. package/dist/wkc-ui/component/scan/ScanTobaResult/type.d.ts +148 -0
  88. package/dist/wkc-ui/component/scan/ScanTobaResultV2/index.vue.d.ts +10 -0
  89. package/dist/wkc-ui/component/scan/ScanTobaResultV2/type.d.ts +154 -0
  90. package/dist/wkc-ui/component/shared/PopupWrapper/index.vue.d.ts +36 -0
  91. package/dist/wkc-ui/component/test/CaptchaInput/index.vue.d.ts +38 -0
  92. package/dist/wkc-ui/constants.d.ts +63 -0
  93. package/dist/wkc-ui/index.d.ts +3 -0
  94. package/dist/wkc-ui/types/act.d.ts +506 -0
  95. package/dist/wkc-ui/types/component.d.ts +30 -0
  96. package/dist/wkc-ui/utils/busiHelper.d.ts +24 -0
  97. package/dist/wkc-ui/utils/index.d.ts +12 -0
  98. package/dist/wkc-ui/utils/libraryManager.d.ts +154 -0
  99. package/dist/wkc-ui/utils/request.d.ts +29 -0
  100. package/dist/wkc-ui/utils/sessionHelper.d.ts +23 -0
  101. package/dist/wkc-ui/utils/styleHelper.d.ts +44 -0
  102. package/dist/wkc-ui/vite.config.d.ts +2 -0
  103. package/package.json +1 -1
@@ -0,0 +1,154 @@
1
+ import { App } from 'vue';
2
+ import { ComponentListItem } from '../types/component';
3
+ /**
4
+ * 初始化配置选项
5
+ */
6
+ export interface InitOptions {
7
+ isEditing?: boolean;
8
+ isWrapper?: boolean;
9
+ isPreview?: boolean;
10
+ baseUrl?: string;
11
+ apiToken?: string;
12
+ }
13
+ /**
14
+ * 初始化组件库环境
15
+ * @param options 初始化配置选项
16
+ * @description
17
+ * 该函数用于设置组件库运行所需的环境标识,包括:
18
+ * - 编辑器环境标识(isEditing)
19
+ * - 组件包裹标识(isWrapper)
20
+ *
21
+ * 使用场景:
22
+ * 1. 编辑器环境:在 MobileRender 组件挂载时调用
23
+ * 2. 第三方使用:在应用入口处调用,根据实际场景传入配置
24
+ *
25
+ * @example
26
+ * initComponentLibrary({ isEditing: true, isWrapper: true })
27
+ */
28
+ export declare function initComponentLibrary(options?: InitOptions): void;
29
+ /**
30
+ * 设置外部必需的 Session 数据
31
+ * @param params 外部 Session 数据配置
32
+ * @description
33
+ * 该函数用于设置组件库运行所需的外部数据,这些数据通常由宿主应用提供。
34
+ * 包括页面路由参数、位置信息、用户信息、零售户信息等。
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * import { LibraryHelper } from 'yswk-ui'
39
+ *
40
+ * LibraryHelper.setRequiredSessionKey({
41
+ * routeQuery: '',
42
+ * locationInfo: 'loactionInfo',
43
+ * })
44
+ * ```
45
+ */
46
+ export interface RequiredSessionParams {
47
+ /** 页面路由查询参数 */
48
+ routeQuery?: string;
49
+ /** 地理位置信息 */
50
+ locationInfo?: string;
51
+ }
52
+ export declare function setRequiredSessionKey(params: RequiredSessionParams): void;
53
+ /**
54
+ * 清除组件库环境标识
55
+ * @description
56
+ * 用于清理组件库设置的所有环境标识,通常在组件卸载或应用退出时调用
57
+ *
58
+ * @example
59
+ * // 在组件卸载时清理
60
+ * onUnmounted(() => {
61
+ * clearComponentLibrary()
62
+ * })
63
+ */
64
+ export declare function clearComponentLibrary(): void;
65
+ /**
66
+ * 全局注册所有组件
67
+ * @param app Vue应用实例
68
+ * @description
69
+ * 使用 config 中的 id 作为组件名进行全局注册
70
+ * 注册后可以使用 <component :is="componentId"> 动态渲染
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * import { createApp } from 'vue'
75
+ * import { registerComponents } from 'yswk-ui'
76
+ * import App from './App.vue'
77
+ *
78
+ * const app = createApp(App)
79
+ * registerComponents(app)
80
+ * app.mount('#app')
81
+ * ```
82
+ *
83
+ * @example
84
+ * ```vue
85
+ * <template>
86
+ * <!-- 使用 config 中的 id 动态渲染 -->
87
+ * <component :is="'BtnLink'" />
88
+ * </template>
89
+ * ```
90
+ */
91
+ export declare function registerComponents(app: App): void;
92
+ /**
93
+ * 获取组件配置
94
+ * @param componentId 组件ID(如 'BtnLink', 'RotatePlate')
95
+ * @returns 组件配置对象
96
+ *
97
+ * @example
98
+ * ```typescript
99
+ * import { getComponentConfig } from 'yswk-ui'
100
+ *
101
+ * const config = getComponentConfig('BtnLink')
102
+ * console.log(config.styleSchema)
103
+ * ```
104
+ */
105
+ export declare function getComponentConfig(componentId: string): any;
106
+ /**
107
+ * 获取组件实例
108
+ * @param componentId 组件ID(如 'BtnLink', 'RotatePlate')
109
+ * @returns 组件实例
110
+ *
111
+ * @example
112
+ * ```typescript
113
+ * import { getComponent } from 'yswk-ui'
114
+ *
115
+ * const BtnLinkComponent = getComponent('BtnLink')
116
+ * ```
117
+ */
118
+ export declare function getComponent(componentId: string): any;
119
+ /**
120
+ * 获取当前组件列表
121
+ */
122
+ export declare function getComponentList(): ComponentListItem[];
123
+ /**
124
+ * 获取按分组组织的组件列表
125
+ * @returns 按分组组织的组件列表,每个分组包含 label、value 和 children
126
+ *
127
+ * @example
128
+ * ```typescript
129
+ * const groupedList = getComponentListByGroup()
130
+ * // 返回格式:
131
+ * // [
132
+ * // {
133
+ * // label: '基础组件',
134
+ * // value: 'base',
135
+ * // children: [
136
+ * // { id: 'btn-link', name: '链接按钮', ... },
137
+ * // { id: 'btn-rule', name: '规则按钮', ... }
138
+ * // ]
139
+ * // },
140
+ * // {
141
+ * // label: '抽奖组件',
142
+ * // value: 'lucky',
143
+ * // children: [
144
+ * // { id: 'rotate-plate', name: '转盘抽奖', ... }
145
+ * // ]
146
+ * // }
147
+ * // ]
148
+ * ```
149
+ */
150
+ export declare function getComponentListByGroup(): {
151
+ label: string;
152
+ value: string;
153
+ children: ComponentListItem[];
154
+ }[];
@@ -0,0 +1,29 @@
1
+ import { IApiConfig } from '../types/component';
2
+ /**
3
+ * 延迟函数,用于模拟请求等待时间
4
+ * @param ms - 延迟的毫秒数
5
+ * @returns Promise<void>
6
+ */
7
+ export declare const delay: (ms: number) => Promise<void>;
8
+ declare const service: import('axios').AxiosInstance;
9
+ /**
10
+ * 通用接口使用封装
11
+ * @param obj - 请求配置对象
12
+ * @param obj.key - 接口标识符,用于在 previewConfig 中查找对应的接口配置
13
+ * @param obj.previewConfig - 接口配置数组,包含多个接口的配置信息(如 URL、请求方法等)
14
+ * @param obj.preUrl - 预设的服务地址前缀,当 sessionStorage 中没有配置时使用
15
+ * @param obj.data - 可选的请求体数据,用于 POST/PUT 等请求
16
+ * @param obj.params - 可选的 URL 查询参数,用于 GET 请求
17
+ * @param obj.headers - 可选的自定义请求头,会覆盖默认的请求头
18
+ * @returns Promise<any> - 返回接口请求的 Promise 对象
19
+ */
20
+ export declare const getRequestByKey: (obj: {
21
+ key: string;
22
+ previewConfig: Record<string, IApiConfig>;
23
+ preUrl?: string;
24
+ data?: any;
25
+ params?: any;
26
+ headers?: Record<string, string>;
27
+ resetParams?: any;
28
+ }) => Promise<any>;
29
+ export default service;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * 组件辅助工具函数 从session中取值
3
+ * 独立的工具函数,避免循环依赖
4
+ */
5
+ /**
6
+ * 组件外层是否有一层包裹组件 仅项目内使用
7
+ */
8
+ export declare function isWrappedByEditor(): boolean;
9
+ /**
10
+ * 组件是否处于编辑状态 仅项目内使用
11
+ */
12
+ export declare function getIsEditing(): boolean;
13
+ export declare function getComBaseApiUrl(): string;
14
+ export declare function getComIsPreview(): number;
15
+ export declare function getRouteCacheParams(): any;
16
+ export declare function getScanRouteParams(): {
17
+ qrCode: string;
18
+ tobaCode: string;
19
+ };
20
+ export declare function getLocationInfo(): {
21
+ lat: number;
22
+ lng: number;
23
+ };
@@ -0,0 +1,44 @@
1
+ /**
2
+ * px 转 vw 工具函数 不需被导出,仅组件库非编辑环境使用
3
+ * @param px - px 值
4
+ * @param viewportWidth - 设计稿宽度,默认 375
5
+ * @returns vw 值 小于5将不转换
6
+ */
7
+ export declare const px2vw: (px: number, viewportWidth?: number) => string;
8
+ /**
9
+ * 转换 style 对象中的 px 值为 vw
10
+ * @param styleObj - 样式对象
11
+ * @param viewportWidth - 设计稿宽度,默认 375
12
+ * @returns 转换后的样式对象
13
+ *
14
+ * @example
15
+ * const style = { width: '100px', height: '200px', margin: '10px 20px' }
16
+ * const vwStyle = convertPxToVw(style)
17
+ * // { width: '26.66667vw', height: '53.33333vw', margin: '2.66667vw 5.33333vw' }
18
+ */
19
+ export declare const convertPxToVw: (styleObj: Record<string, any>, viewportWidth?: number) => Record<string, any>;
20
+ export declare const getBgImg: (bgUrl?: string) => string;
21
+ export declare const getBorderRadius: (radius?: string | number) => string;
22
+ export declare const setHCenterByMargin: (styleObj: any, marginLeft: number, isCenter: boolean) => void;
23
+ /**
24
+ * 应用旋转和缩放变换
25
+ * @param transform - transform 配置对象
26
+ * @param centerHorizontal - 是否水平居中
27
+ * @param isEdit - 是否编辑模式
28
+ * @returns transform 字符串
29
+ */
30
+ export declare const applyTransform: (obj: {
31
+ transform?: {
32
+ rotate?: {
33
+ angle: number;
34
+ };
35
+ scale?: {
36
+ value: number;
37
+ };
38
+ };
39
+ centerHorizontal?: boolean;
40
+ isEdit: boolean;
41
+ }) => {
42
+ transformStr: string;
43
+ animationStr: string;
44
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vite').UserConfig;
2
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yswk-ui",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "H5活动组件库 - 核心组件",
5
5
  "type": "module",
6
6
  "main": "./dist/index.es.js",