sard-uniapp 1.19.1 → 1.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/components/action-sheet/variables.scss +1 -1
  3. package/components/calendar/calendar.vue +2 -2
  4. package/components/calendar-input/calendar-input.d.ts +3 -2
  5. package/components/calendar-input/calendar-input.vue +1 -0
  6. package/components/calendar-input/common.d.ts +2 -0
  7. package/components/calendar-popout/calendar-popout.d.ts +12 -2
  8. package/components/calendar-popout/calendar-popout.vue +7 -1
  9. package/components/calendar-popout/common.d.ts +2 -0
  10. package/components/cascader-input/cascader-input.d.ts +2 -1
  11. package/components/cascader-input/cascader-input.vue +7 -6
  12. package/components/cascader-input/common.d.ts +2 -0
  13. package/components/cascader-input/common.js +1 -0
  14. package/components/cascader-popout/cascader-popout.d.ts +1 -1
  15. package/components/cascader-popout/cascader-popout.vue +2 -2
  16. package/components/check-icon/variables.scss +1 -1
  17. package/components/checkbox/variables.scss +1 -1
  18. package/components/checkbox-input/checkbox-input.d.ts +1 -0
  19. package/components/checkbox-input/checkbox-input.vue +3 -2
  20. package/components/checkbox-input/common.d.ts +2 -0
  21. package/components/checkbox-input/common.js +5 -1
  22. package/components/config/index.d.ts +44 -1
  23. package/components/config/index.js +36 -0
  24. package/components/datetime-picker-input/common.d.ts +2 -0
  25. package/components/datetime-picker-input/common.js +1 -0
  26. package/components/datetime-picker-input/datetime-picker-input.d.ts +2 -1
  27. package/components/datetime-picker-input/datetime-picker-input.vue +1 -0
  28. package/components/datetime-picker-popout/datetime-picker-popout.d.ts +1 -1
  29. package/components/datetime-picker-popout/datetime-picker-popout.vue +2 -2
  30. package/components/datetime-range-picker-input/common.d.ts +2 -0
  31. package/components/datetime-range-picker-input/common.js +1 -0
  32. package/components/datetime-range-picker-input/datetime-range-picker-input.d.ts +1 -0
  33. package/components/datetime-range-picker-input/datetime-range-picker-input.vue +1 -0
  34. package/components/datetime-range-picker-popout/datetime-range-picker-popout.vue +2 -2
  35. package/components/dialog/dialog.d.ts +1 -1
  36. package/components/dialog-agent/dialog-agent.d.ts +1 -1
  37. package/components/dropdown/dropdown.d.ts +1 -1
  38. package/components/dropdown/variables.scss +1 -1
  39. package/components/empty/variables.scss +1 -1
  40. package/components/input/common.d.ts +1 -0
  41. package/components/input/index.scss +0 -20
  42. package/components/input/input.vue +16 -17
  43. package/components/input/variables.scss +2 -2
  44. package/components/picker/common.d.ts +1 -1
  45. package/components/picker/common.js +18 -6
  46. package/components/picker/picker.vue +30 -15
  47. package/components/picker-input/common.d.ts +2 -0
  48. package/components/picker-input/common.js +2 -0
  49. package/components/picker-input/picker-input.d.ts +2 -1
  50. package/components/picker-input/picker-input.vue +3 -2
  51. package/components/picker-popout/picker-popout.d.ts +1 -1
  52. package/components/picker-popout/picker-popout.vue +9 -4
  53. package/components/popout/common.d.ts +1 -0
  54. package/components/popout/popout.d.ts +1 -1
  55. package/components/popout/popout.vue +1 -0
  56. package/components/popout-input/popout-input.vue +1 -0
  57. package/components/popout-input/variables.scss +1 -1
  58. package/components/pull-down-refresh/pull-down-refresh.d.ts +1 -1
  59. package/components/qrcode/common.d.ts +2 -0
  60. package/components/qrcode/qrcode.vue +58 -61
  61. package/components/radio/variables.scss +1 -1
  62. package/components/radio-input/common.d.ts +3 -1
  63. package/components/radio-input/common.js +5 -1
  64. package/components/radio-input/radio-input.d.ts +1 -0
  65. package/components/radio-input/radio-input.vue +3 -2
  66. package/components/radio-popout/common.d.ts +1 -1
  67. package/components/rate/rate.d.ts +1 -1
  68. package/components/rate/variables.scss +1 -1
  69. package/components/search/variables.scss +1 -1
  70. package/components/share-sheet/variables.scss +1 -1
  71. package/components/stepper/variables.scss +1 -1
  72. package/components/style/variables-dark.scss +10 -6
  73. package/components/style/variables.scss +17 -11
  74. package/components/tag/common.d.ts +1 -1
  75. package/components/tag/index.scss +5 -1
  76. package/components/tag/tag.vue +2 -2
  77. package/components/timeline/variables.scss +1 -1
  78. package/components/tree/variables.scss +3 -3
  79. package/components/upload/common.d.ts +1 -0
  80. package/components/upload/upload.d.ts +1 -1
  81. package/components/upload/upload.vue +45 -26
  82. package/package.json +2 -2
  83. package/use/useFormPopout.d.ts +1 -1
  84. package/use/useFormPopout.js +4 -1
  85. package/use/usePopoutInput.d.ts +2 -1
  86. package/use/usePopoutInput.js +7 -4
