sard-uniapp 1.25.4 → 1.25.5
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 +16 -0
- package/components/accordion/accordion.vue +1 -1
- package/components/accordion-item/accordion-item.vue +1 -1
- package/components/action-sheet/action-sheet.vue +1 -1
- package/components/alert/alert.vue +1 -1
- package/components/avatar/avatar.vue +1 -1
- package/components/avatar-group/avatar-group.vue +1 -1
- package/components/back-top/back-top.vue +1 -1
- package/components/badge/badge.vue +1 -1
- package/components/button/button.vue +1 -1
- package/components/calendar/calendar.vue +1 -1
- package/components/calendar-input/calendar-input.vue +2 -2
- package/components/calendar-popout/calendar-popout.vue +2 -2
- package/components/card/card.vue +1 -1
- package/components/cascader/README.md +89 -18
- package/components/cascader/cascader.d.ts +6 -6
- package/components/cascader/cascader.vue +201 -182
- package/components/cascader/common.d.ts +32 -7
- package/components/cascader/common.js +39 -23
- package/components/cascader/index.d.ts +1 -1
- package/components/cascader/index.scss +40 -4
- package/components/cascader/useCascaderTabs.d.ts +12 -0
- package/components/cascader/useCascaderTabs.js +59 -0
- package/components/cascader/useCascaderTree.d.ts +66 -0
- package/components/cascader/useCascaderTree.js +194 -0
- package/components/cascader/variables.scss +9 -2
- package/components/cascader-input/README.md +26 -13
- package/components/cascader-input/cascader-input.d.ts +7 -2
- package/components/cascader-input/cascader-input.vue +70 -16
- package/components/cascader-input/common.d.ts +356 -30
- package/components/cascader-popout/README.md +6 -0
- package/components/cascader-popout/cascader-popout.d.ts +5 -1
- package/components/cascader-popout/cascader-popout.vue +16 -4
- package/components/cascader-popout/common.d.ts +169 -17
- package/components/check-icon/check-icon.vue +1 -1
- package/components/checkbox/checkbox.d.ts +2 -2
- package/components/checkbox/checkbox.vue +1 -1
- package/components/checkbox-group/checkbox-group.vue +1 -1
- package/components/checkbox-input/checkbox-input.vue +2 -2
- package/components/checkbox-popout/checkbox-popout.vue +2 -2
- package/components/col/col.vue +1 -1
- package/components/collapse/collapse.vue +1 -1
- package/components/config/index.js +4 -1
- package/components/cool-icon/cool-icon.vue +1 -1
- package/components/count-down/count-down.vue +1 -1
- package/components/crop-image/crop-image.vue +1 -1
- package/components/crop-image-agent/crop-image-agent.vue +1 -1
- package/components/datetime-picker/datetime-picker.vue +1 -1
- package/components/datetime-picker-input/datetime-picker-input.vue +2 -2
- package/components/datetime-picker-popout/datetime-picker-popout.vue +2 -2
- package/components/datetime-range-picker/datetime-range-picker.vue +1 -1
- package/components/datetime-range-picker-input/datetime-range-picker-input.vue +2 -2
- package/components/datetime-range-picker-popout/datetime-range-picker-popout.vue +2 -2
- package/components/dialog/dialog.vue +2 -2
- package/components/dialog-agent/dialog-agent.vue +2 -2
- package/components/divider/divider.vue +1 -1
- package/components/dnd/dnd.vue +1 -1
- package/components/dnd-handle/dnd-handle.vue +1 -1
- package/components/dnd-item/dnd-item.vue +1 -1
- package/components/dropdown/dropdown.vue +1 -1
- package/components/dropdown-item/dropdown-item.vue +7 -2
- package/components/empty/empty.vue +1 -1
- package/components/fab/fab.vue +1 -1
- package/components/fab-item/fab-item.vue +1 -1
- package/components/floating-bubble/floating-bubble.vue +1 -1
- package/components/floating-panel/floating-panel.vue +1 -1
- package/components/form/form.vue +1 -1
- package/components/form-item/form-item.vue +1 -1
- package/components/form-item-plain/form-item-plain.vue +1 -1
- package/components/form-plain/form-plain.vue +1 -1
- package/components/grid/grid.vue +1 -1
- package/components/grid-item/grid-item.vue +2 -2
- package/components/icon/icon.vue +1 -1
- package/components/icon/sari.scss +17 -17
- package/components/image/image.vue +10 -4
- package/components/indexes/indexes.vue +1 -1
- package/components/indexes-anchor/indexes-anchor.vue +1 -1
- package/components/input/input.vue +1 -1
- package/components/keyboard/keyboard.vue +1 -1
- package/components/list/list.vue +1 -1
- package/components/list-item/list-item.vue +1 -1
- package/components/load-more/load-more.vue +1 -1
- package/components/loading/loading.vue +1 -1
- package/components/locale/lang/ar-SA.d.ts +2 -0
- package/components/locale/lang/ar-SA.js +2 -0
- package/components/locale/lang/en-US.d.ts +2 -0
- package/components/locale/lang/en-US.js +2 -0
- package/components/locale/lang/vi-VN.d.ts +2 -0
- package/components/locale/lang/vi-VN.js +2 -0
- package/components/locale/lang/zh-CN.d.ts +2 -0
- package/components/locale/lang/zh-CN.js +2 -0
- package/components/marquee/marquee.vue +1 -1
- package/components/menu/menu.vue +1 -1
- package/components/navbar/navbar.vue +2 -2
- package/components/navbar-item/navbar-item.vue +1 -1
- package/components/navbar-pit/navbar-pit.vue +1 -1
- package/components/notice-bar/notice-bar.vue +1 -1
- package/components/notify/notify.vue +2 -1
- package/components/notify-agent/notify-agent.vue +1 -1
- package/components/overlay/overlay.vue +1 -1
- package/components/pagination/pagination.vue +1 -1
- package/components/password-input/password-input.vue +1 -1
- package/components/picker/picker.vue +1 -1
- package/components/picker-input/picker-input.vue +2 -2
- package/components/picker-item/picker-item.vue +1 -1
- package/components/picker-popout/picker-popout.vue +2 -2
- package/components/popout/popout.vue +1 -1
- package/components/popout-input/popout-input.vue +1 -1
- package/components/popover/popover.vue +3 -2
- package/components/popover-reference/popover-reference.vue +1 -1
- package/components/popup/README.md +1 -0
- package/components/popup/common.d.ts +28 -0
- package/components/popup/index.scss +4 -2
- package/components/popup/popup.d.ts +1 -0
- package/components/popup/popup.vue +82 -16
- package/components/popup/variables.scss +6 -0
- package/components/progress-bar/progress-bar.vue +1 -1
- package/components/progress-circle/progress-circle.vue +1 -1
- package/components/pull-down-refresh/pull-down-refresh.vue +1 -1
- package/components/qrcode/qrcode.vue +6 -5
- package/components/radio/radio.vue +1 -1
- package/components/radio-group/radio-group.vue +1 -1
- package/components/radio-input/radio-input.vue +2 -2
- package/components/radio-popout/radio-popout.vue +2 -2
- package/components/rate/rate.vue +1 -1
- package/components/read-more/read-more.vue +1 -1
- package/components/resize-sensor/index.scss +7 -0
- package/components/resize-sensor/resize-sensor.vue +10 -3
- package/components/result/result.vue +1 -1
- package/components/row/row.vue +1 -1
- package/components/scroll-list/scroll-list.vue +1 -1
- package/components/scroll-spy/scroll-spy.vue +1 -1
- package/components/scroll-spy-anchor/scroll-spy-anchor.vue +1 -1
- package/components/search/search.vue +1 -1
- package/components/segmented/segmented.vue +1 -1
- package/components/segmented-item/segmented-item.vue +1 -1
- package/components/share-sheet/share-sheet.vue +2 -1
- package/components/sidebar/sidebar.vue +1 -1
- package/components/sidebar-item/sidebar-item.vue +1 -1
- package/components/signature/signature.vue +1 -1
- package/components/skeleton/skeleton.vue +1 -1
- package/components/skeleton-avatar/skeleton-avatar.vue +1 -1
- package/components/skeleton-block/skeleton-block.vue +1 -1
- package/components/skeleton-paragraph/skeleton-paragraph.vue +1 -1
- package/components/skeleton-title/skeleton-title.vue +1 -1
- package/components/slider/slider.vue +1 -1
- package/components/space/space.vue +1 -1
- package/components/status-bar/status-bar.vue +1 -1
- package/components/step/step.vue +1 -1
- package/components/stepper/stepper.vue +1 -1
- package/components/steps/steps.vue +1 -1
- package/components/sticky/sticky.vue +1 -1
- package/components/sticky-box/sticky-box.vue +1 -1
- package/components/swipe-action/swipe-action.vue +1 -1
- package/components/swiper-dot/swiper-dot.vue +1 -1
- package/components/switch/switch.vue +1 -1
- package/components/tab/tab.vue +1 -1
- package/components/tabbar/tabbar.vue +1 -1
- package/components/tabbar-item/tabbar-item.vue +1 -1
- package/components/tabbar-pit/tabbar-pit.vue +1 -1
- package/components/table/table.vue +1 -1
- package/components/table-cell/table-cell.vue +1 -1
- package/components/table-fixation/table-fixation.vue +1 -1
- package/components/table-row/table-row.vue +1 -1
- package/components/tabs/tabs.vue +1 -1
- package/components/tag/tag.vue +1 -1
- package/components/timeline/timeline.vue +1 -1
- package/components/timeline-item/timeline-item.vue +1 -1
- package/components/toast/toast.vue +2 -1
- package/components/toast-agent/toast-agent.vue +1 -1
- package/components/tree/README.md +0 -2
- package/components/tree/tree.d.ts +1 -1
- package/components/tree/tree.vue +36 -81
- package/components/tree-node/tree-node.vue +8 -4
- package/components/upload/upload.vue +1 -1
- package/components/upload-preview/upload-preview.vue +1 -1
- package/components/waterfall/waterfall.vue +1 -1
- package/components/waterfall-item/waterfall-item.vue +1 -1
- package/components/waterfall-load/waterfall-load.vue +1 -1
- package/components/watermark/watermark.vue +6 -8
- package/package.json +2 -1
- package/use/index.d.ts +1 -0
- package/use/index.js +1 -0
- package/use/useLockScroll.d.ts +8 -0
- package/use/useLockScroll.js +88 -0
- package/utils/file.d.ts +6 -0
- package/utils/file.js +33 -11
- package/utils/index.d.ts +2 -0
- package/utils/index.js +2 -0
- package/utils/log.d.ts +1 -0
- package/utils/log.js +4 -0
- package/utils/router.js +2 -1
- package/utils/system.d.ts +2 -0
- package/utils/system.js +6 -1
- package/utils/tree.d.ts +18 -0
- package/utils/tree.js +94 -0
- package/components/tree/utils.d.ts +0 -5
- package/components/tree/utils.js +0 -29
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
:internal-prepend="$slots.prepend ? 1 : 0"
|
|
14
14
|
:internal-append="$slots.append ? 1 : 0"
|
|
15
15
|
:input-props="inputProps"
|
|
16
|
+
:multiline="multiple"
|
|
16
17
|
@clear="onClear"
|
|
17
18
|
@click="show"
|
|
18
19
|
>
|
|
@@ -38,6 +39,10 @@
|
|
|
38
39
|
:change-on-select="changeOnSelect"
|
|
39
40
|
:label-render="labelRender"
|
|
40
41
|
:all-levels="allLevels"
|
|
42
|
+
:multiple="multiple"
|
|
43
|
+
:check-strictly="checkStrictly"
|
|
44
|
+
:lazy="lazy"
|
|
45
|
+
:load="load"
|
|
41
46
|
:validate-event="validateEvent"
|
|
42
47
|
:resettable="resettable"
|
|
43
48
|
@select="(option, tabIndex) => $emit('select', option, tabIndex)"
|
|
@@ -54,14 +59,15 @@
|
|
|
54
59
|
|
|
55
60
|
<script>
|
|
56
61
|
import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
|
|
57
|
-
import { watch, computed } from "vue";
|
|
62
|
+
import { watch, computed, shallowRef, provide } from "vue";
|
|
58
63
|
import SarPopoutInput from "../popout-input/popout-input.vue";
|
|
59
64
|
import SarCascaderPopout from "../cascader-popout/cascader-popout.vue";
|
|
60
65
|
import {
|
|
66
|
+
cascaderOptionsContextSymbol,
|
|
61
67
|
defaultFieldKeys,
|
|
62
68
|
getSelectedOptionsByValue
|
|
63
69
|
} from "../cascader/common";
|
|
64
|
-
import { isEmptyBinding } from "../../utils";
|
|
70
|
+
import { isEmptyArray, isEmptyBinding, isNullish } from "../../utils";
|
|
65
71
|
import { usePopoutInput } from "../../use";
|
|
66
72
|
import {
|
|
67
73
|
defaultCascaderInputProps
|
|
@@ -69,13 +75,17 @@ import {
|
|
|
69
75
|
/**
|
|
70
76
|
* @property {string} rootClass 弹出式输入框根元素类名,默认值:-。
|
|
71
77
|
* @property {StyleValue} rootStyle 弹出式输入框根元素样式,默认值:-。
|
|
72
|
-
* @property {
|
|
78
|
+
* @property {CascaderValue} modelValue 选中项的值,默认值:-。
|
|
73
79
|
* @property {CascaderOption[]} options 可选项数据源,默认值:[]。
|
|
74
80
|
* @property {CascaderFieldKeys} fieldKeys 自定义 `options` 中的字段,默认值:defaultFieldKeys。
|
|
75
81
|
* @property {string} hintText 未选中时的提示文案,默认值:'请选择'。
|
|
76
82
|
* @property {(option: CascaderOption) => string} labelRender 自定义可选项渲染,默认值:-。
|
|
77
83
|
* @property {boolean} changeOnSelect 点击每级选项都会触发变化,默认值:false。
|
|
78
84
|
* @property {boolean} allLevels 是否绑定所有级别的值,而不单单是最后一级,默认值:false。
|
|
85
|
+
* @property {boolean} multiple 是否多选,默认值:false。
|
|
86
|
+
* @property {boolean} checkStrictly 是否严格的遵守父子节点不互相关联(用于多选),默认值:false。
|
|
87
|
+
* @property {boolean} lazy 是否懒加载子节点,需与 load 方法结合使用,默认值:false。
|
|
88
|
+
* @property {(node?: CascaderStateNode) => Promise<CascaderOption[]> | CascaderOption[]} load 加载子节点的方法,仅当 lazy 属性为true 时生效,默认值:-。
|
|
79
89
|
* @property {string} popoutClass 弹窗框根元素类名,默认值:-。
|
|
80
90
|
* @property {StyleValue} popoutStyle 弹窗框根元素样式,默认值:-。
|
|
81
91
|
* @property {boolean} visible 是否显示弹出框,默认值:-。
|
|
@@ -92,6 +102,7 @@ import {
|
|
|
92
102
|
* @property {string} arrow 自定义箭头图标名,默认值:'caret-right'。
|
|
93
103
|
* @property {string} arrowFamily 自定义箭头图标字体,默认值:'sari'。
|
|
94
104
|
* @property {InputProps} inputProps 自定义输入框组件属性,默认值:-。
|
|
105
|
+
* @property {number} maxRows 多选时,输入框最大展示行数,设为 -1 表示不限制,默认值:3。
|
|
95
106
|
* @event {(visible: boolean) => void} update 弹出框显隐时触发
|
|
96
107
|
* @event {(value: string | number, selectedOptions: CascaderOption[]) => void} change 级联输入组件值改变时触发
|
|
97
108
|
* @event {(option: CascaderOption, tabIndex: number) => void} select 选择级联选择某一项时触发
|
|
@@ -120,14 +131,15 @@ export default _defineComponent({
|
|
|
120
131
|
__name: "cascader-input",
|
|
121
132
|
props: _mergeDefaults({
|
|
122
133
|
valueOnClear: { type: Function, required: false },
|
|
134
|
+
maxRows: { type: Number, required: false },
|
|
123
135
|
visible: { type: Boolean, required: false },
|
|
124
136
|
title: { type: String, required: false },
|
|
125
137
|
showConfirm: { type: Boolean, required: false },
|
|
126
138
|
validateEvent: { type: Boolean, required: false },
|
|
127
139
|
popoutClass: { type: String, required: false },
|
|
128
|
-
popoutStyle: { type:
|
|
140
|
+
popoutStyle: { type: null, required: false },
|
|
129
141
|
resettable: { type: Boolean, required: false },
|
|
130
|
-
rootStyle: { type:
|
|
142
|
+
rootStyle: { type: null, required: false },
|
|
131
143
|
rootClass: { type: String, required: false },
|
|
132
144
|
modelValue: { type: [String, Number, Array], required: false },
|
|
133
145
|
options: { type: Array, required: false },
|
|
@@ -136,6 +148,10 @@ export default _defineComponent({
|
|
|
136
148
|
labelRender: { type: Function, required: false },
|
|
137
149
|
changeOnSelect: { type: Boolean, required: false },
|
|
138
150
|
allLevels: { type: Boolean, required: false },
|
|
151
|
+
multiple: { type: Boolean, required: false },
|
|
152
|
+
checkStrictly: { type: Boolean, required: false },
|
|
153
|
+
lazy: { type: Boolean, required: false },
|
|
154
|
+
load: { type: Function, required: false },
|
|
139
155
|
placeholder: { type: String, required: false },
|
|
140
156
|
readonly: { type: Boolean, required: false },
|
|
141
157
|
disabled: { type: Boolean, required: false },
|
|
@@ -175,24 +191,62 @@ export default _defineComponent({
|
|
|
175
191
|
props.fieldKeys
|
|
176
192
|
);
|
|
177
193
|
});
|
|
194
|
+
const lazyOptions = shallowRef([]);
|
|
195
|
+
provide(cascaderOptionsContextSymbol, {
|
|
196
|
+
set(options) {
|
|
197
|
+
lazyOptions.value = options;
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
const renderedOptions = computed(() => {
|
|
201
|
+
return props.lazy && !!props.load ? lazyOptions.value : props.options;
|
|
202
|
+
});
|
|
178
203
|
function getOutletText(options, value, fieldKeys) {
|
|
179
|
-
const selectedOptions = getSelectedOptionsByValue(
|
|
180
|
-
|
|
181
|
-
|
|
204
|
+
const selectedOptions = getSelectedOptionsByValue(
|
|
205
|
+
options,
|
|
206
|
+
value,
|
|
207
|
+
fieldKeys,
|
|
208
|
+
props.multiple
|
|
209
|
+
);
|
|
210
|
+
if (!selectedOptions || selectedOptions.length === 0) {
|
|
211
|
+
return getValueDisplay(value);
|
|
182
212
|
}
|
|
183
|
-
const labels = selectedOptions.map((option) =>
|
|
184
|
-
|
|
213
|
+
const labels = selectedOptions.map((option) => {
|
|
214
|
+
return Array.isArray(option) ? option.map((item) => item[fieldKeys.label]) : option[fieldKeys.label];
|
|
215
|
+
});
|
|
216
|
+
return props.multiple ? labels.map((item) => item.join("/")) : labels.join("/");
|
|
185
217
|
}
|
|
186
|
-
function
|
|
187
|
-
if (
|
|
218
|
+
function getValueDisplay(value) {
|
|
219
|
+
if (Array.isArray(value)) {
|
|
220
|
+
return value.map(
|
|
221
|
+
(item) => Array.isArray(item) ? item.join("/") : item
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
return isNullish(value) ? "" : String(value);
|
|
225
|
+
}
|
|
226
|
+
function getInputValue(options) {
|
|
227
|
+
if (isEmptyBinding(innerValue.value) || isEmptyArray(innerValue.value)) {
|
|
188
228
|
return "";
|
|
189
229
|
}
|
|
190
|
-
|
|
230
|
+
if (!options || isEmptyArray(options)) {
|
|
231
|
+
return getValueDisplay(innerValue.value);
|
|
232
|
+
}
|
|
233
|
+
return getOutletText(options, innerValue.value, fieldkeys.value);
|
|
234
|
+
}
|
|
235
|
+
function getMayMultilineText(value) {
|
|
236
|
+
if (Array.isArray(value)) {
|
|
237
|
+
const diff = value.length - (props.maxRows === -1 ? Number.MAX_SAFE_INTEGER : props.maxRows);
|
|
238
|
+
const rows = value.slice(0, props.maxRows);
|
|
239
|
+
if (diff > 0) {
|
|
240
|
+
rows.push(`+${diff}`);
|
|
241
|
+
}
|
|
242
|
+
return rows.join("\n");
|
|
243
|
+
}
|
|
244
|
+
return value;
|
|
191
245
|
}
|
|
192
246
|
watch(
|
|
193
|
-
[innerValue,
|
|
247
|
+
[innerValue, renderedOptions],
|
|
194
248
|
() => {
|
|
195
|
-
inputValue.value = getInputValue();
|
|
249
|
+
inputValue.value = getMayMultilineText(getInputValue(renderedOptions.value));
|
|
196
250
|
},
|
|
197
251
|
{
|
|
198
252
|
immediate: true
|
|
@@ -201,7 +255,7 @@ export default _defineComponent({
|
|
|
201
255
|
const onConfirm = () => {
|
|
202
256
|
emit("confirm");
|
|
203
257
|
};
|
|
204
|
-
const __returned__ = { props, emit, innerVisible, innerValue, inputValue, show, onChange, onClear, onVisibleHook, fieldkeys, getOutletText, getInputValue, onConfirm, SarPopoutInput, SarCascaderPopout };
|
|
258
|
+
const __returned__ = { props, emit, innerVisible, innerValue, inputValue, show, onChange, onClear, onVisibleHook, fieldkeys, lazyOptions, renderedOptions, getOutletText, getValueDisplay, getInputValue, getMayMultilineText, onConfirm, SarPopoutInput, SarCascaderPopout };
|
|
205
259
|
return __returned__;
|
|
206
260
|
}
|
|
207
261
|
});
|