stellar-ui-plus 1.22.2 → 1.22.4

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.
@@ -0,0 +1,51 @@
1
+ import { unref } from 'vue';
2
+ export function initDebugTool() {
3
+ if (process.env.NODE_ENV === 'development') {
4
+ const stellarDebugRegistry = new Map<string, Record<string, any>>();
5
+ (globalThis as any).stellarDebugRegistry = stellarDebugRegistry;
6
+
7
+ const execFunName = '$vs';
8
+
9
+ const printInfo = () => {
10
+ const pages = getCurrentPages();
11
+ if (!pages.length) {
12
+ console.warn('[StellarUI Debug] 未找到当前页面。');
13
+ return;
14
+ }
15
+ const currentPage = pages[pages.length - 1];
16
+ const route = currentPage.route;
17
+ const data = stellarDebugRegistry.get(route || '');
18
+
19
+ if (!data) {
20
+ console.warn(`[StellarUI Debug] 页面 ${route} 没有注册任何调试变量。`);
21
+ return;
22
+ }
23
+
24
+ const output: Record<string, any> = {};
25
+ for (const key in data) {
26
+ if (Object.prototype.hasOwnProperty.call(data, key)) {
27
+ output[key] = unref(data[key]);
28
+ }
29
+ }
30
+
31
+ console.log(`%c[StellarUI Debug] 当前页面: ${route}`, 'color: #409EFF; font-weight: bold;');
32
+ console.table(output);
33
+ return '';
34
+ };
35
+
36
+ // #ifdef MP-WEIXIN
37
+ (wx as any)[execFunName] = printInfo;
38
+ console.log(`%c[StellarUI Debug] 调试工具已挂载。在控制台输入 ${`wx.${execFunName}()`} 查看当前页面变量。`, 'color: #409EFF; font-weight: bold;');
39
+ // #endif
40
+
41
+ // #ifdef MP-ALIPAY
42
+ (my as any)[execFunName] = printInfo;
43
+ console.log(`%c[StellarUI Debug] 调试工具已挂载。在控制台输入 ${`my.${execFunName}()`} 查看当前页面变量。`, 'color: #409EFF; font-weight: bold;');
44
+ // #endif
45
+
46
+ // #ifdef WEB || H5
47
+ (window as any)[execFunName] = printInfo;
48
+ console.log(`%c[StellarUI Debug] 调试工具已挂载。在控制台输入 ${`${execFunName}()`} 查看当前页面变量。`, 'color: #409EFF; font-weight: bold;');
49
+ // #endif
50
+ }
51
+ }
@@ -0,0 +1,26 @@
1
+ import { onLoad } from '@dcloudio/uni-app';
2
+
3
+ /**
4
+ * 手动注册需要调试的变量。
5
+ * 在需要调试的页面的 <script setup> 中调用此函数。
6
+ *
7
+ * @param data 包含需要调试的变量的对象。
8
+ */
9
+ export function useStellarDebug(data: Record<string, any>) {
10
+ onLoad(() => {
11
+ if (process.env.NODE_ENV !== 'development') {
12
+ return;
13
+ }
14
+
15
+ const pages = getCurrentPages();
16
+ if (!pages.length) return;
17
+
18
+ const currentPage = pages[pages.length - 1];
19
+ const route = currentPage.route;
20
+
21
+ if (route && (globalThis as any).stellarDebugRegistry) {
22
+ (globalThis as any).stellarDebugRegistry.set(route, data);
23
+ console.log(`%c[StellarUI Debug] 成功为页面 ${route} 手动注册调试变量。`, 'color: #67C23A;');
24
+ }
25
+ });
26
+ }
@@ -0,0 +1,66 @@
1
+ import { parse, compileScript } from '@vue/compiler-sfc';
2
+
3
+ export default function autoDebugPlugin(dirName) {
4
+ return {
5
+ name: 'vite-plugin-auto-debug',
6
+ enforce: 'pre',
7
+ transform(code, id) {
8
+ const isPage = id.endsWith('.vue') && (id.includes('/src/pages/') || id.includes('/src/subPackages') || (dirName && id.includes(dirName)));
9
+
10
+ if (!isPage) return null;
11
+
12
+ const { descriptor } = parse(code);
13
+
14
+ if (!descriptor.scriptSetup) {
15
+ return null;
16
+ }
17
+
18
+ let scriptContent = descriptor.scriptSetup.content;
19
+ let scriptLang = descriptor.scriptSetup.lang || 'js';
20
+
21
+ const { bindings } = compileScript(descriptor, { id });
22
+
23
+ if (!bindings) {
24
+ return null;
25
+ }
26
+
27
+ const debugVars = Object.keys(bindings).filter(key => ['setup-ref', 'setup-reactive-const', 'setup-computed', 'setup-shallow-ref'].includes(bindings[key]));
28
+
29
+ if (debugVars.length === 0) {
30
+ return null;
31
+ }
32
+
33
+ const injectionCall = `
34
+ import { useStellarDebug } from 'stellar-ui-plus/common/auto-debug/useStellarDebug';
35
+ useStellarDebug({ ${debugVars.join(', ')} });
36
+ `;
37
+
38
+ let newScriptContent = scriptContent + injectionCall;
39
+
40
+ let newCode = '';
41
+
42
+ if (descriptor.template) {
43
+ const attrs = Object.keys(descriptor.template.attrs)
44
+ .map(key => `${key}="${key === 'lang' ? descriptor.template.attrs[key] : descriptor.template.attrs[key]}"`)
45
+ .join(' ');
46
+ newCode += `<template ${attrs ? ` ${attrs}` : ''}>\n${descriptor.template.content}\n</template>\n`;
47
+ }
48
+
49
+ newCode += `<script setup${scriptLang ? ` lang="${scriptLang}"` : ''}>\n${newScriptContent}\n</script>\n`;
50
+
51
+ if (descriptor.styles) {
52
+ descriptor.styles.forEach(style => {
53
+ const attrs = Object.keys(style.attrs)
54
+ .map(key => `${key}="${key === 'lang' ? style.attrs[key] : style.attrs[key]}"`)
55
+ .join(' ');
56
+ newCode += `<style${attrs ? ` ${attrs}` : ''}>\n${style.content}\n</style>\n`;
57
+ });
58
+ }
59
+
60
+ return {
61
+ code: newCode,
62
+ map: null,
63
+ };
64
+ },
65
+ };
66
+ }
@@ -172,7 +172,7 @@ export function stringToCode128(text: string) {
172
172
 
173
173
  codes = codes.concat(codesForChar(b1, b2, barc.currcs))
174
174
  // code C takes 2 chars each time
175
- if (barc.currcs === CODESET.C)
175
+ if (barc.currcs === CODESET.C)
176
176
  i++
177
177
  }
178
178
 
@@ -203,7 +203,7 @@ export function stringToCode128(text: string) {
203
203
  function perhapsCodeC(bytes: number[], codeset: number) {
204
204
  for (let i = 0; i < bytes.length; i++) {
205
205
  const b = bytes[i]
206
- if ((b < 48 || b > 57) && b !== CHAR_TILDE)
206
+ if ((b < 48 || b > 57) && b !== CHAR_TILDE)
207
207
  return codeset
208
208
  }
209
209
  return CODESET.C
@@ -221,13 +221,13 @@ export function stringToCode128(text: string) {
221
221
  if (chr2 === -1) {
222
222
  shifter === SET_CODEB
223
223
  currcs = CODESET.B
224
- }
224
+ }
225
225
  else if (chr2 !== -1 && !charCompatible(chr2, currcs)) {
226
226
  // need to check ahead as well
227
227
  if (charCompatible(chr2, CODESET.A)) {
228
228
  shifter = SET_CODEA
229
229
  currcs = CODESET.A
230
- }
230
+ }
231
231
  else {
232
232
  shifter = SET_CODEB
233
233
  currcs = CODESET.B
@@ -235,7 +235,7 @@ export function stringToCode128(text: string) {
235
235
  }
236
236
  }
237
237
  /* eslint-enable no-unused-expressions */
238
- }
238
+ }
239
239
  else {
240
240
  // if there is a next char AND that next char is also not compatible
241
241
 
@@ -251,11 +251,11 @@ export function stringToCode128(text: string) {
251
251
  currcs = CODESET.A
252
252
  break
253
253
  }
254
- }
254
+ }
255
255
  else {
256
256
  // no need to shift code sets, a temporary SHIFT will suffice
257
257
  shifter = SET_SHIFT
258
- }
258
+ }
259
259
  }
260
260
 
261
261
  // ok some type of shift is nessecary
@@ -263,12 +263,12 @@ export function stringToCode128(text: string) {
263
263
  result.push(shifter)
264
264
  // result.push(codeValue(chr2));-----------------------------------
265
265
  result.push(codeValue(chr1))
266
- }
266
+ }
267
267
  else {
268
268
  if (currcs === CODESET.C) {
269
269
  // include next as well
270
270
  result.push(codeValue(chr1, chr2))
271
- }
271
+ }
272
272
  else {
273
273
  result.push(codeValue(chr1))
274
274
  }
@@ -284,19 +284,19 @@ function codeValue(chr1: number, chr2: any = undefined) {
284
284
  if (typeof chr2 === 'undefined')
285
285
  return chr1 >= 32 ? chr1 - 32 : chr1 + 64
286
286
  else
287
- return Number.parseInt(String.fromCharCode(chr1) + String.fromCharCode(chr2))
287
+ return Number.parseInt(String.fromCharCode(chr1) + String.fromCharCode(chr2))
288
288
  }
289
289
 
290
290
  function charCompatible(chr: number, codeset: number) {
291
291
  const csa = codeSetAllowedFor(chr)
292
- if (csa === CODESET.ANY)
292
+ if (csa === CODESET.ANY)
293
293
  return true
294
294
  // if we need to change from current
295
- if (csa === CODESET.AB)
295
+ if (csa === CODESET.AB)
296
296
  return true
297
- if (csa === CODESET.A && codeset === CODESET.A)
297
+ if (csa === CODESET.A && codeset === CODESET.A)
298
298
  return true
299
- if (csa === CODESET.B && codeset === CODESET.B)
299
+ if (csa === CODESET.B && codeset === CODESET.B)
300
300
  return true
301
301
  return false
302
302
  }
