sard-uniapp 1.2.1 → 1.3.0

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 (60) hide show
  1. package/changelog.md +11 -1
  2. package/components/alert/alert.d.ts +35 -0
  3. package/components/alert/alert.vue +74 -0
  4. package/components/alert/common.d.ts +26 -0
  5. package/components/alert/common.js +8 -0
  6. package/components/alert/index.d.ts +1 -0
  7. package/components/alert/index.js +1 -0
  8. package/components/alert/index.scss +59 -0
  9. package/components/alert/variables.scss +14 -0
  10. package/components/button/button.d.ts +1 -1
  11. package/components/calendar-input/calendar-input.vue +8 -7
  12. package/components/cascader-input/cascader-input.vue +8 -7
  13. package/components/checkbox/common.d.ts +13 -0
  14. package/components/checkbox/common.js +4 -0
  15. package/components/checkbox-group/checkbox-group.vue +24 -6
  16. package/components/checkbox-input/checkbox-input.d.ts +35 -0
  17. package/components/checkbox-input/checkbox-input.vue +185 -0
  18. package/components/checkbox-input/common.d.ts +17 -0
  19. package/components/checkbox-input/common.js +5 -0
  20. package/components/checkbox-input/index.d.ts +1 -0
  21. package/components/checkbox-input/index.js +1 -0
  22. package/components/checkbox-input/index.scss +7 -0
  23. package/components/checkbox-input/variables.scss +5 -0
  24. package/components/config/index.d.ts +20 -0
  25. package/components/config/index.js +10 -0
  26. package/components/datetime-picker-input/datetime-picker-input.vue +2 -1
  27. package/components/form/variables.scss +2 -2
  28. package/components/input/common.d.ts +1 -0
  29. package/components/input/index.scss +21 -0
  30. package/components/input/input.vue +22 -4
  31. package/components/input/variables.scss +1 -0
  32. package/components/list/index.scss +6 -0
  33. package/components/list/list.vue +1 -0
  34. package/components/list-item/index.scss +1 -0
  35. package/components/notify/notify.d.ts +1 -1
  36. package/components/notify-agent/notify-agent.d.ts +1 -1
  37. package/components/picker-input/picker-input.vue +2 -1
  38. package/components/popout-input/common.d.ts +1 -0
  39. package/components/popout-input/popout-input.vue +6 -2
  40. package/components/radio/common.d.ts +13 -0
  41. package/components/radio/common.js +4 -0
  42. package/components/radio-group/radio-group.vue +24 -6
  43. package/components/radio-input/common.d.ts +18 -0
  44. package/components/radio-input/common.js +5 -0
  45. package/components/radio-input/index.d.ts +1 -0
  46. package/components/radio-input/index.js +1 -0
  47. package/components/radio-input/index.scss +7 -0
  48. package/components/radio-input/radio-input.d.ts +38 -0
  49. package/components/radio-input/radio-input.vue +181 -0
  50. package/components/radio-input/variables.scss +5 -0
  51. package/components/result/result.d.ts +1 -1
  52. package/components/result/result.vue +1 -1
  53. package/components/tag/tag.d.ts +1 -1
  54. package/global.d.ts +7 -1
  55. package/index.d.ts +3 -0
  56. package/index.js +3 -0
  57. package/index.scss +3 -0
  58. package/package.json +1 -1
  59. package/utils/lwa.slim.d.ts +348 -0
  60. package/utils/lwa.slim.js +816 -0