@@ -2,7 +2,7 @@
2
2
  <view :class="qrcodeClass" :style="qrcodeStyle">
3
3
  <view :class="bem.e('canvas-wrapper')">
4
4
  <canvas
5
- type="2d"
5
+ :class="canvasId"
6
6
  :width="canvasSize"
7
7
  :height="canvasSize"
8
8
  :style="{ width: canvasSize + 'px', height: canvasSize + 'px' }"
@@ -10,7 +10,12 @@
10
10
  :id="canvasId"
11
11
  ></canvas>
12
12
  </view>
13
- <image :src="dataURL" mode="aspectFit" :class="bem.e('image')" />
13
+ <image
14
+ :src="dataURL"
15
+ :show-menu-by-longpress="showMenuByLongpress"
16
+ mode="aspectFit"
17
+ :class="bem.e('image')"
18
+ />
14
19
  <slot></slot>
15
20
  </view>
16
21
  </template>
@@ -30,9 +35,7 @@ import {
30
35
  stringifyStyle,
31
36
  createBem,
32
37
  uniqid,
33
- qrcode,
34
- isApp,
35
- getNode
38
+ qrcode
36
39
  } from "../../utils";
37
40
  import { defaultQrcodeProps } from "./common";
38
41
  export default _defineComponent({
@@ -53,7 +56,9 @@ export default _defineComponent({
53
56
  canvasSize: { type: Number, required: false },
54
57
  color: { type: String, required: false },
55
58
  bgColor: { type: String, required: false },
56
- quietZoneModules: { type: Number, required: false }
59
+ quietZoneModules: { type: Number, required: false },
60
+ showMenuByLongpress: { type: Boolean, required: false },
61
+ icon: { type: String, required: false }
57
62
  }, defaultQrcodeProps),
58
63
  setup(__props, { expose: __expose }) {
59
64
  __expose();
@@ -62,14 +67,13 @@ export default _defineComponent({
62
67
  const instance = getCurrentInstance();
63
68
  const canvasId = uniqid();
64
69
  const contextRef = shallowRef();
65
- const canvasRef = shallowRef();
66
70
  const qrcodeMap = computed(() => {
67
71
  return qrcode(props.text, {
68
72
  ecl: props.ecl
69
73
  });
70
74
  });
71
75
  const dataURL = ref("");
72
- const drawQrcodeInApp = () => {
76
+ const drawQrcode = async () => {
73
77
  const context = contextRef.value;
74
78
  if (!context) {
75
79
  return;
@@ -94,76 +98,69 @@ export default _defineComponent({
94
98
  }
95
99
  });
96
100
  });
97
- context.draw();
98
- uni.canvasToTempFilePath({
99
- x: 0,
100
- y: 0,
101
- width: size,
102
- height: size,
103
- destWidth: size,
104
- destHeight: size,
105
- canvasId,
106
- success(res) {
107
- dataURL.value = res.tempFilePath;
108
- }
101
+ await drawIcon(context);
102
+ context.draw(false, () => {
103
+ uni.canvasToTempFilePath(
104
+ {
105
+ x: 0,
106
+ y: 0,
107
+ width: size,
108
+ height: size,
109
+ destWidth: size,
110
+ destHeight: size,
111
+ canvasId,
112
+ success(res) {
113
+ dataURL.value = res.tempFilePath;
114
+ },
115
+ fail(err) {
116
+ console.log("uni.canvasToTempFilePath fail", err);
117
+ }
118
+ },
119
+ instance
120
+ );
109
121
  });
110
122
  };
111
- const drawQrcodeInOthers = () => {
112
- const canvas = canvasRef.value;
113
- if (!canvas) {
114
- return;
123
+ const drawIcon = async (ctx) => {
124
+ if (props.icon) {
125
+ const iconInfo = await loadIcon(props.icon);
126
+ const size = props.canvasSize;
127
+ ctx.save();
128
+ ctx.beginPath();
129
+ ctx.drawImage(iconInfo.path, size * 0.4, size * 0.4, size * 0.2, size * 0.2);
130
+ ctx.restore();
115
131
  }
116
- const map = qrcodeMap.value;
117
- const size = props.canvasSize;
118
- canvas.width = size;
119
- canvas.height = size;
120
- const moduleSize = size / (map.length + props.quietZoneModules * 2);
121
- const margin = moduleSize * props.quietZoneModules;
122
- const context = canvas.getContext("2d");
123
- const path2D = context.createPath2D ? context.createPath2D() : canvas.createPath2D ? canvas.createPath2D() : new Path2D();
124
- map.forEach((row, rowIndex) => {
125
- row.forEach((col, colIndex) => {
126
- if (col === 1) {
127
- path2D.rect(
128
- colIndex * moduleSize + margin,
129
- rowIndex * moduleSize + margin,
130
- moduleSize,
131
- moduleSize
132
- );
132
+ };
133
+ const loadIcon = (path) => {
134
+ return new Promise((resolve, reject) => {
135
+ uni.getImageInfo({
136
+ src: path,
137
+ success(res) {
138
+ resolve(res);
139
+ },
140
+ fail(err) {
141
+ console.log("uni.getImageInfo fail", path);
142
+ console.log("uni.getImageInfo fail", err);
143
+ reject(err);
133
144
  }
134
145
  });
135
146
  });
136
- context.clearRect(0, 0, size, size);
137
- context.fillStyle = props.bgColor;
138
- context.fillRect(0, 0, size, size);
139
- context.fillStyle = props.color;
140
- context.fill(path2D);
141
- dataURL.value = canvas.toDataURL();
142
147
  };
143
148
  watch(
144
149
  [
145
150
  contextRef,
146
- canvasRef,
147
151
  qrcodeMap,
148
152
  () => props.canvasSize,
149
153
  () => props.color,
150
154
  () => props.bgColor,
151
- () => props.quietZoneModules
155
+ () => props.quietZoneModules,
156
+ () => props.icon
152
157
  ],
153
158
  () => {
154
- if (isApp) {
155
- drawQrcodeInApp();
156
- } else {
157
- drawQrcodeInOthers();
158
- }
159
+ drawQrcode();
159
160
  }
160
161
  );
161
162
  onMounted(async () => {
162
- if (isApp) {
163
- contextRef.value = uni.createCanvasContext(canvasId, instance);
164
- } else {
165
- canvasRef.value = await getNode(`#${canvasId}`, instance);
166
- }
163
+ contextRef.value = uni.createCanvasContext(canvasId, instance);
167
164
  });
168
165
  const qrcodeClass = computed(() => {
169
166
  return classNames(bem.b(), props.rootClass);
@@ -174,12 +171,12 @@ export default _defineComponent({
174
171
  height: props.size
175
172
  });
176
173
  });
177
- const __returned__ = { props, bem, instance, canvasId, contextRef, canvasRef, qrcodeMap, dataURL, drawQrcodeInApp, drawQrcodeInOthers, qrcodeClass, qrcodeStyle };
174
+ const __returned__ = { props, bem, instance, canvasId, contextRef, qrcodeMap, dataURL, drawQrcode, drawIcon, loadIcon, qrcodeClass, qrcodeStyle };
178
175
  return __returned__;
179
176
  }
180
177
  });
181
178
  </script>
182
179
 
183
180
  <style lang="scss">
184
- @import './index.scss';
181
+ @use './index.scss' as *;
185
182
  </style>
@@ -5,7 +5,7 @@ page,
5
5
  --sar-radio-group-row-gap: 16rpx;
6
6
 
7
7
  --sar-radio-icon-font-size: 40rpx;
8
- --sar-radio-icon-color: var(--sar-quaternary-color);
8
+ --sar-radio-icon-color: var(--sar-fourth-color);
9
9
  --sar-radio-icon-checked-color: var(--sar-primary);
10
10
  --sar-radio-icon-disabled-color: var(--sar-disabled-color);
11
11
  --sar-radio-icon-transition-duration: var(--sar-duration);
@@ -3,11 +3,13 @@ import { type PopoutInputProps } from '../popout-input/common';
3
3
  import { type RadioPopoutEmits, type RadioPopoutProps } from '../radio-popout/common';
4
4
  export type RadioInputOption = RadioGroupOption;
5
5
  export interface RadioInputProps extends RadioPopoutProps, Omit<PopoutInputProps, 'modelValue'> {
6
+ valueOnClear?: () => any;
6
7
  }
7
8
  export declare const defaultRadioInputProps: () => {
9
+ valueOnClear: RadioInputProps["valueOnClear"];
8
10
  options: () => never[];
9
11
  validateEvent: boolean;
10
- type: RadioInputProps["type"];
12
+ type: RadioPopoutProps["type"];
11
13
  };
12
14
  export interface RadioInputEmits extends RadioPopoutEmits {
13
15
  }
@@ -1,2 +1,6 @@
1
1
  import { defaultRadioPopoutProps, } from '../radio-popout/common';
2
- export const defaultRadioInputProps = defaultRadioPopoutProps;
2
+ import { defaultConfig } from '../config';
3
+ export const defaultRadioInputProps = () => ({
4
+ ...defaultRadioPopoutProps(),
5
+ ...defaultConfig.radioInput,
6
+ });
@@ -10,6 +10,7 @@ declare const _default: import("vue").DefineComponent<RadioInputProps, {}, {}, {
10
10
  }>, {
11
11
  options: import("../radio/common").RadioGroupOption[];
12
12
  type: import("../radio/common").IconType;
13
+ valueOnClear: () => any;
13
14
  validateEvent: boolean;
14
15
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
16
  export default _default;
@@ -37,7 +37,7 @@ import { defaultOptionKeys } from "../radio/common";
37
37
  import {
38
38
  defaultRadioInputProps
39
39
  } from "./common";
40
- import { getMayPrimitiveOption, isNullish } from "../../utils";
40
+ import { getMayPrimitiveOption, isEmptyBinding, isNullish } from "../../utils";
41
41
  import { usePopoutInput } from "../../use";
42
42
  export default _defineComponent({
43
43
  components: {
@@ -52,6 +52,7 @@ export default _defineComponent({
52
52
  },
53
53
  __name: "radio-input",
54
54
  props: _mergeDefaults({
55
+ valueOnClear: { type: Function, required: false },
55
56
  visible: { type: Boolean, required: false },
56
57
  title: { type: String, required: false },
57
58
  popoutClass: { type: String, required: false },
@@ -89,7 +90,7 @@ export default _defineComponent({
89
90
  return isNullish(option) ? "" : getMayPrimitiveOption(option, optionKeys.label);
90
91
  }
91
92
  function getInputValue() {
92
- if (isNullish(innerValue.value) || innerValue.value.length === 0) {
93
+ if (isEmptyBinding(innerValue.value)) {
93
94
  return "";
94
95
  }
95
96
  return getOutletText(props.options, fieldKeys.value, innerValue.value);
@@ -9,7 +9,7 @@ export interface RadioPopoutProps extends RadioGroupProps {
9
9
  export declare const defaultRadioPopoutProps: () => {
10
10
  options: () => never[];
11
11
  validateEvent: boolean;
12
- type: import("../radio-input").RadioInputProps["type"];
12
+ type: RadioPopoutProps["type"];
13
13
  };
14
14
  export interface RadioPopoutSlots {
15
15
  default?(props: Record<string, never>): any;
@@ -6,9 +6,9 @@ declare const _default: import("vue").DefineComponent<RateProps, {}, {}, {}, {},
6
6
  "onUpdate:model-value"?: ((value: number) => any) | undefined;
7
7
  onChange?: ((value: number) => any) | undefined;
8
8
  }>, {
9
+ validateEvent: boolean;
9
10
  count: number;
10
11
  icon: string;
11
- validateEvent: boolean;
12
12
  voidIcon: string;
13
13
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
14
  export default _default;
@@ -3,7 +3,7 @@ page,
3
3
  .sar-portal {
4
4
  --sar-rate-gap: 20rpx;
5
5
  --sar-rate-star-font-size: 40rpx;
6
- --sar-rate-star-void-color: var(--sar-quaternary-color);
6
+ --sar-rate-star-void-color: var(--sar-fourth-color);
7
7
  --sar-rate-star-color: var(--sar-warning);
8
8
  }
9
9
  // #endvariables
@@ -7,6 +7,6 @@ page,
7
7
 
8
8
  --sar-search-input-bg: var(--sar-body-bg);
9
9
  --sar-search-input-disabled-bg: var(--sar-disabled-shallow-bg);
10
- --sar-search-icon-color: var(--sar-quaternary-color);
10
+ --sar-search-icon-color: var(--sar-fourth-color);
11
11
  }
12
12
  // #endvariables
@@ -34,7 +34,7 @@ page,
34
34
  --sar-share-sheet-item-description-margin-top: 0;
35
35
  --sar-share-sheet-item-description-padding-x: 8rpx;
36
36
  --sar-share-sheet-item-description-font-size: var(--sar-text-sm);
37
- --sar-share-sheet-item-description-color: var(--sar-quaternary-color);
37
+ --sar-share-sheet-item-description-color: var(--sar-fourth-color);
38
38
 
39
39
  --sar-share-sheet-gap-bg: var(--sar-body-bg);
40
40
  --sar-share-sheet-gap-height: 16rpx;
@@ -9,7 +9,7 @@ page,
9
9
  --sar-stepper-input-padding-x: 10rpx;
10
10
  --sar-stepper-input-font-size: var(--sar-text-base);
11
11
  --sar-stepper-input-disabled-color: var(--sar-disabled-color);
12
- --sar-stepper-placeholder-color: var(--sar-quaternary-color);
12
+ --sar-stepper-placeholder-color: var(--sar-fourth-color);
13
13
 
14
14
  --sar-stepper-button-font-size: var(--sar-text-lg);
15
15
  --sar-stepper-button-border-radius: var(--sar-rounded-sm);
@@ -11,6 +11,8 @@
11
11
  --sar-secondary-bg: var(--sar-gray-700);
12
12
  --sar-tertiary-color: var(--sar-gray-500);
13
13
  --sar-tertiary-bg: var(--sar-gray-600);
14
+ --sar-fourth-color: var(--sar-gray-600);
15
+ --sar-fourth-bg: var(--sar-gray-500);
14
16
  --sar-quaternary-color: var(--sar-gray-600);
15
17
  --sar-quaternary-bg: var(--sar-gray-500);
16
18
  --sar-emphasis-color: var(--sar-white);
@@ -26,6 +28,8 @@
26
28
  --sar-secondary-bg-rgb: var(--sar-gray-700-rgb);
27
29
  --sar-tertiary-color-rgb: var(--sar-gray-500-rgb);
28
30
  --sar-tertiary-bg-rgb: var(--sar-gray-700-rgb);
31
+ --sar-fourth-color-rgb: var(--sar-gray-600-rgb);
32
+ --sar-fourth-bg-rgb: var(--sar-gray-700-rgb);
29
33
  --sar-quaternary-color-rgb: var(--sar-gray-600-rgb);
30
34
  --sar-quaternary-bg-rgb: var(--sar-gray-700-rgb);
31
35
  --sar-emphasis-color-rgb: var(--sar-white-rgb);
@@ -36,12 +40,12 @@
36
40
  // # 阴影
37
41
  --sar-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.1);
38
42
  --sar-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.2), 0 1px 2px -1px rgb(0 0 0 / 0.2);
39
- --sar-shadow-md: 0 2px 6px -1px rgb(0 0 0 / 0.2),
40
- 0 2px 4px -2px rgb(0 0 0 / 0.1);
41
- --sar-shadow-lg: 0 5px 15px -3px rgb(0 0 0 / 0.2),
42
- 0 4px 6px -4px rgb(0 0 0 / 0.1);
43
- --sar-shadow-xl: 0 10px 25px -5px rgb(0 0 0 / 0.25),
44
- 0 8px 10px -6px rgb(0 0 0 / 0.1);
43
+ --sar-shadow-md:
44
+ 0 2px 6px -1px rgb(0 0 0 / 0.2), 0 2px 4px -2px rgb(0 0 0 / 0.1);
45
+ --sar-shadow-lg:
46
+ 0 5px 15px -3px rgb(0 0 0 / 0.2), 0 4px 6px -4px rgb(0 0 0 / 0.1);
47
+ --sar-shadow-xl:
48
+ 0 10px 25px -5px rgb(0 0 0 / 0.25), 0 8px 10px -6px rgb(0 0 0 / 0.1);
45
49
  --sar-shadow-2xl: 0 15px 50px -12px rgb(0 0 0 / 0.5);
46
50
  --sar-shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.1);
47
51
 
@@ -90,6 +90,8 @@ page,
90
90
  --sar-tertiary-bg: var(--sar-gray-300);
91
91
  --sar-quaternary-color: var(--sar-gray-500);
92
92
  --sar-quaternary-bg: var(--sar-gray-400);
93
+ --sar-fourth-color: var(--sar-gray-500);
94
+ --sar-fourth-bg: var(--sar-gray-400);
93
95
  --sar-emphasis-color: var(--sar-black);
94
96
  --sar-emphasis-bg: var(--sar-white);
95
97
  --sar-border-color: var(--sar-gray-300);
@@ -105,6 +107,8 @@ page,
105
107
  --sar-tertiary-bg-rgb: var(--sar-gray-300-rgb);
106
108
  --sar-quaternary-color-rgb: var(--sar-gray-500-rgb);
107
109
  --sar-quaternary-bg-rgb: var(--sar-gray-400-rgb);
110
+ --sar-fourth-color-rgb: var(--sar-gray-500-rgb);
111
+ --sar-fourth-bg-rgb: var(--sar-gray-400-rgb);
108
112
  --sar-emphasis-color-rgb: var(--sar-black-rgb);
109
113
  --sar-emphasis-bg-rgb: var(--sar-white-rgb);
110
114
  --sar-border-color-rgb: var(--sar-gray-300-rgb);
@@ -119,12 +123,14 @@ page,
119
123
  --sar-rounded-full: 9999px;
120
124
 
121
125
  // # 字体
122
- --sar-font-sans: system-ui, -apple-system, 'Segoe UI', Roboto,
123
- 'Helvetica Neue', Arial, 'Noto Sans', 'Liberation Sans', sans-serif,
124
- 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
126
+ --sar-font-sans:
127
+ system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
128
+ 'Noto Sans', 'Liberation Sans', sans-serif, 'Apple Color Emoji',
129
+ 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
125
130
  --sar-font-serif: ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif;
126
- --sar-font-mono: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono',
127
- 'Courier New', monospace;
131
+ --sar-font-mono:
132
+ SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
133
+ monospace;
128
134
 
129
135
  // # 字号
130
136
  --sar-text-xs: 20rpx;
@@ -150,12 +156,12 @@ page,
150
156
  // # 阴影
151
157
  --sar-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
152
158
  --sar-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
153
- --sar-shadow-md: 0 2px 6px -1px rgb(0 0 0 / 0.1),
154
- 0 2px 4px -2px rgb(0 0 0 / 0.1);
155
- --sar-shadow-lg: 0 3px 15px -3px rgb(0 0 0 / 0.1),
156
- 0 4px 6px -4px rgb(0 0 0 / 0.1);
157
- --sar-shadow-xl: 0 5px 25px -5px rgb(0 0 0 / 0.1),
158
- 0 8px 10px -6px rgb(0 0 0 / 0.1);
159
+ --sar-shadow-md:
160
+ 0 2px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
161
+ --sar-shadow-lg:
162
+ 0 3px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
163
+ --sar-shadow-xl:
164
+ 0 5px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
159
165
  --sar-shadow-2xl: 0 10px 50px -12px rgb(0 0 0 / 0.25);
160
166
  --sar-shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
161
167
 
@@ -5,7 +5,7 @@ export interface TagProps {
5
5
  theme?: 'default' | 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'danger';
6
6
  plain?: boolean;
7
7
  round?: boolean;
8
- mark?: boolean;
8
+ mark?: boolean | 'left' | 'right';
9
9
  size?: 'small' | 'medium' | 'large';
10
10
  color?: string;
11
11
  textColor?: string;
@@ -66,7 +66,11 @@ $sar-tag-sizes: (
66
66
  }
67
67
 
68
68
  // 标记
69
- @include m(mark) {
69
+ @include m(mark-left) {
70
+ border-top-left-radius: var(--sar-rounded-full);
71
+ border-bottom-left-radius: var(--sar-rounded-full);
72
+ }
73
+ @include m(mark, mark-right) {
70
74
  border-top-right-radius: var(--sar-rounded-full);
71
75
  border-bottom-right-radius: var(--sar-rounded-full);
72
76
  }
@@ -32,7 +32,7 @@ export default _defineComponent({
32
32
  theme: { type: String, required: false },
33
33
  plain: { type: Boolean, required: false },
34
34
  round: { type: Boolean, required: false },
35
- mark: { type: Boolean, required: false },
35
+ mark: { type: [Boolean, String], required: false },
36
36
  size: { type: String, required: false },
37
37
  color: { type: String, required: false },
38
38
  textColor: { type: String, required: false },
@@ -51,7 +51,7 @@ export default _defineComponent({
51
51
  bem.m(`${props.theme}-plain`, props.plain),
52
52
  bem.m(props.size),
53
53
  bem.m("round", props.round),
54
- bem.m("mark", props.mark),
54
+ bem.m(props.mark === true ? "mark" : `mark-${props.mark}`, !!props.mark),
55
55
  props.rootClass
56
56
  );
57
57
  });
@@ -10,7 +10,7 @@ page,
10
10
  --sar-timeline-item-icon-wrapper-margin-y: 6rpx;
11
11
 
12
12
  --sar-timeline-item-icon-font-size: 48rpx;
13
- --sar-timeline-item-icon-color: var(--sar-quaternary-bg);
13
+ --sar-timeline-item-icon-color: var(--sar-fourth-bg);
14
14
 
15
15
  --sar-timeline-item-dot-size: 16rpx;
16
16
  --sar-timeline-item-dot-bg: var(--sar-tertiary-bg);
@@ -27,17 +27,17 @@ page,
27
27
 
28
28
  --sar-tree-edit-padding-x: 24rpx;
29
29
  --sar-tree-edit-font-size: 36rpx;
30
- --sar-tree-edit-color: var(--sar-quaternary-color);
30
+ --sar-tree-edit-color: var(--sar-fourth-color);
31
31
  --sar-tree-edit-active-opacity: var(--sar-active-opacity);
32
32
 
33
33
  --sar-tree-level-btn-padding-x: 24rpx;
34
34
  --sar-tree-level-btn-font-size: 36rpx;
35
- --sar-tree-level-btn-color: var(--sar-quaternary-color);
35
+ --sar-tree-level-btn-color: var(--sar-fourth-color);
36
36
  --sar-tree-level-btn-active-opacity: var(--sar-active-opacity);
37
37
 
38
38
  --sar-tree-drag-padding-x: 24rpx;
39
39
  --sar-tree-drag-font-size: 36rpx;
40
- --sar-tree-drag-color: var(--sar-quaternary-color);
40
+ --sar-tree-drag-color: var(--sar-fourth-color);
41
41
  --sar-tree-drag-active-opacity: var(--sar-active-opacity);
42
42
  }
43
43
  // #endvariables
@@ -33,6 +33,7 @@ export interface UploadProps {
33
33
  overSize?: (fileItem: UploadFileItem[]) => void;
34
34
  disabled?: boolean;
35
35
  readonly?: boolean;
36
+ beforeChoose?: (fileList: UploadFileItem[], next: (allowed: boolean) => void) => void;
36
37
  beforeRead?: (file: UploadFile) => boolean | Promise<UploadFile>;
37
38
  afterRead?: (fileItem: UploadFileItem) => void;
38
39
  removable?: boolean;
@@ -10,11 +10,11 @@ declare const __VLS_component: import("vue").DefineComponent<UploadProps, {}, {}
10
10
  onRemove?: ((index: number, item: UploadFileItem) => any) | undefined;
11
11
  }>, {
12
12
  accept: "image" | "video";
13
+ validateEvent: boolean;
13
14
  maxDuration: number;
14
15
  maxCount: number;
15
16
  maxSize: number | ((file: UploadFile) => boolean);
16
17
  removable: boolean;
17
- validateEvent: boolean;
18
18
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
19
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
20
20
  export default _default;
@@ -20,7 +20,7 @@
20
20
  @image-click="onImageClick"
21
21
  />
22
22
  <view
23
- v-if="innerValue.length < maxCount"
23
+ v-if="innerValue.length < maxCount && !isReadonly"
24
24
  :class="bem.e('select')"
25
25
  @click="onSelect"
26
26
  >
@@ -81,6 +81,7 @@ export default _defineComponent({
81
81
  overSize: { type: Function, required: false },
82
82
  disabled: { type: Boolean, required: false },
83
83
  readonly: { type: Boolean, required: false },
84
+ beforeChoose: { type: Function, required: false },
84
85
  beforeRead: { type: Function, required: false },
85
86
  afterRead: { type: Function, required: false },
86
87
  removable: { type: Boolean, required: false },
@@ -201,33 +202,47 @@ export default _defineComponent({
201
202
  );
202
203
  chain(files);
203
204
  }
205
+ let isSelectPending = false;
204
206
  const onSelect = () => {
205
- if (isDisabled.value || isReadonly.value || innerValue.value.length >= props.maxCount) {
207
+ if (isSelectPending || isDisabled.value || isReadonly.value || innerValue.value.length >= props.maxCount) {
206
208
  return;
207
209
  }
208
- chooseMedia({
209
- mediaType: props.accept,
210
- count: props.multiple ? 9999 : 1,
211
- sizeType: props.sizeType,
212
- sourceType: props.sourceType,
213
- maxDuration: props.maxDuration,
214
- camera: props.camera,
215
- success(result) {
216
- toChain(
217
- result.tempFiles.map((file) => {
218
- return {
219
- type: file.fileType,
220
- size: file.size,
221
- path: file.tempFilePath,
222
- duration: file.duration,
223
- width: file.width,
224
- height: file.height
225
- };
226
- })
227
- );
228
- },
229
- fail: noop
230
- });
210
+ const next = () => {
211
+ chooseMedia({
212
+ mediaType: props.accept,
213
+ count: props.multiple ? 9999 : 1,
214
+ sizeType: props.sizeType,
215
+ sourceType: props.sourceType,
216
+ maxDuration: props.maxDuration,
217
+ camera: props.camera,
218
+ success(result) {
219
+ toChain(
220
+ result.tempFiles.map((file) => {
221
+ return {
222
+ type: file.fileType,
223
+ size: file.size,
224
+ path: file.tempFilePath,
225
+ duration: file.duration,
226
+ width: file.width,
227
+ height: file.height
228
+ };
229
+ })
230
+ );
231
+ },
232
+ fail: noop
233
+ });
234
+ };
235
+ if (props.beforeChoose) {
236
+ isSelectPending = true;
237
+ props.beforeChoose?.(innerValue.value, (allowed) => {
238
+ isSelectPending = false;
239
+ if (allowed) {
240
+ next();
241
+ }
242
+ });
243
+ } else {
244
+ next();
245
+ }
231
246
  };
232
247
  const onRemove = (index, item) => {
233
248
  const list = innerValue.value.filter((_, i) => i !== index);
@@ -259,7 +274,11 @@ export default _defineComponent({
259
274
  const uploadStyle = computed(() => {
260
275
  return stringifyStyle(props.rootStyle);
261
276
  });
262
- const __returned__ = { props, emit, bem, formContext, formItemContext, isDisabled, isReadonly, innerValue, limitCountNode, beforeReadNode, toUploadFileNode, limitSizeNode, afterReadNode, toChain, onSelect, onRemove, onImageClick, uploadClass, uploadStyle, SarUploadPreview, SarIcon };
277
+ const __returned__ = { props, emit, bem, formContext, formItemContext, isDisabled, isReadonly, innerValue, limitCountNode, beforeReadNode, toUploadFileNode, limitSizeNode, afterReadNode, toChain, get isSelectPending() {
278
+ return isSelectPending;
279
+ }, set isSelectPending(v) {
280
+ isSelectPending = v;
281
+ }, onSelect, onRemove, onImageClick, uploadClass, uploadStyle, SarUploadPreview, SarIcon };
263
282
  return __returned__;
264
283
  }
265
284
  });
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.19.1",
5
+ "version": "1.19.2",
6
6
  "description": "sard-uniapp 是一套基于 Uniapp + Vue3 框架开发的兼容多端的 UI 组件库",
7
7
  "main": "index.js",
8
8
  "scripts": {
@@ -122,7 +122,7 @@
122
122
  "lodash-es": "^4.17.21",
123
123
  "prettier": "^3.5.3",
124
124
  "region-data": "^1.2.3",
125
- "sard-cli": "^1.2.4",
125
+ "sard-cli": "^1.3.0",
126
126
  "sass": "^1.69.7",
127
127
  "tel-area-code": "^1.1.0",
128
128
  "ts-custom-error": "^3.3.1",
@@ -10,7 +10,7 @@ export interface UseFormPopoutEmits {
10
10
  }
11
11
  export declare function useFormPopout(props: UseFormPopoutProps, emit: UseFormPopoutEmits, options?: {
12
12
  onChange?: (...args: any[]) => void;
13
- onConfirmBefore?: () => void;
13
+ onConfirmBefore?: () => any;
14
14
  }): {
15
15
  innerVisible: import("vue").Ref<boolean | undefined, boolean | undefined>;
16
16
  innerValue: import("vue").Ref<any, any>;