sard-uniapp 1.10.2 → 1.10.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.
package/README.md CHANGED
@@ -114,7 +114,7 @@ npm run release
114
114
  - 提交
115
115
  - 给提交打标签
116
116
  - 运行 `npm run buildAndRelease` 打包组件库并发布到 npm
117
- - 发布到 uniapp 插件市场
117
+ - 使用 HBuilderX 发布到 uniapp 插件市场
118
118
  - 运行 `npm run push` 推送代码和标签
119
119
  - 运行 `npm run build:site` 打包文档(如果文档有修改)
120
120
  - 运行 `npm run deploy` 部署文档(如果文档有修改)
package/changelog.md CHANGED
@@ -1,9 +1,19 @@
1
- ## [1.10.2](https://github.com/sutras/sard-uniapp/compare/v1.10.1...v1.10.2) (2025-02-14)
1
+ ## [1.10.4](https://github.com/sutras/sard-uniapp/compare/v1.10.3...v1.10.4) (2025-02-19)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * 使用 [@import](https://github.com/import) 导入scss, 兼容mp-alipay ([1830610](https://github.com/sutras/sard-uniapp/commit/1830610e17b29fd5f7e362d5c04a0ebcbb1ac772))
7
+
8
+
9
+
10
+ ## [1.10.3](https://github.com/sutras/sard-uniapp/compare/v1.10.1...v1.10.3) (2025-02-19)
2
11
 
3
12
 
4
13
  ### Bug Fixes
5
14
 