@@ -305,11 +305,11 @@ function codeSetAllowedFor(chr: number) {
305
305
  if (chr >= 48 && chr <= 57) {
306
306
  // 0-9
307
307
  return CODESET.ANY
308
- }
308
+ }
309
309
  else if (chr >= 32 && chr <= 95) {
310
310
  // 0-9 A-Z
311
311
  return CODESET.AB
312
- }
312
+ }
313
313
  else {
314
314
  // if non printable
315
315
  return chr < 32 ? CODESET.A : CODESET.B
@@ -0,0 +1,33 @@
1
+ #### Props
2
+ | 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
3
+ | ----- | ----- | --- | ------- | ------ | -------- |
4
+ | `width` | 图表宽度,单位rpx | `number / string` | `750` | - | - |
5
+ | `height` | 图表高度,单位rpx | `number / string` | `200` | - | - |
6
+ | `canvas2d` | canvas2d模式,用于解决小程序层级过高及拖拽卡顿问题 | `boolean` | `true` | - | - |
7
+ | `pixelRatio` | 设备像素比,解决开启canvas2d后画布模糊的问题 | `number` | `微信小程序由具体设备决定,其余的默认为1` | - | - |
8
+ | `animation` | 是否动画展示图表 | `boolean` | `true` | - | - |
9
+ | `timing` | 图表动画效果 | `string` | `easeOut` | `easeOut`:由快到慢<br/>`easeIn`:由慢到快<br/>`easeInOut`:慢快慢<br/>`linear`:匀速 | - |
10
+ | `duration` | 动画展示时长(单位:毫秒) | `string` | `1000` | - | - |
11
+ | `rotate` | 横屏模式 | `boolean` | `false` | - | - |
12
+ | `rotateLock` | 横屏锁定模式 | `boolean` | `false` | - | - |
13
+ | `background` | 背景颜色,开启滚动条后请赋值 | `string` | `rgba(0,0,0,0)` | - | - |
14
+ | `color` | 主题颜色数组,16进制颜色格式 | `array` | `["#165DFF","#14C9C9","#F7BA1E","#3491FA","#722ED1","#9FDB1D"]` | - | - |
15
+ | `padding` | 画布填充边距(顺序为上右下左),单位px | `array` | `[5,5,5,5]` | - | - |
16
+ | `fontSize` | 全局默认字体大小,单位px | `number` | `13` | - | - |
17
+ | `fontColor` | 全局默认字体颜色 | `string` | `#666666` | - | - |
18
+ | `dataLabel` | 是否显示图表区域内数据点上方的数据文案 | `boolean` | `false` | - | - |
19
+ | `dataPointShape` | 是否显示数据点的图形标识 | `boolean` | `true` | - | - |
20
+ | `dataPointShapeType` | 图形标识点显示类型 | `string` | `solid` | `solid`:实心<br/>`hollow`:空心 | - |
21
+ | `touchMoveLimit` | 图表拖拽时每秒重新渲染的帧数 | `number` | `24` | - | - |
22
+ | `enableScroll` | 开启滚动条功能 | `boolean` | `false` | - | - |
23
+ | `enableMarkLine` | 是否启用标记线功能 | `boolean` | `false` | - | - |
24
+ | `scrollPosition` | 连续更新数据时滚动条的位置 | `string` | `current` | `current`:当前位置<br/>`left`:左对齐<br/>`right`:右对齐 | - |
25
+ | `series` | 图表数据 | `object` | `{}` | - | - |
26
+ | `xAxis` | X轴配置 | `-` | <a href="https://www.ucharts.cn/v2/#/document/index" target="_blank">文档地址</a> | - | - |
27
+ | `yAxis` | Y轴配置 | `-` | <a href="https://www.ucharts.cn/v2/#/document/index" target="_blank">文档地址</a> | - | - |
28
+ | `legend` | 图例配置 | `-` | <a href="https://www.ucharts.cn/v2/#/document/index" target="_blank">文档地址</a> | - | - |
29
+ | `title` | 标题配置(仅适用于 ring、arcbar、gauge) | `-` | <a href="https://www.ucharts.cn/v2/#/document/index" target="_blank">文档地址</a> | - | - |
30
+ | `subtitle` | 副标题配置 | `-` | <a href="https://www.ucharts.cn/v2/#/document/index" target="_blank">文档地址</a> | - | - |
31
+ | `extra` | 额外配置项 | `-` | <a href="https://www.ucharts.cn/v2/#/document/index" target="_blank">文档地址</a> | - | - |
32
+
33
+
@@ -1,15 +1,17 @@
1
1
  #### Props
2
2
  | 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
3
3
  | ----- | ----- | --- | ------- | ------ | -------- |
4
- | `value` | 当前值,支持v-model:value双向绑定 | `object[]` | `` | - | - |
4
+ | `v-model:value` | 当前选中值,支持双向绑定 | `FilterValue[]` | `[]` | - | - |
5
5
  | `activeColor` | 激活状态颜色 | `string` | `#0275FF` | - | - |
6
6
  | `inactiveColor` | 非激活状态颜色 | `string` | `#555A61` | - | - |
7
- | `data` | 菜单数据列表 | `FilterItem[]` | `[]` | - | - |
8
- | `showCategory` | 是否显示分类 | `boolean` | `true` | - | - |
7
+ | `filterType` | 筛选类型 | `string` | `button` | - | - |
8
+ | `data` | 筛选数据源,详细配置见文档 | `FilterItem[]` | `[]` | - | - |
9
+ | `showCategory` | 是否显示左侧的分类栏 | `boolean` | `true` | - | - |
9
10
 
10
11
 
11
12
  #### Events
12
13
  | 事件名 | 说明 | 事件参数 | 支持版本 |
13
14
  | ----- | ----- | ------- | -------- |
14
- | `reset` | 点击重置时触发 | - | - |
15
- | `confirm` | 菜单变化时触发 | `items`:变化后的菜单项列表 | - |
15
+ | `confirm` | 点击确认按钮时触发 | `values`:当前所有选中的值 | - |
16
+ | `reset` | 点击重置按钮时触发 | - | - |
17
+ | `itemClick` | 点击任意筛选项时触发(实时) | `item`:当前操作的筛选项数据 | - |
@@ -4,6 +4,31 @@
4
4
 
5
5
  ---$
6
6
 
7
+ ### `data` 属性详解
8
+
9
+ `data` 属性是组件的核心,它是一个数组,数组中的每个对象代表一个筛选分组。下面是每个筛选分组对象的详细配置项:
10
+
11
+ | 属性 | 说明 | 类型 | 默认值 |
12
+ | ------------- | ------------------------------------------------------- | --------------------- | ---------- |
13
+ | `title` | 分组的标题 | `string` | - |
14
+ | `key` | 分组的唯一标识,用于在 `value` 和事件回调中识别 | `string` | - |
15
+ | `children` | 当前分组下的筛选项数组,每个选项包含 `title` 和 `value` | `BaseFilterItem[]` | `[]` |
16
+ | `multiple` | 是否支持多选 | `boolean` | `false` |
17
+ | `rowCount` | 每行显示的筛选项数量 | `number` | `3` |
18
+ | `expandCount` | 折叠时显示的行数,`0` 或不设置为不折叠 | `number` | `0` |
19
+ | `type` | 分组的类型,可以是按钮或输入框 | `'button' \| 'input'` | `'button'` |
20
+ | `config` | 当 `type` 为 `input` 时的详细配置 | `object` | `{}` |
21
+ | `random` | 是否启用无规则布局(使用flex-wrap) | `boolean` | `false` |
22
+
23
+ **`config` 对象属性 (当 `type: 'input'` 时):**
24
+
25
+ | 属性 | 说明 | 类型 | 默认值 |
26
+ | ------------- | ---------------- | --------- | -------------- |
27
+ | `value` | 输入框的默认值 | `string` | - |
28
+ | `placeholder` | 输入框的提示文字 | `string` | `'请输入内容'` |
29
+ | `maxLength` | 最大输入长度 | `number` | `100` |
30
+ | `clearable` | 是否显示清除按钮 | `boolean` | `false` |
31
+
7
32
  ### 基础用法
8
33
 
9
34
  - 筛选数据需按照下方`script`中的格式传入
@@ -1,55 +1,73 @@
1
- {
2
- "name": "ste-filter-tool",
3
- "description": "筛选选项",
4
- "example": "<ste-filter-tool></ste-filter-tool>",
5
- "tutorial": "https://stellar-ui.intecloud.com.cn/plus/#/?active=filter-tool",
6
- "attributes": [
7
- {
8
- "name": "value",
9
- "description": "当前值,支持v-model:value双向绑定",
10
- "type": "object[]",
11
- "default": ""
12
- },
13
- {
14
- "name": "activeColor",
15
- "description": "激活状态颜色",
16
- "type": "string",
17
- "default": "#0275FF"
18
- },
19
- {
20
- "name": "inactiveColor",
21
- "description": "非激活状态颜色",
22
- "type": "string",
23
- "default": "#555A61"
24
- },
25
- {
26
- "name": "data",
27
- "description": "菜单数据列表",
28
- "type": "FilterItem[]",
29
- "default": "[]"
30
- },
31
- {
32
- "name": "showCategory",
33
- "description": "是否显示分类",
34
- "type": "boolean",
35
- "default": "true"
36
- },
37
- {
38
- "name": "[event]reset",
39
- "description": "点击重置时触发",
40
- "type": "() => void",
41
- "params": []
42
- },
43
- {
44
- "name": "[event]confirm",
45
- "description": "菜单变化时触发",
46
- "type": "(items: FilterItem[]) => void",
47
- "params": [
48
- {
49
- "name": "items",
50
- "description": "变化后的菜单项列表"
51
- }
52
- ]
53
- }
54
- ]
55
- }
1
+ {
2
+ "name": "ste-filter-tool",
3
+ "description": "筛选选项",
4
+ "example": "<ste-filter-tool></ste-filter-tool>",
5
+ "tutorial": "https://stellar-ui.intecloud.com.cn/plus/#/?active=filter-tool",
6
+ "attributes": [
7
+ {
8
+ "name": "v-model:value",
9
+ "description": "当前选中值,支持双向绑定",
10
+ "type": "FilterValue[]",
11
+ "default": "[]"
12
+ },
13
+ {
14
+ "name": "activeColor",
15
+ "description": "激活状态颜色",
16
+ "type": "string",
17
+ "default": "#0275FF"
18
+ },
19
+ {
20
+ "name": "inactiveColor",
21
+ "description": "非激活状态颜色",
22
+ "type": "string",
23
+ "default": "#555A61"
24
+ },
25
+ {
26
+ "name": "filterType",
27
+ "description": "筛选类型",
28
+ "type": "string",
29
+ "options": "button | checkbox | calendar",
30
+ "default": "button"
31
+ },
32
+ {
33
+ "name": "data",
34
+ "description": "筛选数据源,详细配置见文档",
35
+ "type": "FilterItem[]",
36
+ "default": "[]"
37
+ },
38
+ {
39
+ "name": "showCategory",
40
+ "description": "是否显示左侧的分类栏",
41
+ "type": "boolean",
42
+ "default": "true"
43
+ },
44
+ {
45
+ "name": "[event]confirm",
46
+ "description": "点击确认按钮时触发",
47
+ "type": "(values: FilterValue[]) => void",
48
+ "params": [
49
+ {
50
+ "name": "values",
51
+ "description": "当前所有选中的值"
52
+ }
53
+ ]
54
+ },
55
+ {
56
+ "name": "[event]reset",
57
+ "description": "点击重置按钮时触发",
58
+ "type": "() => void",
59
+ "params": []
60
+ },
61
+ {
62
+ "name": "[event]itemClick",
63
+ "description": "点击任意筛选项时触发(实时)",
64
+ "type": "(item: FilterValue) => void",
65
+ "params": [
66
+ {
67
+ "name": "item",
68
+ "description": "当前操作的筛选项数据"
69
+ }
70
+ ]
71
+ }
72
+ ]
73
+ }
@@ -27,7 +27,6 @@
27
27
  width: 144rpx;
28
28
  display: flex;
29
29
  flex-direction: column;
30
- // background-color: #f4f5f6;
31
30
  .category-item {
32
31
  padding: 24rpx;
33
32
  text-align: center;
@@ -50,7 +49,6 @@
50
49
  }
51
50
 
52
51
  &.placeholder {
53
- // color: var(--placeholder-color, #999);
54
52
  height: calc(100% - (var(--category-count) * 82rpx));
55
53
  }
56
54
  }
