@tplc/wot 1.0.20 → 1.0.21

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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.0.21](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v1.0.20...v1.0.21) (2025-12-30)
6
+
7
+
8
+ ### 💄 Styles | 风格
9
+
10
+ * Update wd-select-picker label padding and adjust required indicator position ([c484165](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/commit/c484165672df34c3a8a0497a89f4878bc9eca62c))
11
+
5
12
  ### [1.0.20](https://gitlab888.30jia.com.cn/tourism-front/zero-code-pro/compare/v1.0.19...v1.0.20) (2025-12-29)
6
13
 
7
14
 
@@ -55,7 +55,10 @@ export function getType(target: unknown): string {
55
55
  * @param kv - 配置对象,包含 labelKey 作为键值
56
56
  * @returns 格式化后的字符串
57
57
  */
58
- export const defaultDisplayFormat = function (items: any[] | Record<string, any>, kv?: { labelKey?: string }): string {
58
+ export const defaultDisplayFormat = function (
59
+ items: any[] | Record<string, any>,
60
+ kv?: { labelKey?: string },
61
+ ): string {
59
62
  const labelKey: string = kv?.labelKey || 'value'
60
63
 
61
64
  if (Array.isArray(items)) {
@@ -156,7 +159,11 @@ export const gradient = (startColor: string, endColor: string, step: number = 2)
156
159
  for (let i = 0; i < step; i++) {
157
160
  // 计算每一步的hex值
158
161
  gradientColorArr.push(
159
- rgbToHex(parseInt(String(rStep * i + sColor[0])), parseInt(String(gStep * i + sColor[1])), parseInt(String(bStep * i + sColor[2])))
162
+ rgbToHex(
163
+ parseInt(String(rStep * i + sColor[0])),
164
+ parseInt(String(gStep * i + sColor[1])),
165
+ parseInt(String(bStep * i + sColor[2])),
166
+ ),
160
167
  )
161
168
  }
162
169
  return gradientColorArr
@@ -227,7 +234,7 @@ export const padZero = (number: number | string, length: number = 2): string =>
227
234
 
228
235
  /** @description 全局变量id */
229
236
  export const context = {
230
- id: 1000
237
+ id: 1000,
231
238
  }
232
239
 
233
240
  export type RectResultType<T extends boolean> = T extends true ? UniApp.NodeInfo[] : UniApp.NodeInfo
@@ -240,7 +247,12 @@ export type RectResultType<T extends boolean> = T extends true ? UniApp.NodeInfo
240
247
  * @param useFields 是否使用 fields 方法获取节点信息
241
248
  * @returns 节点信息或节点信息数组
242
249
  */
243
- export function getRect<T extends boolean>(selector: string, all: T, scope?: any, useFields?: boolean): Promise<RectResultType<T>> {
250
+ export function getRect<T extends boolean>(
251
+ selector: string,
252
+ all: T,
253
+ scope?: any,
254
+ useFields?: boolean,
255
+ ): Promise<RectResultType<T>> {
244
256
  return new Promise<RectResultType<T>>((resolve, reject) => {
245
257
  let query: UniNamespace.SelectorQuery | null = null
246
258
  if (scope) {
@@ -543,7 +555,10 @@ export function deepClone<T>(obj: T, cache: Map<any, any> = new Map()): T {
543
555
  * @param source 源对象,要合并到目标对象的对象
544
556
  * @returns 合并后的目标对象
545
557
  */
546
- export function deepMerge<T extends Record<string, any>>(target: T, source: Record<string, any>): T {
558
+ export function deepMerge<T extends Record<string, any>>(
559
+ target: T,
560
+ source: Record<string, any>,
561
+ ): T {
547
562
  // 深拷贝目标对象,避免修改原始对象
548
563
  target = deepClone(target)
549
564
 
@@ -570,7 +585,10 @@ export function deepMerge<T extends Record<string, any>>(target: T, source: Reco
570
585
  * @param source
571
586
  * @returns
572
587
  */
573
- export function deepAssign(target: Record<string, any>, source: Record<string, any>): Record<string, any> {
588
+ export function deepAssign(
589
+ target: Record<string, any>,
590
+ source: Record<string, any>,
591
+ ): Record<string, any> {
574
592
  Object.keys(source).forEach((key) => {
575
593
  const targetValue = target[key]
576
594
  const newObjValue = source[key]
@@ -607,7 +625,11 @@ type DebounceOptions = {
607
625
  trailing?: boolean // 是否在延迟时间结束时调用函数
608
626
  }
609
627
 
610
- export function debounce<T extends (...args: any[]) => any>(func: T, wait: number, options: DebounceOptions = {}): T {
628
+ export function debounce<T extends (...args: any[]) => any>(
629
+ func: T,
630
+ wait: number,
631
+ options: DebounceOptions = {},
632
+ ): T {
611
633
  let timeoutId: ReturnType<typeof setTimeout> | null = null
612
634
  let lastArgs: any[] | undefined
613
635
  let lastThis: any
@@ -640,7 +662,7 @@ export function debounce<T extends (...args: any[]) => any>(func: T, wait: numbe
640
662
 
641
663
  function debounced(this: any, ...args: Parameters<T>): ReturnType<T> | undefined {
642
664
  lastArgs = args
643
- lastThis = this
665
+ lastThis = this as any
644
666
 
645
667
  if (timeoutId === null) {
646
668
  if (leading) {
@@ -696,7 +718,10 @@ export const getPropByPath = (obj: any, path: string): any => {
696
718
  const keys: string[] = path.split('.')
697
719
 
698
720
  try {
699
- return keys.reduce((acc: any, key: string) => (acc !== undefined && acc !== null ? acc[key] : undefined), obj)
721
+ return keys.reduce(
722
+ (acc: any, key: string) => (acc !== undefined && acc !== null ? acc[key] : undefined),
723
+ obj,
724
+ )
700
725
  } catch (error) {
701
726
  return undefined
702
727
  }
@@ -707,7 +732,8 @@ export const getPropByPath = (obj: any, path: string): any => {
707
732
  * @param val 要检查的值
708
733
  * @returns 如果值是Date类型,则返回true,否则返回false
709
734
  */
710
- export const isDate = (val: unknown): val is Date => Object.prototype.toString.call(val) === '[object Date]' && !Number.isNaN((val as Date).getTime())
735
+ export const isDate = (val: unknown): val is Date =>
736
+ Object.prototype.toString.call(val) === '[object Date]' && !Number.isNaN((val as Date).getTime())
711
737
 
712
738
  /**
713
739
  * 检查提供的URL是否为视频链接。
@@ -716,7 +742,8 @@ export const isDate = (val: unknown): val is Date => Object.prototype.toString.c
716
742
  */
717
743
  export function isVideoUrl(url: string): boolean {
718
744
  // 使用正则表达式匹配视频文件类型的URL
719
- const videoRegex = /\.(ogm|webm|ogv|asx|m4v|mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv|video)(?=$|[?#])/i
745
+ const videoRegex =
746
+ /\.(ogm|webm|ogv|asx|m4v|mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv|video)(?=$|[?#])/i
720
747
  return videoRegex.test(url)
721
748
  }
722
749
 
@@ -727,7 +754,8 @@ export function isVideoUrl(url: string): boolean {
727
754
  */
728
755
  export function isImageUrl(url: string): boolean {
729
756
  // 使用正则表达式匹配图片URL
730
- const imageRegex = /\.(xbm|tif|pjp|apng|svgz|jpeg|jpg|heif|ico|tiff|heic|pjpeg|avif|gif|png|svg|webp|jfif|bmp|dpg|image)(?=$|[?#])/i
757
+ const imageRegex =
758
+ /\.(xbm|tif|pjp|apng|svgz|jpeg|jpg|heif|ico|tiff|heic|pjpeg|avif|gif|png|svg|webp|jfif|bmp|dpg|image)(?=$|[?#])/i
731
759
  return imageRegex.test(url)
732
760
  }
733
761
 
@@ -748,7 +776,10 @@ export const isH5 = (() => {
748
776
  * @param predicate
749
777
  * @returns
750
778
  */
751
- export function omitBy<O extends Record<string, any>>(obj: O, predicate: (value: any, key: keyof O) => boolean): Partial<O> {
779
+ export function omitBy<O extends Record<string, any>>(
780
+ obj: O,
781
+ predicate: (value: any, key: keyof O) => boolean,
782
+ ): Partial<O> {
752
783
  const newObj = deepClone(obj)
753
784
  Object.keys(newObj).forEach((key) => predicate(newObj[key], key) && delete newObj[key]) // 遍历对象的键,删除值为不满足predicate的字段
754
785
  return newObj
@@ -774,7 +805,9 @@ export function easingFn(t: number = 0, b: number = 0, c: number = 0, d: number
774
805
  * @returns 最接近目标值的元素
775
806
  */
776
807
  export function closest(arr: number[], target: number) {
777
- return arr.reduce((prev, curr) => (Math.abs(curr - target) < Math.abs(prev - target) ? curr : prev))
808
+ return arr.reduce((prev, curr) =>
809
+ Math.abs(curr - target) < Math.abs(prev - target) ? curr : prev,
810
+ )
778
811
  }
779
812
 
780
813
  /**
@@ -816,12 +849,12 @@ export function getSystemInfo(): SystemInfo {
816
849
  try {
817
850
  // const systemSetting = uni.getSystemSetting() // 暂时不需要
818
851
  const deviceInfo = uni.getDeviceInfo()
819
- const windowInfo = uni.getWindowInfo()
852
+ const windowInfo = uni.getWindowInfo ? uni.getWindowInfo() : uni.getSystemInfoSync()
820
853
  const appBaseInfo = uni.getAppBaseInfo()
821
854
  systemInfo = {
822
855
  ...deviceInfo,
823
856
  ...windowInfo,
824
- ...appBaseInfo
857
+ ...appBaseInfo,
825
858
  }
826
859
  } catch (error) {
827
860
  console.warn('获取系统信息失败,降级使用uni.getSystemInfoSync:', error)
@@ -72,7 +72,9 @@ watch(
72
72
  )
73
73
 
74
74
  onBeforeMount(() => {
75
- windowHeight.value = uni.getWindowInfo().windowHeight
75
+ windowHeight.value = (
76
+ uni.getWindowInfo ? uni.getWindowInfo() : uni.getSystemInfoSync()
77
+ ).windowHeight
76
78
  })
77
79
 
78
80
  function noop(event: Event) {
@@ -32,7 +32,7 @@ const rootStyle = computed(() => {
32
32
  rootStyle.height = addUnit(props.height)
33
33
  }
34
34
  if (props.safeAreaTop) {
35
- const { statusBarHeight } = uni.getWindowInfo()
35
+ const { statusBarHeight } = uni.getWindowInfo ? uni.getWindowInfo() : uni.getSystemInfoSync()
36
36
  rootStyle.paddingTop = addUnit(statusBarHeight || 0)
37
37
  }
38
38
  return `${objToStyle(rootStyle)};${props.customStyle}`
@@ -504,7 +504,7 @@ export default {
504
504
  this.templateOptions.canvasHeight = qr.size
505
505
  this.templateOptions.canvasTransform = ''
506
506
  /* 使用dynamicSize+scale,可以解决小块间出现白线问题,dpr可以解决模糊问题 */
507
- const dpr = uni.getWindowInfo().pixelRatio
507
+ const dpr = (uni.getWindowInfo ? uni.getWindowInfo() : uni.getSystemInfoSync()).pixelRatio
508
508
  canvas.width = qr.dynamicSize * dpr
509
509
  canvas.height = qr.dynamicSize * dpr
510
510
  canvasContext.scale(dpr, dpr)
@@ -823,7 +823,7 @@ export default {
823
823
  }
824
824
  // #endif
825
825
  // #ifdef APP-NVUE
826
- const dpr = uni.getWindowInfo().pixelRatio
826
+ const dpr = (uni.getWindowInfo ? uni.getWindowInfo() : uni.getSystemInfoSync()).pixelRatio
827
827
  this.canvasContext.toTempFilePath(
828
828
  0,
829
829
  0,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "@tplc/wot",
3
3
  "name": "@tplc/wot",
4
- "version": "1.0.20",
4
+ "version": "1.0.21",
5
5
  "keywords": [
6
6
  "wot-design-uni",
7
7
  "国际化",