@@ -0,0 +1,17 @@
1
+ import { type CheckboxGroupProps } from '../checkbox/common';
2
+ import { type PopoutInputProps } from '../popout-input/common';
3
+ export interface CheckboxInputOption {
4
+ [key: PropertyKey]: any;
5
+ }
6
+ export interface CheckboxInputProps extends CheckboxGroupProps, Omit<PopoutInputProps, 'modelValue'> {
7
+ visible?: boolean;
8
+ title?: string;
9
+ }
10
+ export declare const checkboxInputPropsDefaults: {
11
+ options: () => never[];
12
+ validateEvent: boolean;
13
+ };
14
+ export interface CheckboxInputEmits {
15
+ (e: 'update:visible', visible: boolean): void;
16
+ (e: 'update:model-value', value: any): void;
17
+ }
@@ -0,0 +1,5 @@
1
+ import { defaultConfig } from '../config';
2
+ export const checkboxInputPropsDefaults = {
3
+ ...defaultConfig.checkboxInput,
4
+ options: () => [],
5
+ };
@@ -0,0 +1 @@
1
+ export type { CheckboxInputProps, CheckboxInputEmits } from './common';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ @use '../style/base' as *;
2
+
3
+ @include bem(checkbox-input) {
4
+ @include e(scroll) {
5
+ max-height: var(--sar-checkbox-input-max-height);
6
+ }
7
+ }
@@ -0,0 +1,5 @@
1
+ // #variables
2
+ page {
3
+ --sar-checkbox-input-max-height: 640rpx;
4
+ }
5
+ // #endvariables
@@ -4,6 +4,9 @@ export declare const defaultConfig: {
4
4
  overlayClosable: boolean;
5
5
  duration: number;
6
6
  };
7
+ alert: {
8
+ type: "primary";
9
+ };
7
10
  avatar: {
8
11
  shape: "circle";
9
12
  };
@@ -36,6 +39,9 @@ export declare const defaultConfig: {
36
39
  direction: "vertical";
37
40
  validateEvent: boolean;
38
41
  };
