sard-uniapp 1.24.4 → 1.24.6

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 (89) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/components/accordion-item/index.scss +2 -2
  3. package/components/action-sheet/index.scss +4 -4
  4. package/components/avatar/README.md +60 -8
  5. package/components/avatar/avatar.d.ts +5 -1
  6. package/components/avatar/avatar.vue +42 -7
  7. package/components/avatar/common.d.ts +4 -0
  8. package/components/avatar/index.scss +21 -1
  9. package/components/avatar/variables.scss +5 -0
  10. package/components/avatar-group/avatar-group.d.ts +17 -0
  11. package/components/avatar-group/avatar-group.vue +75 -0
  12. package/components/avatar-group/common.d.ts +31 -0
  13. package/components/avatar-group/common.js +3 -0
  14. package/components/avatar-group/index.d.ts +1 -0
  15. package/components/avatar-group/index.js +1 -0
  16. package/components/avatar-group/index.scss +9 -0
  17. package/components/back-top/index.scss +1 -1
  18. package/components/badge/index.scss +1 -1
  19. package/components/button/index.scss +2 -2
  20. package/components/calendar-month/index.scss +3 -3
  21. package/components/card/index.scss +2 -2
  22. package/components/cascader/index.scss +1 -1
  23. package/components/check-icon/index.scss +1 -1
  24. package/components/checkbox-input/checkbox-input.vue +6 -2
  25. package/components/config/index.d.ts +4 -0
  26. package/components/config/index.js +4 -0
  27. package/components/count-down/common.js +1 -1
  28. package/components/crop-image/index.scss +1 -1
  29. package/components/dialog/index.scss +1 -1
  30. package/components/dropdown/index.scss +1 -1
  31. package/components/fab/index.scss +1 -0
  32. package/components/fab-item/index.scss +1 -1
  33. package/components/floating-bubble/index.scss +1 -1
  34. package/components/form/index.scss +1 -1
  35. package/components/grid-item/index.scss +2 -2
  36. package/components/indexes-anchor/index.scss +1 -1
  37. package/components/indexes-nav/index.scss +2 -2
  38. package/components/input/index.scss +2 -2
  39. package/components/keyboard/index.scss +5 -5
  40. package/components/list-item/index.scss +2 -2
  41. package/components/menu-item/index.scss +2 -2
  42. package/components/notice-bar/index.scss +3 -2
  43. package/components/overlay/index.scss +1 -1
  44. package/components/pagination/index.scss +2 -2
  45. package/components/pagination/pagination.d.ts +1 -1
  46. package/components/password-input/index.scss +6 -7
  47. package/components/picker/common.js +2 -1
  48. package/components/picker/picker.vue +11 -14
  49. package/components/picker-input/README.md +4 -0
  50. package/components/picker-input/picker-input.vue +2 -2
  51. package/components/picker-popout/README.md +4 -0
  52. package/components/picker-popout/picker-popout.vue +7 -7
  53. package/components/popout/index.scss +1 -1
  54. package/components/popout/popout.vue +50 -48
  55. package/components/popover/index.scss +3 -3
  56. package/components/progress-bar/index.scss +5 -5
  57. package/components/progress-circle/index.scss +1 -1
  58. package/components/scroll-list/index.scss +2 -2
  59. package/components/search/index.scss +3 -3
  60. package/components/segmented/index.scss +2 -2
  61. package/components/segmented-item/index.scss +1 -1
  62. package/components/share-sheet/index.scss +4 -4
  63. package/components/sidebar-item/index.scss +1 -1
  64. package/components/signature/index.scss +2 -2
  65. package/components/skeleton/index.scss +1 -1
  66. package/components/skeleton-block/index.scss +1 -1
  67. package/components/slider/index.scss +7 -7
  68. package/components/step/index.scss +3 -3
  69. package/components/stepper/index.scss +4 -4
  70. package/components/swiper-dot/index.scss +4 -4
  71. package/components/swiper-dot/swiper-dot.d.ts +1 -1
  72. package/components/switch/index.scss +3 -3
  73. package/components/tab/index.scss +3 -2
  74. package/components/tabbar/index.scss +1 -1
  75. package/components/table/index.scss +1 -1
  76. package/components/table-cell/index.scss +1 -1
  77. package/components/table-row/index.scss +1 -1
  78. package/components/tabs/index.scss +1 -1
  79. package/components/timeline-item/index.scss +2 -2
  80. package/components/toast/index.scss +1 -1
  81. package/components/tree/index.scss +1 -1
  82. package/components/tree-node/index.scss +3 -3
  83. package/components/upload/index.scss +2 -2
  84. package/components/upload-preview/index.scss +5 -5
  85. package/global.d.ts +1 -0
  86. package/index.d.ts +1 -0
  87. package/index.js +1 -0
  88. package/package.json +1 -1
  89. package/utils/dom.js +20 -12
