qy-better-lib 0.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.
- package/.vscode/extensions.json +3 -0
- package/LICENSE +24 -0
- package/README.md +2 -0
- package/index.html +13 -0
- package/package.json +37 -0
- package/packages/core/DOCUMENTATION.md +2681 -0
- package/packages/core/LICENSE +24 -0
- package/packages/core/package.json +67 -0
- package/packages/core/types/index.d.ts +39 -0
- package/packages/core/types/json.d.ts +4 -0
- package/packages/core/types/vue.shim.d.ts +5 -0
- package/packages/core/vitest.config.ts +15 -0
- package/packages/core/yarn.lock +1233 -0
- package/packages/hooks/DOCUMENTATION.md +634 -0
- package/packages/hooks/LICENSE +24 -0
- package/packages/hooks/__tests__/use-chart/index.test.ts +287 -0
- package/packages/hooks/__tests__/use-emit/index.test.ts +248 -0
- package/packages/hooks/__tests__/use-fullscreen/index.test.ts +162 -0
- package/packages/hooks/__tests__/use-image/index.test.ts +230 -0
- package/packages/hooks/__tests__/use-layout-flow/index.test.ts +382 -0
- package/packages/hooks/__tests__/use-mqtt/index.test.ts +392 -0
- package/packages/hooks/__tests__/use-print/index.test.ts +378 -0
- package/packages/hooks/__tests__/use-watermark/index.test.ts +277 -0
- package/packages/hooks/__tests__/use-websocket/index.test.ts +402 -0
- package/packages/hooks/package.json +104 -0
- package/packages/hooks/types/index.d.ts +1 -0
- package/packages/hooks/types/json.d.ts +4 -0
- package/packages/hooks/types/vue.shim.d.ts +5 -0
- package/packages/hooks/yarn.lock +1832 -0
- package/packages/lowcode/core/package.json +60 -0
- package/packages/lowcode/core/types/index.d.ts +1 -0
- package/packages/lowcode/core/types/json.d.ts +4 -0
- package/packages/lowcode/core/types/vue.shim.d.ts +5 -0
- package/packages/lowcode/core/vite.dist.min.config.js +40 -0
- package/packages/lowcode/core/vite.dist.min.config.js.map +1 -0
- package/packages/lowcode/core/vite.lib.config.js +74 -0
- package/packages/lowcode/core/vite.lib.config.js.map +1 -0
- package/packages/lowcode/core/yarn.lock +1132 -0
- package/packages/lowcode/mobile/package.json +63 -0
- package/packages/lowcode/mobile/types/index.d.ts +1 -0
- package/packages/lowcode/mobile/types/json.d.ts +4 -0
- package/packages/lowcode/mobile/types/vue.shim.d.ts +77 -0
- package/packages/lowcode/mobile/vite.config.js +11 -0
- package/packages/lowcode/mobile/vite.config.js.map +1 -0
- package/packages/lowcode/mobile/vite.dist.min.config.js +71 -0
- package/packages/lowcode/mobile/vite.dist.min.config.js.map +1 -0
- package/packages/lowcode/mobile/vite.lib.config.js +137 -0
- package/packages/lowcode/mobile/vite.lib.config.js.map +1 -0
- package/packages/lowcode/mobile/yarn.lock +3888 -0
- package/packages/lowcode/pc/package.json +64 -0
- package/packages/lowcode/pc/vite.config.js +11 -0
- package/packages/lowcode/pc/vite.config.js.map +1 -0
- package/packages/lowcode/pc/vite.dist.min.config.js +71 -0
- package/packages/lowcode/pc/vite.dist.min.config.js.map +1 -0
- package/packages/lowcode/pc/vite.lib.config.js +137 -0
- package/packages/lowcode/pc/vite.lib.config.js.map +1 -0
- package/packages/lowcode/pc/yarn.lock +4026 -0
- package/packages/pc_components/DOCUMENTATION.md +566 -0
- package/packages/pc_components/LICENSE +24 -0
- package/packages/pc_components/lib/commDialog/index.d.ts +3 -0
- package/packages/pc_components/lib/commDialog/index.js +8 -0
- package/packages/pc_components/lib/commDialog/src/index.vue.d.ts +102 -0
- package/packages/pc_components/lib/commDialog/src/index.vue.js +43 -0
- package/packages/pc_components/lib/commDialog/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/commDialog/src/props.d.ts +49 -0
- package/packages/pc_components/lib/commDialog/src/props.js +48 -0
- package/packages/pc_components/lib/commDialog/src/type.d.ts +39 -0
- package/packages/pc_components/lib/commForm/index.d.ts +3 -0
- package/packages/pc_components/lib/commForm/index.js +8 -0
- package/packages/pc_components/lib/commForm/src/index.vue.d.ts +95 -0
- package/packages/pc_components/lib/commForm/src/index.vue.js +50 -0
- package/packages/pc_components/lib/commForm/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/commForm/src/props.d.ts +49 -0
- package/packages/pc_components/lib/commForm/src/props.js +47 -0
- package/packages/pc_components/lib/commForm/src/type.d.ts +8 -0
- package/packages/pc_components/lib/contextMenu/index.d.ts +5 -0
- package/packages/pc_components/lib/contextMenu/index.js +8 -0
- package/packages/pc_components/lib/contextMenu/src/index.vue.d.ts +91 -0
- package/packages/pc_components/lib/contextMenu/src/index.vue.js +153 -0
- package/packages/pc_components/lib/contextMenu/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/contextMenu/src/props.d.ts +32 -0
- package/packages/pc_components/lib/contextMenu/src/props.js +27 -0
- package/packages/pc_components/lib/contextMenu/src/type.d.ts +11 -0
- package/packages/pc_components/lib/describeView/index.d.ts +2 -0
- package/packages/pc_components/lib/describeView/index.js +7 -0
- package/packages/pc_components/lib/describeView/src/index.vue.d.ts +61 -0
- package/packages/pc_components/lib/describeView/src/index.vue.js +84 -0
- package/packages/pc_components/lib/describeView/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/describeView/src/props.d.ts +35 -0
- package/packages/pc_components/lib/describeView/src/props.js +33 -0
- package/packages/pc_components/lib/describeView/src/type.d.ts +10 -0
- package/packages/pc_components/lib/index.d.ts +18 -0
- package/packages/pc_components/lib/index.js +40 -0
- package/packages/pc_components/lib/simpleVirtualList/index.d.ts +2 -0
- package/packages/pc_components/lib/simpleVirtualList/index.js +7 -0
- package/packages/pc_components/lib/simpleVirtualList/src/index.vue.d.ts +28 -0
- package/packages/pc_components/lib/simpleVirtualList/src/index.vue.js +101 -0
- package/packages/pc_components/lib/simpleVirtualList/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/simpleVirtualList/src/type.d.ts +12 -0
- package/packages/pc_components/lib/styles/comm-form.scss +4 -0
- package/packages/pc_components/lib/styles/context-menu.scss +47 -0
- package/packages/pc_components/lib/styles/describe-view.scss +25 -0
- package/packages/pc_components/lib/styles/index.scss +6 -0
- package/packages/pc_components/lib/styles/simple-virtual-list.scss +25 -0
- package/packages/pc_components/lib/styles/table-extend.scss +100 -0
- package/packages/pc_components/lib/styles/text-button.scss +71 -0
- package/packages/pc_components/lib/tableExtend/index.d.ts +3 -0
- package/packages/pc_components/lib/tableExtend/index.js +7 -0
- package/packages/pc_components/lib/tableExtend/props.d.ts +130 -0
- package/packages/pc_components/lib/tableExtend/props.js +128 -0
- package/packages/pc_components/lib/tableExtend/src/colVisible.vue.d.ts +3 -0
- package/packages/pc_components/lib/tableExtend/src/colVisible.vue.js +128 -0
- package/packages/pc_components/lib/tableExtend/src/colVisible.vue2.js +4 -0
- package/packages/pc_components/lib/tableExtend/src/index.vue.d.ts +186 -0
- package/packages/pc_components/lib/tableExtend/src/index.vue.js +234 -0
- package/packages/pc_components/lib/tableExtend/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/tableExtend/src/valueCol.vue.d.ts +24 -0
- package/packages/pc_components/lib/tableExtend/src/valueCol.vue.js +29 -0
- package/packages/pc_components/lib/tableExtend/src/valueCol.vue2.js +4 -0
- package/packages/pc_components/lib/tableExtend/type.d.ts +165 -0
- package/packages/pc_components/lib/tableExtend/type.js +9 -0
- package/packages/pc_components/lib/tableExtend/useTable.d.ts +27 -0
- package/packages/pc_components/lib/tableExtend/useTable.js +115 -0
- package/packages/pc_components/lib/textButton/index.d.ts +2 -0
- package/packages/pc_components/lib/textButton/index.js +7 -0
- package/packages/pc_components/lib/textButton/src/index.vue.d.ts +42 -0
- package/packages/pc_components/lib/textButton/src/index.vue.js +44 -0
- package/packages/pc_components/lib/textButton/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/textButton/src/props.d.ts +23 -0
- package/packages/pc_components/lib/textButton/src/props.js +30 -0
- package/packages/pc_components/lib/textButton/src/type.d.ts +30 -0
- package/packages/pc_components/lib/utils/index.d.ts +77 -0
- package/packages/pc_components/lib/utils/index.js +124 -0
- package/packages/pc_components/package.json +73 -0
- package/packages/pc_components/types/index.d.ts +9 -0
- package/packages/pc_components/types/json.d.ts +4 -0
- package/packages/pc_components/types/vue.shim.d.ts +5 -0
- package/packages/pc_components/yarn.lock +1641 -0
- package/postcss.config.js +19 -0
- package/public/vite.svg +1 -0
- package/src/App.vue +37 -0
- package/src/api/index.ts +42 -0
- package/src/assets/vue.svg +1 -0
- package/src/document/core.md +2680 -0
- package/src/document/hooks.md +632 -0
- package/src/document/pc_components.md +566 -0
- package/src/locales/en.json +1 -0
- package/src/locales/zh-cn.json +1 -0
- package/src/main.ts +13 -0
- package/src/plugins/element-plus.ts +16 -0
- package/src/plugins/i18n.ts +17 -0
- package/src/plugins/index.ts +13 -0
- package/src/plugins/store.ts +12 -0
- package/src/router/index.ts +20 -0
- package/src/shared/chartType.ts +279 -0
- package/src/shared/const.ts +160 -0
- package/src/shared/lib.ts +129 -0
- package/src/shared/request.ts +255 -0
- package/src/shared/type.ts +48 -0
- package/src/shared/utils/date.ts +83 -0
- package/src/shared/utils/utils.ts +85 -0
- package/src/store/index.ts +22 -0
- package/src/store/modules/app.ts +17 -0
- package/src/store/modules/shared.ts +21 -0
- package/src/styles/index.scss +169 -0
- package/src/types/app.d.ts +23 -0
- package/src/types/echarts.d.ts +5 -0
- package/src/types/index.d.ts +1 -0
- package/src/types/json.d.ts +4 -0
- package/src/types/scss.d.ts +9 -0
- package/src/types/vue.shim.d.ts +5 -0
- package/src/views/docs/docs-content.vue +379 -0
- package/src/views/docs/docs-header.vue +130 -0
- package/src/views/docs/docs-sidebar.vue +76 -0
- package/src/views/docs/hooks.ts +600 -0
- package/src/views/docs/index.vue +30 -0
- package/src/views/docs/styles/docs-content.scss +106 -0
- package/src/views/docs/styles/docs-header.scss +20 -0
- package/src/views/docs/styles/docs-sidebar.scss +182 -0
- package/src/views/docs/styles/index.scss +14 -0
- package/src/views/docs/type.ts +101 -0
- package/src/views/index.vue +34 -0
- package/tsconfig.json +37 -0
- package/tsconfig.node.json +8 -0
- package/vite.config.ts +54 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 图表结构
|
|
3
|
+
*/
|
|
4
|
+
export type TypeDesignChart = {
|
|
5
|
+
/**组件类型 */
|
|
6
|
+
type: string;
|
|
7
|
+
/**是否坐标系图表 */
|
|
8
|
+
isAxis?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* 图表ID
|
|
11
|
+
*/
|
|
12
|
+
chartId?: string | number;
|
|
13
|
+
/**
|
|
14
|
+
* 自定义配置
|
|
15
|
+
*/
|
|
16
|
+
__config__: ChartConfig;
|
|
17
|
+
/**
|
|
18
|
+
* 标题
|
|
19
|
+
*/
|
|
20
|
+
title?: string;
|
|
21
|
+
/**
|
|
22
|
+
* 提示框
|
|
23
|
+
*/
|
|
24
|
+
tooltip?: ToolTip;
|
|
25
|
+
/**
|
|
26
|
+
* 图例
|
|
27
|
+
*/
|
|
28
|
+
legend?: Legend;
|
|
29
|
+
/**
|
|
30
|
+
* X轴配置
|
|
31
|
+
*/
|
|
32
|
+
xAxis?: Aris;
|
|
33
|
+
/**
|
|
34
|
+
* y轴配置
|
|
35
|
+
*/
|
|
36
|
+
yAxis?: Aris;
|
|
37
|
+
/**
|
|
38
|
+
* 数据
|
|
39
|
+
*/
|
|
40
|
+
series: Serie[];
|
|
41
|
+
|
|
42
|
+
radar?: object;
|
|
43
|
+
/**
|
|
44
|
+
* 网格大小
|
|
45
|
+
*/
|
|
46
|
+
grid?: Grid;
|
|
47
|
+
|
|
48
|
+
//批量选中
|
|
49
|
+
batchDelete?: boolean;
|
|
50
|
+
// 是否分页
|
|
51
|
+
paging?: boolean;
|
|
52
|
+
// 数据源(多图表同源)
|
|
53
|
+
tableData?: any;
|
|
54
|
+
// 列配置
|
|
55
|
+
tableColums?: any;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export type ChartConfig = {
|
|
59
|
+
/**
|
|
60
|
+
* 图表名称
|
|
61
|
+
*/
|
|
62
|
+
label: string;
|
|
63
|
+
/**
|
|
64
|
+
* 默认图表类型
|
|
65
|
+
*/
|
|
66
|
+
type: string;
|
|
67
|
+
/**
|
|
68
|
+
* 图标名称
|
|
69
|
+
*/
|
|
70
|
+
icon: string;
|
|
71
|
+
/**
|
|
72
|
+
* 数据类型
|
|
73
|
+
*/
|
|
74
|
+
dataType: DataSourceType[];
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* X轴数据类型
|
|
78
|
+
*/
|
|
79
|
+
xAxisDataType?: string;
|
|
80
|
+
/**
|
|
81
|
+
* X轴数据绑定字段
|
|
82
|
+
*/
|
|
83
|
+
xAxisDataAttr?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Y轴数据类型
|
|
86
|
+
*/
|
|
87
|
+
yAxisDataType?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Y轴数据绑定字段
|
|
90
|
+
*/
|
|
91
|
+
yAxisDataAttr?: string;
|
|
92
|
+
/**
|
|
93
|
+
* 数据源绑定字段
|
|
94
|
+
*/
|
|
95
|
+
dataSourceAttr: string[];
|
|
96
|
+
/**
|
|
97
|
+
* 深色模式,rgba(16,12,42,1)
|
|
98
|
+
*/
|
|
99
|
+
isDark: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* 跨行
|
|
102
|
+
*/
|
|
103
|
+
colSpan?: number;
|
|
104
|
+
/**
|
|
105
|
+
* 跨列
|
|
106
|
+
*/
|
|
107
|
+
rowSpan?: number;
|
|
108
|
+
/**是否具有详情跳转 */
|
|
109
|
+
isDetail: false;
|
|
110
|
+
/**
|
|
111
|
+
* 数据源配置
|
|
112
|
+
*/
|
|
113
|
+
dataSource?: any;
|
|
114
|
+
dataOrg: string[];
|
|
115
|
+
tableName?: string;
|
|
116
|
+
fkey?: string;
|
|
117
|
+
fTableName?: string;
|
|
118
|
+
fTableId?: string;
|
|
119
|
+
fKeyValue?: string;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export type ToolTip = {
|
|
123
|
+
/**
|
|
124
|
+
* 是否显示
|
|
125
|
+
*/
|
|
126
|
+
show?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* 触发类型
|
|
129
|
+
*/
|
|
130
|
+
trigger?: string;
|
|
131
|
+
/**
|
|
132
|
+
* 触发条件
|
|
133
|
+
*/
|
|
134
|
+
triggerOn?: string;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export type Aris = {
|
|
138
|
+
axisLine?: any;
|
|
139
|
+
axisLabel?: any;
|
|
140
|
+
/**
|
|
141
|
+
* 是否显示
|
|
142
|
+
*/
|
|
143
|
+
show?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* 坐标轴类型
|
|
146
|
+
*/
|
|
147
|
+
type?: AxisType;
|
|
148
|
+
/**
|
|
149
|
+
* 坐标轴名字旋转角度
|
|
150
|
+
*/
|
|
151
|
+
nameRotate?: number;
|
|
152
|
+
/**
|
|
153
|
+
* 坐标轴刻度最小值
|
|
154
|
+
*/
|
|
155
|
+
min?: number;
|
|
156
|
+
/**
|
|
157
|
+
* 坐标轴刻度最大值
|
|
158
|
+
*/
|
|
159
|
+
max?: number;
|
|
160
|
+
|
|
161
|
+
data?: any[];
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export type Serie = {
|
|
165
|
+
id?: string;
|
|
166
|
+
name?: string;
|
|
167
|
+
type: string;
|
|
168
|
+
radius?: number;
|
|
169
|
+
stack?: string;
|
|
170
|
+
cursor?: string;
|
|
171
|
+
data: Data[];
|
|
172
|
+
annular?: boolean;
|
|
173
|
+
/**显示占比(饼状图) */
|
|
174
|
+
ratio?: boolean;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export type Data = string | number | boolean | any;
|
|
178
|
+
|
|
179
|
+
export type Grid = {
|
|
180
|
+
top?: number;
|
|
181
|
+
left?: number;
|
|
182
|
+
right?: number;
|
|
183
|
+
bottom?: number;
|
|
184
|
+
containLabel: boolean;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
export type ChartPanel = {
|
|
188
|
+
/**
|
|
189
|
+
* 行数
|
|
190
|
+
*/
|
|
191
|
+
rows?: number;
|
|
192
|
+
/**
|
|
193
|
+
* 列数
|
|
194
|
+
*/
|
|
195
|
+
columns?: number;
|
|
196
|
+
/**
|
|
197
|
+
* 单元格宽
|
|
198
|
+
*/
|
|
199
|
+
cellWidth?: number;
|
|
200
|
+
/**
|
|
201
|
+
* 单元格高
|
|
202
|
+
*/
|
|
203
|
+
cellHeight?: number;
|
|
204
|
+
/**
|
|
205
|
+
* 单元格间距
|
|
206
|
+
*/
|
|
207
|
+
gap?: number;
|
|
208
|
+
|
|
209
|
+
searchConfig?: SearchConfig[];
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
export type Legend = {
|
|
213
|
+
show: boolean;
|
|
214
|
+
position?: string;
|
|
215
|
+
data?: string[];
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
/**查询配置 */
|
|
219
|
+
type SearchConfig = {
|
|
220
|
+
/**KEY */
|
|
221
|
+
key: string;
|
|
222
|
+
/**字段列表名称 */
|
|
223
|
+
fieldText: string;
|
|
224
|
+
/**字段列表 应用-模块-表-字段 */
|
|
225
|
+
fieldList: Array<string | number>;
|
|
226
|
+
/**字段属性 */
|
|
227
|
+
field?: string;
|
|
228
|
+
/**字段描述 */
|
|
229
|
+
fieldDes?: string;
|
|
230
|
+
/**搜索组件类型 */
|
|
231
|
+
fieldType?: SearchFieldType;
|
|
232
|
+
/**搜索组件查询类型 */
|
|
233
|
+
filterType?: FilterType;
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* 搜索组件类型
|
|
237
|
+
*/
|
|
238
|
+
enum SearchFieldType {
|
|
239
|
+
/**文本框 */
|
|
240
|
+
TEXT = 1,
|
|
241
|
+
/**下拉框 */
|
|
242
|
+
SELECT = 2,
|
|
243
|
+
/**日期 */
|
|
244
|
+
DATE = 3,
|
|
245
|
+
/**日期时间 */
|
|
246
|
+
DATETIME = 4,
|
|
247
|
+
/**时间 */
|
|
248
|
+
TIME = 5,
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**值判断类型 */
|
|
252
|
+
enum FilterType {
|
|
253
|
+
/**等于 */
|
|
254
|
+
Equal = 1,
|
|
255
|
+
/**区间 */
|
|
256
|
+
Extent = 2,
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* 坐标轴类型
|
|
260
|
+
*/
|
|
261
|
+
export enum AxisType {
|
|
262
|
+
/**值坐标轴 */
|
|
263
|
+
VALUE = "value",
|
|
264
|
+
/**类目轴 */
|
|
265
|
+
CATEGORY = "category",
|
|
266
|
+
/**时间轴 */
|
|
267
|
+
TIME = "time",
|
|
268
|
+
/**对数轴 */
|
|
269
|
+
LOG = "log",
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* 数据源类型,SQL/API
|
|
273
|
+
*/
|
|
274
|
+
export enum DataSourceType {
|
|
275
|
+
/**SQL语句 */
|
|
276
|
+
SQL = "0",
|
|
277
|
+
/**API接口 */
|
|
278
|
+
API = "1",
|
|
279
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
export const APIEnrty = {
|
|
2
|
+
DEFAULT: import.meta.env.VITE_DEFAULT_API, // "/api"
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
declare type labelValue = {
|
|
6
|
+
/**文本字段 */
|
|
7
|
+
label: string;
|
|
8
|
+
/**
|
|
9
|
+
* 值字段
|
|
10
|
+
*/
|
|
11
|
+
value: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export enum dateTimeFormat {
|
|
15
|
+
/** 日期 */
|
|
16
|
+
date = "YYYY-MM-DD",
|
|
17
|
+
/** 周 */
|
|
18
|
+
week = "gggg第ww周",
|
|
19
|
+
/** 年月 */
|
|
20
|
+
month = "YYYY-MM",
|
|
21
|
+
/** 年 */
|
|
22
|
+
year = "YYYY",
|
|
23
|
+
/** 日期时间 */
|
|
24
|
+
datetime = "YYYY-MM-DD HH:mm:ss",
|
|
25
|
+
/** 多个日期 */
|
|
26
|
+
dates = "YYYY-MM-DD",
|
|
27
|
+
/** 时间 */
|
|
28
|
+
time = "HH:mm:ss",
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 单位类型
|
|
33
|
+
* @enum {number}
|
|
34
|
+
*/
|
|
35
|
+
export enum ResultUnit {
|
|
36
|
+
/** 天 */
|
|
37
|
+
DAY = 1,
|
|
38
|
+
/** 小时 */
|
|
39
|
+
HOUR = 2,
|
|
40
|
+
/** 分钟 */
|
|
41
|
+
MINUTE = 3,
|
|
42
|
+
/** 秒 */
|
|
43
|
+
SECOND = 4,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const justifyOptions: Array<labelValue> = [
|
|
47
|
+
{
|
|
48
|
+
label: "start",
|
|
49
|
+
value: "start",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: "end",
|
|
53
|
+
value: "end",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
label: "center",
|
|
57
|
+
value: "center",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
label: "space-around",
|
|
61
|
+
value: "space-around",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
label: "space-between",
|
|
65
|
+
value: "space-between",
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
export const dateTypeOptions: Array<labelValue> = [
|
|
70
|
+
{
|
|
71
|
+
label: "日(date)",
|
|
72
|
+
value: "date",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: "周(week)",
|
|
76
|
+
value: "week",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
label: "月(month)",
|
|
80
|
+
value: "month",
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
label: "年(year)",
|
|
84
|
+
value: "year",
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
label: "日期时间(datetime)",
|
|
88
|
+
value: "datetime",
|
|
89
|
+
},
|
|
90
|
+
// {
|
|
91
|
+
// label: '多个日期(dates)',
|
|
92
|
+
// value: 'dates',
|
|
93
|
+
// },
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
export const dateRangeTypeOptions: Array<labelValue> = [
|
|
97
|
+
{
|
|
98
|
+
label: "日期范围(daterange)",
|
|
99
|
+
value: "daterange",
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
label: "月范围(monthrange)",
|
|
103
|
+
value: "monthrange",
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
label: "日期时间范围(datetimerange)",
|
|
107
|
+
value: "datetimerange",
|
|
108
|
+
},
|
|
109
|
+
];
|
|
110
|
+
|
|
111
|
+
export const colorFormatOptions: Array<labelValue> = [
|
|
112
|
+
{
|
|
113
|
+
label: "hex",
|
|
114
|
+
value: "hex",
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
label: "rgb",
|
|
118
|
+
value: "rgb",
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
label: "rgba",
|
|
122
|
+
value: "rgba",
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
label: "hsv",
|
|
126
|
+
value: "hsv",
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
label: "hsl",
|
|
130
|
+
value: "hsl",
|
|
131
|
+
},
|
|
132
|
+
];
|
|
133
|
+
|
|
134
|
+
export const AxisType: labelValue[] = [
|
|
135
|
+
{
|
|
136
|
+
label: "数值轴",
|
|
137
|
+
value: "value",
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
label: "类目轴",
|
|
141
|
+
value: "category",
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
label: "时间轴",
|
|
145
|
+
value: "time",
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
label: "对数轴",
|
|
149
|
+
value: "log",
|
|
150
|
+
},
|
|
151
|
+
];
|
|
152
|
+
|
|
153
|
+
export const chartType: labelValue[] = [
|
|
154
|
+
{ label: "折线图", value: "line" },
|
|
155
|
+
{ label: "柱状图", value: "bar" },
|
|
156
|
+
{ label: "饼图", value: "pie" },
|
|
157
|
+
{ label: "散点图", value: "scatter" },
|
|
158
|
+
{ label: "雷达图", value: "radar" },
|
|
159
|
+
{ label: "仪表盘", value: "gauge" },
|
|
160
|
+
];
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
;
|
|
2
|
+
(function(win, lib) {
|
|
3
|
+
var doc = win.document;
|
|
4
|
+
var docEl = doc.documentElement;
|
|
5
|
+
var metaEl = doc.querySelector('meta[name="viewport"]');
|
|
6
|
+
var flexibleEl = doc.querySelector('meta[name="flexible"]');
|
|
7
|
+
var dpr = 0;
|
|
8
|
+
var scale = 0;
|
|
9
|
+
var tid;
|
|
10
|
+
var flexible = lib.flexible || (lib.flexible = {});
|
|
11
|
+
|
|
12
|
+
if (metaEl) {
|
|
13
|
+
console.warn('将根据已有的meta标签来设置缩放比例');
|
|
14
|
+
var match = metaEl.getAttribute('content').match(/initial\-scale=([\d\.]+)/);
|
|
15
|
+
if (match) {
|
|
16
|
+
scale = parseFloat(match[1]);
|
|
17
|
+
dpr = parseInt(1 / scale);
|
|
18
|
+
}
|
|
19
|
+
} else if (flexibleEl) {
|
|
20
|
+
var content = flexibleEl.getAttribute('content');
|
|
21
|
+
if (content) {
|
|
22
|
+
var initialDpr = content.match(/initial\-dpr=([\d\.]+)/);
|
|
23
|
+
var maximumDpr = content.match(/maximum\-dpr=([\d\.]+)/);
|
|
24
|
+
if (initialDpr) {
|
|
25
|
+
dpr = parseFloat(initialDpr[1]);
|
|
26
|
+
scale = parseFloat((1 / dpr).toFixed(2));
|
|
27
|
+
}
|
|
28
|
+
if (maximumDpr) {
|
|
29
|
+
dpr = parseFloat(maximumDpr[1]);
|
|
30
|
+
scale = parseFloat((1 / dpr).toFixed(2));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!dpr && !scale) {
|
|
36
|
+
var isAndroid = win.navigator.appVersion.match(/android/gi);
|
|
37
|
+
var isIPhone = win.navigator.appVersion.match(/iphone/gi);
|
|
38
|
+
var devicePixelRatio = win.devicePixelRatio;
|
|
39
|
+
if (isIPhone) {
|
|
40
|
+
// iOS下,对于2和3的屏,用2倍的方案,其余的用1倍方案
|
|
41
|
+
if (devicePixelRatio >= 3 && (!dpr || dpr >= 3)) {
|
|
42
|
+
dpr = 3;
|
|
43
|
+
} else if (devicePixelRatio >= 2 && (!dpr || dpr >= 2)) {
|
|
44
|
+
dpr = 2;
|
|
45
|
+
} else {
|
|
46
|
+
dpr = 1;
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
// 其他设备下,仍旧使用1倍的方案
|
|
50
|
+
dpr = 1;
|
|
51
|
+
}
|
|
52
|
+
scale = 1 / dpr;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
docEl.setAttribute('data-dpr', dpr);
|
|
56
|
+
if (!metaEl) {
|
|
57
|
+
metaEl = doc.createElement('meta');
|
|
58
|
+
metaEl.setAttribute('name', 'viewport');
|
|
59
|
+
metaEl.setAttribute('content', 'initial-scale=' + scale + ', maximum-scale=' + scale + ', minimum-scale=' + scale + ', user-scalable=no');
|
|
60
|
+
if (docEl.firstElementChild) {
|
|
61
|
+
docEl.firstElementChild.appendChild(metaEl);
|
|
62
|
+
} else {
|
|
63
|
+
var wrap = doc.createElement('div');
|
|
64
|
+
wrap.appendChild(metaEl);
|
|
65
|
+
doc.write(wrap.innerHTML);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// function refreshRem(){
|
|
70
|
+
// var width = docEl.getBoundingClientRect().width;
|
|
71
|
+
// if (width / dpr > 540) {
|
|
72
|
+
// width = 540 * dpr;
|
|
73
|
+
// }
|
|
74
|
+
// var rem = width / 10;
|
|
75
|
+
// docEl.style.fontSize = rem + 'px';
|
|
76
|
+
// flexible.rem = win.rem = rem;
|
|
77
|
+
// }
|
|
78
|
+
function refreshRem() {
|
|
79
|
+
var width = docEl.getBoundingClientRect().width;
|
|
80
|
+
if (width / dpr < 540) {
|
|
81
|
+
width = 540 * dpr;
|
|
82
|
+
} else if (width / dpr > 1980) {
|
|
83
|
+
width = 1980 * dpr
|
|
84
|
+
}
|
|
85
|
+
var rem = width / 10;
|
|
86
|
+
docEl.style.fontSize = rem + 'px';
|
|
87
|
+
flexible.rem = win.rem = rem;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
win.addEventListener('resize', function() {
|
|
91
|
+
clearTimeout(tid);
|
|
92
|
+
tid = setTimeout(refreshRem, 300);
|
|
93
|
+
}, false);
|
|
94
|
+
win.addEventListener('pageshow', function(e) {
|
|
95
|
+
if (e.persisted) {
|
|
96
|
+
clearTimeout(tid);
|
|
97
|
+
tid = setTimeout(refreshRem, 300);
|
|
98
|
+
}
|
|
99
|
+
}, false);
|
|
100
|
+
|
|
101
|
+
if (doc.readyState === 'complete') {
|
|
102
|
+
doc.body.style.fontSize = 12 * dpr + 'px';
|
|
103
|
+
} else {
|
|
104
|
+
doc.addEventListener('DOMContentLoaded', function(e) {
|
|
105
|
+
doc.body.style.fontSize = 12 * dpr + 'px';
|
|
106
|
+
}, false);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
refreshRem();
|
|
111
|
+
|
|
112
|
+
flexible.dpr = win.dpr = dpr;
|
|
113
|
+
flexible.refreshRem = refreshRem;
|
|
114
|
+
flexible.rem2px = function(d) {
|
|
115
|
+
var val = parseFloat(d) * this.rem;
|
|
116
|
+
if (typeof d === 'string' && d.match(/rem$/)) {
|
|
117
|
+
val += 'px';
|
|
118
|
+
}
|
|
119
|
+
return val;
|
|
120
|
+
}
|
|
121
|
+
flexible.px2rem = function(d) {
|
|
122
|
+
var val = parseFloat(d) / this.rem;
|
|
123
|
+
if (typeof d === 'string' && d.match(/px$/)) {
|
|
124
|
+
val += 'rem';
|
|
125
|
+
}
|
|
126
|
+
return val;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
})(window, window['lib'] || (window['lib'] = {}));
|