@@ -58,15 +56,19 @@
58
56
  .category-item.active + .category-item {
59
57
  border-top-right-radius: 16rpx;
60
58
  }
61
-
62
- // .category-item:has(+ .category-item.active) {
63
- // border-bottom-right-radius: 16rpx;
64
- // }
65
59
  }
66
60
 
67
61
  .menu-items {
68
62
  flex: 1;
69
63
 
64
+ .menu-item-input {
65
+ .input-field {
66
+ .content {
67
+ // padding: 0;
68
+ }
69
+ }
70
+ }
71
+
70
72
  .menu-item-block {
71
73
  padding: 0 40rpx;
72
74
  margin-bottom: 20rpx;
@@ -50,7 +50,20 @@
50
50
  </view>
51
51
  </view>
52
52
  </view>
53
+ <view v-if="item.type === 'input'" class="menu-item-input" :style="[{ width: utils.formatPx(item.config?.width || '100%') }]">
54
+ <ste-input
55
+ :font-size="24"
56
+ background="#F4F5F6"
57
+ :value="item.config?.value"
58
+ :placeholder="item.config?.placeholder || '请输入内容'"
59
+ :maxlength="item.config?.maxLength || 100"
60
+ :clearable="item.config?.clearable || false"
61
+ class="input-field"
62
+ @input="value => handleFilterItemInput(item, value)"
63
+ />
64
+ </view>
53
65
  <view
66
+ v-else
54
67
  class="menu-item-content"
55
68
  :style="[{ '--expand-count': item.expandCount }]"
56
69
  :class="[
@@ -106,9 +119,10 @@
106
119
  import { ref, reactive, computed, watch, getCurrentInstance, onUnmounted } from 'vue';
107
120
  import type { ComponentPublicInstance } from 'vue';
108
121
  import propsData, { filterToolEmits } from './props';
109
- import type { FilterItem, CategoryItem } from './type';
122
+ import type { BaseFilterItem, FilterItem, CategoryItem } from './type';
110
123
  import { useColorStore } from '../../store/color';
111
124
  import { ScrollCalculator, ScrollController, InitializationManager, EventHandlerFactory } from './scrollUtil';
125
+ import utils from '../../utils/utils';
112
126
  import useData from './useData';
113
127
 
114
128
  // 组合式API和响应式数据
@@ -162,7 +176,7 @@ const initializeData = () => {
162
176
  };
163
177
 
164
178
  // 包装筛选逻辑的点击事件
165
- const handleFilterItemClick = (item: FilterItem, child: FilterItem) => {
179
+ const handleFilterItemClick = (item: FilterItem, child: BaseFilterItem) => {
166
180
  handleFilterClick(item, child);
167
181
  };
168
182
 
@@ -170,6 +184,15 @@ const handleCheckboxItemClick = (item: FilterItem, value: string) => {
170
184
  handleCheckboxChange(item, value);
171
185
  };
172
186
 
187
+ const handleFilterItemInput = (item: FilterItem, value: any) => {
188
+ if (item.config) {
189
+ item.config = {
190
+ ...item.config,
191
+ value: value,
192
+ };
193
+ }
194
+ };
195
+
173
196
  // 包装重置和确认事件
174
197
  const handleMenuReset = () => {
175
198
  handleReset();
@@ -1,12 +1,26 @@
1
- export interface FilterItem {
1
+ type FilterToolType = 'button' | 'input';
2
+ interface FilterToolProps {
3
+ value?: string; // 控件默认值
4
+ placeholder?: string;
5
+ maxLength?: number;
6
+ [key: string]: any;
7
+ }
8
+
9
+ interface BaseFilterItem {
2
10
  title: string;
3
- children?: FilterItem[];
4
- multiple?: boolean;
5
11
  value?: string | number;
12
+ [key: string]: any;
13
+ }
14
+
15
+ export interface FilterItem extends BaseFilterItem {
16
+ children?: BaseFilterItem[];
17
+ multiple?: boolean;
6
18
  id?: string | number;
7
19
  rowCount?: number;
8
20
  expand?: boolean;
9
21
  expandCount?: number;
22
+ type?: FilterToolType;
23
+ config?: FilterToolProps; // 控件额外配置
10
24
  [key: string]: any;
11
25
  }
12
26
 
@@ -1,5 +1,5 @@
1
1
  import { watch, nextTick, type SetupContext } from 'vue';
2
- import type { FilterItem, FilterValue } from './type';
2
+ import type { BaseFilterItem, FilterItem, FilterValue } from './type';
3
3
  import type { FilterToolProps, FilterToolEmits } from './props';
4
4
 
5
5
  /**
@@ -55,8 +55,13 @@ export default function useSimpleFilterLogic(props: FilterToolProps, emits: Setu
55
55
  }
56
56
  } else {
57
57
  // 按钮模式
58
- const activeChildren = item.children?.filter(child => child.active) || [];
59
- selectedValues = activeChildren.map(child => String(child.value));
58
+ if (item.type === 'input') {
59
+ selectedValues = item.config?.value ? [String(item.config.value)] : [];
60
+ } else {
61
+ // 默认为按钮
62
+ const activeChildren = item.children?.filter(child => child.active) || [];
63
+ selectedValues = activeChildren.map(child => String(child.value));
64
+ }
60
65
  }
61
66
 
62
67
  // 只有选中了值才加入结果
@@ -84,7 +89,7 @@ export default function useSimpleFilterLogic(props: FilterToolProps, emits: Setu
84
89
  /**
85
90
  * 处理按钮模式的筛选项点击
86
91
  */
87
- const handleFilterClick = (item: FilterItem, child: FilterItem) => {
92
+ const handleFilterClick = (item: FilterItem, child: BaseFilterItem) => {
88
93
  if (item.multiple) {
89
94
  // 多选:切换状态
90
95
  child.active = !child.active;
@@ -1,34 +1,34 @@
1
- //---------------------------------------------------------------------
2
- // uQRCode二维码生成插件 v4.0.7
3
- //
4
- // uQRCode是一款基于Javascript环境开发的二维码生成插件,适用所有Javascript运行环境的前端应用和Node.js。
5
- //
6
- // Copyright (c) Sansnn uQRCode All rights reserved.
7
- //
8
- // Licensed under the Apache License, Version 2.0.
9
- // http://www.apache.org/licenses/LICENSE-2.0
10
- //
11
- // github地址:
12
- // https://github.com/Sansnn/uQRCode
13
- //
14
- // npm地址:
15
- // https://www.npmjs.com/package/uqrcodejs
16
- //
17
- // uni-app插件市场地址:
18
- // https://ext.dcloud.net.cn/plugin?id=1287
19
- //
20
- // 复制使用请保留本段注释,感谢支持开源!
21
- //
22
- //---------------------------------------------------------------------
23
-
24
- //---------------------------------------------------------------------
25
- // 当前文件格式为 es,将 bundle 保留为 ES 模块文件,适用于其他打包工具以及支持 <script type=module> 标签的浏览器(别名: esm,module)
26
- // 如需在其他环境使用,请获取环境对应的格式文件
27
- // 格式说明:
28
- // amd - 异步模块定义,适用于 RequireJS 等模块加载器
29
- // cjs - CommonJS,适用于 Node 环境和其他打包工具(别名:commonjs)
30
- // es - 将 bundle 保留为 ES 模块文件,适用于其他打包工具以及支持 <script type=module> 标签的浏览器(别名: esm,module)
31
- // umd - 通用模块定义,生成的包同时支持 amd、cjs 和 iife 三种格式
32
- //---------------------------------------------------------------------
33
-
1
+ //---------------------------------------------------------------------
2
+ // uQRCode二维码生成插件 v4.0.7
3
+ //
4
+ // uQRCode是一款基于Javascript环境开发的二维码生成插件,适用所有Javascript运行环境的前端应用和Node.js。
5
+ //
6
+ // Copyright (c) Sansnn uQRCode All rights reserved.
7
+ //
8
+ // Licensed under the Apache License, Version 2.0.
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // github地址:
12
+ // https://github.com/Sansnn/uQRCode
13
+ //
14
+ // npm地址:
15
+ // https://www.npmjs.com/package/uqrcodejs
16
+ //
17
+ // uni-app插件市场地址:
18
+ // https://ext.dcloud.net.cn/plugin?id=1287
19
+ //
20
+ // 复制使用请保留本段注释,感谢支持开源!
21
+ //
22
+ //---------------------------------------------------------------------
23
+
24
+ //---------------------------------------------------------------------
25
+ // 当前文件格式为 es,将 bundle 保留为 ES 模块文件,适用于其他打包工具以及支持 <script type=module> 标签的浏览器(别名: esm,module)
26
+ // 如需在其他环境使用,请获取环境对应的格式文件
27
+ // 格式说明:
28
+ // amd - 异步模块定义,适用于 RequireJS 等模块加载器
29
+ // cjs - CommonJS,适用于 Node 环境和其他打包工具(别名:commonjs)
30
+ // es - 将 bundle 保留为 ES 模块文件,适用于其他打包工具以及支持 <script type=module> 标签的浏览器(别名: esm,module)
31
+ // umd - 通用模块定义,生成的包同时支持 amd、cjs 和 iife 三种格式
32
+ //---------------------------------------------------------------------
33
+
34
34
  function o(o){this.mode=r.MODE_8BIT_BYTE,this.data=o;}function e(o,e){this.typeNumber=o,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=new Array;}o.prototype={getLength:function(o){return this.data.length},write:function(o){for(var e=0;e<this.data.length;e++)o.put(this.data.charCodeAt(e),8);}},e.prototype={addData:function(e){var r=new o(e);this.dataList.push(r),this.dataCache=null;},isDark:function(o,e){if(o<0||this.moduleCount<=o||e<0||this.moduleCount<=e)throw new Error(o+","+e);return this.modules[o][e]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var o=1;for(o=1;o<40;o++){for(var e=v.getRSBlocks(o,this.errorCorrectLevel),r=new p,t=0,i=0;i<e.length;i++)t+=e[i].dataCount;for(i=0;i<this.dataList.length;i++){var n=this.dataList[i];r.put(n.mode,4),r.put(n.getLength(),h.getLengthInBits(n.mode,o)),n.write(r);}if(r.getLengthInBits()<=8*t)break}this.typeNumber=o;}this.makeImpl(!1,this.getBestMaskPattern());},makeImpl:function(o,r){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var t=0;t<this.moduleCount;t++){this.modules[t]=new Array(this.moduleCount);for(var i=0;i<this.moduleCount;i++)this.modules[t][i]=null;}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(o,r),this.typeNumber>=7&&this.setupTypeNumber(o),null==this.dataCache&&(this.dataCache=e.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,r);},setupPositionProbePattern:function(o,e){for(var r=-1;r<=7;r++)if(!(o+r<=-1||this.moduleCount<=o+r))for(var t=-1;t<=7;t++)e+t<=-1||this.moduleCount<=e+t||(this.modules[o+r][e+t]=0<=r&&r<=6&&(0==t||6==t)||0<=t&&t<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=t&&t<=4);},getBestMaskPattern:function(){for(var o=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var t=h.getLostPoint(this);(0==r||o>t)&&(o=t,e=r);}return e},createMovieClip:function(o,e,r){var t=o.createEmptyMovieClip(e,r);this.make();for(var i=0;i<this.modules.length;i++)for(var n=1*i,a=0;a<this.modules[i].length;a++){var d=1*a;this.modules[i][a]&&(t.beginFill(0,100),t.moveTo(d,n),t.lineTo(d+1,n),t.lineTo(d+1,n+1),t.lineTo(d,n+1),t.endFill());}return t},setupTimingPattern:function(){for(var o=8;o<this.moduleCount-8;o++)null==this.modules[o][6]&&(this.modules[o][6]=o%2==0);for(var e=8;e<this.moduleCount-8;e++)null==this.modules[6][e]&&(this.modules[6][e]=e%2==0);},setupPositionAdjustPattern:function(){for(var o=h.getPatternPosition(this.typeNumber),e=0;e<o.length;e++)for(var r=0;r<o.length;r++){var t=o[e],i=o[r];if(null==this.modules[t][i])for(var n=-2;n<=2;n++)for(var a=-2;a<=2;a++)this.modules[t+n][i+a]=-2==n||2==n||-2==a||2==a||0==n&&0==a;}},setupTypeNumber:function(o){for(var e=h.getBCHTypeNumber(this.typeNumber),r=0;r<18;r++){var t=!o&&1==(e>>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=t;}for(r=0;r<18;r++){t=!o&&1==(e>>r&1);this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=t;}},setupTypeInfo:function(o,e){for(var r=this.errorCorrectLevel<<3|e,t=h.getBCHTypeInfo(r),i=0;i<15;i++){var n=!o&&1==(t>>i&1);i<6?this.modules[i][8]=n:i<8?this.modules[i+1][8]=n:this.modules[this.moduleCount-15+i][8]=n;}for(i=0;i<15;i++){n=!o&&1==(t>>i&1);i<8?this.modules[8][this.moduleCount-i-1]=n:i<9?this.modules[8][15-i-1+1]=n:this.modules[8][15-i-1]=n;}this.modules[this.moduleCount-8][8]=!o;},mapData:function(o,e){for(var r=-1,t=this.moduleCount-1,i=7,n=0,a=this.moduleCount-1;a>0;a-=2)for(6==a&&a--;;){for(var d=0;d<2;d++)if(null==this.modules[t][a-d]){var u=!1;n<o.length&&(u=1==(o[n]>>>i&1)),h.getMask(e,t,a-d)&&(u=!u),this.modules[t][a-d]=u,-1==--i&&(n++,i=7);}if((t+=r)<0||this.moduleCount<=t){t-=r,r=-r;break}}}},e.PAD0=236,e.PAD1=17,e.createData=function(o,r,t){for(var i=v.getRSBlocks(o,r),n=new p,a=0;a<t.length;a++){var d=t[a];n.put(d.mode,4),n.put(d.getLength(),h.getLengthInBits(d.mode,o)),d.write(n);}var u=0;for(a=0;a<i.length;a++)u+=i[a].dataCount;if(n.getLengthInBits()>8*u)throw new Error("code length overflow. ("+n.getLengthInBits()+">"+8*u+")");for(n.getLengthInBits()+4<=8*u&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(!1);for(;!(n.getLengthInBits()>=8*u||(n.put(e.PAD0,8),n.getLengthInBits()>=8*u));)n.put(e.PAD1,8);return e.createBytes(n,i)},e.createBytes=function(o,e){for(var r=0,t=0,i=0,n=new Array(e.length),a=new Array(e.length),d=0;d<e.length;d++){var u=e[d].dataCount,s=e[d].totalCount-u;t=Math.max(t,u),i=Math.max(i,s),n[d]=new Array(u);for(var g=0;g<n[d].length;g++)n[d][g]=255&o.buffer[g+r];r+=u;var l=h.getErrorCorrectPolynomial(s),c=new f(n[d],l.getLength()-1).mod(l);a[d]=new Array(l.getLength()-1);for(g=0;g<a[d].length;g++){var m=g+c.getLength()-a[d].length;a[d][g]=m>=0?c.get(m):0;}}var v=0;for(g=0;g<e.length;g++)v+=e[g].totalCount;var p=new Array(v),C=0;for(g=0;g<t;g++)for(d=0;d<e.length;d++)g<n[d].length&&(p[C++]=n[d][g]);for(g=0;g<i;g++)for(d=0;d<e.length;d++)g<a[d].length&&(p[C++]=a[d][g]);return p};for(var r={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},t={L:1,M:0,Q:3,H:2},i=0,n=1,a=2,d=3,u=4,s=5,g=6,l=7,h={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(o){for(var e=o<<10;h.getBCHDigit(e)-h.getBCHDigit(h.G15)>=0;)e^=h.G15<<h.getBCHDigit(e)-h.getBCHDigit(h.G15);return (o<<10|e)^h.G15_MASK},getBCHTypeNumber:function(o){for(var e=o<<12;h.getBCHDigit(e)-h.getBCHDigit(h.G18)>=0;)e^=h.G18<<h.getBCHDigit(e)-h.getBCHDigit(h.G18);return o<<12|e},getBCHDigit:function(o){for(var e=0;0!=o;)e++,o>>>=1;return e},getPatternPosition:function(o){return h.PATTERN_POSITION_TABLE[o-1]},getMask:function(o,e,r){switch(o){case i:return (e+r)%2==0;case n:return e%2==0;case a:return r%3==0;case d:return (e+r)%3==0;case u:return (Math.floor(e/2)+Math.floor(r/3))%2==0;case s:return e*r%2+e*r%3==0;case g:return (e*r%2+e*r%3)%2==0;case l:return (e*r%3+(e+r)%2)%2==0;default:throw new Error("bad maskPattern:"+o)}},getErrorCorrectPolynomial:function(o){for(var e=new f([1],0),r=0;r<o;r++)e=e.multiply(new f([1,c.gexp(r)],0));return e},getLengthInBits:function(o,e){if(1<=e&&e<10)switch(o){case r.MODE_NUMBER:return 10;case r.MODE_ALPHA_NUM:return 9;case r.MODE_8BIT_BYTE:case r.MODE_KANJI:return 8;default:throw new Error("mode:"+o)}else if(e<27)switch(o){case r.MODE_NUMBER:return 12;case r.MODE_ALPHA_NUM:return 11;case r.MODE_8BIT_BYTE:return 16;case r.MODE_KANJI:return 10;default:throw new Error("mode:"+o)}else {if(!(e<41))throw new Error("type:"+e);switch(o){case r.MODE_NUMBER:return 14;case r.MODE_ALPHA_NUM:return 13;case r.MODE_8BIT_BYTE:return 16;case r.MODE_KANJI:return 12;default:throw new Error("mode:"+o)}}},getLostPoint:function(o){for(var e=o.getModuleCount(),r=0,t=0;t<e;t++)for(var i=0;i<e;i++){for(var n=0,a=o.isDark(t,i),d=-1;d<=1;d++)if(!(t+d<0||e<=t+d))for(var u=-1;u<=1;u++)i+u<0||e<=i+u||0==d&&0==u||a==o.isDark(t+d,i+u)&&n++;n>5&&(r+=3+n-5);}for(t=0;t<e-1;t++)for(i=0;i<e-1;i++){var s=0;o.isDark(t,i)&&s++,o.isDark(t+1,i)&&s++,o.isDark(t,i+1)&&s++,o.isDark(t+1,i+1)&&s++,0!=s&&4!=s||(r+=3);}for(t=0;t<e;t++)for(i=0;i<e-6;i++)o.isDark(t,i)&&!o.isDark(t,i+1)&&o.isDark(t,i+2)&&o.isDark(t,i+3)&&o.isDark(t,i+4)&&!o.isDark(t,i+5)&&o.isDark(t,i+6)&&(r+=40);for(i=0;i<e;i++)for(t=0;t<e-6;t++)o.isDark(t,i)&&!o.isDark(t+1,i)&&o.isDark(t+2,i)&&o.isDark(t+3,i)&&o.isDark(t+4,i)&&!o.isDark(t+5,i)&&o.isDark(t+6,i)&&(r+=40);var g=0;for(i=0;i<e;i++)for(t=0;t<e;t++)o.isDark(t,i)&&g++;return r+=10*(Math.abs(100*g/e/e-50)/5)}},c={glog:function(o){if(o<1)throw new Error("glog("+o+")");return c.LOG_TABLE[o]},gexp:function(o){for(;o<0;)o+=255;for(;o>=256;)o-=255;return c.EXP_TABLE[o]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},m=0;m<8;m++)c.EXP_TABLE[m]=1<<m;for(m=8;m<256;m++)c.EXP_TABLE[m]=c.EXP_TABLE[m-4]^c.EXP_TABLE[m-5]^c.EXP_TABLE[m-6]^c.EXP_TABLE[m-8];for(m=0;m<255;m++)c.LOG_TABLE[c.EXP_TABLE[m]]=m;function f(o,e){if(null==o.length)throw new Error(o.length+"/"+e);for(var r=0;r<o.length&&0==o[r];)r++;this.num=new Array(o.length-r+e);for(var t=0;t<o.length-r;t++)this.num[t]=o[t+r];}function v(o,e){this.totalCount=o,this.dataCount=e;}function p(){this.buffer=new Array,this.length=0;}function C(o){return o.setFillStyle=o.setFillStyle||function(e){o.fillStyle=e;},o.setFontSize=o.setFontSize||function(e){o.font=`${e}px`;},o.setTextAlign=o.setTextAlign||function(e){o.textAlign=e;},o.setTextBaseline=o.setTextBaseline||function(e){o.textBaseline=e;},o.setGlobalAlpha=o.setGlobalAlpha||function(e){o.globalAlpha=e;},o.setStrokeStyle=o.setStrokeStyle||function(e){o.strokeStyle=e;},o.setShadow=o.setShadow||function(e,r,t,i){o.shadowOffsetX=e,o.shadowOffsetY=r,o.shadowBlur=t,o.shadowColor=i;},o.draw=o.draw||function(o,e){e&&e();},o}function b(o,e){var r=this.data="";this.dataEncode=!0;var t=this.size=200;this.useDynamicSize=!1,this.dynamicSize=t;var i=this.typeNumber=-1;this.errorCorrectLevel=b.errorCorrectLevel.H;var n=this.margin=0;this.areaColor="#FFFFFF",this.backgroundColor="rgba(255,255,255,0)",this.backgroundImageSrc=void 0;var a=this.backgroundImageWidth=void 0,d=this.backgroundImageHeight=void 0,u=this.backgroundImageX=void 0,s=this.backgroundImageY=void 0;this.backgroundImageAlpha=1,this.backgroundImageBorderRadius=0;var g=this.backgroundPadding=0;this.foregroundColor="#000000",this.foregroundImageSrc=void 0;var l=this.foregroundImageWidth=void 0,h=this.foregroundImageHeight=void 0,c=this.foregroundImageX=void 0,m=this.foregroundImageY=void 0,f=this.foregroundImagePadding=0;this.foregroundImageBackgroundColor="#FFFFFF";var v=this.foregroundImageBorderRadius=0,p=this.foregroundImageShadowOffsetX=0,k=this.foregroundImageShadowOffsetY=0,y=this.foregroundImageShadowBlur=0;this.foregroundImageShadowColor="#808080";var w=this.foregroundPadding=0,I=this.positionProbeBackgroundColor=void 0,B=this.positionProbeForegroundColor=void 0,S=this.separatorColor=void 0,P=this.positionAdjustBackgroundColor=void 0,E=this.positionAdjustForegroundColor=void 0,L=this.timingBackgroundColor=void 0,D=this.timingForegroundColor=void 0,A=this.typeNumberBackgroundColor=void 0,T=this.typeNumberForegroundColor=void 0,N=this.darkBlockColor=void 0;this.base=void 0,this.modules=[],this.moduleCount=0,this.drawModules=[];var M=this.canvasContext=void 0;this.loadImage,this.drawReserve=!1,this.isMaked=!1,Object.defineProperties(this,{data:{get(){if(""===r||void 0===r)throw console.error("[uQRCode]: data must be set!"),new b.Error("data must be set!");return r},set(o){r=String(o);}},size:{get:()=>t,set(o){t=Number(o);}},typeNumber:{get:()=>i,set(o){i=Number(o);}},margin:{get:()=>n,set(o){n=Number(o);}},backgroundImageWidth:{get(){return void 0===a?this.dynamicSize:this.useDynamicSize?this.dynamicSize/this.size*a:a},set(o){a=Number(o);}},backgroundImageHeight:{get(){return void 0===d?this.dynamicSize:this.useDynamicSize?this.dynamicSize/this.size*d:d},set(o){d=Number(o);}},backgroundImageX:{get(){return void 0===u?0:this.useDynamicSize?this.dynamicSize/this.size*u:u},set(o){u=Number(o);}},backgroundImageY:{get(){return void 0===s?0:this.useDynamicSize?this.dynamicSize/this.size*s:s},set(o){s=Number(o);}},backgroundPadding:{get:()=>g,set(o){g=o>1?1:o<0?0:o;}},foregroundImageWidth:{get(){return void 0===l?(this.dynamicSize-2*this.margin)/4:this.useDynamicSize?this.dynamicSize/this.size*l:l},set(o){l=Number(o);}},foregroundImageHeight:{get(){return void 0===h?(this.dynamicSize-2*this.margin)/4:this.useDynamicSize?this.dynamicSize/this.size*h:h},set(o){h=Number(o);}},foregroundImageX:{get(){return void 0===c?this.dynamicSize/2-this.foregroundImageWidth/2:this.useDynamicSize?this.dynamicSize/this.size*c:c},set(o){c=Number(o);}},foregroundImageY:{get(){return void 0===m?this.dynamicSize/2-this.foregroundImageHeight/2:this.useDynamicSize?this.dynamicSize/this.size*m:m},set(o){m=Number(o);}},foregroundImagePadding:{get(){return this.useDynamicSize?this.dynamicSize/this.size*f:f},set(o){f=Number(o);}},foregroundImageBorderRadius:{get(){return this.useDynamicSize?this.dynamicSize/this.size*v:v},set(o){v=Number(o);}},foregroundImageShadowOffsetX:{get(){return this.useDynamicSize?this.dynamicSize/this.size*p:p},set(o){p=Number(o);}},foregroundImageShadowOffsetY:{get(){return this.useDynamicSize?this.dynamicSize/this.size*k:k},set(o){k=Number(o);}},foregroundImageShadowBlur:{get(){return this.useDynamicSize?this.dynamicSize/this.size*y:y},set(o){y=Number(o);}},foregroundPadding:{get:()=>w,set(o){w=o>1?1:o<0?0:o;}},positionProbeBackgroundColor:{get(){return I||this.backgroundColor},set(o){I=o;}},positionProbeForegroundColor:{get(){return B||this.foregroundColor},set(o){B=o;}},separatorColor:{get(){return S||this.backgroundColor},set(o){S=o;}},positionAdjustBackgroundColor:{get(){return P||this.backgroundColor},set(o){P=o;}},positionAdjustForegroundColor:{get(){return E||this.foregroundColor},set(o){E=o;}},timingBackgroundColor:{get(){return L||this.backgroundColor},set(o){L=o;}},timingForegroundColor:{get(){return D||this.foregroundColor},set(o){D=o;}},typeNumberBackgroundColor:{get(){return A||this.backgroundColor},set(o){A=o;}},typeNumberForegroundColor:{get(){return T||this.foregroundColor},set(o){T=o;}},darkBlockColor:{get(){return N||this.foregroundColor},set(o){N=o;}},canvasContext:{get(){if(void 0===M)throw console.error("[uQRCode]: use drawCanvas, you need to set the canvasContext!"),new b.Error("use drawCanvas, you need to set the canvasContext!");return M},set(o){M=C(o);}}}),b.plugins.forEach((o=>o(b,this,!1))),o&&this.setOptions(o),e&&(this.canvasContext=C(e));}f.prototype={get:function(o){return this.num[o]},getLength:function(){return this.num.length},multiply:function(o){for(var e=new Array(this.getLength()+o.getLength()-1),r=0;r<this.getLength();r++)for(var t=0;t<o.getLength();t++)e[r+t]^=c.gexp(c.glog(this.get(r))+c.glog(o.get(t)));return new f(e,0)},mod:function(o){if(this.getLength()-o.getLength()<0)return this;for(var e=c.glog(this.get(0))-c.glog(o.get(0)),r=new Array(this.getLength()),t=0;t<this.getLength();t++)r[t]=this.get(t);for(t=0;t<o.getLength();t++)r[t]^=c.gexp(c.glog(o.get(t))+e);return new f(r,0).mod(o)}},v.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],v.getRSBlocks=function(o,e){var r=v.getRsBlockTable(o,e);if(null==r)throw new Error("bad rs block @ typeNumber:"+o+"/errorCorrectLevel:"+e);for(var t=r.length/3,i=new Array,n=0;n<t;n++)for(var a=r[3*n+0],d=r[3*n+1],u=r[3*n+2],s=0;s<a;s++)i.push(new v(d,u));return i},v.getRsBlockTable=function(o,e){switch(e){case t.L:return v.RS_BLOCK_TABLE[4*(o-1)+0];case t.M:return v.RS_BLOCK_TABLE[4*(o-1)+1];case t.Q:return v.RS_BLOCK_TABLE[4*(o-1)+2];case t.H:return v.RS_BLOCK_TABLE[4*(o-1)+3];default:return}},p.prototype={get:function(o){var e=Math.floor(o/8);return 1==(this.buffer[e]>>>7-o%8&1)},put:function(o,e){for(var r=0;r<e;r++)this.putBit(1==(o>>>e-r-1&1));},getLengthInBits:function(){return this.length},putBit:function(o){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),o&&(this.buffer[e]|=128>>>this.length%8),this.length++;}},e.errorCorrectLevel=t,b.errorCorrectLevel=e.errorCorrectLevel,b.Error=function(o){this.errMsg="[uQRCode]: "+o;},b.plugins=[],b.use=function(o){"function"==typeof o&&b.plugins.push(o);},b.prototype.loadImage=function(o){return Promise.resolve(o)},b.prototype.setOptions=function(o){var e,r,t,i,n,a,d,u,s,g,l,h,c,m,f,v,p,C,b,k,y,w,I,B,S,P,E,L,D,A,T,N,M,z,_,O,R,F,x,H,X,Y,j,W,G,K,Q,U,$,J,q,V,Z,oo,eo,ro;o&&(Object.keys(o).forEach((e=>{this[e]=o[e];})),function(o={},e={},r=!1){let t;for(var i in t=r?o:{...o},e){var n=e[i];null!=n&&(n.constructor==Object?t[i]=this.deepReplace(t[i],n):n.constructor!=String||n?t[i]=n:t[i]=t[i]);}}(this,{data:o.data||o.text,dataEncode:o.dataEncode,size:o.size,useDynamicSize:o.useDynamicSize,typeNumber:o.typeNumber,errorCorrectLevel:o.errorCorrectLevel,margin:o.margin,areaColor:o.areaColor,backgroundColor:o.backgroundColor||(null===(e=o.background)||void 0===e?void 0:e.color),backgroundImageSrc:o.backgroundImageSrc||(null===(r=o.background)||void 0===r||null===(t=r.image)||void 0===t?void 0:t.src),backgroundImageWidth:o.backgroundImageWidth||(null===(i=o.background)||void 0===i||null===(n=i.image)||void 0===n?void 0:n.width),backgroundImageHeight:o.backgroundImageHeight||(null===(a=o.background)||void 0===a||null===(d=a.image)||void 0===d?void 0:d.height),backgroundImageX:o.backgroundImageX||(null===(u=o.background)||void 0===u||null===(s=u.image)||void 0===s?void 0:s.x),backgroundImageY:o.backgroundImageY||(null===(g=o.background)||void 0===g||null===(l=g.image)||void 0===l?void 0:l.y),backgroundImageAlpha:o.backgroundImageAlpha||(null===(h=o.background)||void 0===h||null===(c=h.image)||void 0===c?void 0:c.alpha),backgroundImageBorderRadius:o.backgroundImageBorderRadius||(null===(m=o.background)||void 0===m||null===(f=m.image)||void 0===f?void 0:f.borderRadius),backgroundPadding:o.backgroundPadding,foregroundColor:o.foregroundColor||(null===(v=o.foreground)||void 0===v?void 0:v.color),foregroundImageSrc:o.foregroundImageSrc||(null===(p=o.foreground)||void 0===p||null===(C=p.image)||void 0===C?void 0:C.src),foregroundImageWidth:o.foregroundImageWidth||(null===(b=o.foreground)||void 0===b||null===(k=b.image)||void 0===k?void 0:k.width),foregroundImageHeight:o.foregroundImageHeight||(null===(y=o.foreground)||void 0===y||null===(w=y.image)||void 0===w?void 0:w.height),foregroundImageX:o.foregroundImageX||(null===(I=o.foreground)||void 0===I||null===(B=I.image)||void 0===B?void 0:B.x),foregroundImageY:o.foregroundImageY||(null===(S=o.foreground)||void 0===S||null===(P=S.image)||void 0===P?void 0:P.y),foregroundImagePadding:o.foregroundImagePadding||(null===(E=o.foreground)||void 0===E||null===(L=E.image)||void 0===L?void 0:L.padding),foregroundImageBackgroundColor:o.foregroundImageBackgroundColor||(null===(D=o.foreground)||void 0===D||null===(A=D.image)||void 0===A?void 0:A.backgroundColor),foregroundImageBorderRadius:o.foregroundImageBorderRadius||(null===(T=o.foreground)||void 0===T||null===(N=T.image)||void 0===N?void 0:N.borderRadius),foregroundImageShadowOffsetX:o.foregroundImageShadowOffsetX||(null===(M=o.foreground)||void 0===M||null===(z=M.image)||void 0===z?void 0:z.shadowOffsetX),foregroundImageShadowOffsetY:o.foregroundImageShadowOffsetY||(null===(_=o.foreground)||void 0===_||null===(O=_.image)||void 0===O?void 0:O.shadowOffsetY),foregroundImageShadowBlur:o.foregroundImageShadowBlur||(null===(R=o.foreground)||void 0===R||null===(F=R.image)||void 0===F?void 0:F.shadowBlur),foregroundImageShadowColor:o.foregroundImageShadowColor||(null===(x=o.foreground)||void 0===x||null===(H=x.image)||void 0===H?void 0:H.shadowColor),foregroundPadding:o.foregroundPadding,positionProbeBackgroundColor:o.positionProbeBackgroundColor||(null===(X=o.positionProbe)||void 0===X?void 0:X.backgroundColor)||(null===(Y=o.positionDetection)||void 0===Y?void 0:Y.backgroundColor),positionProbeForegroundColor:o.positionProbeForegroundColor||(null===(j=o.positionProbe)||void 0===j?void 0:j.foregroundColor)||(null===(W=o.positionDetection)||void 0===W?void 0:W.foregroundColor),separatorColor:o.separatorColor||(null===(G=o.separator)||void 0===G?void 0:G.color),positionAdjustBackgroundColor:o.positionAdjustBackgroundColor||(null===(K=o.positionAdjust)||void 0===K?void 0:K.backgroundColor)||(null===(Q=o.alignment)||void 0===Q?void 0:Q.backgroundColor),positionAdjustForegroundColor:o.positionAdjustForegroundColor||(null===(U=o.positionAdjust)||void 0===U?void 0:U.foregroundColor)||(null===($=o.alignment)||void 0===$?void 0:$.foregroundColor),timingBackgroundColor:o.timingBackgroundColor||(null===(J=o.timing)||void 0===J?void 0:J.backgroundColor),timingForegroundColor:o.timingForegroundColor||(null===(q=o.timing)||void 0===q?void 0:q.foregroundColor),typeNumberBackgroundColor:o.typeNumberBackgroundColor||(null===(V=o.typeNumber)||void 0===V?void 0:V.backgroundColor)||(null===(Z=o.versionInformation)||void 0===Z?void 0:Z.backgroundColor),typeNumberForegroundColor:o.typeNumberForegroundColor||(null===(oo=o.typeNumber)||void 0===oo?void 0:oo.foregroundColor)||(null===(eo=o.versionInformation)||void 0===eo?void 0:eo.foregroundColor),darkBlockColor:o.darkBlockColor||(null===(ro=o.darkBlock)||void 0===ro?void 0:ro.color)},!0));},b.prototype.make=function(){let{foregroundColor:o,backgroundColor:r,typeNumber:t,errorCorrectLevel:i,data:n,dataEncode:a,size:d,margin:u,useDynamicSize:s}=this;if(o===r)throw console.error("[uQRCode]: foregroundColor and backgroundColor cannot be the same!"),new b.Error("foregroundColor and backgroundColor cannot be the same!");a&&(n=function(o){o=o.toString();for(var e,r="",t=0;t<o.length;t++)(e=o.charCodeAt(t))>=1&&e<=127?r+=o.charAt(t):e>2047?(r+=String.fromCharCode(224|e>>12&15),r+=String.fromCharCode(128|e>>6&63),r+=String.fromCharCode(128|e>>0&63)):(r+=String.fromCharCode(192|e>>6&31),r+=String.fromCharCode(128|e>>0&63));return r}(n));var g=new e(t,i);g.addData(n),g.make(),this.base=g,this.typeNumber=g.typeNumber,this.modules=g.modules,this.moduleCount=g.moduleCount,this.dynamicSize=s?Math.ceil((d-2*u)/g.moduleCount)*g.moduleCount+2*u:d,function(o){let{dynamicSize:e,margin:r,backgroundColor:t,backgroundPadding:i,foregroundColor:n,foregroundPadding:a,modules:d,moduleCount:u}=o;var s=(e-2*r)/u,g=s,l=0;i>0&&(g-=2*(l=g*i/2));var h=s,c=0;a>0&&(h-=2*(c=h*a/2));for(var m=0;m<u;m++)for(var f=0;f<u;f++){var v=f*s+r,p=m*s+r;if(d[m][f]){var C=c,b=v+c,k=p+c,y=h,w=h;d[m][f]={type:["foreground"],color:n,isBlack:!0,isDrawn:!1,destX:v,destY:p,destWidth:s,destHeight:s,x:b,y:k,width:y,height:w,paddingTop:C,paddingRight:C,paddingBottom:C,paddingLeft:C};}else C=l,b=v+l,k=p+l,y=g,w=g,d[m][f]={type:["background"],color:t,isBlack:!1,isDrawn:!1,destX:v,destY:p,destWidth:s,destHeight:s,x:b,y:k,width:y,height:w,paddingTop:C,paddingRight:C,paddingBottom:C,paddingLeft:C};}}(this),function(o){let{modules:e,moduleCount:r,positionProbeBackgroundColor:t,positionProbeForegroundColor:i}=o;var n=r-7;[[0,0,1],[1,0,1],[2,0,1],[3,0,1],[4,0,1],[5,0,1],[6,0,1],[0,1,1],[1,1,0],[2,1,0],[3,1,0],[4,1,0],[5,1,0],[6,1,1],[0,2,1],[1,2,0],[2,2,1],[3,2,1],[4,2,1],[5,2,0],[6,2,1],[0,3,1],[1,3,0],[2,3,1],[3,3,1],[4,3,1],[5,3,0],[6,3,1],[0,4,1],[1,4,0],[2,4,1],[3,4,1],[4,4,1],[5,4,0],[6,4,1],[0,5,1],[1,5,0],[2,5,0],[3,5,0],[4,5,0],[5,5,0],[6,5,1],[0,6,1],[1,6,1],[2,6,1],[3,6,1],[4,6,1],[5,6,1],[6,6,1]].forEach((o=>{var r=e[o[0]][o[1]],a=e[o[0]+n][o[1]],d=e[o[0]][o[1]+n];d.type.push("positionProbe"),a.type.push("positionProbe"),r.type.push("positionProbe"),r.color=1==o[2]?i:t,a.color=1==o[2]?i:t,d.color=1==o[2]?i:t;}));}(this),function(o){let{modules:e,moduleCount:r,separatorColor:t}=o;[[7,0],[7,1],[7,2],[7,3],[7,4],[7,5],[7,6],[7,7],[0,7],[1,7],[2,7],[3,7],[4,7],[5,7],[6,7]].forEach((o=>{var i=e[o[0]][o[1]],n=e[r-o[0]-1][o[1]],a=e[o[0]][r-o[1]-1];a.type.push("separator"),n.type.push("separator"),i.type.push("separator"),i.color=t,n.color=t,a.color=t;}));}(this),function(o){let{typeNumber:e,modules:r,moduleCount:t,foregroundColor:i,backgroundColor:n,positionAdjustForegroundColor:a,positionAdjustBackgroundColor:d,timingForegroundColor:u,timingBackgroundColor:s}=o;var g=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]][e-1];if(g)for(var l=[[-2,-2,1],[-1,-2,1],[0,-2,1],[1,-2,1],[2,-2,1],[-2,-1,1],[-1,-1,0],[0,-1,0],[1,-1,0],[2,-1,1],[-2,0,1],[-1,0,0],[0,0,1],[1,0,0],[2,0,1],[-2,1,1],[-1,1,0],[0,1,0],[1,1,0],[2,1,1],[-2,2,1],[-1,2,1],[0,2,1],[1,2,1],[2,2,1]],h=g.length,c=0;c<h;c++)for(var m=0;m<h;m++){var{x:f,y:v}={x:g[c],y:g[m]};f<9&&v<9||f>t-9-1&&v<9||v>t-9-1&&f<9||l.forEach((o=>{var e=r[f+o[0]][v+o[1]];e.type.push("positionAdjust"),e.type.includes("timing")?1==o[2]?e.color=a==i?u:a:e.color=a==i&&d==n?s:d:e.color=1==o[2]?a:d;}));}}(this),function(o){let{modules:e,moduleCount:r,timingForegroundColor:t,timingBackgroundColor:i}=o;for(var n=r-16,a=0;a<n;a++){var d=e[6][8+a],u=e[8+a][6];d.type.push("timing"),u.type.push("timing"),d.color=1&a^1?t:i,u.color=1&a^1?t:i;}}(this),function(o){let{modules:e,moduleCount:r,darkBlockColor:t}=o;var i=e[r-7-1][8];i.type.push("darkBlock"),i.color=t;}(this),function(o){let{typeNumber:e,modules:r,moduleCount:t,typeNumberBackgroundColor:i,typeNumberForegroundColor:n}=o;if(e<7)return r;var a=[0,0,0,0,0,0,0,"000111110010010100","001000010110111100","001001101010011001","001010010011010011","001011101111110110","001100011101100010","001101100001000111","001110011000001101","001111100100101000","010000101101111000","010001010001011101","010010101000010111","010011010100110010","010100100110100110","010101011010000011","010110100011001001","010111011111101100","011000111011000100","011001000111100001","011010111110101011","011011000010001110","011100110000011010","011101001100111111","011110110101110101","011111001001010000","100000100111010101","100001011011110000","100010100010111010","100011011110011111","100100101100001011","100101010000101110","100110101001100100","100111010101000001","101000110001101001"],d=a[e]+a[e],u=[t-11,t-10,t-9];[[5,u[2]],[5,u[1]],[5,u[0]],[4,u[2]],[4,u[1]],[4,u[0]],[3,u[2]],[3,u[1]],[3,u[0]],[2,u[2]],[2,u[1]],[2,u[0]],[1,u[2]],[1,u[1]],[1,u[0]],[0,u[2]],[0,u[1]],[0,u[0]],[u[2],5],[u[1],5],[u[0],5],[u[2],4],[u[1],4],[u[0],4],[u[2],3],[u[1],3],[u[0],3],[u[2],2],[u[1],2],[u[0],2],[u[2],1],[u[1],1],[u[0],1],[u[2],0],[u[1],0],[u[0],0]].forEach(((o,e)=>{var t=r[o[0]][o[1]];t.type.push("typeNumber"),t.color="1"==d[e]?n:i;}));}(this),this.isMaked=!0,this.drawModules=[];},b.prototype.getDrawModules=function(){if(this.drawModules&&this.drawModules.length>0)return this.drawModules;let o=this.drawModules=[],{modules:e,moduleCount:r,dynamicSize:t,areaColor:i,backgroundImageSrc:n,backgroundImageX:a,backgroundImageY:d,backgroundImageWidth:u,backgroundImageHeight:s,backgroundImageAlpha:g,backgroundImageBorderRadius:l,foregroundImageSrc:h,foregroundImageX:c,foregroundImageY:m,foregroundImageWidth:f,foregroundImageHeight:v,foregroundImagePadding:p,foregroundImageBackgroundColor:C,foregroundImageBorderRadius:b,foregroundImageShadowOffsetX:k,foregroundImageShadowOffsetY:y,foregroundImageShadowBlur:w,foregroundImageShadowColor:I}=this;i&&o.push({name:"area",type:"area",color:i,x:0,y:0,width:t,height:t}),n&&o.push({name:"backgroundImage",type:"image",imageSrc:n,mappingName:"backgroundImageSrc",x:a,y:d,width:u,height:s,alpha:g,borderRadius:l});for(var B=0;B<r;B++)for(var S=0;S<r;S++){var P=e[B][S];P.isDrawn||(P.type.includes("foreground")?o.push({name:"foreground",type:"tile",color:P.color,destX:P.destX,destY:P.destY,destWidth:P.destWidth,destHeight:P.destHeight,x:P.x,y:P.y,width:P.width,height:P.height,paddingTop:P.paddingTop,paddingRight:P.paddingRight,paddingBottom:P.paddingBottom,paddingLeft:P.paddingLeft,rowIndex:B,colIndex:S}):o.push({name:"background",type:"tile",color:P.color,destX:P.destX,destY:P.destY,destWidth:P.destWidth,destHeight:P.destHeight,x:P.x,y:P.y,width:P.width,height:P.height,paddingTop:P.paddingTop,paddingRight:P.paddingRight,paddingBottom:P.paddingBottom,paddingLeft:P.paddingLeft,rowIndex:B,colIndex:S}),P.isDrawn=!0);}return h&&o.push({name:"foregroundImage",type:"image",imageSrc:h,mappingName:"foregroundImageSrc",x:c,y:m,width:f,height:v,padding:p,backgroundColor:C,borderRadius:b,shadowOffsetX:k,shadowOffsetY:y,shadowBlur:w,shadowColor:I}),o},b.prototype.isBlack=function(o,e){var r=this.moduleCount;return !(0>o||0>e||o>=r||e>=r)&&this.modules[o][e].isBlack},b.prototype.drawCanvas=function(o){let{isMaked:e,canvasContext:r,useDynamicSize:t,dynamicSize:i,foregroundColor:n,foregroundPadding:a,backgroundColor:d,backgroundPadding:u,drawReserve:s,margin:g}=this;if(!e)return console.error("[uQRCode]: please execute the make method first!"),Promise.reject(new b.Error("please execute the make method first!"));let l=this.getDrawModules(),h=async(e,t)=>{try{r.draw(o);for(var i=0;i<l.length;i++){var n=l[i];switch(r.save(),n.type){case"area":r.setFillStyle(n.color),r.fillRect(n.x,n.y,n.width,n.height);break;case"tile":var a=n.x,d=n.y,u=n.width,g=n.height;r.setFillStyle(n.color),r.fillRect(a,d,u,g);break;case"image":if("backgroundImage"===n.name){a=Math.round(n.x),d=Math.round(n.y),u=Math.round(n.width),g=Math.round(n.height);u<2*(c=Math.round(n.borderRadius))&&(c=u/2),g<2*c&&(c=g/2),r.setGlobalAlpha(n.alpha),c>0&&(r.beginPath(),r.moveTo(a+c,d),r.arcTo(a+u,d,a+u,d+g,c),r.arcTo(a+u,d+g,a,d+g,c),r.arcTo(a,d+g,a,d,c),r.arcTo(a,d,a+u,d,c),r.closePath(),r.setStrokeStyle("rgba(0,0,0,0)"),r.stroke(),r.clip());try{var h=await this.loadImage(n.imageSrc);r.drawImage(h,a,d,u,g);}catch(o){throw console.error(`[uQRCode]: ${n.mappingName} invalid!`),new b.Error(`${n.mappingName} invalid!`)}}else if("foregroundImage"===n.name){a=Math.round(n.x),d=Math.round(n.y),u=Math.round(n.width),g=Math.round(n.height);var c,m=Math.round(n.padding);u<2*(c=Math.round(n.borderRadius))&&(c=u/2),g<2*c&&(c=g/2);var f=a-m,v=d-m,p=u+2*m,C=g+2*m,k=Math.round(p/u*c);p<2*k&&(k=p/2),C<2*k&&(k=C/2),r.save(),r.setShadow(n.shadowOffsetX,n.shadowOffsetY,n.shadowBlur,n.shadowColor),k>0?(r.beginPath(),r.moveTo(f+k,v),r.arcTo(f+p,v,f+p,v+C,k),r.arcTo(f+p,v+C,f,v+C,k),r.arcTo(f,v+C,f,v,k),r.arcTo(f,v,f+p,v,k),r.closePath(),r.setFillStyle(n.backgroundColor),r.fill()):(r.setFillStyle(n.backgroundColor),r.fillRect(f,v,p,C)),r.restore(),r.save(),k>0?(r.beginPath(),r.moveTo(f+k,v),r.arcTo(f+p,v,f+p,v+C,k),r.arcTo(f+p,v+C,f,v+C,k),r.arcTo(f,v+C,f,v,k),r.arcTo(f,v,f+p,v,k),r.closePath(),r.setFillStyle(m>0?n.backgroundColor:"rgba(0,0,0,0)"),r.fill()):(r.setFillStyle(m>0?n.backgroundColor:"rgba(0,0,0,0)"),r.fillRect(f,v,p,C)),r.restore(),c>0&&(r.beginPath(),r.moveTo(a+c,d),r.arcTo(a+u,d,a+u,d+g,c),r.arcTo(a+u,d+g,a,d+g,c),r.arcTo(a,d+g,a,d,c),r.arcTo(a,d,a+u,d,c),r.closePath(),r.setStrokeStyle("rgba(0,0,0,0)"),r.stroke(),r.clip());try{h=await this.loadImage(n.imageSrc);r.drawImage(h,a,d,u,g);}catch(o){throw console.error(`[uQRCode]: ${n.mappingName} invalid!`),new b.Error(`${n.mappingName} invalid!`)}}}s&&r.draw(!0),r.restore();}r.draw(!0),setTimeout(e,150);}catch(o){t(o);}};return new Promise(((o,e)=>{h(o,e);}))},b.prototype.draw=function(o){return this.drawCanvas(o)},b.prototype.register=function(o){o&&o(b,this,!0);};export{b as default};
package/index.ts CHANGED
@@ -28,6 +28,8 @@ import steDatePicker from "./components/ste-date-picker/ste-date-picker.vue"
28
28
  export const SteDatePicker = steDatePicker
29
29
  import steDateUser from "./components/ste-date-user/ste-date-user.vue"
30
30
  export const SteDateUser = steDateUser
31
+ import steDonutChart from "./components/ste-donut-chart/ste-donut-chart.vue"
32
+ export const SteDonutChart = steDonutChart
31
33
  import steDrag from "./components/ste-drag/ste-drag.vue"
32
34
  export const SteDrag = steDrag
33
35
  import steDropdownMenu from "./components/ste-dropdown-menu/ste-dropdown-menu.vue"
@@ -62,8 +64,6 @@ import steLogin from "./components/ste-login/ste-login.vue"
62
64
  export const SteLogin = steLogin
63
65
  import steLoginInfo from "./components/ste-login-info/ste-login-info.vue"
64
66
  export const SteLoginInfo = steLoginInfo
65
- import steMainInfo from "./components/ste-main-info/ste-main-info.vue"
66
- export const SteMainInfo = steMainInfo
67
67
  import steMediaPreview from "./components/ste-media-preview/ste-media-preview.vue"
68
68
  export const SteMediaPreview = steMediaPreview
69
69
  import steMessageBox from "./components/ste-message-box/ste-message-box.vue"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stellar-ui-plus",
3
- "version": "1.22.2",
3
+ "version": "1.22.4",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -11,7 +11,6 @@
11
11
  },
12
12
  "scripts": {
13
13
  "test": "echo \"Error: no test specified\" && exit 1",
14
- "publish-vscode-plugin": "cd ../../../plugins/ste-helper & pnpm run publish",
15
- "prepublishOnly": "pnpm run publish-vscode-plugin"
14
+ "publish-vscode-plugin": "cd ../../../plugins/ste-helper & pnpm run publish"
16
15
  }
17
16
  }
@@ -13,6 +13,7 @@ import steCodeInput from "../components/ste-code-input/ste-code-input.vue"
13
13
  import steColumnChart from "../components/ste-column-chart/ste-column-chart.vue"
14
14
  import steDatePicker from "../components/ste-date-picker/ste-date-picker.vue"
15
15
  import steDateUser from "../components/ste-date-user/ste-date-user.vue"
16
+ import steDonutChart from "../components/ste-donut-chart/ste-donut-chart.vue"
16
17
  import steDrag from "../components/ste-drag/ste-drag.vue"
17
18
  import steDropdownMenu from "../components/ste-dropdown-menu/ste-dropdown-menu.vue"
18
19
  import steDropdownMenuItem from "../components/ste-dropdown-menu-item/ste-dropdown-menu-item.vue"
@@ -30,7 +31,6 @@ import steLineChart from "../components/ste-line-chart/ste-line-chart.vue"
30
31
  import steLoading from "../components/ste-loading/ste-loading.vue"
31
32
  import steLogin from "../components/ste-login/ste-login.vue"
32
33
  import steLoginInfo from "../components/ste-login-info/ste-login-info.vue"
33
- import steMainInfo from "../components/ste-main-info/ste-main-info.vue"
34
34
  import steMediaPreview from "../components/ste-media-preview/ste-media-preview.vue"
35
35
  import steMessageBox from "../components/ste-message-box/ste-message-box.vue"
36
36
  import steNavbar from "../components/ste-navbar/ste-navbar.vue"
@@ -99,6 +99,7 @@ import steWatermark from "../components/ste-watermark/ste-watermark.vue"
99
99
  SteColumnChart: typeof steColumnChart;
100
100
  SteDatePicker: typeof steDatePicker;
101
101
  SteDateUser: typeof steDateUser;
102
+ SteDonutChart: typeof steDonutChart;
102
103
  SteDrag: typeof steDrag;
103
104
  SteDropdownMenu: typeof steDropdownMenu;
104
105
  SteDropdownMenuItem: typeof steDropdownMenuItem;
@@ -116,7 +117,6 @@ import steWatermark from "../components/ste-watermark/ste-watermark.vue"
116
117
  SteLoading: typeof steLoading;
117
118
  SteLogin: typeof steLogin;
118
119
  SteLoginInfo: typeof steLoginInfo;
119
- SteMainInfo: typeof steMainInfo;
120
120
  SteMediaPreview: typeof steMediaPreview;
121
121
  SteMessageBox: typeof steMessageBox;
122
122
  SteNavbar: typeof steNavbar;
@@ -13,6 +13,7 @@ import steCodeInput from "../components/ste-code-input/ste-code-input.vue"
13
13
  import steColumnChart from "../components/ste-column-chart/ste-column-chart.vue"
14
14
  import steDatePicker from "../components/ste-date-picker/ste-date-picker.vue"
15
15
  import steDateUser from "../components/ste-date-user/ste-date-user.vue"
16
+ import steDonutChart from "../components/ste-donut-chart/ste-donut-chart.vue"
16
17
  import steDrag from "../components/ste-drag/ste-drag.vue"
17
18
  import steDropdownMenu from "../components/ste-dropdown-menu/ste-dropdown-menu.vue"
18
19
  import steDropdownMenuItem from "../components/ste-dropdown-menu-item/ste-dropdown-menu-item.vue"
@@ -30,7 +31,6 @@ import steLineChart from "../components/ste-line-chart/ste-line-chart.vue"
30
31
  import steLoading from "../components/ste-loading/ste-loading.vue"
31
32
  import steLogin from "../components/ste-login/ste-login.vue"
32
33
  import steLoginInfo from "../components/ste-login-info/ste-login-info.vue"
33
- import steMainInfo from "../components/ste-main-info/ste-main-info.vue"
34
34
  import steMediaPreview from "../components/ste-media-preview/ste-media-preview.vue"
35
35
  import steMessageBox from "../components/ste-message-box/ste-message-box.vue"
36
36
  import steNavbar from "../components/ste-navbar/ste-navbar.vue"
@@ -94,6 +94,7 @@ export type RefCodeInput = InstanceType<typeof steCodeInput>
94
94
  export type RefColumnChart = InstanceType<typeof steColumnChart>
95
95
  export type RefDatePicker = InstanceType<typeof steDatePicker>
96
96
  export type RefDateUser = InstanceType<typeof steDateUser>
97
+ export type RefDonutChart = InstanceType<typeof steDonutChart>
97
98
  export type RefDrag = InstanceType<typeof steDrag>
98
99
  export type RefDropdownMenu = InstanceType<typeof steDropdownMenu>
99
100
  export type RefDropdownMenuItem = InstanceType<typeof steDropdownMenuItem>
@@ -111,7 +112,6 @@ export type RefLineChart = InstanceType<typeof steLineChart>
111
112
  export type RefLoading = InstanceType<typeof steLoading>
112
113
  export type RefLogin = InstanceType<typeof steLogin>
113
114
  export type RefLoginInfo = InstanceType<typeof steLoginInfo>
114
- export type RefMainInfo = InstanceType<typeof steMainInfo>
115
115
  export type RefMediaPreview = InstanceType<typeof steMediaPreview>
116
116
  export type RefMessageBox = InstanceType<typeof steMessageBox>
117
117
  export type RefNavbar = InstanceType<typeof steNavbar>
package/utils/utils.ts CHANGED
@@ -18,6 +18,8 @@ type PartType = 0 | 1 | 2;
18
18
  let throLast: number = 0;
19
19
  let throTimer: ReturnType<typeof setTimeout> | null = null;
20
20
 
21
+ let debounceTimer: ReturnType<typeof setTimeout> | null = null;
22
+
21
23
  let windowWidth: number = 0;
22
24
 
23
25
  // 定义延迟选项接口
@@ -75,7 +77,7 @@ const utils = {
75
77
  * @param args 要防抖方法的参数,如果最后一个参数是 {delay:2000},则该参数为防抖时间参数,不记入方法参数
76
78
  * @returns 返回一个新的函数
77
79
  */
78
- debounce<T extends (...args: any[]) => any>(fn: T, ...args: any[]): () => void {
80
+ debounce<T extends (...args: any[]) => any>(fn: T, ...args: any[]): void {
79
81
  let delay: number = 500;
80
82
  let lastArg: any = null;
81
83
 
@@ -87,16 +89,22 @@ const utils = {
87
89
  }
88
90
  }
89
91
 
90
- let timer: ReturnType<typeof setTimeout> | null = null;
91
-
92
- return function (this: any): void {
93
- if (timer !== null) {
94
- clearTimeout(timer);
95
- }
96
- timer = setTimeout(() => {
97
- fn.call(this, ...args);
98
- }, delay);
99
- };
92
+ // let timer: ReturnType<typeof setTimeout> | null = null;
93
+
94
+ // return function (this: any): void {
95
+ // if (debounceTimer !== null) {
96
+ // clearTimeout(debounceTimer);
97
+ // }
98
+ // debounceTimer = setTimeout(() => {
99
+ // fn.call(this, ...args);
100
+ // }, delay);
101
+ // };
102
+ if (debounceTimer !== null) {
103
+ clearTimeout(debounceTimer);
104
+ }
105
+ debounceTimer = setTimeout(() => {
106
+ fn.call(this, ...args);
107
+ }, delay);
100
108
  },
101
109
  isNaN(value: number | string | null | undefined): boolean {
102
110
  const deg = /^-?\d+(\.\d+)?$/i;
@@ -1,17 +0,0 @@
1
- #### Props
2
- | 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
3
- | ----- | ----- | --- | ------- | ------ | -------- |
4
- | `mainColor` | 主颜色 | `string` | `` | - | - |
5
- | `showAvatar` | 是否显示头像,若未配置头像url也不显示头像 | `boolean` | `true` | - | - |
6
- | `avatarUrl` | 头像url | `string` | `` | - | - |
7
- | `infoUser` | 用户数据 | `InfoUser` | `{}` | - | - |
8
- | `infoData` | 中间数据 | `InfoItem[]` | `[]` | - | - |
9
- | `infoCode` | 最后部分数据 | `InfoItem` | `{}` | - | - |
10
-
11
-
12
- #### Events
13
- | 事件名 | 说明 | 事件参数 | 支持版本 |
14
- | ----- | ----- | ------- | -------- |
15
- | `data-click` | 中间数据点击时触发 | `item`:点击的项 | - |
16
- | `avatar-click` | 头像点击时触发 | - | - |
17
- | `user-click` | 用户数据点击时触发 | - | - |