@@ -75,7 +75,7 @@
75
75
  align-items: center;
76
76
  font-size: 60rpx;
77
77
  color: #fff;
78
- background-color: var(--sar-mask-illegible);
78
+ background: var(--sar-mask-illegible);
79
79
  touch-action: none;
80
80
  }
81
81
  }
@@ -5,7 +5,7 @@
5
5
  @include universal;
6
6
  width: var(--sar-dialog-width);
7
7
  max-width: 100%;
8
- background-color: var(--sar-dialog-bg);
8
+ background: var(--sar-dialog-bg);
9
9
  border-radius: var(--sar-dialog-border-radius);
10
10
  }
11
11
 
@@ -5,7 +5,7 @@
5
5
  @include universal;
6
6
  flex-direction: row;
7
7
  height: var(--sar-dropdown-height);
8
- background-color: var(--sar-dropdown-bg);
8
+ background: var(--sar-dropdown-bg);
9
9
  }
10
10
 
11
11
  @include e(shadow) {
@@ -8,6 +8,7 @@
8
8
  bottom: var(--sar-fab-bottom);
9
9
  z-index: var(--sar-fab-z-index);
10
10
  opacity: 0;
11
+ touch-action: none;
11
12
  }
12
13
 
13
14
  @include e(content) {
@@ -38,7 +38,7 @@
38
38
  border-radius: var(--sar-rounded-full);
39
39
  font-size: var(--sar-fab-item-btn-font-size);
40
40
  color: var(--sar-fab-item-btn-color);
41
- background-color: var(--sar-fab-item-btn-bg);
41
+ background: var(--sar-fab-item-btn-bg);
42
42
  box-shadow: var(--sar-fab-item-btn-box-shadow);
43
43
  }
44
44
  }
@@ -13,7 +13,7 @@
13
13
  height: var(--sar-floating-bubble-size);
14
14
  border-radius: var(--sar-rounded-full);
15
15
  color: var(--sar-floating-bubble-color);
16
- background-color: var(--sar-floating-bubble-bg);
16
+ background: var(--sar-floating-bubble-bg);
17
17
  box-shadow: var(--sar-floating-bubble-box-shadow);
18
18
  opacity: 0;
19
19
  cursor: pointer;
@@ -3,7 +3,7 @@
3
3
  @include bem(form) {
4
4
  @include b() {
5
5
  @include universal;
6
- background-color: var(--sar-form-bg);
6
+ background: var(--sar-form-bg);
7
7
  }
8
8
 
9
9
  @include m(card) {
@@ -20,7 +20,7 @@
20
20
  padding-right: var(--sar-grid-item-padding-x);
21
21
  padding-bottom: var(--sar-grid-item-padding-y);
22
22
  padding-left: var(--sar-grid-item-padding-x);
23
- background-color: var(--sar-grid-bg);
23
+ background: var(--sar-grid-bg);
24
24
  }
25
25
 
26
26
  @include e(main) {
@@ -120,7 +120,7 @@
120
120
  @include e(content) {
121
121
  cursor: pointer;
122
122
  &:active {
123
- background-color: var(--sar-grid-active-bg);
123
+ background: var(--sar-grid-active-bg);
124
124
  }
125
125
  }
126
126
  }
@@ -10,6 +10,6 @@
10
10
  font-size: var(--sar-indexes-anchor-font-size);
11
11
  line-height: var(--sar-indexes-anchor-line-height);
12
12
  color: var(--sar-indexes-anchor-color);
13
- background-color: var(--sar-indexes-anchor-bg);
13
+ background: var(--sar-indexes-anchor-bg);
14
14
  }
15
15
  }
@@ -25,7 +25,7 @@
25
25
 
26
26
  @include m(active) {
27
27
  color: var(--sar-indexes-nav-item-active-color);
28
- background-color: var(--sar-indexes-nav-item-active-bg);
28
+ background: var(--sar-indexes-nav-item-active-bg);
29
29
  }