42
+ checkboxInput: {
43
+ validateEvent: boolean;
44
+ };
39
45
  countDown: {
40
46
  time: number;
41
47
  autoStart: boolean;
@@ -198,6 +204,10 @@ export declare const defaultConfig: {
198
204
  direction: "vertical";
199
205
  validateEvent: boolean;
200
206
  };
207
+ radioInput: {
208
+ validateEvent: boolean;
209
+ type: "record";
210
+ };
201
211
  rate: {
202
212
  count: number;
203
213
  icon: string;
@@ -332,6 +342,9 @@ export declare function useConfigContext(): DeepPartial<{
332
342
  overlayClosable: boolean;
333
343
  duration: number;
334
344
  };
345
+ alert: {
346
+ type: "primary";
347
+ };
335
348
  avatar: {
336
349
  shape: "circle";
337
350
  };
@@ -364,6 +377,9 @@ export declare function useConfigContext(): DeepPartial<{
364
377
  direction: "vertical";
365
378
  validateEvent: boolean;
366
379
  };
380
+ checkboxInput: {
381
+ validateEvent: boolean;
382
+ };
367
383
  countDown: {
368
384
  time: number;
369
385
  autoStart: boolean;
@@ -526,6 +542,10 @@ export declare function useConfigContext(): DeepPartial<{
526
542
  direction: "vertical";
527
543
  validateEvent: boolean;
528
544
  };
545
+ radioInput: {
546
+ validateEvent: boolean;
547
+ type: "record";
548
+ };
529
549
  rate: {
530
550
  count: number;
531
551
  icon: string;
@@ -5,6 +5,9 @@ export const defaultConfig = {
5
5
  overlayClosable: true,
6
6
  duration: 300,
7
7
  },
8
+ alert: {
9
+ type: 'primary',
10
+ },
8
11
  avatar: {
9
12
  shape: 'circle',
10
13
  },
@@ -37,6 +40,9 @@ export const defaultConfig = {
37
40
  direction: 'vertical',
38
41
  validateEvent: true,
39
42
  },
43
+ checkboxInput: {
44
+ validateEvent: true,
45
+ },
40
46
  countDown: {
41
47
  time: 0,
42
48
  autoStart: true,
@@ -199,6 +205,10 @@ export const defaultConfig = {
199
205
  direction: 'vertical',
200
206
  validateEvent: true,
201
207
  },
208
+ radioInput: {
209
+ validateEvent: true,
210
+ type: 'record',
211
+ },
202
212
  rate: {
203
213
  count: 5,
204
214
  icon: 'star-fill',
@@ -74,7 +74,8 @@ export default _defineComponent({
74
74
  placeholder: { type: String, required: false },
75
75
  readonly: { type: Boolean, required: false },
76
76
  disabled: { type: Boolean, required: false },
77
- clearable: { type: Boolean, required: false }
77
+ clearable: { type: Boolean, required: false },
78
+ multiline: { type: Boolean, required: false }
78
79
  }, datetimePickerInputPropsDefaults),
79
80
  emits: ["update:visible", "update:model-value"],
80
81
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -11,10 +11,10 @@ page {
11
11
  --sar-form-item-label-margin-right: 24rpx;
12
12
  --sar-form-item-label-margin-bottom: 8rpx;
13
13
  --sar-form-item-label-font-size: var(--sar-text-base);
14
- --sar-form-item-label-line-height: var(--sar-leading-snug);
14
+ --sar-form-item-label-line-height: var(--sar-leading-normal);
15
15
 
16
16
  --sar-form-item-star-font-size: var(--sar-text-base);
17
- --sar-form-item-star-line-height: var(--sar-leading-snug);
17
+ --sar-form-item-star-line-height: var(--sar-leading-normal);
18
18
  --sar-form-item-star-color: var(--sar-danger);
19
19
  --sar-form-item-star-gap: 8rpx;
20
20
 
@@ -21,6 +21,7 @@ export interface InputProps {
21
21
  fixed?: boolean;
22
22
  showConfirmBar?: boolean;
23
23
  disableDefaultPadding?: boolean;
24
+ inputMinHeight?: boolean;
24
25
  type?: 'text' | 'number' | 'idcard' | 'digit' | 'tel' | 'safe-password' | 'nickname' | 'password' | 'textarea';
25
26
  alwaysEmbed?: boolean;
26
27
  safePasswordCertPath?: string;
@@ -49,6 +49,7 @@
49
49
  padding: 0;
50
50
  border-width: 0;
51
51
  font-size: var(--sar-input-control-font-size);
52
+ line-height: var(--sar-input-control-line-height);
52
53
 
53
54
  @include m(input) {
54
55
  height: var(--sar-input-control-input-height);
@@ -58,10 +59,30 @@
58
59
  height: var(--sar-input-control-textarea-height);
59
60
  min-height: var(--sar-input-control-textarea-height);
60
61
  }
62
+
63
+ @include m(input-min-height) {
64
+ min-height: var(--sar-input-control-input-height);
65
+ line-height: var(--sar-input-control-input-height);
66
+ }
61
67
  }
62
68
 
63
69
  @include e(placeholder) {
64
70
  color: var(--sar-input-placeholder-color);
71
+ line-height: var(--sar-input-control-line-height);
72
+
73
+ @include m(textarea) {
74
+ position: absolute;
75
+ top: 0;
76
+ left: 0;
77
+ right: 0;
78
+ bottom: 0;
79
+ overflow: hidden;
80
+ pointer-events: none;
81
+ }
82
+
83
+ @include m(input-min-height) {
84
+ line-height: var(--sar-input-control-input-height);
85
+ }
65
86
  }
66
87
 
67
88
  @include e(prepend, append) {
@@ -4,13 +4,30 @@
4
4
  <view v-if="$slots.prepend" :class="bem.e('prepend')">
5
5
  <slot name="prepend"></slot>
6
6
  </view>
7
+ <view
8
+ v-if="type === 'textarea' && innerValue === '' && placeholder"
9
+ :class="
10
+ classNames(
11
+ bem.e('placeholder'),
12
+ bem.em('placeholder', 'textarea'),
13
+ bem.em('placeholder', 'input-min-height', inputMinHeight),
14
+ placeholderClass,
15
+ )
16
+ "
17
+ :style="placeholderStyle"
18
+ >
19
+ {{ placeholder }}
20
+ </view>
7
21
  <textarea
8
22
  v-if="type === 'textarea'"
9
- :class="classNames(bem.e('control'), bem.em('control', 'textarea'))"
23
+ :class="
24
+ classNames(
25
+ bem.e('control'),
26
+ bem.em('control', 'textarea'),
27
+ bem.em('control', 'input-min-height', inputMinHeight),
28
+ )
29
+ "
10
30
  :value="innerValue"
11
- :placeholder="placeholder"
12
- :placeholder-style="placeholderStyle"
13
- :placeholder-class="classNames(bem.e('placeholder'), placeholderClass)"
14
31
  :disabled="isDisabled || isReadonly"
15
32
  :maxlength="maxlength"
16
33
  :focus="focus"
@@ -139,6 +156,7 @@ export default _defineComponent({
139
156
  fixed: { type: Boolean, required: false },
140
157
  showConfirmBar: { type: Boolean, required: false },
141
158
  disableDefaultPadding: { type: Boolean, required: false },
159
+ inputMinHeight: { type: Boolean, required: false },
142
160
  type: { type: String, required: false },
143
161
  alwaysEmbed: { type: Boolean, required: false },
144
162
  safePasswordCertPath: { type: String, required: false },
@@ -11,6 +11,7 @@ page {
11
11
 
12
12
  --sar-input-control-font-size: var(--sar-text-base);
13
13
  --sar-input-control-input-height: 48rpx;
14
+ --sar-input-control-line-height: var(--sar-leading-normal);
14
15
  --sar-input-control-textarea-height: 168rpx;
15
16
 
16
17
  --sar-input-placeholder-color: var(--sar-quaternary-color);
@@ -40,6 +40,12 @@
40
40
  }
41
41
  }
42
42
 
43
+ @include m(not-card) {
44
+ @include e(content) {
45
+ border-radius: 0;
46
+ }
47
+ }
48
+
43
49
  @include m(card, inlaid) {
44
50
  @include e(content) {
45
51
  &::before {
@@ -48,6 +48,7 @@ export default _defineComponent({
48
48
  return classNames(
49
49
  bem.b(),
50
50
  bem.m("card", props.card),
51
+ bem.m("not-card", !props.card),
51
52
  bem.m("inlaid", props.inlaid),
52
53
  props.rootClass
53
54
  );
@@ -78,6 +78,7 @@
78
78
  color: var(--sar-list-item-value-color);
79
79
  text-align: right;
80
80
  word-wrap: break-word;
81
+ word-break: break-word;
81
82
  }
82
83
 
83
84
  @include e(arrow) {
@@ -19,7 +19,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
19
19
  onClick?: ((event: any) => any) | undefined;
20
20
  "onUpdate:visible"?: ((event: any) => any) | undefined;
21
21
  }, {
22
- type: "success" | "primary" | "error" | "warning";
22
+ type: "success" | "primary" | "warning" | "error";
23
23
  duration: number;
24
24
  position: "top" | "bottom";
25
25
  timeout: number;
@@ -12,7 +12,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
12
12
  duration: number;
13
13
  timeout: number;
14
14
  }>>>, {
15
- type: "success" | "primary" | "error" | "warning";
15
+ type: "success" | "primary" | "warning" | "error";
16
16
  id: string;
17
17
  duration: number;
18
18
  position: "top" | "bottom";
@@ -71,7 +71,8 @@ export default _defineComponent({
71
71
  readonly: { type: Boolean, required: false },
72
72
  disabled: { type: Boolean, required: false },
73
73
  clearable: { type: Boolean, required: false },
74
- loading: { type: Boolean, required: false }
74
+ loading: { type: Boolean, required: false },
75
+ multiline: { type: Boolean, required: false }
75
76
  }, pickerInputPropsDefaults),
76
77
  emits: ["update:visible", "update:model-value"],
77
78
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -8,6 +8,7 @@ export interface PopoutInputProps {
8
8
  disabled?: boolean;
9
9
  clearable?: boolean;
10
10
  loading?: boolean;
11
+ multiline?: boolean;
11
12
  }
12
13
  export interface PopoutInputEmits {
13
14
  (e: 'click', event: any): void;
@@ -8,8 +8,11 @@
8
8
  :readonly="isReadonly"
9
9
  :disabled="isDisabled"
10
10
  :clearable="clearable"
11
- @clear="onClear"
12
11
  :validate-event="false"
12
+ :type="multiline ? 'textarea' : undefined"
13
+ :auto-height="multiline"
14
+ :input-min-height="multiline"
15
+ @clear="onClear"
13
16
  >
14
17
  <template #append>
15
18
  <view :class="bem.e('append')">
@@ -59,7 +62,8 @@ export default _defineComponent({
59
62
  readonly: { type: Boolean, required: false },
60
63
  disabled: { type: Boolean, required: false },
61
64
  clearable: { type: Boolean, required: false },
62
- loading: { type: Boolean, required: false }
65
+ loading: { type: Boolean, required: false },
66
+ multiline: { type: Boolean, required: false }
63
67
  },
64
68
  emits: ["click", "update:model-value", "clear"],
65
69
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -20,6 +20,17 @@ export interface RadioSlots {
20
20
  export interface RadioEmits {
21
21
  (e: 'click', event: any): void;
22
22
  }
23
+ export declare const defaultOptionKeys: {
24
+ label: string;
25
+ value: string;
26
+ };
27
+ export interface RadioGroupOption {
28
+ [key: PropertyKey]: any;
29
+ }
30
+ export interface RadioGroupOptionKeys {
31
+ label?: string;
32
+ value?: string;
33
+ }
23
34
  export interface RadioGroupProps {
24
35
  rootStyle?: StyleValue;
25
36
  rootClass?: string;
@@ -31,6 +42,8 @@ export interface RadioGroupProps {
31
42
  checkedColor?: string;
32
43
  direction?: 'horizontal' | 'vertical';
33
44
  validateEvent?: boolean;
45
+ options?: RadioGroupOption[];
46
+ optionKeys?: RadioGroupOptionKeys;
34
47
  }
35
48
  export declare const radioGroupPropsDefaults: {
36
49
  direction: "vertical";
@@ -1,4 +1,8 @@
1
1
  import { defaultConfig } from '../config';
2
+ export const defaultOptionKeys = {
3
+ label: 'label',
4
+ value: 'value',
5
+ };
2
6
  export const radioGroupPropsDefaults = defaultConfig.radioGroup;
3
7
  export const radioContextSymbol = Symbol('radio-context');
4
8
  export const mapTypeIcon = {
@@ -9,19 +9,32 @@
9
9
  :toggle="toggle"
10
10
  :value="innerValue"
11
11
  ></slot>
12
- <slot v-else></slot>
12
+ <slot v-else>
13
+ <template v-if="options">
14
+ <sar-radio
15
+ v-for="option in options"
16
+ :key="option[fieldKeys.value]"
17
+ :value="option[fieldKeys.value]"
18
+ :validate-event="false"
19
+ >
20
+ {{ option[fieldKeys.label] }}
21
+ </sar-radio>
22
+ </template>
23
+ </slot>
13
24
  </view>
14
25
  </template>
15
26
 
16
27
  <script>
17
28
  import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
18
- import { ref, watch, provide, toRef, reactive } from "vue";
29
+ import { ref, watch, provide, toRef, reactive, computed } from "vue";
19
30
  import {
20
31
  radioContextSymbol,
21
- radioGroupPropsDefaults
32
+ radioGroupPropsDefaults,
33
+ defaultOptionKeys
22
34
  } from "../radio/common";
23
35
  import { classNames, stringifyStyle, createBem } from "../../utils";
24
36
  import { useFormItemContext } from "../form/common";
37
+ import SarRadio from "../radio/radio.vue";
25
38
  export default _defineComponent({
26
39
  ...{
27
40
  options: {
@@ -40,7 +53,9 @@ export default _defineComponent({
40
53
  type: { type: String, required: false },
41
54
  checkedColor: { type: String, required: false },
42
55
  direction: { type: String, required: false },
43
- validateEvent: { type: Boolean, required: false }
56
+ validateEvent: { type: Boolean, required: false },
57
+ options: { type: Array, required: false },
58
+ optionKeys: { type: Object, required: false }
44
59
  }, radioGroupPropsDefaults),
45
60
  emits: ["click", "update:model-value"],
46
61
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -49,6 +64,9 @@ export default _defineComponent({
49
64
  const emit = __emit;
50
65
  const bem = createBem("radio-group");
51
66
  const formItemContext = useFormItemContext();
67
+ const fieldKeys = computed(() => {
68
+ return Object.assign({}, defaultOptionKeys, props.optionKeys);
69
+ });
52
70
  const innerValue = ref(props.modelValue);
53
71
  watch(
54
72
  () => props.modelValue,
@@ -74,11 +92,11 @@ export default _defineComponent({
74
92
  toggle
75
93
  })
76
94
  );
77
- const __returned__ = { props, emit, bem, formItemContext, innerValue, toggle, get classNames() {
95
+ const __returned__ = { props, emit, bem, formItemContext, fieldKeys, innerValue, toggle, get classNames() {
78
96
  return classNames;
79
97
  }, get stringifyStyle() {
80
98
  return stringifyStyle;
81
- } };
99
+ }, SarRadio };
82
100
  return __returned__;
83
101
  }
84
102
  });
@@ -0,0 +1,18 @@
1
+ import { type RadioGroupProps } from '../radio/common';
2
+ import { type PopoutInputProps } from '../popout-input/common';
3
+ export interface RadioInputOption {
4
+ [key: PropertyKey]: any;
5
+ }
6
+ export interface RadioInputProps extends RadioGroupProps, Omit<PopoutInputProps, 'modelValue'> {
7
+ visible?: boolean;
8
+ title?: string;
9
+ }
10
+ export declare const radioInputPropsDefaults: {
11
+ options: () => never[];
12
+ validateEvent: boolean;
13
+ type: "record";
14
+ };
15
+ export interface RadioInputEmits {
16
+ (e: 'update:visible', visible: boolean): void;
17
+ (e: 'update:model-value', value: any): void;
18
+ }
@@ -0,0 +1,5 @@
1
+ import { defaultConfig } from '../config';
2
+ export const radioInputPropsDefaults = {
3
+ ...defaultConfig.radioInput,
4
+ options: () => [],
5
+ };
@@ -0,0 +1 @@
1
+ export type { RadioInputProps, RadioInputEmits } from './common';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ @use '../style/base' as *;
2
+
3
+ @include bem(radio-input) {
4
+ @include e(scroll) {
5
+ max-height: var(--sar-radio-input-max-height);
6
+ }
7
+ }
@@ -0,0 +1,38 @@
1
+ import { type RadioInputProps } from './common';
2
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<RadioInputProps>, {
3
+ options: () => never[];
4
+ validateEvent: boolean;
5
+ type: "record";
6
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
+ "update:visible": (visible: boolean) => void;
8
+ "update:model-value": (value: any) => void;
9
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<RadioInputProps>, {
10
+ options: () => never[];
11
+ validateEvent: boolean;
12
+ type: "record";
13
+ }>>> & {
14
+ "onUpdate:model-value"?: ((value: any) => any) | undefined;
15
+ "onUpdate:visible"?: ((visible: boolean) => any) | undefined;
16
+ }, {
17
+ options: import("../radio/common").RadioGroupOption[];
18
+ type: import("../radio/common").IconType;
19
+ validateEvent: boolean;
20
+ }, {}>;
21
+ export default _default;
22
+ type __VLS_WithDefaults<P, D> = {
23
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
24
+ default: D[K];
25
+ }> : P[K];
26
+ };
27
+ type __VLS_Prettify<T> = {
28
+ [K in keyof T]: T[K];
29
+ } & {};
30
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
31
+ type __VLS_TypePropsToOption<T> = {
32
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
33
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
34
+ } : {
35
+ type: import('vue').PropType<T[K]>;
36
+ required: true;
37
+ };
38
+ };