6
15
  * 修复 cascader, cascader-input 组件 ([e964e40](https://github.com/sutras/sard-uniapp/commit/e964e400452e873713a95b9a07cbe4e1459113cc))
16
+ * 确保 DatetimePickerInput value 格式化, 移除sass警告 ([e8e326d](https://github.com/sutras/sard-uniapp/commit/e8e326d9db1b96bd542bff5a1a60276083d53fba))
7
17
 
8
18
 
9
19
 
@@ -67,12 +67,15 @@
67
67
  type="compact"
68
68
  @confirm="onPickerConfirm"
69
69
  >
70
- <sar-datetime-picker
71
- type="yM"
72
- v-model="pickerValue"
73
- :min="minDate"
74
- :max="maxDate"
75
- />
70
+ <template #visible="{ already }">
71
+ <sar-datetime-picker
72
+ v-if="already"
73
+ type="yM"
74
+ v-model="pickerValue"
75
+ :min="minDate"
76
+ :max="maxDate"
77
+ />
78
+ </template>
76
79
  </sar-popout>
77
80
  </template>
78
81
 
@@ -115,8 +115,9 @@ export default _defineComponent({
115
115
  return maxDate2 < minDate.value ? new Date(minDate.value) : maxDate2;
116
116
  });
117
117
  const onConfirm = () => {
118
- if (isNullish(popoutValue.value)) {
119
- popoutValue.value = getInitialValue(minDate.value, maxDate.value);
118
+ if (!popoutValue.value) {
119
+ const initialValue = getInitialValue(minDate.value, maxDate.value);
120
+ popoutValue.value = props.valueFormat ? formatDate(initialValue, props.valueFormat) : initialValue;
120
121
  }
121
122
  innerValue.value = popoutValue.value;
122
123
  emit("update:model-value", popoutValue.value);
@@ -50,6 +50,7 @@
50
50
  border-width: 0;
51
51
  font-size: var(--sar-input-control-font-size);
52
52
  line-height: var(--sar-input-control-line-height);
53
+ background-color: transparent;
53
54
 
54
55
  @include m(input) {
55
56
  height: var(--sar-input-control-input-height);
@@ -54,6 +54,7 @@
54
54
  @keyboardheightchange="onKeyboardheightchange"
55
55
  :auto-height="autoHeight"
56
56
  :style="controlStyle"
57
+ :show-count="false"
57
58
  />
58
59
  <input
59
60
  v-else
@@ -18,15 +18,16 @@
18
18
  :loading="loading.cancel"
19
19
  @click="onCancel"
20
20
  >
21
- <slot name="cancel">
22
- {{ cancelText || t('cancel') }}
23
- </slot>
21
+ <template v-if="cancelText">{{ cancelText }}</template>
22
+ <slot v-else-if="$slots.cancel" name="cancel"></slot>
23
+ <template v-else>{{ t('cancel') }}</template>
24
24
  </sar-button>
25
25
  </view>
26
26
  <view :class="bem.e('title')">
27
- <slot name="title">
27
+ <template v-if="title">
28
28
  <text :class="bem.e('title-text')">{{ title }}</text>
29
- </slot>
29
+ </template>
30
+ <slot v-else-if="$slots.title" name="title"></slot>
30
31
  </view>
31
32
  <view v-if="type === 'compact'" :class="bem.e('button-wrap')">
32
33
  <sar-button
@@ -37,9 +38,9 @@
37
38
  :disabled="confirmDisabled"
38
39
  @click="onConfirm"
39
40
  >
40
- <slot name="confirm">
41
- {{ confirmText || t('confirm') }}
42
- </slot>
41
+ <template v-if="confirmText">{{ confirmText }}</template>
42
+ <slot v-else-if="$slots.confirm" name="confirm"></slot>
43
+ <template v-else>{{ t('confirm') }}</template>
43
44
  </sar-button>
44
45
  </view>
45
46
  <view
@@ -63,9 +64,9 @@
63
64
  :loading="loading.cancel"
64
65
  @click="onCancel"
65
66
  >
66
- <slot name="cancel">
67
- {{ cancelText || t('cancel') }}
68
- </slot>
67
+ <template v-if="cancelText">{{ cancelText }}</template>
68
+ <slot v-else-if="$slots.cancel" name="cancel"></slot>
69
+ <template v-else>{{ t('cancel') }}</template>
69
70
  </sar-button>
70
71
  <sar-button
71
72
  v-if="showConfirm"
@@ -76,9 +77,9 @@
76
77
  :disabled="confirmDisabled"
77
78
  @click="onConfirm"
78
79
  >
79
- <slot name="confirm">
80
- {{ confirmText || t('confirm') }}
81
- </slot>
80
+ <template v-if="confirmText">{{ confirmText }}</template>
81
+ <slot v-else-if="$slots.confirm" name="confirm"></slot>
82
+ <template v-else>{{ t('confirm') }}</template>
82
83
  </sar-button>
83
84
  </view>
84
85
  </view>
@@ -119,7 +119,7 @@ export default _defineComponent({
119
119
  const moduleSize = size / (map.length + props.quietZoneModules * 2);
120
120
  const margin = moduleSize * props.quietZoneModules;
121
121
  const context = canvas.getContext("2d");
122
- const path2D = canvas.createPath2D ? canvas.createPath2D() : new Path2D();
122
+ const path2D = context.createPath2D ? context.createPath2D() : canvas.createPath2D ? canvas.createPath2D() : new Path2D();
123
123
  map.forEach((row, rowIndex) => {
124
124
  row.forEach((col, colIndex) => {
125
125
  if (col === 1) {
@@ -1,15 +1,18 @@
1
1
  @use 'sass:color';
2
2
  @use 'sass:math';
3
+ @use 'sass:string';
4
+ @use 'sass:list';
5
+ @use 'sass:map';
3
6
  @use './configuration' as *;
4
7
 
5
8
  // scss原生并没有提供字符串的替换函数,需自己编写函数来实现这个功能
6
9
  @function str-replace($string, $search, $replace) {
7
- $index: str-index($string, $search);
10
+ $index: string.index($string, $search);
8
11
 
9
12
  @if $index {
10
- @return str-slice($string, 1, $index - 1) + $replace +
13
+ @return string.slice($string, 1, $index - 1) + $replace +
11
14
  str-replace(
12
- str-slice($string, $index + str-length($search)),
15
+ string.slice($string, $index + string.length($search)),
13
16
  $search,
14
17
  $replace
15
18
  );
@@ -25,13 +28,10 @@
25
28
 
26
29
  // 把一个数四舍五入到指定位数小数
27
30
  @function tofixed($n, $digits: 0) {
28
- @return math.div(round($n * math.pow(10, $digits)), math.pow(10, $digits));
29
- }
30
-
31
- // 从一个颜色提取出rgb组成一个字符串,通过赋值给一个css变量,
32
- // 以便将此变量和一个透明度组成一个rgba从而实现自定义一个颜色的透明度。
33
- @function extractRGB($color) {
34
- @return '#{color.red($color)},#{color.green($color)},#{color.blue($color)}';
31
+ @return math.div(
32
+ math.round($n * math.pow(10, $digits)),
33
+ math.pow(10, $digits)
34
+ );
35
35
  }
36
36
 
37
37
  @function bem-ns($str) {
@@ -49,24 +49,69 @@
49
49
  @return $result;
50
50
  }
51
51
 
52
+ // 兼容旧版本
52
53
  @function str-split($string, $separator) {
53
54
  // empty array/list
54
55
  $split-arr: ();
55
56
  // first index of separator in string
56
- $index: str-index($string, $separator);
57
+ $index: string.index($string, $separator);
57
58
  // loop through string
58
59
  @while $index != null {
59
60
  // get the substring from the first character to the separator
60
- $item: str-slice($string, 1, $index - 1);
61
+ $item: string.slice($string, 1, $index - 1);
61
62
  // push item to array
62
- $split-arr: append($split-arr, $item);
63
+ $split-arr: list.append($split-arr, $item);
63
64
  // remove item and separator from string
64
- $string: str-slice($string, $index + 1);
65
+ $string: string.slice($string, $index + 1);
65
66
  // find new index of separator
66
- $index: str-index($string, $separator);
67
+ $index: string.index($string, $separator);
67
68
  }
68
69
  // add the remaining string to list (the last item)
69
- $split-arr: append($split-arr, $string);
70
+ $split-arr: list.append($split-arr, $string);
70
71
 
71
72
  @return $split-arr;
72
73
  }
74
+
75
+ @function three-to-six($str) {
76
+ $first: string.slice($str, 1, 1);
77
+ $second: string.slice($str, 2, 2);
78
+ $three: string.slice($str, 3, 3);
79
+
80
+ @return $first + $first + $second + $second + $three + $three;
81
+ }
82
+
83
+ $map-hex-decimal: (
84
+ '0': 0,
85
+ '1': 1,
86
+ '2': 2,
87
+ '3': 3,
88
+ '4': 4,
89
+ '5': 5,
90
+ '6': 6,
91
+ '7': 7,
92
+ '8': 8,
93
+ '9': 9,
94
+ 'a': 10,
95
+ 'b': 11,
96
+ 'c': 12,
97
+ 'd': 13,
98
+ 'e': 14,
99
+ 'f': 15,
100
+ );
101
+
102
+ @function hex-to-decimal($hex) {
103
+ $hex: string.to-lower-case($hex);
104
+ @return map.get($map-hex-decimal, string.slice($hex, 1, 1)) * 16 +
105
+ map.get($map-hex-decimal, string.slice($hex, 2, 2));
106
+ }
107
+
108
+ @function hex-to-rgb($hex) {
109
+ $hex: str-replace(#{$hex}, '#', '');
110
+ $hex: if(string.length($hex) == 3, three-to-six($hex), $hex);
111
+
112
+ $first: string.slice($hex, 1, 2);
113
+ $second: string.slice($hex, 3, 4);
114
+ $three: string.slice($hex, 5, 6);
115
+
116
+ @return '#{hex-to-decimal($first)},#{hex-to-decimal($second)},#{hex-to-decimal($three)}';
117
+ }
@@ -18,17 +18,17 @@ page {
18
18
  --sar-black: #{$sar-black};
19
19
 
20
20
  // # 灰度值 rgb
21
- --sar-white-rgb: #{extractRGB($sar-white)};
22
- --sar-gray-100-rgb: #{extractRGB($sar-gray-100)};
23
- --sar-gray-200-rgb: #{extractRGB($sar-gray-200)};
24
- --sar-gray-300-rgb: #{extractRGB($sar-gray-300)};
25
- --sar-gray-400-rgb: #{extractRGB($sar-gray-400)};
26
- --sar-gray-500-rgb: #{extractRGB($sar-gray-500)};
27
- --sar-gray-600-rgb: #{extractRGB($sar-gray-600)};
28
- --sar-gray-700-rgb: #{extractRGB($sar-gray-700)};
29
- --sar-gray-800-rgb: #{extractRGB($sar-gray-800)};
30
- --sar-gray-900-rgb: #{extractRGB($sar-gray-900)};
31
- --sar-black-rgb: #{extractRGB($sar-black)};
21
+ --sar-white-rgb: #{hex-to-rgb($sar-white)};
22
+ --sar-gray-100-rgb: #{hex-to-rgb($sar-gray-100)};
23
+ --sar-gray-200-rgb: #{hex-to-rgb($sar-gray-200)};
24
+ --sar-gray-300-rgb: #{hex-to-rgb($sar-gray-300)};
25
+ --sar-gray-400-rgb: #{hex-to-rgb($sar-gray-400)};
26
+ --sar-gray-500-rgb: #{hex-to-rgb($sar-gray-500)};
27
+ --sar-gray-600-rgb: #{hex-to-rgb($sar-gray-600)};
28
+ --sar-gray-700-rgb: #{hex-to-rgb($sar-gray-700)};
29
+ --sar-gray-800-rgb: #{hex-to-rgb($sar-gray-800)};
30
+ --sar-gray-900-rgb: #{hex-to-rgb($sar-gray-900)};
31
+ --sar-black-rgb: #{hex-to-rgb($sar-black)};
32
32
 
33
33
  // # 基础颜色
34
34
  --sar-blue: #{$sar-blue};
@@ -43,16 +43,16 @@ page {
43
43
  --sar-cyan: #{$sar-cyan};
44
44
 
45
45
  // # 基础颜色 rgb
46
- --sar-blue-rgb: #{extractRGB($sar-blue)};
47
- --sar-indigo-rgb: #{extractRGB($sar-indigo)};
48
- --sar-purple-rgb: #{extractRGB($sar-purple)};
49
- --sar-pink-rgb: #{extractRGB($sar-pink)};
50
- --sar-red-rgb: #{extractRGB($sar-red)};
51
- --sar-orange-rgb: #{extractRGB($sar-orange)};
52
- --sar-yellow-rgb: #{extractRGB($sar-yellow)};
53
- --sar-green-rgb: #{extractRGB($sar-green)};
54
- --sar-teal-rgb: #{extractRGB($sar-teal)};
55
- --sar-cyan-rgb: #{extractRGB($sar-cyan)};
46
+ --sar-blue-rgb: #{hex-to-rgb($sar-blue)};
47
+ --sar-indigo-rgb: #{hex-to-rgb($sar-indigo)};
48
+ --sar-purple-rgb: #{hex-to-rgb($sar-purple)};
49
+ --sar-pink-rgb: #{hex-to-rgb($sar-pink)};
50
+ --sar-red-rgb: #{hex-to-rgb($sar-red)};
51
+ --sar-orange-rgb: #{hex-to-rgb($sar-orange)};
52
+ --sar-yellow-rgb: #{hex-to-rgb($sar-yellow)};
53
+ --sar-green-rgb: #{hex-to-rgb($sar-green)};
54
+ --sar-teal-rgb: #{hex-to-rgb($sar-teal)};
55
+ --sar-cyan-rgb: #{hex-to-rgb($sar-cyan)};
56
56
 
57
57
  // # 主题色
58
58
  --sar-primary: var(--sar-blue);
@@ -69,7 +69,7 @@ export default _defineComponent({
69
69
  onMounted(() => {
70
70
  nextTick(setTableRect);
71
71
  });
72
- uni.onWindowResize(setTableRect);
72
+ uni.onWindowResize?.(setTableRect);
73
73
  const fixedRow = computed(() => {
74
74
  return !isNullish(props.height);
75
75
  });
@@ -97,5 +97,5 @@ export default _defineComponent({
97
97
  </script>
98
98
 
99
99
  <style lang="scss">
100
- @import './index.scss';
100
+ @use './index.scss';
101
101
  </style>
@@ -1,4 +1,5 @@
1
1
  @use 'sass:list';
2
+ @use 'sass:map';
2
3
  @use '../style/base' as *;
3
4
 
4
5
  $sar-tag-sizes: (
@@ -53,9 +54,9 @@ $sar-tag-sizes: (
53
54
  // 尺寸
54
55
  @each $size, $value in $sar-tag-sizes {
55
56
  @include m($size) {
56
- padding: map-get($value, padding);
57
- font-size: map-get($value, font-size);
58
- border-radius: map-get($value, border-radius);
57
+ padding: map.get($value, padding);
58
+ font-size: map.get($value, font-size);
59
+ border-radius: map.get($value, border-radius);
59
60
  }
60
61
  }
61
62
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "id": "sard-uniapp",
3
3
  "name": "sard-uniapp",
4
4
  "displayName": "sard-uniapp",
5
- "version": "1.10.2",
5
+ "version": "1.10.4",
6
6
  "description": "sard-uniapp 是一套基于 Uniapp + Vue3 框架开发的兼容多端的 UI 组件库",
7
7
  "main": "index.js",
8
8
  "scripts": {
@@ -71,24 +71,24 @@
71
71
  "@commitlint/config-conventional": "^17.8.1",
72
72
  "@commitlint/prompt-cli": "^17.8.1",
73
73
  "@dcloudio/types": "^3.4.14",
74
- "@dcloudio/uni-app": "3.0.0-alpha-4030120241021001",
75
- "@dcloudio/uni-app-plus": "3.0.0-alpha-4030120241021001",
76
- "@dcloudio/uni-automator": "3.0.0-alpha-4030120241021001",
77
- "@dcloudio/uni-cli-shared": "3.0.0-alpha-4030120241021001",
78
- "@dcloudio/uni-components": "3.0.0-alpha-4030120241021001",
79
- "@dcloudio/uni-h5": "3.0.0-alpha-4030120241021001",
80
- "@dcloudio/uni-mp-alipay": "3.0.0-alpha-4030120241021001",
81
- "@dcloudio/uni-mp-baidu": "3.0.0-alpha-4030120241021001",
82
- "@dcloudio/uni-mp-jd": "3.0.0-alpha-4030120241021001",
83
- "@dcloudio/uni-mp-kuaishou": "3.0.0-alpha-4030120241021001",
84
- "@dcloudio/uni-mp-lark": "3.0.0-alpha-4030120241021001",
85
- "@dcloudio/uni-mp-qq": "3.0.0-alpha-4030120241021001",
86
- "@dcloudio/uni-mp-toutiao": "3.0.0-alpha-4030120241021001",
87
- "@dcloudio/uni-mp-weixin": "3.0.0-alpha-4030120241021001",
88
- "@dcloudio/uni-mp-xhs": "3.0.0-alpha-4030120241021001",
89
- "@dcloudio/uni-quickapp-webview": "3.0.0-alpha-4030120241021001",
90
- "@dcloudio/uni-stacktracey": "3.0.0-alpha-4030120241021001",
91
- "@dcloudio/vite-plugin-uni": "3.0.0-alpha-4030120241021001",
74
+ "@dcloudio/uni-app": "3.0.0-4040520250104002",
75
+ "@dcloudio/uni-app-plus": "3.0.0-4040520250104002",
76
+ "@dcloudio/uni-automator": "3.0.0-4040520250104002",
77
+ "@dcloudio/uni-cli-shared": "3.0.0-4040520250104002",
78
+ "@dcloudio/uni-components": "3.0.0-4040520250104002",
79
+ "@dcloudio/uni-h5": "3.0.0-4040520250104002",
80
+ "@dcloudio/uni-mp-alipay": "3.0.0-4040520250104002",
81
+ "@dcloudio/uni-mp-baidu": "3.0.0-4040520250104002",
82
+ "@dcloudio/uni-mp-jd": "3.0.0-4040520250104002",
83
+ "@dcloudio/uni-mp-kuaishou": "3.0.0-4040520250104002",
84
+ "@dcloudio/uni-mp-lark": "3.0.0-4040520250104002",
85
+ "@dcloudio/uni-mp-qq": "3.0.0-4040520250104002",
86
+ "@dcloudio/uni-mp-toutiao": "3.0.0-4040520250104002",
87
+ "@dcloudio/uni-mp-weixin": "3.0.0-4040520250104002",
88
+ "@dcloudio/uni-mp-xhs": "3.0.0-4040520250104002",
89
+ "@dcloudio/uni-quickapp-webview": "3.0.0-4040520250104002",
90
+ "@dcloudio/uni-stacktracey": "3.0.0-4040520250104002",
91
+ "@dcloudio/vite-plugin-uni": "3.0.0-4040520250104002",
92
92
  "@esbuild/darwin-x64": "^0.21.5",
93
93
  "@gunny/perf-test": "^0.1.3",
94
94
  "@rollup/rollup-darwin-x64": "^4.24.0",
@@ -99,7 +99,7 @@
99
99
  "@typescript-eslint/parser": "^5.62.0",
100
100
  "@vitejs/plugin-vue": "^4.6.2",
101
101
  "@vitejs/plugin-vue-jsx": "^3.1.0",
102
- "@vue/runtime-core": "^3.5.12",
102
+ "@vue/runtime-core": "^3.5.13",
103
103
  "@vue/test-utils": "^2.4.6",
104
104
  "consola": "^3.2.3",
105
105
  "conventional-changelog-cli": "^4.1.0",
@@ -116,17 +116,17 @@
116
116
  "prettier": "^2.8.8",
117
117
  "region-data": "^1.2.3",
118
118
  "sard-cli": "^1.0.9",
119
- "sass": "^1.49.11",
119
+ "sass": "^1.69.7",
120
120
  "tel-area-code": "^1.0.1",
121
121
  "ts-custom-error": "^3.3.1",
122
122
  "tsx": "^4.19.2",
123
123
  "typescript": "~5.6.2",
124
124
  "typescript-eslint": "^8.17.0",
125
- "vite": "6.0.6",
125
+ "vite": "5.2.8",
126
126
  "vite-plugin-eslint": "^1.8.1",
127
127
  "vitest": "^1.6.0",
128
- "vue": "^3.5.12",
129
- "vue-i18n": "^9.14.1",
128
+ "vue": "^3.5.13",
129
+ "vue-i18n": "^9.14.2",
130
130
  "vue-tsc": "^2.0.29"
131
131
  },
132
132
  "author": "wuzhitao",
@@ -219,5 +219,8 @@
219
219
  },
220
220
  "pnpm": {
221
221
  "overrides": {}
222
+ },
223
+ "dependencies": {
224
+ "@dcloudio/uni-app-harmony": "3.0.0-4040520250104002"
222
225
  }
223
226
  }