30
30
  }
31
31
 
@@ -40,7 +40,7 @@
40
40
  justify-content: center;
41
41
  margin-right: var(--sar-indexes-hint-margin-right);
42
42
  border-radius: 50% 0 50% 50%;
43
- background-color: var(--sar-indexes-hint-bg);
43
+ background: var(--sar-indexes-hint-bg);
44
44
  transform-origin: top right;
45
45
  transform: rotate(45deg);
46
46
  pointer-events: none;
@@ -34,7 +34,7 @@
34
34
  }
35
35
 
36
36
  @include m(disabled) {
37
- background-color: var(--sar-disabled-shallow-bg);
37
+ background: var(--sar-disabled-shallow-bg);
38
38
  }
39
39
  }
40
40
 
@@ -58,7 +58,7 @@
58
58
  border-width: 0;
59
59
  font-size: var(--sar-input-control-font-size);
60
60
  line-height: var(--sar-input-control-line-height);
61
- background-color: transparent;
61
+ background: var(--sar-input-bg);
62
62
 
63
63
  @include m(input) {
64
64
  height: var(--sar-input-control-input-height);
@@ -4,7 +4,7 @@
4
4
  @include b() {
5
5
  @include universal;
6
6
  padding: var(--sar-keyboard-padding);
7
- background-color: var(--sar-keyboard-bg);
7
+ background: var(--sar-keyboard-bg);
8
8
  }
9
9
 
10
10
  @include e(content) {
@@ -31,11 +31,11 @@
31
31
  border-radius: var(--sar-keyboard-key-border-radius);
32
32
  font-size: var(--sar-keyboard-key-font-size);
33
33
  color: var(--sar-keyboard-key-color);
34
- background-color: var(--sar-keyboard-key-bg);
34
+ background: var(--sar-keyboard-key-bg);
35
35
  cursor: pointer;
36
36
 
37
37
  &:active {
38
- background-color: var(--sar-keyboard-key-active-bg);
38
+ background: var(--sar-keyboard-key-active-bg);
39
39
  }
40
40
  }
41
41
 
@@ -57,10 +57,10 @@
57
57
  max-width: 20%;
58
58
 
59
59
  @include e(key) {
60
- background-color: var(--sar-keyboard-key-plate-bg);
60
+ background: var(--sar-keyboard-key-plate-bg);
61
61
 
62
62
  &:active {
63
- background-color: var(--sar-keyboard-key-plate-active-bg);
63
+ background: var(--sar-keyboard-key-plate-active-bg);
64
64
  }
65
65
  }
66
66
  }
@@ -8,7 +8,7 @@
8
8
  overflow: hidden;
9
9
  min-height: var(--sar-list-item-min-height);
10
10
  padding: var(--sar-list-item-padding-y) var(--sar-list-item-padding-x);
11
- background-color: var(--sar-list-item-bg);
11
+ background: var(--sar-list-item-bg);
12
12
 
13
13
  &:first-child {
14
14
  border-top-left-radius: inherit;
@@ -40,7 +40,7 @@
40
40
  cursor: pointer;
41
41
 
42
42
  &:active {
43
- background-color: var(--sar-list-item-active-bg);
43
+ background: var(--sar-list-item-active-bg);
44
44
  }
45
45
  }
46
46
 
