sard-uniapp 1.16.0 → 1.17.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.
- package/CHANGELOG.md +15 -0
- package/components/count-down/count-down.vue +5 -3
- package/components/datetime-picker/common.d.ts +3 -0
- package/components/datetime-picker/datetime-picker.d.ts +9 -2
- package/components/datetime-picker-input/common.d.ts +3 -1
- package/components/datetime-picker-input/datetime-picker-input.d.ts +9 -2
- package/components/datetime-picker-popout/common.d.ts +2 -3
- package/components/datetime-range-picker/common.d.ts +2 -3
- package/components/datetime-range-picker-input/common.d.ts +3 -1
- package/components/datetime-range-picker-input/datetime-range-picker-input.d.ts +9 -2
- package/components/datetime-range-picker-popout/common.d.ts +2 -3
- package/components/picker/common.d.ts +11 -0
- package/components/picker/index.scss +0 -13
- package/components/picker/picker.d.ts +9 -2
- package/components/picker/picker.vue +31 -9
- package/components/picker/variables.scss +4 -1
- package/components/picker-input/common.d.ts +3 -1
- package/components/picker-input/picker-input.d.ts +9 -2
- package/components/picker-input/picker-input.vue +25 -1
- package/components/picker-item/common.d.ts +12 -0
- package/components/picker-item/common.js +1 -0
- package/components/picker-item/index.d.ts +1 -0
- package/components/picker-item/index.js +1 -0
- package/components/picker-item/index.scss +12 -0
- package/components/picker-item/picker-item.d.ts +10 -0
- package/components/picker-item/picker-item.vue +41 -0
- package/components/picker-popout/common.d.ts +2 -3
- package/components/picker-popout/common.js +1 -1
- package/components/picker-popout/picker-popout.vue +32 -4
- package/components/popup/popup.vue +15 -3
- package/components/tree/common.d.ts +11 -0
- package/components/tree/index.d.ts +1 -1
- package/components/tree/tree.d.ts +8 -2
- package/components/tree/tree.vue +28 -5
- package/components/tree/variables.scss +2 -2
- package/components/tree-node/index.scss +2 -1
- package/components/tree-node/tree-node.vue +25 -3
- package/global.d.ts +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# [1.17.0](https://github.com/sutras/sard-uniapp/compare/v1.16.0...v1.17.0) (2025-05-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* 修复popup在h5弹出状态跳转页面仍显示的问题 ([1187368](https://github.com/sutras/sard-uniapp/commit/11873685cc8017ec42b4ad02c4d74754d5d3fc6c))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* picker 组件新增 custom 插槽 ([218d384](https://github.com/sutras/sard-uniapp/commit/218d3841459d65dec29d6cf35fd6fea7c713cca5))
|
|
12
|
+
* tree 组件新增单选功能 ([a1fb8a2](https://github.com/sutras/sard-uniapp/commit/a1fb8a2c54ac7fc32e3dab2a416636553893bc2f))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
1
16
|
# [1.16.0](https://github.com/sutras/sard-uniapp/compare/v1.15.4...v1.16.0) (2025-05-28)
|
|
2
17
|
|
|
3
18
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type StyleValue } from 'vue';
|
|
2
|
+
import { type PickerSlots } from '../picker/common';
|
|
2
3
|
export interface DatetimePickerProps {
|
|
3
4
|
rootStyle?: StyleValue;
|
|
4
5
|
rootClass?: string;
|
|
@@ -13,6 +14,8 @@ export interface DatetimePickerProps {
|
|
|
13
14
|
export declare const defaultDatetimePickerProps: {
|
|
14
15
|
type: string;
|
|
15
16
|
};
|
|
17
|
+
export interface DatetimePickerSlots extends PickerSlots {
|
|
18
|
+
}
|
|
16
19
|
export interface DatetimePickerEmits {
|
|
17
20
|
(e: 'update:model-value', date: Date | string): void;
|
|
18
21
|
(e: 'change', date: Date | string): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type DatetimePickerProps } from './common';
|
|
2
|
-
declare
|
|
1
|
+
import { type DatetimePickerProps, type DatetimePickerSlots } from './common';
|
|
2
|
+
declare function __VLS_template(): Readonly<DatetimePickerSlots> & DatetimePickerSlots;
|
|
3
|
+
declare const __VLS_component: import("vue").DefineComponent<DatetimePickerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
3
4
|
"update:model-value": (date: string | Date) => any;
|
|
4
5
|
change: (date: string | Date) => any;
|
|
5
6
|
}, string, import("vue").PublicProps, Readonly<DatetimePickerProps> & Readonly<{
|
|
@@ -8,4 +9,10 @@ declare const _default: import("vue").DefineComponent<DatetimePickerProps, {}, {
|
|
|
8
9
|
}>, {
|
|
9
10
|
type: string;
|
|
10
11
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
11
13
|
export default _default;
|
|
14
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PopoutInputProps } from '../popout-input/common';
|
|
2
|
-
import { type DatetimePickerPopoutProps, type DatetimePickerPopoutEmits } from '../datetime-picker-popout/common';
|
|
2
|
+
import { type DatetimePickerPopoutProps, type DatetimePickerPopoutEmits, type DatetimePickerPopoutSlots } from '../datetime-picker-popout/common';
|
|
3
3
|
export interface DatetimePickerInputProps extends DatetimePickerPopoutProps, Omit<PopoutInputProps, 'modelValue' | 'loading'> {
|
|
4
4
|
outletFormat?: string;
|
|
5
5
|
}
|
|
@@ -7,6 +7,8 @@ export declare const defaultDatetimePickerInputProps: () => {
|
|
|
7
7
|
validateEvent: boolean;
|
|
8
8
|
type: string;
|
|
9
9
|
};
|
|
10
|
+
export interface DatetimePickerInputSlots extends DatetimePickerPopoutSlots {
|
|
11
|
+
}
|
|
10
12
|
export interface DatetimePickerInputEmits extends DatetimePickerPopoutEmits {
|
|
11
13
|
}
|
|
12
14
|
export declare const mapTypeFormat: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type DatetimePickerInputProps } from './common';
|
|
2
|
-
declare
|
|
1
|
+
import { type DatetimePickerInputProps, type DatetimePickerInputSlots } from './common';
|
|
2
|
+
declare function __VLS_template(): Readonly<DatetimePickerInputSlots> & DatetimePickerInputSlots;
|
|
3
|
+
declare const __VLS_component: import("vue").DefineComponent<DatetimePickerInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
3
4
|
"update:model-value": (date: string | Date | undefined) => any;
|
|
4
5
|
change: (date: string | Date | undefined) => any;
|
|
5
6
|
"update:visible": (visible: boolean) => any;
|
|
@@ -11,4 +12,10 @@ declare const _default: import("vue").DefineComponent<DatetimePickerInputProps,
|
|
|
11
12
|
type: string;
|
|
12
13
|
validateEvent: boolean;
|
|
13
14
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
14
16
|
export default _default;
|
|
17
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
18
|
+
new (): {
|
|
19
|
+
$slots: S;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type StyleValue } from 'vue';
|
|
2
|
-
import { type DatetimePickerProps } from '../datetime-picker/common';
|
|
2
|
+
import { type DatetimePickerProps, type DatetimePickerSlots } from '../datetime-picker/common';
|
|
3
3
|
export interface DatetimePickerPopoutProps extends DatetimePickerProps {
|
|
4
4
|
visible?: boolean;
|
|
5
5
|
title?: string;
|
|
@@ -11,8 +11,7 @@ export declare const defaultDatetimePickerPopoutProps: () => {
|
|
|
11
11
|
validateEvent: boolean;
|
|
12
12
|
type: string;
|
|
13
13
|
};
|
|
14
|
-
export interface DatetimePickerPopoutSlots {
|
|
15
|
-
default?(props: Record<string, never>): any;
|
|
14
|
+
export interface DatetimePickerPopoutSlots extends DatetimePickerSlots {
|
|
16
15
|
}
|
|
17
16
|
export interface DatetimePickerPopoutEmits {
|
|
18
17
|
(e: 'update:visible', visible: boolean): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type DatetimePickerProps } from '../datetime-picker/common';
|
|
1
|
+
import { type DatetimePickerSlots, type DatetimePickerProps } from '../datetime-picker/common';
|
|
2
2
|
export interface DatetimeRangePickerProps extends Omit<DatetimePickerProps, 'modelValue'> {
|
|
3
3
|
modelValue?: (Date | string)[];
|
|
4
4
|
tabs?: string[];
|
|
@@ -6,8 +6,7 @@ export interface DatetimeRangePickerProps extends Omit<DatetimePickerProps, 'mod
|
|
|
6
6
|
export declare const defaultDatetimeRangePickerProps: {
|
|
7
7
|
type: string;
|
|
8
8
|
};
|
|
9
|
-
export interface DatetimeRangePickerSlots {
|
|
10
|
-
default?(props: Record<string, never>): any;
|
|
9
|
+
export interface DatetimeRangePickerSlots extends DatetimePickerSlots {
|
|
11
10
|
}
|
|
12
11
|
export interface DatetimeRangePickerEmits {
|
|
13
12
|
(e: 'update:model-value', date: (Date | string)[]): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type DatetimeRangePickerPopoutProps, type DatetimeRangePickerPopoutEmits } from '../datetime-range-picker-popout/common';
|
|
1
|
+
import { type DatetimeRangePickerPopoutProps, type DatetimeRangePickerPopoutSlots, type DatetimeRangePickerPopoutEmits } from '../datetime-range-picker-popout/common';
|
|
2
2
|
import { type PopoutInputProps } from '../popout-input/common';
|
|
3
3
|
export interface DatetimeRangePickerInputProps extends DatetimeRangePickerPopoutProps, Omit<PopoutInputProps, 'modelValue' | 'loading'> {
|
|
4
4
|
outletFormat?: string;
|
|
@@ -7,5 +7,7 @@ export declare const defaultDatetimeRangePickerInputProps: () => {
|
|
|
7
7
|
validateEvent: boolean;
|
|
8
8
|
type: string;
|
|
9
9
|
};
|
|
10
|
+
export interface DatetimeRangePickerInputSlots extends DatetimeRangePickerPopoutSlots {
|
|
11
|
+
}
|
|
10
12
|
export interface DatetimeRangePickerInputEmits extends DatetimeRangePickerPopoutEmits {
|
|
11
13
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type DatetimeRangePickerInputProps } from './common';
|
|
2
|
-
declare
|
|
1
|
+
import { type DatetimeRangePickerInputProps, type DatetimeRangePickerInputSlots } from './common';
|
|
2
|
+
declare function __VLS_template(): Readonly<DatetimeRangePickerInputSlots> & DatetimeRangePickerInputSlots;
|
|
3
|
+
declare const __VLS_component: import("vue").DefineComponent<DatetimeRangePickerInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
3
4
|
"update:model-value": (date: (string | Date)[] | undefined) => any;
|
|
4
5
|
change: (date: (string | Date)[] | undefined) => any;
|
|
5
6
|
"update:visible": (visible: boolean) => any;
|
|
@@ -11,4 +12,10 @@ declare const _default: import("vue").DefineComponent<DatetimeRangePickerInputPr
|
|
|
11
12
|
type: string;
|
|
12
13
|
validateEvent: boolean;
|
|
13
14
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
14
16
|
export default _default;
|
|
17
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
18
|
+
new (): {
|
|
19
|
+
$slots: S;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type StyleValue } from 'vue';
|
|
2
|
-
import { type DatetimeRangePickerProps } from '../datetime-range-picker/common';
|
|
2
|
+
import { type DatetimeRangePickerProps, type DatetimeRangePickerSlots } from '../datetime-range-picker/common';
|
|
3
3
|
export interface DatetimeRangePickerPopoutProps extends DatetimeRangePickerProps {
|
|
4
4
|
visible?: boolean;
|
|
5
5
|
title?: string;
|
|
@@ -11,8 +11,7 @@ export declare const defaultDatetimeRangePickerInputProps: () => {
|
|
|
11
11
|
validateEvent: boolean;
|
|
12
12
|
type: string;
|
|
13
13
|
};
|
|
14
|
-
export interface DatetimeRangePickerPopoutSlots {
|
|
15
|
-
default?(props: Record<string, never>): any;
|
|
14
|
+
export interface DatetimeRangePickerPopoutSlots extends DatetimeRangePickerSlots {
|
|
16
15
|
}
|
|
17
16
|
export interface DatetimeRangePickerPopoutEmits {
|
|
18
17
|
(e: 'update:visible', visible: boolean): void;
|
|
@@ -15,11 +15,22 @@ export interface PickerProps {
|
|
|
15
15
|
optionKeys?: PickerOptionKeys;
|
|
16
16
|
modelValue?: any;
|
|
17
17
|
immediateChange?: boolean;
|
|
18
|
+
internalCustom?: number;
|
|
18
19
|
}
|
|
19
20
|
export declare const defaultPickerProps: () => {
|
|
20
21
|
columns: () => never[];
|
|
21
22
|
immediateChange: boolean;
|
|
22
23
|
};
|
|
24
|
+
export interface PickerSlots {
|
|
25
|
+
custom?(props: {
|
|
26
|
+
columns: any[][];
|
|
27
|
+
value: number[];
|
|
28
|
+
pickerViewClass: string;
|
|
29
|
+
maskClass: string;
|
|
30
|
+
indicatorClass: string;
|
|
31
|
+
onChange: (event: any) => void;
|
|
32
|
+
}): any;
|
|
33
|
+
}
|
|
23
34
|
export interface PickerEmits {
|
|
24
35
|
(e: 'update:model-value', value: any, selectedOptions: PickerOption[], indexes: number[]): void;
|
|
25
36
|
(e: 'change', value: any, selectedOptions: PickerOption[], indexes: number[]): void;
|
|
@@ -5,17 +5,4 @@
|
|
|
5
5
|
@include universal;
|
|
6
6
|
height: var(--sar-picker-height);
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
@include e(picker-view) {
|
|
10
|
-
height: 100%;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
@include e(item) {
|
|
14
|
-
height: var(--sar-picker-item-height);
|
|
15
|
-
line-height: var(--sar-picker-item-height);
|
|
16
|
-
font-size: var(--sar-picker-item-font-size);
|
|
17
|
-
text-align: center;
|
|
18
|
-
color: var(--sar-picker-item-color);
|
|
19
|
-
@include ellipsis;
|
|
20
|
-
}
|
|
21
8
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type PickerProps, type PickerOption } from './common';
|
|
2
|
-
declare
|
|
1
|
+
import { type PickerProps, type PickerSlots, type PickerOption } from './common';
|
|
2
|
+
declare function __VLS_template(): Readonly<PickerSlots> & PickerSlots;
|
|
3
|
+
declare const __VLS_component: import("vue").DefineComponent<PickerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
3
4
|
"update:model-value": (value: any, selectedOptions: PickerOption[], indexes: number[]) => any;
|
|
4
5
|
change: (value: any, selectedOptions: PickerOption[], indexes: number[]) => any;
|
|
5
6
|
}, string, import("vue").PublicProps, Readonly<PickerProps> & Readonly<{
|
|
@@ -9,4 +10,10 @@ declare const _default: import("vue").DefineComponent<PickerProps, {}, {}, {}, {
|
|
|
9
10
|
columns: PickerOption[] | PickerOption[][];
|
|
10
11
|
immediateChange: boolean;
|
|
11
12
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
12
14
|
export default _default;
|
|
15
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
16
|
+
new (): {
|
|
17
|
+
$slots: S;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view :class="pickerClass" :style="pickerStyle">
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
:
|
|
3
|
+
<slot
|
|
4
|
+
v-if="isNumber(internalCustom) ? internalCustom : $slots.custom"
|
|
5
|
+
name="custom"
|
|
6
|
+
:columns="renderedColumns"
|
|
7
|
+
:picker-view-class="pickerViewClass"
|
|
8
|
+
:mask-class="maskClass"
|
|
9
|
+
:indicator-class="indicatorClass"
|
|
7
10
|
:value="columnIndexes"
|
|
11
|
+
:on-change="onChange"
|
|
12
|
+
></slot>
|
|
13
|
+
<picker-view
|
|
14
|
+
v-else
|
|
15
|
+
:class="pickerViewClass"
|
|
8
16
|
:immediate-change="immediateChange"
|
|
17
|
+
:indicator-class="indicatorClass"
|
|
18
|
+
:mask-class="maskClass"
|
|
19
|
+
:value="columnIndexes"
|
|
9
20
|
@change="onChange"
|
|
10
21
|
>
|
|
11
22
|
<picker-view-column v-for="(column, i) in renderedColumns" :key="i">
|
|
12
|
-
<
|
|
23
|
+
<sar-picker-item v-for="(option, j) in column" :key="j">
|
|
13
24
|
{{ getLabelByOption(option) }}
|
|
14
|
-
</
|
|
25
|
+
</sar-picker-item>
|
|
15
26
|
</picker-view-column>
|
|
16
27
|
</picker-view>
|
|
17
28
|
</view>
|
|
@@ -27,7 +38,8 @@ import {
|
|
|
27
38
|
nestedToMulti,
|
|
28
39
|
toArray,
|
|
29
40
|
arrayEqual,
|
|
30
|
-
isNullish
|
|
41
|
+
isNullish,
|
|
42
|
+
isNumber
|
|
31
43
|
} from "../../utils";
|
|
32
44
|
import {
|
|
33
45
|
defaultOptionKeys,
|
|
@@ -39,7 +51,11 @@ import {
|
|
|
39
51
|
getValueOrLabelByOption,
|
|
40
52
|
defaultPickerProps
|
|
41
53
|
} from "./common";
|
|
54
|
+
import SarPickerItem from "../picker-item/picker-item.vue";
|
|
42
55
|
export default _defineComponent({
|
|
56
|
+
components: {
|
|
57
|
+
SarPickerItem,
|
|
58
|
+
},
|
|
43
59
|
...{
|
|
44
60
|
options: {
|
|
45
61
|
virtualHost: true,
|
|
@@ -53,7 +69,8 @@ export default _defineComponent({
|
|
|
53
69
|
columns: { type: Array, required: false },
|
|
54
70
|
optionKeys: { type: Object, required: false },
|
|
55
71
|
modelValue: { type: null, required: false },
|
|
56
|
-
immediateChange: { type: Boolean, required: false }
|
|
72
|
+
immediateChange: { type: Boolean, required: false },
|
|
73
|
+
internalCustom: { type: Number, required: false }
|
|
57
74
|
}, defaultPickerProps()),
|
|
58
75
|
emits: ["update:model-value", "change"],
|
|
59
76
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -173,7 +190,12 @@ export default _defineComponent({
|
|
|
173
190
|
const pickerStyle = computed(() => {
|
|
174
191
|
return stringifyStyle(props.rootStyle);
|
|
175
192
|
});
|
|
176
|
-
const
|
|
193
|
+
const pickerViewClass = bem.e("picker-view");
|
|
194
|
+
const indicatorClass = bem.e("indicator");
|
|
195
|
+
const maskClass = bem.e("mask");
|
|
196
|
+
const __returned__ = { props, emit, bem, fieldKeys, columnsType, innerValue, columnIndexes, onChange, getRenderedColumns, renderedColumns, getLabelByOption, pickerClass, pickerStyle, pickerViewClass, indicatorClass, maskClass, get isNumber() {
|
|
197
|
+
return isNumber;
|
|
198
|
+
}, SarPickerItem };
|
|
177
199
|
return __returned__;
|
|
178
200
|
}
|
|
179
201
|
});
|
|
@@ -11,7 +11,8 @@ page,
|
|
|
11
11
|
|
|
12
12
|
--sar-picker-indicator-border-color: var(--sar-border-color);
|
|
13
13
|
|
|
14
|
-
--sar-picker-mask-bg-image:
|
|
14
|
+
--sar-picker-mask-bg-image:
|
|
15
|
+
linear-gradient(
|
|
15
16
|
to bottom,
|
|
16
17
|
rgba(var(--sar-emphasis-bg-rgb), 0.95),
|
|
17
18
|
rgba(var(--sar-emphasis-bg-rgb), 0.6)
|
|
@@ -27,6 +28,8 @@ page,
|
|
|
27
28
|
// 放到全局,兼容app
|
|
28
29
|
@include bem(picker) {
|
|
29
30
|
@include e(picker-view) {
|
|
31
|
+
height: var(--sar-picker-height);
|
|
32
|
+
|
|
30
33
|
@include e(indicator) {
|
|
31
34
|
height: var(--sar-picker-item-height);
|
|
32
35
|
&::before {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PopoutInputProps } from '../popout-input/common';
|
|
2
|
-
import { type PickerPopoutEmits, type PickerPopoutProps } from '../picker-popout/common';
|
|
2
|
+
import { type PickerPopoutSlots, type PickerPopoutEmits, type PickerPopoutProps } from '../picker-popout/common';
|
|
3
3
|
export interface PickerInputProps extends PickerPopoutProps, Omit<PopoutInputProps, 'modelValue'> {
|
|
4
4
|
}
|
|
5
5
|
export declare const defaultPickerInputProps: () => {
|
|
@@ -7,5 +7,7 @@ export declare const defaultPickerInputProps: () => {
|
|
|
7
7
|
columns: () => never[];
|
|
8
8
|
immediateChange: boolean;
|
|
9
9
|
};
|
|
10
|
+
export interface PickerInputSlots extends PickerPopoutSlots {
|
|
11
|
+
}
|
|
10
12
|
export interface PickerInputEmits extends PickerPopoutEmits {
|
|
11
13
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type PickerOption } from '../picker/common';
|
|
2
|
-
import { type PickerInputProps } from './common';
|
|
3
|
-
declare
|
|
2
|
+
import { type PickerInputProps, type PickerInputSlots } from './common';
|
|
3
|
+
declare function __VLS_template(): Readonly<PickerInputSlots> & PickerInputSlots;
|
|
4
|
+
declare const __VLS_component: import("vue").DefineComponent<PickerInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
4
5
|
"update:model-value": (value: any) => any;
|
|
5
6
|
change: (value: any) => any;
|
|
6
7
|
"update:visible": (visible: boolean) => any;
|
|
@@ -13,4 +14,10 @@ declare const _default: import("vue").DefineComponent<PickerInputProps, {}, {},
|
|
|
13
14
|
validateEvent: boolean;
|
|
14
15
|
immediateChange: boolean;
|
|
15
16
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
16
18
|
export default _default;
|
|
19
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
20
|
+
new (): {
|
|
21
|
+
$slots: S;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -21,8 +21,31 @@
|
|
|
21
21
|
:option-keys="optionKeys"
|
|
22
22
|
:immediate-change="immediateChange"
|
|
23
23
|
:validate-event="validateEvent"
|
|
24
|
+
:internal-custom="$slots.custom ? 1 : 0"
|
|
24
25
|
@change="onChange"
|
|
25
|
-
|
|
26
|
+
>
|
|
27
|
+
<template
|
|
28
|
+
v-if="$slots.custom"
|
|
29
|
+
#custom="{
|
|
30
|
+
columns,
|
|
31
|
+
maskClass,
|
|
32
|
+
pickerViewClass,
|
|
33
|
+
indicatorClass,
|
|
34
|
+
value,
|
|
35
|
+
onChange,
|
|
36
|
+
}"
|
|
37
|
+
>
|
|
38
|
+
<slot
|
|
39
|
+
name="custom"
|
|
40
|
+
:columns="columns"
|
|
41
|
+
:picker-view-class="pickerViewClass"
|
|
42
|
+
:mask-class="maskClass"
|
|
43
|
+
:indicator-class="indicatorClass"
|
|
44
|
+
:value="value"
|
|
45
|
+
:on-change="onChange"
|
|
46
|
+
></slot>
|
|
47
|
+
</template>
|
|
48
|
+
</sar-picker-popout>
|
|
26
49
|
</sar-popout-input>
|
|
27
50
|
</template>
|
|
28
51
|
|
|
@@ -66,6 +89,7 @@ export default _defineComponent({
|
|
|
66
89
|
optionKeys: { type: Object, required: false },
|
|
67
90
|
modelValue: { type: null, required: false },
|
|
68
91
|
immediateChange: { type: Boolean, required: false },
|
|
92
|
+
internalCustom: { type: Number, required: false },
|
|
69
93
|
placeholder: { type: String, required: false },
|
|
70
94
|
readonly: { type: Boolean, required: false },
|
|
71
95
|
disabled: { type: Boolean, required: false },
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type StyleValue } from 'vue';
|
|
2
|
+
export interface PickerItemProps {
|
|
3
|
+
rootStyle?: StyleValue;
|
|
4
|
+
rootClass?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PickerItemSlots {
|
|
7
|
+
default?(props: Record<string, never>): any;
|
|
8
|
+
}
|
|
9
|
+
export interface PickerItemEmits {
|
|
10
|
+
}
|
|
11
|
+
export interface PickerItemExpose {
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { PickerItemProps, PickerItemSlots, PickerItemEmits, PickerItemExpose, } from './common';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
@use '../style/base' as *;
|
|
2
|
+
|
|
3
|
+
@include bem(picker) {
|
|
4
|
+
@include e(item) {
|
|
5
|
+
height: var(--sar-picker-item-height);
|
|
6
|
+
line-height: var(--sar-picker-item-height);
|
|
7
|
+
font-size: var(--sar-picker-item-font-size);
|
|
8
|
+
text-align: center;
|
|
9
|
+
color: var(--sar-picker-item-color);
|
|
10
|
+
@include ellipsis;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type PickerItemProps, type PickerItemSlots } from './common';
|
|
2
|
+
declare function __VLS_template(): Readonly<PickerItemSlots> & PickerItemSlots;
|
|
3
|
+
declare const __VLS_component: import("vue").DefineComponent<PickerItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<PickerItemProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
4
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
5
|
+
export default _default;
|
|
6
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
7
|
+
new (): {
|
|
8
|
+
$slots: S;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="pickerItemClass" :style="pickerItemStyle">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</view>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import { defineComponent as _defineComponent } from "vue";
|
|
9
|
+
import { computed } from "vue";
|
|
10
|
+
import { classNames, stringifyStyle, createBem } from "../../utils";
|
|
11
|
+
export default _defineComponent({
|
|
12
|
+
...{
|
|
13
|
+
options: {
|
|
14
|
+
virtualHost: true,
|
|
15
|
+
styleIsolation: "shared"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
__name: "picker-item",
|
|
19
|
+
props: {
|
|
20
|
+
rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
21
|
+
rootClass: { type: String, required: false }
|
|
22
|
+
},
|
|
23
|
+
setup(__props, { expose: __expose }) {
|
|
24
|
+
const props = __props;
|
|
25
|
+
const bem = createBem("picker");
|
|
26
|
+
__expose({});
|
|
27
|
+
const pickerItemClass = computed(() => {
|
|
28
|
+
return classNames(bem.e("item"), props.rootClass);
|
|
29
|
+
});
|
|
30
|
+
const pickerItemStyle = computed(() => {
|
|
31
|
+
return stringifyStyle(props.rootStyle);
|
|
32
|
+
});
|
|
33
|
+
const __returned__ = { props, bem, pickerItemClass, pickerItemStyle };
|
|
34
|
+
return __returned__;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<style lang="scss">
|
|
40
|
+
@import './index.scss';
|
|
41
|
+
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type StyleValue } from 'vue';
|
|
2
|
-
import { type PickerProps } from '../picker/common';
|
|
2
|
+
import { type PickerSlots, type PickerProps } from '../picker/common';
|
|
3
3
|
export interface PickerPopoutProps extends PickerProps {
|
|
4
4
|
visible?: boolean;
|
|
5
5
|
title?: string;
|
|
@@ -12,8 +12,7 @@ export declare const defaultPickerPopoutProps: () => {
|
|
|
12
12
|
columns: () => never[];
|
|
13
13
|
immediateChange: boolean;
|
|
14
14
|
};
|
|
15
|
-
export interface PickerPopoutSlots {
|
|
16
|
-
default?(props: Record<string, never>): any;
|
|
15
|
+
export interface PickerPopoutSlots extends PickerSlots {
|
|
17
16
|
}
|
|
18
17
|
export interface PickerPopoutEmits {
|
|
19
18
|
(e: 'update:visible', visible: boolean): void;
|
|
@@ -15,8 +15,33 @@
|
|
|
15
15
|
:columns="columns"
|
|
16
16
|
:option-keys="optionKeys"
|
|
17
17
|
:immediate-change="immediateChange"
|
|
18
|
+
:internal-custom="
|
|
19
|
+
isNumber(internalCustom) ? internalCustom : $slots.custom ? 1 : 0
|
|
20
|
+
"
|
|
18
21
|
@change="onChange"
|
|
19
|
-
|
|
22
|
+
>
|
|
23
|
+
<template
|
|
24
|
+
v-if="$slots.custom"
|
|
25
|
+
#custom="{
|
|
26
|
+
columns,
|
|
27
|
+
maskClass,
|
|
28
|
+
pickerViewClass,
|
|
29
|
+
indicatorClass,
|
|
30
|
+
value,
|
|
31
|
+
onChange,
|
|
32
|
+
}"
|
|
33
|
+
>
|
|
34
|
+
<slot
|
|
35
|
+
name="custom"
|
|
36
|
+
:columns="columns"
|
|
37
|
+
:picker-view-class="pickerViewClass"
|
|
38
|
+
:mask-class="maskClass"
|
|
39
|
+
:indicator-class="indicatorClass"
|
|
40
|
+
:value="value"
|
|
41
|
+
:on-change="onChange"
|
|
42
|
+
></slot>
|
|
43
|
+
</template>
|
|
44
|
+
</sar-picker>
|
|
20
45
|
</template>
|
|
21
46
|
</sar-popout>
|
|
22
47
|
</template>
|
|
@@ -28,7 +53,7 @@ import SarPicker from "../picker/picker.vue";
|
|
|
28
53
|
import {
|
|
29
54
|
defaultPickerPopoutProps
|
|
30
55
|
} from "./common";
|
|
31
|
-
import { isNullish } from "../../utils";
|
|
56
|
+
import { isNullish, isNumber } from "../../utils";
|
|
32
57
|
import { defaultOptionKeys, getInitialValue } from "../picker/common";
|
|
33
58
|
import { computed } from "vue";
|
|
34
59
|
import { useFormPopout } from "../../use";
|
|
@@ -55,7 +80,8 @@ export default _defineComponent({
|
|
|
55
80
|
columns: { type: Array, required: false },
|
|
56
81
|
optionKeys: { type: Object, required: false },
|
|
57
82
|
modelValue: { type: null, required: false },
|
|
58
|
-
immediateChange: { type: Boolean, required: false }
|
|
83
|
+
immediateChange: { type: Boolean, required: false },
|
|
84
|
+
internalCustom: { type: Number, required: false }
|
|
59
85
|
}, defaultPickerPopoutProps()),
|
|
60
86
|
emits: ["update:visible", "update:model-value", "change"],
|
|
61
87
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -77,7 +103,9 @@ export default _defineComponent({
|
|
|
77
103
|
popoutValue.value = innerValue.value;
|
|
78
104
|
}
|
|
79
105
|
};
|
|
80
|
-
const __returned__ = { props, emit, innerVisible, innerValue, popoutValue, onChange, onConfirm, fieldKeys, onEnter, SarPopout, SarPicker
|
|
106
|
+
const __returned__ = { props, emit, innerVisible, innerValue, popoutValue, onChange, onConfirm, fieldKeys, onEnter, SarPopout, SarPicker, get isNumber() {
|
|
107
|
+
return isNumber;
|
|
108
|
+
} };
|
|
81
109
|
return __returned__;
|
|
82
110
|
}
|
|
83
111
|
});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<!-- #ifdef MP -->
|
|
6
6
|
<root-portal>
|
|
7
7
|
<!-- #endif -->
|
|
8
|
-
<view class="sar-portal">
|
|
8
|
+
<view v-show="pageVisible" class="sar-portal">
|
|
9
9
|
<sar-overlay
|
|
10
10
|
v-if="overlay"
|
|
11
11
|
:visible="visible"
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
<script>
|
|
37
37
|
import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
|
|
38
38
|
import { computed, reactive, ref, toRef } from "vue";
|
|
39
|
-
import {
|
|
39
|
+
import { onHide, onShow } from "@dcloudio/uni-app";
|
|
40
|
+
import { classNames, stringifyStyle, createBem, isWeb } from "../../utils";
|
|
40
41
|
import { useTransition, useZIndex } from "../../use";
|
|
41
42
|
import SarOverlay from "../overlay/overlay.vue";
|
|
42
43
|
import {
|
|
@@ -100,6 +101,17 @@ export default _defineComponent({
|
|
|
100
101
|
const onOverlayClick = (event) => {
|
|
101
102
|
emit("overlay-click", event);
|
|
102
103
|
};
|
|
104
|
+
const pageVisible = ref(true);
|
|
105
|
+
onShow(() => {
|
|
106
|
+
if (isWeb) {
|
|
107
|
+
pageVisible.value = true;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
onHide(() => {
|
|
111
|
+
if (isWeb) {
|
|
112
|
+
pageVisible.value = false;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
103
115
|
const popupClass = computed(() => {
|
|
104
116
|
return classNames(
|
|
105
117
|
bem.b(),
|
|
@@ -116,7 +128,7 @@ export default _defineComponent({
|
|
|
116
128
|
transitionDuration: props.duration + "ms"
|
|
117
129
|
});
|
|
118
130
|
});
|
|
119
|
-
const __returned__ = { props, emit, bem, zIndex, increaseZIndex, callVisibleHook, keepRenderClass, onVisibleHook, realVisible, transitionClass, onTransitionEnd, onOverlayClick, popupClass, popupStyle, SarOverlay };
|
|
131
|
+
const __returned__ = { props, emit, bem, zIndex, increaseZIndex, callVisibleHook, keepRenderClass, onVisibleHook, realVisible, transitionClass, onTransitionEnd, onOverlayClick, pageVisible, popupClass, popupStyle, SarOverlay };
|
|
120
132
|
return __returned__;
|
|
121
133
|
}
|
|
122
134
|
});
|
|
@@ -45,6 +45,9 @@ export interface TreeProps {
|
|
|
45
45
|
accordion?: boolean;
|
|
46
46
|
selectable?: boolean;
|
|
47
47
|
checkStrictly?: boolean;
|
|
48
|
+
singleSelectable?: boolean;
|
|
49
|
+
leafOnly?: boolean;
|
|
50
|
+
current?: string | number;
|
|
48
51
|
defaultCheckedKeys?: (string | number)[];
|
|
49
52
|
draggable?: boolean;
|
|
50
53
|
editable?: boolean;
|
|
@@ -57,6 +60,10 @@ export declare const defaultTreeProps: () => {
|
|
|
57
60
|
filterMode: TreeProps["filterMode"];
|
|
58
61
|
accordion: boolean;
|
|
59
62
|
};
|
|
63
|
+
export interface TreeEmits {
|
|
64
|
+
(e: 'update:current', key: string | number, node: TreeStateNode): void;
|
|
65
|
+
(e: 'select', key: string | number, node: TreeStateNode): void;
|
|
66
|
+
}
|
|
60
67
|
export interface TreeExpose {
|
|
61
68
|
setExpanded: (key: string | number, expanded: boolean) => void;
|
|
62
69
|
toggleExpanded: (key: string | number) => void;
|
|
@@ -81,6 +88,8 @@ export interface TreeContext {
|
|
|
81
88
|
selectable: TreeProps['selectable'];
|
|
82
89
|
draggable: TreeProps['draggable'];
|
|
83
90
|
editable: TreeProps['editable'];
|
|
91
|
+
singleSelectable: TreeProps['singleSelectable'];
|
|
92
|
+
leafOnly: TreeProps['leafOnly'];
|
|
84
93
|
treeData: TreeStateNode[];
|
|
85
94
|
setExpandedByNode: (node: TreeStateNode, expanded: boolean) => void;
|
|
86
95
|
toggleExpandedByNode: (node: TreeStateNode) => void;
|
|
@@ -89,5 +98,7 @@ export interface TreeContext {
|
|
|
89
98
|
leveldown: (node: TreeStateNode) => void;
|
|
90
99
|
edit: (node: TreeStateNode, getEditRect: () => Promise<NodeRect>) => void;
|
|
91
100
|
drop: (dropOriginNode: TreeStateNode, dropTargetNode: TreeStateNode, position: number) => void;
|
|
101
|
+
currentKey: string | number | undefined;
|
|
102
|
+
singleSelect: (node: TreeStateNode) => void;
|
|
92
103
|
}
|
|
93
104
|
export declare const treeContextSymbol: unique symbol;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { TreeProps, TreeExpose } from './common';
|
|
1
|
+
export type { TreeProps, TreeEmits, TreeExpose, TreeNode, TreeStateNode, } from './common';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TreeProps, type TreeNode, type TreeCleanNode } from './common';
|
|
1
|
+
import { type TreeProps, type TreeNode, type TreeStateNode, type TreeCleanNode } from './common';
|
|
2
2
|
declare const _default: import("vue").DefineComponent<TreeProps, {
|
|
3
3
|
setExpanded: (key: string | number, expanded: boolean) => void;
|
|
4
4
|
toggleExpanded: (key: string | number) => void;
|
|
@@ -11,7 +11,13 @@ declare const _default: import("vue").DefineComponent<TreeProps, {
|
|
|
11
11
|
addRootNode: () => void;
|
|
12
12
|
getCleanTreeData: () => TreeCleanNode[];
|
|
13
13
|
filter: (searchString: string) => void;
|
|
14
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}
|
|
14
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
15
|
+
select: (key: string | number, node: TreeStateNode) => any;
|
|
16
|
+
"update:current": (key: string | number, node: TreeStateNode) => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<TreeProps> & Readonly<{
|
|
18
|
+
onSelect?: ((key: string | number, node: TreeStateNode) => any) | undefined;
|
|
19
|
+
"onUpdate:current"?: ((key: string | number, node: TreeStateNode) => any) | undefined;
|
|
20
|
+
}>, {
|
|
15
21
|
accordion: boolean;
|
|
16
22
|
data: TreeNode[];
|
|
17
23
|
filterMode: "lenient" | "strict";
|
package/components/tree/tree.vue
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
|
|
36
36
|
<script>
|
|
37
37
|
import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
|
|
38
|
-
import { computed, provide, reactive, ref, toRef, watch } from "vue";
|
|
38
|
+
import { computed, provide, reactive, ref, shallowRef, toRef, watch } from "vue";
|
|
39
39
|
import {
|
|
40
40
|
classNames,
|
|
41
41
|
stringifyStyle,
|
|
@@ -80,14 +80,19 @@ export default _defineComponent({
|
|
|
80
80
|
accordion: { type: Boolean, required: false },
|
|
81
81
|
selectable: { type: Boolean, required: false },
|
|
82
82
|
checkStrictly: { type: Boolean, required: false },
|
|
83
|
+
singleSelectable: { type: Boolean, required: false },
|
|
84
|
+
leafOnly: { type: Boolean, required: false },
|
|
85
|
+
current: { type: [String, Number], required: false },
|
|
83
86
|
defaultCheckedKeys: { type: Array, required: false },
|
|
84
87
|
draggable: { type: Boolean, required: false },
|
|
85
88
|
editable: { type: Boolean, required: false },
|
|
86
89
|
filterMode: { type: String, required: false },
|
|
87
90
|
filterMethod: { type: Function, required: false }
|
|
88
91
|
}, defaultTreeProps()),
|
|
89
|
-
|
|
92
|
+
emits: ["update:current", "select"],
|
|
93
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
90
94
|
const props = __props;
|
|
95
|
+
const emit = __emit;
|
|
91
96
|
const bem = createBem("tree");
|
|
92
97
|
const { t } = useTranslate("tree");
|
|
93
98
|
const fieldKeys = computed(() => {
|
|
@@ -506,12 +511,28 @@ export default _defineComponent({
|
|
|
506
511
|
recur(treeData.value);
|
|
507
512
|
setRenderPosition();
|
|
508
513
|
}
|
|
514
|
+
const currentKey = shallowRef(props.current);
|
|
515
|
+
watch(
|
|
516
|
+
() => props.current,
|
|
517
|
+
() => {
|
|
518
|
+
currentKey.value = props.current;
|
|
519
|
+
}
|
|
520
|
+
);
|
|
521
|
+
const singleSelect = (node) => {
|
|
522
|
+
if (currentKey.value !== node.key) {
|
|
523
|
+
currentKey.value = node.key;
|
|
524
|
+
emit("update:current", node.key, node);
|
|
525
|
+
emit("select", node.key, node);
|
|
526
|
+
}
|
|
527
|
+
};
|
|
509
528
|
provide(
|
|
510
529
|
treeContextSymbol,
|
|
511
530
|
reactive({
|
|
512
531
|
selectable: toRef(() => props.selectable),
|
|
513
532
|
draggable: toRef(() => props.draggable),
|
|
514
533
|
editable: toRef(() => props.editable),
|
|
534
|
+
singleSelectable: toRef(() => props.singleSelectable),
|
|
535
|
+
leafOnly: toRef(() => props.leafOnly),
|
|
515
536
|
treeData: toRef(() => treeData.value),
|
|
516
537
|
setExpandedByNode,
|
|
517
538
|
toggleExpandedByNode,
|
|
@@ -519,7 +540,9 @@ export default _defineComponent({
|
|
|
519
540
|
levelup,
|
|
520
541
|
leveldown,
|
|
521
542
|
drop,
|
|
522
|
-
edit
|
|
543
|
+
edit,
|
|
544
|
+
currentKey,
|
|
545
|
+
singleSelect
|
|
523
546
|
})
|
|
524
547
|
);
|
|
525
548
|
__expose({
|
|
@@ -546,7 +569,7 @@ export default _defineComponent({
|
|
|
546
569
|
props.rootStyle
|
|
547
570
|
);
|
|
548
571
|
});
|
|
549
|
-
const __returned__ = { props, bem, t, fieldKeys, treeData, get treeMap() {
|
|
572
|
+
const __returned__ = { props, emit, bem, t, fieldKeys, treeData, get treeMap() {
|
|
550
573
|
return treeMap;
|
|
551
574
|
}, set treeMap(v) {
|
|
552
575
|
treeMap = v;
|
|
@@ -554,7 +577,7 @@ export default _defineComponent({
|
|
|
554
577
|
return currentEditNode;
|
|
555
578
|
}, set currentEditNode(v) {
|
|
556
579
|
currentEditNode = v;
|
|
557
|
-
}, currentEditType, currentEditValue, mapEditTypeTitle, currentEditTitle, dialogVisible, toastVisible, onPopoverSelect, beforeClose, edit, focused, onVisibleHook, defaultFilterMethod, filter, treeClass, treeStyle, SarTreeNode, SarPopover, SarInput, SarDialog, SarToast };
|
|
580
|
+
}, currentEditType, currentEditValue, mapEditTypeTitle, currentEditTitle, dialogVisible, toastVisible, onPopoverSelect, beforeClose, edit, focused, onVisibleHook, defaultFilterMethod, filter, currentKey, singleSelect, treeClass, treeStyle, SarTreeNode, SarPopover, SarInput, SarDialog, SarToast };
|
|
558
581
|
return __returned__;
|
|
559
582
|
}
|
|
560
583
|
});
|
|
@@ -11,8 +11,8 @@ page,
|
|
|
11
11
|
--sar-tree-node-bg: var(--sar-emphasis-bg);
|
|
12
12
|
--sar-tree-node-active-bg: var(--sar-active-bg);
|
|
13
13
|
--sar-tree-node-dragging-bg: var(--sar-mask-white-legible);
|
|
14
|
-
--sar-tree-node-dragging-shadow:
|
|
15
|
-
0 1px 10px rgb(0 0 0 / 0.2);
|
|
14
|
+
--sar-tree-node-dragging-shadow:
|
|
15
|
+
0 0 1px 1px rgb(0 0 0 / 0.2), 0 1px 10px rgb(0 0 0 / 0.2);
|
|
16
16
|
|
|
17
17
|
--sar-tree-toolbar-margin-right: -24rpx;
|
|
18
18
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<sar-icon family="sari" name="right" />
|
|
14
14
|
</view>
|
|
15
15
|
<view
|
|
16
|
-
v-if="treeContext.selectable"
|
|
16
|
+
v-if="treeContext.selectable || canSingleSelectable"
|
|
17
17
|
:class="selectionClass"
|
|
18
18
|
@touchstart.stop="onSelectionTouchStart"
|
|
19
19
|
@touchend.stop="onSelectionTouchEnd"
|
|
@@ -22,11 +22,18 @@
|
|
|
22
22
|
@click.stop
|
|
23
23
|
>
|
|
24
24
|
<sar-checkbox
|
|
25
|
+
v-if="treeContext.selectable"
|
|
25
26
|
readonly
|
|
26
27
|
:checked="node.checked"
|
|
27
28
|
:indeterminate="node.indeterminate"
|
|
28
29
|
:disabled="node.disabled"
|
|
29
30
|
/>
|
|
31
|
+
<sar-radio
|
|
32
|
+
v-if="canSingleSelectable"
|
|
33
|
+
readonly
|
|
34
|
+
:checked="isSingleChecked"
|
|
35
|
+
:disabled="node.disabled"
|
|
36
|
+
/>
|
|
30
37
|
</view>
|
|
31
38
|
<view :class="bem.e('title')">
|
|
32
39
|
{{ node.title }}
|
|
@@ -103,6 +110,7 @@ import {
|
|
|
103
110
|
import { useMouseDown, useSimulatedClick, useSimulatedPress } from "../../use";
|
|
104
111
|
import SarIcon from "../icon/icon.vue";
|
|
105
112
|
import SarCheckbox from "../checkbox/checkbox.vue";
|
|
113
|
+
import SarRadio from "../radio/radio.vue";
|
|
106
114
|
import SarPopover from "../popover/popover.vue";
|
|
107
115
|
import { usePopover } from "../popover";
|
|
108
116
|
import { getNodeLevel, recurDescendant } from "../tree/utils";
|
|
@@ -110,6 +118,7 @@ export default _defineComponent({
|
|
|
110
118
|
components: {
|
|
111
119
|
SarIcon,
|
|
112
120
|
SarCheckbox,
|
|
121
|
+
SarRadio,
|
|
113
122
|
SarPopover,
|
|
114
123
|
},
|
|
115
124
|
...{
|
|
@@ -263,10 +272,13 @@ export default _defineComponent({
|
|
|
263
272
|
if (!isLeaf.value) {
|
|
264
273
|
treeContext.toggleExpandedByNode(props.node);
|
|
265
274
|
}
|
|
275
|
+
if (canSingleSelectable.value && treeContext.leafOnly) {
|
|
276
|
+
treeContext.singleSelect(props.node);
|
|
277
|
+
}
|
|
266
278
|
};
|
|
267
279
|
const nodeActive = ref(false);
|
|
268
280
|
const onNodeTouchStart = () => {
|
|
269
|
-
if (!isLeaf.value) {
|
|
281
|
+
if (!isLeaf.value || canSingleSelectable.value && treeContext.leafOnly) {
|
|
270
282
|
nodeActive.value = true;
|
|
271
283
|
}
|
|
272
284
|
};
|
|
@@ -278,11 +290,20 @@ export default _defineComponent({
|
|
|
278
290
|
void 0,
|
|
279
291
|
onNodeTouchEnd
|
|
280
292
|
);
|
|
293
|
+
const canSingleSelectable = computed(() => {
|
|
294
|
+
return treeContext.singleSelectable && (!treeContext.leafOnly || isLeaf.value);
|
|
295
|
+
});
|
|
296
|
+
const isSingleChecked = computed(
|
|
297
|
+
() => props.node.key === treeContext.currentKey
|
|
298
|
+
);
|
|
281
299
|
const [onSelectionTouchStart, onSelectionTouchEnd] = useSimulatedClick(() => {
|
|
282
300
|
if (!props.node.disabled) {
|
|
283
301
|
if (treeContext.selectable) {
|
|
284
302
|
treeContext.setCheckedByNode(props.node, !props.node.checked);
|
|
285
303
|
}
|
|
304
|
+
if (canSingleSelectable.value) {
|
|
305
|
+
treeContext.singleSelect(props.node);
|
|
306
|
+
}
|
|
286
307
|
}
|
|
287
308
|
});
|
|
288
309
|
const onSelectionMouseDown = useMouseDown(
|
|
@@ -308,6 +329,7 @@ export default _defineComponent({
|
|
|
308
329
|
bem.em("node", "dragging", dragging.value),
|
|
309
330
|
bem.em("node", "selectable", treeContext.selectable),
|
|
310
331
|
bem.em("node", "active", nodeActive.value),
|
|
332
|
+
bem.em("node", "current", isSingleChecked.value),
|
|
311
333
|
nodeId
|
|
312
334
|
);
|
|
313
335
|
});
|
|
@@ -355,7 +377,7 @@ export default _defineComponent({
|
|
|
355
377
|
return obviousNodes;
|
|
356
378
|
}, set obviousNodes(v) {
|
|
357
379
|
obviousNodes = v;
|
|
358
|
-
}, onDragStart, onDragMove, onDragEnd, onDragSimulatedClickTouchStart, onDragSimulatedClickTouchEnd, onDragSimulatedPressTouchStart, onDragSimulatedPressTouchMove, onDragSimulatedPressTouchEnd, onDragTouchStart, onDragTouchMove, onDragTouchEnd, onDragMouseDown, dragId, popover, isLastNode, popoverOptions, onPopoverSelect, isLeaf, onNodeClick, nodeActive, onNodeTouchStart, onNodeTouchEnd, onNodeMouseDown, onSelectionTouchStart, onSelectionTouchEnd, onSelectionMouseDown, editId, getEditRect, onEditTouchStart, onEditTouchEnd, onEditMouseDown, nodeClass, nodeStyle, editClass, indentStyle, arrowClass, selectionClass, SarIcon, SarCheckbox, SarPopover };
|
|
380
|
+
}, onDragStart, onDragMove, onDragEnd, onDragSimulatedClickTouchStart, onDragSimulatedClickTouchEnd, onDragSimulatedPressTouchStart, onDragSimulatedPressTouchMove, onDragSimulatedPressTouchEnd, onDragTouchStart, onDragTouchMove, onDragTouchEnd, onDragMouseDown, dragId, popover, isLastNode, popoverOptions, onPopoverSelect, isLeaf, onNodeClick, nodeActive, onNodeTouchStart, onNodeTouchEnd, onNodeMouseDown, canSingleSelectable, isSingleChecked, onSelectionTouchStart, onSelectionTouchEnd, onSelectionMouseDown, editId, getEditRect, onEditTouchStart, onEditTouchEnd, onEditMouseDown, nodeClass, nodeStyle, editClass, indentStyle, arrowClass, selectionClass, SarIcon, SarCheckbox, SarRadio, SarPopover };
|
|
359
381
|
return __returned__;
|
|
360
382
|
}
|
|
361
383
|
});
|
package/global.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ declare module 'vue' {
|
|
|
66
66
|
SarPasswordInput: typeof import('./components/password-input/password-input').default
|
|
67
67
|
SarPicker: typeof import('./components/picker/picker').default
|
|
68
68
|
SarPickerInput: typeof import('./components/picker-input/picker-input').default
|
|
69
|
+
SarPickerItem: typeof import('./components/picker-item/picker-item').default
|
|
69
70
|
SarPickerPopout: typeof import('./components/picker-popout/picker-popout').default
|
|
70
71
|
SarPopout: typeof import('./components/popout/popout').default
|
|
71
72
|
SarPopoutInput: typeof import('./components/popout-input/popout-input').default
|
package/index.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ export * from './components/pagination';
|
|
|
58
58
|
export * from './components/password-input';
|
|
59
59
|
export * from './components/picker';
|
|
60
60
|
export * from './components/picker-input';
|
|
61
|
+
export * from './components/picker-item';
|
|
61
62
|
export * from './components/picker-popout';
|
|
62
63
|
export * from './components/popout';
|
|
63
64
|
export * from './components/popout-input';
|
package/index.js
CHANGED
|
@@ -58,6 +58,7 @@ export * from './components/pagination';
|
|
|
58
58
|
export * from './components/password-input';
|
|
59
59
|
export * from './components/picker';
|
|
60
60
|
export * from './components/picker-input';
|
|
61
|
+
export * from './components/picker-item';
|
|
61
62
|
export * from './components/picker-popout';
|
|
62
63
|
export * from './components/popout';
|
|
63
64
|
export * from './components/popout-input';
|
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.
|
|
5
|
+
"version": "1.17.0",
|
|
6
6
|
"description": "sard-uniapp 是一套基于 Uniapp + Vue3 框架开发的兼容多端的 UI 组件库",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"@dcloudio/uni-quickapp-webview": "3.0.0-4060420250429001",
|
|
97
97
|
"@dcloudio/uni-stacktracey": "3.0.0-4060420250429001",
|
|
98
98
|
"@dcloudio/vite-plugin-uni": "3.0.0-4060420250429001",
|
|
99
|
-
"@esbuild/darwin-x64": "0.
|
|
99
|
+
"@esbuild/darwin-x64": "0.25.4",
|
|
100
100
|
"@gunny/perf-test": "^0.1.3",
|
|
101
101
|
"@rollup/rollup-darwin-x64": "^4.24.0",
|
|
102
102
|
"@types/inquirer": "^9.0.7",
|