sard-uniapp 1.21.1 → 1.22.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 +24 -0
- package/components/accordion/README.md +13 -6
- package/components/accordion/accordion.vue +10 -3
- package/components/accordion/common.d.ts +2 -0
- package/components/accordion/index.scss +6 -0
- package/components/accordion-item/accordion-item.vue +6 -1
- package/components/accordion-item/index.scss +12 -0
- package/components/calendar-input/README.md +9 -0
- package/components/calendar-input/calendar-input.d.ts +9 -2
- package/components/calendar-input/calendar-input.vue +13 -1
- package/components/calendar-input/common.d.ts +3 -1
- package/components/cascader-input/README.md +8 -1
- package/components/cascader-input/cascader-input.vue +13 -1
- package/components/cascader-input/common.d.ts +2 -2
- package/components/checkbox-input/README.md +9 -0
- package/components/checkbox-input/checkbox-input.d.ts +9 -2
- package/components/checkbox-input/checkbox-input.vue +13 -1
- package/components/checkbox-input/common.d.ts +3 -1
- package/components/config/index.d.ts +5 -0
- package/components/config/index.js +5 -0
- package/components/datetime-picker-input/README.md +9 -0
- package/components/datetime-picker-input/common.d.ts +2 -2
- package/components/datetime-picker-input/datetime-picker-input.vue +13 -1
- package/components/datetime-range-picker-input/README.md +9 -0
- package/components/datetime-range-picker-input/common.d.ts +2 -2
- package/components/datetime-range-picker-input/datetime-range-picker-input.vue +13 -1
- package/components/dnd/README.md +120 -0
- package/components/dnd/common.d.ts +49 -0
- package/components/dnd/common.js +1 -0
- package/components/dnd/dnd.d.ts +37 -0
- package/components/dnd/dnd.vue +136 -0
- package/components/dnd/index.d.ts +1 -0
- package/components/dnd/index.js +1 -0
- package/components/dnd/index.scss +11 -0
- package/components/dnd/variables.scss +7 -0
- package/components/dnd-handle/common.d.ts +12 -0
- package/components/dnd-handle/common.js +1 -0
- package/components/dnd-handle/dnd-handle.d.ts +10 -0
- package/components/dnd-handle/dnd-handle.vue +89 -0
- package/components/dnd-handle/index.d.ts +1 -0
- package/components/dnd-handle/index.js +1 -0
- package/components/dnd-handle/index.scss +13 -0
- package/components/dnd-item/common.d.ts +21 -0
- package/components/dnd-item/common.js +1 -0
- package/components/dnd-item/dnd-item.d.ts +10 -0
- package/components/dnd-item/dnd-item.vue +193 -0
- package/components/dnd-item/index.d.ts +1 -0
- package/components/dnd-item/index.js +1 -0
- package/components/dnd-item/index.scss +28 -0
- package/components/floating-bubble/index.scss +1 -0
- package/components/form/README.md +6 -5
- package/components/form/common.d.ts +4 -0
- package/components/form-item/form-item.vue +10 -4
- package/components/icon/sari.scss +9 -1
- package/components/input/README.md +47 -46
- package/components/input/common.d.ts +1 -0
- package/components/input/index.scss +15 -0
- package/components/input/input.vue +61 -4
- package/components/input/variables.scss +6 -0
- package/components/picker-input/README.md +9 -0
- package/components/picker-input/common.d.ts +2 -2
- package/components/picker-input/picker-input.vue +15 -1
- package/components/popout-input/README.md +20 -11
- package/components/popout-input/common.d.ts +10 -0
- package/components/popout-input/common.js +2 -1
- package/components/popout-input/index.scss +1 -0
- package/components/popout-input/popout-input.d.ts +5 -1
- package/components/popout-input/popout-input.vue +22 -7
- package/components/popup/README.md +24 -22
- package/components/popup/common.d.ts +3 -0
- package/components/popup/popup.d.ts +8 -5
- package/components/popup/popup.vue +25 -2
- package/components/radio-input/README.md +9 -0
- package/components/radio-input/common.d.ts +3 -1
- package/components/radio-input/radio-input.d.ts +9 -2
- package/components/radio-input/radio-input.vue +13 -1
- package/components/share-sheet/share-sheet.vue +1 -1
- package/components/stepper/common.d.ts +1 -1
- package/components/stepper/stepper.vue +1 -1
- package/components/style/mixins/disable-scroll.scss +14 -0
- package/components/style/mixins.scss +1 -0
- package/components/style/variables.scss +4 -0
- package/components/tree/common.d.ts +1 -0
- package/components/tree/index.scss +4 -0
- package/components/tree/tree.vue +33 -21
- package/components/tree/variables.scss +1 -2
- package/components/tree-node/tree-node.vue +2 -0
- package/global.d.ts +3 -0
- package/index.d.ts +3 -0
- package/index.js +3 -0
- package/index.scss +1 -0
- package/package.json +2 -2
- package/use/index.d.ts +1 -0
- package/use/index.js +1 -0
- package/use/useKeyList.d.ts +5 -0
- package/use/useKeyList.js +15 -0
- package/utils/array.js +6 -6
|
@@ -7,9 +7,14 @@
|
|
|
7
7
|
:clearable="clearable"
|
|
8
8
|
:root-class="rootClass"
|
|
9
9
|
:root-style="rootStyle"
|
|
10
|
+
:internal-arrow="$slots.arrow ? 1 : 0"
|
|
11
|
+
:input-props="inputProps"
|
|
10
12
|
@clear="onClear"
|
|
11
13
|
@click="show"
|
|
12
14
|
>
|
|
15
|
+
<template v-if="$slots.arrow" #arrow>
|
|
16
|
+
<slot name="arrow"></slot>
|
|
17
|
+
</template>
|
|
13
18
|
<sar-radio-popout
|
|
14
19
|
v-model:visible="innerVisible"
|
|
15
20
|
v-model="innerValue"
|
|
@@ -63,6 +68,9 @@ import { usePopoutInput } from "../../use";
|
|
|
63
68
|
* @property {boolean} clearable 是否显示清空按钮,默认值:false。
|
|
64
69
|
* @property {string} placeholder 输入框占位符内容,默认值:-。
|
|
65
70
|
* @property {() => any} valueOnClear 设置点击清除按钮后的值,默认值:() => undefined。
|
|
71
|
+
* @property {string} arrow 自定义箭头图标名,默认值:'caret-right'。
|
|
72
|
+
* @property {string} arrowFamily 自定义箭头图标字体,默认值:'sari'。
|
|
73
|
+
* @property {InputProps} inputProps 自定义输入框组件属性,默认值:-。
|
|
66
74
|
* @event {(visible: boolean) => void} update 弹出框显隐时触发
|
|
67
75
|
* @event {(value: any | undefined) => void} change 单选输入组件值改变时触发
|
|
68
76
|
*/
|
|
@@ -101,7 +109,11 @@ export default _defineComponent({
|
|
|
101
109
|
placeholder: { type: String, required: false },
|
|
102
110
|
clearable: { type: Boolean, required: false },
|
|
103
111
|
loading: { type: Boolean, required: false },
|
|
104
|
-
multiline: { type: Boolean, required: false }
|
|
112
|
+
multiline: { type: Boolean, required: false },
|
|
113
|
+
arrow: { type: String, required: false },
|
|
114
|
+
arrowFamily: { type: String, required: false },
|
|
115
|
+
internalArrow: { type: Number, required: false },
|
|
116
|
+
inputProps: { type: Object, required: false }
|
|
105
117
|
}, defaultRadioInputProps()),
|
|
106
118
|
emits: ["update:visible", "update:model-value", "change"],
|
|
107
119
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -95,11 +95,11 @@ import {
|
|
|
95
95
|
* @property {boolean} overlay 是否显示遮罩,默认值:true。
|
|
96
96
|
* @property {string} background 遮罩背景色,默认值:-。
|
|
97
97
|
* @property {boolean} transparent 透明遮罩,默认值:false。
|
|
98
|
+
* @property {boolean} overlayClosable 点击遮罩后是否关闭,默认值:true。
|
|
98
99
|
* @property {ShareSheetItem[] | ShareSheetItem[][]} itemList 面板选项列表,默认值:[]。
|
|
99
100
|
* @property {string} title 面板标题,默认值:-。
|
|
100
101
|
* @property {string} description 面板描述,默认值:-。
|
|
101
102
|
* @property {string} cancel 取消按钮内容,默认值:-。
|
|
102
|
-
* @property {boolean} overlayClosable 点击遮罩后是否关闭,默认值:true。
|
|
103
103
|
* @property {(type: 'close' | 'cancel' | 'select') => boolean | Promise\<any>} beforeClose 关闭前的回调,返回 `false` 或 `rejected` 状态的 `Promise` 可阻止关闭,默认值:-。
|
|
104
104
|
* @event {(visible: boolean) => void} update 分享面板显隐时触发
|
|
105
105
|
* @event {() => void} close 点击遮罩时触发
|
|
@@ -102,7 +102,7 @@ export default _defineComponent({
|
|
|
102
102
|
props: _mergeDefaults({
|
|
103
103
|
rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
104
104
|
rootClass: { type: String, required: false },
|
|
105
|
-
modelValue: { type: [Number, String], required: false },
|
|
105
|
+
modelValue: { type: [Number, String, null], required: false },
|
|
106
106
|
min: { type: Number, required: false },
|
|
107
107
|
max: { type: Number, required: false },
|
|
108
108
|
valueOnClear: { type: [Number, String], required: false },
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
@use './bem' as *;
|
|
2
|
+
|
|
3
|
+
@mixin disable-scroll {
|
|
4
|
+
position: fixed;
|
|
5
|
+
inset: 0;
|
|
6
|
+
z-index: var(--sar-disable-scroll-z-index);
|
|
7
|
+
display: none;
|
|
8
|
+
background-color: transparent;
|
|
9
|
+
touch-action: none;
|
|
10
|
+
|
|
11
|
+
@include m(dragging) {
|
|
12
|
+
display: block;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -172,6 +172,8 @@ page,
|
|
|
172
172
|
0 5px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
|
|
173
173
|
--sar-shadow-2xl: 0 10px 50px -12px rgb(0 0 0 / 0.25);
|
|
174
174
|
--sar-shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
|
|
175
|
+
--sar-shadow-dragging:
|
|
176
|
+
0 0 2px 0 rgb(0 0 0 / 0.1), 0 2px 12px rgb(0 0 0 / 0.2);
|
|
175
177
|
|
|
176
178
|
--sar-scroll-shadow-start: inset 0 10px 10px -10px rgba(0, 0, 0, 0.1);
|
|
177
179
|
--sar-scroll-shadow-end: inset 0 -10px 10px -10px rgba(0, 0, 0, 0.1);
|
|
@@ -209,5 +211,7 @@ page,
|
|
|
209
211
|
--sar-duration-slow: 500ms;
|
|
210
212
|
--sar-duration: 300ms;
|
|
211
213
|
--sar-duration-fast: 150ms;
|
|
214
|
+
|
|
215
|
+
--sar-disable-scroll-z-index: 999999;
|
|
212
216
|
}
|
|
213
217
|
// #endvariables
|
|
@@ -100,5 +100,6 @@ export interface TreeContext {
|
|
|
100
100
|
drop: (dropOriginNode: TreeStateNode, dropTargetNode: TreeStateNode, position: number) => void;
|
|
101
101
|
currentKey: string | number | undefined;
|
|
102
102
|
singleSelect: (node: TreeStateNode) => void;
|
|
103
|
+
dragging: boolean;
|
|
103
104
|
}
|
|
104
105
|
export declare const treeContextSymbol: unique symbol;
|
package/components/tree/tree.vue
CHANGED
|
@@ -31,6 +31,17 @@
|
|
|
31
31
|
</sar-dialog>
|
|
32
32
|
|
|
33
33
|
<sar-toast v-model:visible="toastVisible" :title="t('please')" />
|
|
34
|
+
|
|
35
|
+
<!-- #ifdef MP-ALIPAY -->
|
|
36
|
+
<view
|
|
37
|
+
:class="
|
|
38
|
+
classNames(
|
|
39
|
+
bem.e('disable-scroll'),
|
|
40
|
+
bem.em('disable-scroll', 'dragging', context.dragging),
|
|
41
|
+
)
|
|
42
|
+
"
|
|
43
|
+
></view>
|
|
44
|
+
<!-- #endif -->
|
|
34
45
|
</template>
|
|
35
46
|
|
|
36
47
|
<script>
|
|
@@ -546,26 +557,25 @@ export default _defineComponent({
|
|
|
546
557
|
emit("select", node.key, node);
|
|
547
558
|
}
|
|
548
559
|
};
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
);
|
|
560
|
+
const context = reactive({
|
|
561
|
+
selectable: toRef(() => props.selectable),
|
|
562
|
+
draggable: toRef(() => props.draggable),
|
|
563
|
+
editable: toRef(() => props.editable),
|
|
564
|
+
singleSelectable: toRef(() => props.singleSelectable),
|
|
565
|
+
leafOnly: toRef(() => props.leafOnly),
|
|
566
|
+
treeData: toRef(() => treeData.value),
|
|
567
|
+
setExpandedByNode,
|
|
568
|
+
toggleExpandedByNode,
|
|
569
|
+
setCheckedByNode,
|
|
570
|
+
levelup,
|
|
571
|
+
leveldown,
|
|
572
|
+
drop,
|
|
573
|
+
edit,
|
|
574
|
+
currentKey,
|
|
575
|
+
singleSelect,
|
|
576
|
+
dragging: false
|
|
577
|
+
});
|
|
578
|
+
provide(treeContextSymbol, context);
|
|
569
579
|
__expose({
|
|
570
580
|
setExpanded,
|
|
571
581
|
toggleExpanded,
|
|
@@ -598,7 +608,9 @@ export default _defineComponent({
|
|
|
598
608
|
return currentEditNode;
|
|
599
609
|
}, set currentEditNode(v) {
|
|
600
610
|
currentEditNode = v;
|
|
601
|
-
}, currentEditType, currentEditValue, mapEditTypeTitle, currentEditTitle, dialogVisible, toastVisible, onPopoverSelect, beforeClose, edit, focused, onVisibleHook, defaultFilterMethod, filter, currentKey, singleSelect, treeClass, treeStyle,
|
|
611
|
+
}, currentEditType, currentEditValue, mapEditTypeTitle, currentEditTitle, dialogVisible, toastVisible, onPopoverSelect, beforeClose, edit, focused, onVisibleHook, defaultFilterMethod, filter, currentKey, singleSelect, context, treeClass, treeStyle, get classNames() {
|
|
612
|
+
return classNames;
|
|
613
|
+
}, SarTreeNode, SarPopover, SarInput, SarDialog, SarToast };
|
|
602
614
|
return __returned__;
|
|
603
615
|
}
|
|
604
616
|
});
|
|
@@ -11,8 +11,7 @@ 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 0 1px 1px rgb(0 0 0 / 0.2), 0 1px 10px rgb(0 0 0 / 0.2);
|
|
14
|
+
--sar-tree-node-dragging-shadow: var(--sar-shadow-dragging);
|
|
16
15
|
|
|
17
16
|
--sar-tree-toolbar-margin-right: -24rpx;
|
|
18
17
|
|
|
@@ -207,6 +207,7 @@ export default _defineComponent({
|
|
|
207
207
|
onDragSimulatedPressTouchEnd
|
|
208
208
|
] = useSimulatedPress({
|
|
209
209
|
start: () => {
|
|
210
|
+
treeContext.dragging = true;
|
|
210
211
|
dragging.value = true;
|
|
211
212
|
treeContext.setExpandedByNode(props.node, false);
|
|
212
213
|
onDragStart();
|
|
@@ -217,6 +218,7 @@ export default _defineComponent({
|
|
|
217
218
|
}
|
|
218
219
|
},
|
|
219
220
|
end: () => {
|
|
221
|
+
treeContext.dragging = false;
|
|
220
222
|
dragging.value = false;
|
|
221
223
|
onDragEnd();
|
|
222
224
|
},
|
package/global.d.ts
CHANGED
|
@@ -34,6 +34,9 @@ declare module 'vue' {
|
|
|
34
34
|
SarDialog: typeof import('./components/dialog/dialog').default
|
|
35
35
|
SarDialogAgent: typeof import('./components/dialog-agent/dialog-agent').default
|
|
36
36
|
SarDivider: typeof import('./components/divider/divider').default
|
|
37
|
+
SarDnd: typeof import('./components/dnd/dnd').default
|
|
38
|
+
SarDndHandle: typeof import('./components/dnd-handle/dnd-handle').default
|
|
39
|
+
SarDndItem: typeof import('./components/dnd-item/dnd-item').default
|
|
37
40
|
SarDropdown: typeof import('./components/dropdown/dropdown').default
|
|
38
41
|
SarDropdownItem: typeof import('./components/dropdown-item/dropdown-item').default
|
|
39
42
|
SarEmpty: typeof import('./components/empty/empty').default
|
package/index.d.ts
CHANGED
|
@@ -30,6 +30,9 @@ export * from './components/datetime-range-picker-popout';
|
|
|
30
30
|
export * from './components/dialog';
|
|
31
31
|
export * from './components/dialog-agent';
|
|
32
32
|
export * from './components/divider';
|
|
33
|
+
export * from './components/dnd';
|
|
34
|
+
export * from './components/dnd-handle';
|
|
35
|
+
export * from './components/dnd-item';
|
|
33
36
|
export * from './components/dropdown';
|
|
34
37
|
export * from './components/empty';
|
|
35
38
|
export * from './components/fab';
|
package/index.js
CHANGED
|
@@ -30,6 +30,9 @@ export * from './components/datetime-range-picker-popout';
|
|
|
30
30
|
export * from './components/dialog';
|
|
31
31
|
export * from './components/dialog-agent';
|
|
32
32
|
export * from './components/divider';
|
|
33
|
+
export * from './components/dnd';
|
|
34
|
+
export * from './components/dnd-handle';
|
|
35
|
+
export * from './components/dnd-item';
|
|
33
36
|
export * from './components/dropdown';
|
|
34
37
|
export * from './components/empty';
|
|
35
38
|
export * from './components/fab';
|
package/index.scss
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
@use './components/datetime-range-picker/variables.scss' as *;
|
|
17
17
|
@use './components/dialog/variables.scss' as *;
|
|
18
18
|
@use './components/divider/variables.scss' as *;
|
|
19
|
+
@use './components/dnd/variables.scss' as *;
|
|
19
20
|
@use './components/dropdown/variables.scss' as *;
|
|
20
21
|
@use './components/empty/variables.scss' as *;
|
|
21
22
|
@use './components/fab/variables.scss' as *;
|
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.22.0",
|
|
6
6
|
"description": "sard-uniapp 是一套基于 Uniapp + Vue3 框架开发的兼容多端的 UI 组件库",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"lodash-es": "^4.17.21",
|
|
124
124
|
"prettier": "^3.5.3",
|
|
125
125
|
"region-data": "^1.2.3",
|
|
126
|
-
"sard-cli": "^1.3.
|
|
126
|
+
"sard-cli": "^1.3.4",
|
|
127
127
|
"sass": "^1.69.7",
|
|
128
128
|
"tailwindcss": "^3.4.17",
|
|
129
129
|
"tel-area-code": "^1.1.0",
|
package/use/index.d.ts
CHANGED
package/use/index.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { computed, reactive, unref } from 'vue';
|
|
2
|
+
import { uniqid } from '../utils';
|
|
3
|
+
export function useKeyList(list) {
|
|
4
|
+
const keyMap = new WeakMap();
|
|
5
|
+
return computed(() => {
|
|
6
|
+
return unref(list).map((item) => {
|
|
7
|
+
const key = keyMap.get(item) || uniqid();
|
|
8
|
+
keyMap.set(item, key);
|
|
9
|
+
return reactive({
|
|
10
|
+
data: item,
|
|
11
|
+
key,
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
}
|
package/utils/array.js
CHANGED
|
@@ -73,18 +73,18 @@ export function arrayMove(array, fromIndex, toIndex) {
|
|
|
73
73
|
const fromValue = array[fromIndex];
|
|
74
74
|
if (fromIndex > toIndex) {
|
|
75
75
|
return [
|
|
76
|
-
...array.slice(0,
|
|
77
|
-
...array.slice(fromIndex + 1, toIndex + 1),
|
|
76
|
+
...array.slice(0, toIndex),
|
|
78
77
|
fromValue,
|
|
79
|
-
...array.slice(toIndex
|
|
78
|
+
...array.slice(toIndex, fromIndex),
|
|
79
|
+
...array.slice(fromIndex + 1),
|
|
80
80
|
];
|
|
81
81
|
}
|
|
82
82
|
else {
|
|
83
83
|
return [
|
|
84
|
-
...array.slice(0,
|
|
84
|
+
...array.slice(0, fromIndex),
|
|
85
|
+
...array.slice(fromIndex + 1, toIndex + 1),
|
|
85
86
|
fromValue,
|
|
86
|
-
...array.slice(toIndex
|
|
87
|
-
...array.slice(fromIndex + 1),
|
|
87
|
+
...array.slice(toIndex + 1),
|
|
88
88
|
];
|
|
89
89
|
}
|
|
90
90
|
}
|