@@ -81,7 +81,7 @@
81
81
  @include e(item) {
82
82
  @include m-not(disabled) {
83
83
  &:active {
84
- background-color: var(--sar-menu-item-active-bg);
84
+ background: var(--sar-menu-item-active-bg);
85
85
  }
86
86
  }
87
87
 
@@ -97,7 +97,7 @@
97
97
  @include e(item) {
98
98
  @include m-not(disabled) {
99
99
  &:active {
100
- background-color: var(--sar-menu-item-dark-active-bg);
100
+ background: var(--sar-menu-item-dark-active-bg);
101
101
  }
102
102
  }
103
103
 
@@ -8,7 +8,7 @@
8
8
  align-items: center;
9
9
  min-height: var(--sar-notice-bar-min-height);
10
10
  padding: 0 var(--sar-notice-bar-padding-x);
11
- background-color: var(--sar-notice-bar-bg);
11
+ background: var(--sar-notice-bar-bg);
12
12
  color: var(--sar-notice-bar-color);
13
13
 
14
14
  @include m(wrap) {
@@ -64,7 +64,8 @@
64
64
 
65
65
  @include m(infinite) {
66
66
  @include e(wrapper) {
67
- animation: #{bem-ns(notice-bar-scroll-infinite)} linear both running infinite;
67
+ animation: #{bem-ns(notice-bar-scroll-infinite)} linear both running
68
+ infinite;
68
69
  }
69
70
  }
70
71
 
@@ -9,7 +9,7 @@
9
9
  right: 0;
10
10
  bottom: 0;
11
11
  z-index: var(--sar-overlay-z-index);
12
- background-color: var(--sar-overlay-bg);
12
+ background: var(--sar-overlay-bg);
13
13
  touch-action: none;
14
14
 
15
15
  @include m(enter-from, leave-to) {
@@ -28,7 +28,7 @@
28
28
  @include m(current) {
29
29
  z-index: 3;
30
30
  color: var(--sar-pagination-item-current-color);
31
- background-color: var(--sar-pagination-item-current-bg);
31
+ background: var(--sar-pagination-item-current-bg);
32
32
  border-color: var(--sar-pagination-item-current-border-color);
33
33
  }
34
34
 
@@ -38,7 +38,7 @@
38
38
 
39
39
  @include m-not(disabled, current) {
40
40
  &:active {
41
- background-color: var(--sar-pagination-item-active-bg);
41
+ background: var(--sar-pagination-item-active-bg);
42
42
  }
43
43
  }
44
44
  }
@@ -8,8 +8,8 @@ declare const __VLS_component: import("vue").DefineComponent<PaginationProps, {}
8
8
  "onUpdate:current"?: ((page: number) => any) | undefined;
9
9
  }>, {
10
10
  type: "simple" | "multi";
11
- current: number;
12
11
  total: number;
12
+ current: number;
13
13
  pageSize: number;
14
14
  pageButtonCount: number;
15
15
  multiCount: number;
@@ -28,17 +28,16 @@
28
28
  width: var(--sar-password-input-ciphertext-size);
29
29
  height: var(--sar-password-input-ciphertext-size);
30
30
  border-radius: var(--sar-rounded-full);
31
- background-color: var(--sar-password-input-ciphertext-bg);
31
+ background: var(--sar-password-input-ciphertext-bg);
32
32
  }
33
33
 
34
34
  @include e(cursor) {
35
35
  @include universal;
36
36
  width: var(--sar-password-input-cursor-width);
37
37
  height: var(--sar-password-input-cursor-height);
38
- background-color: var(--sar-password-input-cursor-color);
39
- animation: var(--sar-password-input-cursor-animation-duration) #{bem-ns(
40
- password-input-cursor-flicker
41
- )} infinite;
38
+ background: var(--sar-password-input-cursor-color);
39
+ animation: var(--sar-password-input-cursor-animation-duration)
40
+ #{bem-ns(password-input-cursor-flicker)} infinite;
42
41
  }
43
42
 
44
43
  @keyframes #{bem-ns(password-input-cursor-flicker)} {
@@ -128,11 +127,11 @@
128
127
  color: var(--sar-disabled-color);
129
128
 
130
129
  @include e(item) {
131
- background-color: var(--sar-disabled-shallow-bg);
130
+ background: var(--sar-disabled-shallow-bg);
132
131
  }
133
132
 
134
133
  @include e(ciphertext) {
135
- background-color: var(--sar-disabled-color);
134
+ background: var(--sar-disabled-color);
136
135
  }
137
136
  }
138
137
  }
@@ -113,8 +113,9 @@ export function getInitialValue(columns, optionKeys) {
113
113
  ];
114
114
  case 'cascader': {
115
115
  const options = [];
116
+ recurse(columns, options);
116
117
  return [
117
- getValueOrLabelByOption(recurse(columns, options), optionKeys.value),
118
+ options.map((option) => getValueOrLabelByOption(option, optionKeys.value)),
118
119
  options,
119
120
  ];
120
121
  }
@@ -39,7 +39,8 @@ import {
39
39
  toArray,
40
40
  arrayEqual,
41
41
  isNumber,
42
- isEmptyBinding
42
+ isEmptyBinding,
43
+ isEmptyArray
43
44
  } from "../../utils";
44
45
  import {
45
46
  defaultOptionKeys,
@@ -112,17 +113,12 @@ export default _defineComponent({
112
113
  columnIndexes.value = indexes;
113
114
  }
114
115
  };
115
- watch(
116
- [innerValue, () => props.columns, fieldKeys],
117
- () => {
118
- if (!isEmptyBinding(innerValue.value)) {
119
- updateColumnIndexes();
120
- }
121
- },
122
- {
123
- immediate: true
116
+ updateColumnIndexes();
117
+ watch([innerValue, () => props.columns, fieldKeys], () => {
118
+ if (!isEmptyBinding(innerValue.value) && !isEmptyArray(innerValue.value)) {
119
+ updateColumnIndexes();
124
120
  }
125
- );
121
+ });
126
122
  const onChange = (event) => {
127
123
  if (!props.columns || props.columns.length === 0) {
128
124
  return;
@@ -130,10 +126,11 @@ export default _defineComponent({
130
126
  let indexes = event.detail.value;
131
127
  if (indexes.some((index) => index === Infinity)) {
132
128
  nextTick(() => {
133
- columnIndexes.value = isEmptyBinding(innerValue.value) ? columnIndexes.value.map(() => 0) : [...columnIndexes.value];
129
+ columnIndexes.value = isEmptyBinding(innerValue.value) || isEmptyArray(innerValue.value) ? columnIndexes.value.map(() => 0) : [...columnIndexes.value];
134
130
  });
135
131
  return;
136
132
  }
133
+ indexes = renderedColumns.value.map((_, index) => indexes[index] || 0);
137
134
  if (columnsType.value === "cascader") {
138
135
  let startIndex = -1;
139
136
  const nextIndexes = [];
@@ -195,7 +192,7 @@ export default _defineComponent({
195
192
  watch(
196
193
  [() => props.columns, innerValue],
197
194
  ([newColumns, newValue], [oldColumns, oldValue]) => {
198
- if (newColumns !== oldColumns || newValue !== oldValue && columnsType.value === "cascader" && !isEmptyBinding(newValue) && (!Array.isArray(newValue) || newValue.length > 0)) {
195
+ if (newColumns !== oldColumns || newValue !== oldValue && columnsType.value === "cascader" && !isEmptyBinding(newValue) && !isEmptyArray(newValue)) {
199
196
  updateRenderedColumns();
200
197
  }
201
198
  }
@@ -203,7 +200,7 @@ export default _defineComponent({
203
200
  watch(
204
201
  () => props.modelValue,
205
202
  () => {
206
- if (isEmptyBinding(props.modelValue)) {
203
+ if (isEmptyBinding(props.modelValue) || isEmptyArray(props.modelValue)) {
207
204
  updateColumnIndexes();
208
205
  updateRenderedColumns();
209
206
  }
@@ -25,6 +25,10 @@ import PickerInput from 'sard-uniapp/components/picker-input/picker-input.vue'
25
25
 
26
26
  @code('${DEMO_PATH}/picker-input/demo/Basic.vue')
27
27
 
28
+ ### 级联选择
29
+
30
+ @code('${DEMO_PATH}/picker-input/demo/Cascaded.vue')
31
+
28
32
  ## API
29
33
 
30
34
  ### PickerInputProps
@@ -71,7 +71,7 @@ import {
71
71
  getOptionsByIndexes,
72
72
  getValueOrLabelByOption
73
73
  } from "../picker/common";
74
- import { isEmptyBinding, toArray } from "../../utils";
74
+ import { isEmptyArray, isEmptyBinding, toArray } from "../../utils";
75
75
  import { usePopoutInput } from "../../use";
76
76
  import {
77
77
  defaultPickerInputProps
@@ -180,7 +180,7 @@ export default _defineComponent({
180
180
  return labels.join("/");
181
181
  }
182
182
  function getInputValue() {
183
- if (isEmptyBinding(innerValue.value)) {
183
+ if (isEmptyBinding(innerValue.value) || isEmptyArray(innerValue.value)) {
184
184
  return "";
185
185
  }
186
186
  return getOutletText(props.columns, fieldKeys.value, innerValue.value);
@@ -24,6 +24,10 @@ import PickerPopout from 'sard-uniapp/components/picker-popout/picker-popout.vue
24
24
 
25
25
  @code('${DEMO_PATH}/picker-popout/demo/Basic.vue')
26
26
 
27
+ ### 级联选择
28
+
29
+ @code('${DEMO_PATH}/picker-popout/demo/Cascaded.vue')
30
+
27
31
  ## API
28
32
 
29
33
  ### PickerPopoutProps
@@ -54,7 +54,7 @@ import SarPicker from "../picker/picker.vue";
54
54
  import {
55
55
  defaultPickerPopoutProps
56
56
  } from "./common";
57
- import { isEmptyBinding, isNumber } from "../../utils";
57
+ import { isEmptyArray, isEmptyBinding, isNumber } from "../../utils";
58
58
  import { defaultOptionKeys, getInitialValue } from "../picker/common";
59
59
  import { computed } from "vue";
60
60
  import { useFormPopout } from "../../use";
@@ -116,6 +116,9 @@ export default _defineComponent({
116
116
  __expose();
117
117
  const props = __props;
118
118
  const emit = __emit;
119
+ const fieldKeys = computed(() => {
120
+ return Object.assign({}, defaultOptionKeys, props.optionKeys);
121
+ });
119
122
  const {
120
123
  innerVisible,
121
124
  innerValue,
@@ -125,7 +128,7 @@ export default _defineComponent({
125
128
  onVisibleHook
126
129
  } = useFormPopout(props, emit, {
127
130
  onConfirmBefore() {
128
- if (isEmptyBinding(popoutValue.value)) {
131
+ if (isEmptyBinding(popoutValue.value) || isEmptyArray(popoutValue.value)) {
129
132
  const [initialValue, selectedOptions] = getInitialValue(
130
133
  props.columns,
131
134
  fieldKeys.value
@@ -135,15 +138,12 @@ export default _defineComponent({
135
138
  }
136
139
  }
137
140
  });
138
- const fieldKeys = computed(() => {
139
- return Object.assign({}, defaultOptionKeys, props.optionKeys);
140
- });
141
141
  const onEnter = () => {
142
- if (!isEmptyBinding(innerValue.value) && popoutValue.value !== innerValue.value) {
142
+ if (!isEmptyBinding(innerValue.value) && !isEmptyArray(innerValue.value) && popoutValue.value !== innerValue.value) {
143
143
  popoutValue.value = innerValue.value;
144
144
  }
145
145
  };
146
- const __returned__ = { props, emit, innerVisible, innerValue, popoutValue, onChange, onConfirm, onVisibleHook, fieldKeys, onEnter, SarPopout, SarPicker, get isNumber() {
146
+ const __returned__ = { props, emit, fieldKeys, innerVisible, innerValue, popoutValue, onChange, onConfirm, onVisibleHook, onEnter, SarPopout, SarPicker, get isNumber() {
147
147
  return isNumber;
148
148
  } };
149
149
  return __returned__;
@@ -6,7 +6,7 @@
6
6
  padding-bottom: env(safe-area-inset-bottom);
7
7
  border-top-left-radius: var(--sar-popout-border-top-radius);
8
8
  border-top-right-radius: var(--sar-popout-border-top-radius);
9
- background-color: var(--sar-popout-bg);
9
+ background: var(--sar-popout-bg);
10
10
  }
11
11
 
12
12
  @include e(header) {
@@ -13,22 +13,23 @@
13
13
  <view :class="classNames(bem.e('header'), bem.em('header', props.type))">
14
14
  <view v-if="type === 'compact'" :class="bem.e('button-wrap')">
15
15
  <slot
16
+ v-if="$slots.cancel"
16
17
  name="cancel"
17
18
  :on-click="onCancel"
18
19
  :loading="loading.cancel"
19
20
  :text="mergedCancelText"
21
+ ></slot>
22
+ <sar-button
23
+ v-if="!$slots.cancel"
24
+ type="pale-text"
25
+ theme="neutral"
26
+ :root-class="classNames(bem.e('header-cancel'))"
27
+ :loading="loading.cancel"
28
+ block
29
+ @click="onCancel"
20
30
  >
21
- <sar-button
22
- type="pale-text"
23
- theme="neutral"
24
- :root-class="classNames(bem.e('header-cancel'))"
25
- :loading="loading.cancel"
26
- block
27
- @click="onCancel"
28
- >
29
- {{ mergedCancelText }}
30
- </sar-button>
31
- </slot>
31
+ {{ mergedCancelText }}
32
+ </sar-button>
32
33
  </view>
33
34
  <slot name="title-prepend"></slot>
34
35
  <view :class="bem.e('title')">
@@ -39,24 +40,25 @@
39
40
  </view>
40
41
  <view v-if="type === 'compact'" :class="bem.e('button-wrap')">
41
42
  <slot
43
+ v-if="$slots.confirm"
42
44
  name="confirm"
43
45
  :on-click="onConfirm"
44
46
  :disabled="confirmDisabled"
45
47
  :loading="loading.confirm"
46
48
  :text="mergedConfirmText"
49
+ ></slot>
50
+ <sar-button
51
+ v-if="!$slots.confirm"
52
+ type="pale-text"
53
+ theme="primary"
54
+ :root-class="classNames(bem.e('header-confirm'))"
55
+ :loading="loading.confirm"
56
+ :disabled="confirmDisabled"
57
+ block
58
+ @click="onConfirm"
47
59
  >
48
- <sar-button
49
- type="pale-text"
50
- theme="primary"
51
- :root-class="classNames(bem.e('header-confirm'))"
52
- :loading="loading.confirm"
53
- :disabled="confirmDisabled"
54
- block
55
- @click="onConfirm"
56
- >
57
- {{ mergedConfirmText }}
58
- </sar-button>
59
- </slot>
60
+ {{ mergedConfirmText }}
61
+ </sar-button>
60
62
  </view>
61
63
  <view
62
64
  v-if="type === 'loose' && showClose"
@@ -72,45 +74,45 @@
72
74
  <slot name="visible" :whole="wholeVisible" :already="already"></slot>
73
75
  <view v-if="showFooter && type === 'loose'" :class="bem.e('footer')">
74
76
  <slot
77
+ v-if="$slots.cancel"
75
78
  name="cancel"
76
79
  :on-click="onCancel"
77
80
  :visible="showCancel"
78
81
  :loading="loading.cancel"
79
82
  :text="mergedCancelText"
83
+ ></slot>
84
+ <sar-button
85
+ v-if="!$slots.cancel && showCancel"
86
+ type="pale"
87
+ theme="primary"
88
+ round
89
+ :loading="loading.cancel"
90
+ block
91
+ @click="onCancel"
80
92
  >
81
- <sar-button
82
- v-if="showCancel"
83
- type="pale"
84
- theme="primary"
85
- round
86
- :loading="loading.cancel"
87
- block
88
- @click="onCancel"
89
- >
90
- {{ mergedCancelText }}
91
- </sar-button>
92
- </slot>
93
+ {{ mergedCancelText }}
94
+ </sar-button>
93
95
  <slot
96
+ v-if="$slots.confirm"
94
97
  name="confirm"
95
98
  :visible="showConfirm"
96
99
  :on-click="onConfirm"
97
100
  :disabled="confirmDisabled"
98
101
  :loading="loading.confirm"
99
102
  :text="mergedConfirmText"
103
+ ></slot>
104
+ <sar-button
105
+ v-if="!$slots.confirm && showConfirm"
106
+ type="default"
107
+ theme="primary"
108
+ round
109
+ :loading="loading.confirm"
110
+ :disabled="confirmDisabled"
111
+ block
112
+ @click="onConfirm"
100
113
  >
101
- <sar-button
102
- v-if="showConfirm"
103
- type="default"
104
- theme="primary"
105
- round
106
- :loading="loading.confirm"
107
- :disabled="confirmDisabled"
108
- block
109
- @click="onConfirm"
110
- >
111
- {{ mergedConfirmText }}
112
- </sar-button>
113
- </slot>
114
+ {{ mergedConfirmText }}
115
+ </sar-button>
114
116
  </view>
115
117
  </view>
116
118
  </sar-popup>
@@ -10,7 +10,7 @@
10
10
  left: auto;
11
11
  overflow: visible;
12
12
  border-radius: var(--sar-popover-border-radius);
13
- background-color: var(--sar-popover-bg);
13
+ background: var(--sar-popover-bg);
14
14
  box-shadow: var(--sar-popover-box-shadow);
15
15
  touch-action: none;
16
16
  }
@@ -38,12 +38,12 @@
38
38
  }
39
39
 
40
40
  @include m(light) {
41
- background-color: var(--sar-popover-bg);
41
+ background: var(--sar-popover-bg);
42
42
  }
43
43
 
44
44
  @include m(dark) {
45
45
  color: var(--sar-popover-dark-color);
46
- background-color: var(--sar-popover-dark-bg);
46
+ background: var(--sar-popover-dark-bg);
47
47
  }
48
48
 
49
49
  // zoom