sard-uniapp 1.22.2 → 1.23.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 +11 -0
- package/components/cascader/README.md +22 -15
- package/components/cascader/cascader.d.ts +4 -4
- package/components/cascader/cascader.vue +81 -70
- package/components/cascader/common.d.ts +6 -5
- package/components/cascader/common.js +23 -7
- package/components/cascader-input/cascader-input.vue +4 -2
- package/components/cascader-popout/cascader-popout.vue +5 -3
- package/components/crop-image/README.md +15 -14
- package/components/crop-image/common.d.ts +1 -0
- package/components/crop-image/crop-image.vue +4 -1
- package/components/crop-image-agent/crop-image-agent.vue +1 -0
- package/components/form/README.md +58 -0
- package/components/form/form.d.ts +5 -5
- package/components/form/form.vue +6 -115
- package/components/form/index.d.ts +1 -0
- package/components/form/index.js +1 -0
- package/components/form/useForm.d.ts +9 -0
- package/components/form/useForm.js +97 -0
- package/components/form-item/form-item.d.ts +2 -2
- package/components/form-item/form-item.vue +21 -236
- package/components/form-item/useFormItem.d.ts +21 -0
- package/components/form-item/useFormItem.js +206 -0
- package/components/form-item-plain/form-item-plain.d.ts +20 -0
- package/components/form-item-plain/form-item-plain.vue +70 -0
- package/components/form-plain/common.d.ts +27 -0
- package/components/form-plain/common.js +1 -0
- package/components/form-plain/form-plain.d.ts +23 -0
- package/components/form-plain/form-plain.vue +48 -0
- package/components/form-plain/index.d.ts +1 -0
- package/components/form-plain/index.js +1 -0
- package/components/status-bar/README.md +1 -1
- package/global.d.ts +2 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +2 -2
- package/utils/dom.d.ts +1 -1
- package/utils/dom.js +8 -5
- package/utils/is.d.ts +1 -1
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { computed, nextTick, onBeforeUnmount, onMounted, provide, reactive, ref, toRef, watch, } from 'vue';
|
|
2
|
+
import { formItemContextSymbol, useFormContext, } from '../form/common';
|
|
3
|
+
import { chainGet, chainSet, deepClone, getBoundingClientRect, getScrollIntoViewValue, getViewportScrollInfo, getWindowInfo, noop, toArray, uniqid, } from '../../utils';
|
|
4
|
+
export function useFormItem(props) {
|
|
5
|
+
// main
|
|
6
|
+
const formContext = useFormContext();
|
|
7
|
+
if (!formContext) {
|
|
8
|
+
throw new Error('FormItem must be included in Form.');
|
|
9
|
+
}
|
|
10
|
+
// 用于阻止验证
|
|
11
|
+
let isResetting = false;
|
|
12
|
+
const fieldValue = computed({
|
|
13
|
+
get() {
|
|
14
|
+
const model = formContext.model;
|
|
15
|
+
if (!model || !props.name) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
return chainGet(model, toArray(props.name));
|
|
19
|
+
},
|
|
20
|
+
set(value) {
|
|
21
|
+
const model = formContext.model;
|
|
22
|
+
if (!model || !props.name) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
chainSet(model, toArray(props.name), value);
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
let initialValue;
|
|
29
|
+
const validateMessage = ref('');
|
|
30
|
+
const validateState = ref('');
|
|
31
|
+
watch(() => props.error, () => {
|
|
32
|
+
validateMessage.value = props.error || '';
|
|
33
|
+
validateState.value = props.error ? 'error' : '';
|
|
34
|
+
});
|
|
35
|
+
watch(() => props.rules, () => {
|
|
36
|
+
if (validateMessage.value) {
|
|
37
|
+
validate().catch(noop);
|
|
38
|
+
}
|
|
39
|
+
}, {
|
|
40
|
+
deep: true,
|
|
41
|
+
flush: 'post',
|
|
42
|
+
});
|
|
43
|
+
const shouldShowError = computed(() => {
|
|
44
|
+
return (!!props.showError && !!formContext.showError && !!validateMessage.value);
|
|
45
|
+
});
|
|
46
|
+
const mergedValidateTrigger = computed(() => {
|
|
47
|
+
const trigger = props.validateTrigger ?? formContext.validateTrigger;
|
|
48
|
+
return trigger ? toArray(trigger) : undefined;
|
|
49
|
+
});
|
|
50
|
+
const mergedRules = computed(() => {
|
|
51
|
+
const rules = [];
|
|
52
|
+
if (props.rules) {
|
|
53
|
+
rules.push(...toArray(props.rules));
|
|
54
|
+
}
|
|
55
|
+
const formRules = formContext.rules;
|
|
56
|
+
if (formRules && props.name) {
|
|
57
|
+
const fRules = chainGet(formRules, toArray(props.name));
|
|
58
|
+
if (fRules) {
|
|
59
|
+
rules.push(...toArray(fRules));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const required = props.required;
|
|
63
|
+
if (required !== undefined) {
|
|
64
|
+
const requiredRules = rules
|
|
65
|
+
.map((rule, i) => [rule, i])
|
|
66
|
+
.filter(([rule]) => {
|
|
67
|
+
return Object.keys(rule).includes('required');
|
|
68
|
+
});
|
|
69
|
+
if (requiredRules.length > 0) {
|
|
70
|
+
for (const [rule, i] of requiredRules) {
|
|
71
|
+
if (rule.required !== required) {
|
|
72
|
+
rules[i] = { ...rule, required };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
rules.push({ required });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const trigger = mergedValidateTrigger.value;
|
|
81
|
+
if (trigger && trigger.length > 0) {
|
|
82
|
+
for (let i = 0, l = rules.length; i < l; i++) {
|
|
83
|
+
const rule = rules[i];
|
|
84
|
+
if (!rule.trigger) {
|
|
85
|
+
rules[i] = { ...rule, trigger: [...trigger] };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return rules;
|
|
90
|
+
});
|
|
91
|
+
const isRequired = computed(() => {
|
|
92
|
+
return mergedRules.value.some((rule) => rule.required);
|
|
93
|
+
});
|
|
94
|
+
const shouldShowStar = computed(() => {
|
|
95
|
+
return !formContext.hideStar && !props.hideStar && isRequired.value;
|
|
96
|
+
});
|
|
97
|
+
const validate = async (trigger) => {
|
|
98
|
+
if (isResetting || !props.name) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const validRules = formContext.validator.getValidTriggerRules(mergedRules.value, trigger);
|
|
102
|
+
if (validRules.length === 0) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
validateState.value = 'validating';
|
|
106
|
+
try {
|
|
107
|
+
await formContext.validator.validate(mergedRules.value, {
|
|
108
|
+
validateFirst: true,
|
|
109
|
+
value: fieldValue.value,
|
|
110
|
+
name: props.name,
|
|
111
|
+
label: props.label,
|
|
112
|
+
trigger,
|
|
113
|
+
});
|
|
114
|
+
validateState.value = 'success';
|
|
115
|
+
validateMessage.value = '';
|
|
116
|
+
}
|
|
117
|
+
catch (messages) {
|
|
118
|
+
validateState.value = 'error';
|
|
119
|
+
validateMessage.value = messages[0];
|
|
120
|
+
const error = {
|
|
121
|
+
name: props.name,
|
|
122
|
+
value: fieldValue.value,
|
|
123
|
+
message: validateMessage.value,
|
|
124
|
+
};
|
|
125
|
+
throw error;
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const clearValidate = () => {
|
|
129
|
+
validateState.value = '';
|
|
130
|
+
validateMessage.value = '';
|
|
131
|
+
isResetting = false;
|
|
132
|
+
};
|
|
133
|
+
const reset = async () => {
|
|
134
|
+
isResetting = true;
|
|
135
|
+
fieldValue.value = deepClone(initialValue);
|
|
136
|
+
await nextTick();
|
|
137
|
+
clearValidate();
|
|
138
|
+
};
|
|
139
|
+
const fieldId = uniqid();
|
|
140
|
+
const scrollToField = async () => {
|
|
141
|
+
const [scrollInfo, fieldRect, windowInfo] = await Promise.all([
|
|
142
|
+
getViewportScrollInfo(),
|
|
143
|
+
getBoundingClientRect(`.${fieldId}`),
|
|
144
|
+
getWindowInfo(),
|
|
145
|
+
]);
|
|
146
|
+
const scrollTop = getScrollIntoViewValue(windowInfo.windowHeight, scrollInfo.scrollTop, fieldRect.height, fieldRect.top + scrollInfo.scrollTop, formContext.scrollIntoViewOptions);
|
|
147
|
+
uni.pageScrollTo({
|
|
148
|
+
scrollTop,
|
|
149
|
+
duration: formContext.scrollIntoViewOptions?.duration ??
|
|
150
|
+
formContext.scrollDuration,
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
const onBlur = () => {
|
|
154
|
+
validate('blur').catch(noop);
|
|
155
|
+
};
|
|
156
|
+
const onChange = () => {
|
|
157
|
+
validate('change').catch(noop);
|
|
158
|
+
};
|
|
159
|
+
const context = reactive({
|
|
160
|
+
name: toRef(() => props.name),
|
|
161
|
+
validateMessage,
|
|
162
|
+
validateState,
|
|
163
|
+
validate,
|
|
164
|
+
clearValidate,
|
|
165
|
+
reset,
|
|
166
|
+
scrollToField,
|
|
167
|
+
onBlur,
|
|
168
|
+
onChange,
|
|
169
|
+
});
|
|
170
|
+
onMounted(() => {
|
|
171
|
+
if (props.name) {
|
|
172
|
+
initialValue = deepClone(fieldValue.value);
|
|
173
|
+
formContext.addField(context);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
onBeforeUnmount(() => {
|
|
177
|
+
formContext.removeField(context);
|
|
178
|
+
});
|
|
179
|
+
const direction = computed(() => props.direction || formContext.direction);
|
|
180
|
+
const labelAlign = computed(() => props.labelAlign || formContext.labelAlign);
|
|
181
|
+
const labelValign = computed(() => props.labelValign || formContext.labelValign);
|
|
182
|
+
const starPosition = computed(() => props.starPosition || formContext.starPosition);
|
|
183
|
+
const labelWidth = computed(() => props.labelWidth || formContext.labelWidth);
|
|
184
|
+
provide(formItemContextSymbol, context);
|
|
185
|
+
const expose = {
|
|
186
|
+
validate,
|
|
187
|
+
reset,
|
|
188
|
+
clearValidate,
|
|
189
|
+
scrollToField,
|
|
190
|
+
validateMessage,
|
|
191
|
+
validateState,
|
|
192
|
+
};
|
|
193
|
+
return {
|
|
194
|
+
expose,
|
|
195
|
+
fieldId,
|
|
196
|
+
validateState,
|
|
197
|
+
shouldShowStar,
|
|
198
|
+
validateMessage,
|
|
199
|
+
shouldShowError,
|
|
200
|
+
direction,
|
|
201
|
+
labelAlign,
|
|
202
|
+
labelValign,
|
|
203
|
+
starPosition,
|
|
204
|
+
labelWidth,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type FormItemPlainProps, type FormItemPlainSlots } from '../form-plain/common';
|
|
2
|
+
declare function __VLS_template(): Readonly<FormItemPlainSlots> & FormItemPlainSlots;
|
|
3
|
+
declare const __VLS_component: import("vue").DefineComponent<FormItemPlainProps, {
|
|
4
|
+
validate: (trigger?: string | string[]) => Promise<void>;
|
|
5
|
+
reset: () => Promise<void>;
|
|
6
|
+
clearValidate: () => void;
|
|
7
|
+
scrollToField: () => void;
|
|
8
|
+
validateMessage: import("vue").Ref<string>;
|
|
9
|
+
validateState: import("vue").Ref<import("../form/common").ValidateState>;
|
|
10
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FormItemPlainProps> & Readonly<{}>, {
|
|
11
|
+
required: boolean;
|
|
12
|
+
showError: boolean;
|
|
13
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
15
|
+
export default _default;
|
|
16
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
17
|
+
new (): {
|
|
18
|
+
$slots: S;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="rootClass" :style="rootStyle">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
<slot
|
|
5
|
+
name="custom"
|
|
6
|
+
:field-id="fieldId"
|
|
7
|
+
:validate-state="validateState"
|
|
8
|
+
:should-show-star="shouldShowStar"
|
|
9
|
+
:validate-message="validateMessage"
|
|
10
|
+
:should-show-error="shouldShowError"
|
|
11
|
+
:direction="direction"
|
|
12
|
+
:label-align="labelAlign"
|
|
13
|
+
:label-valign="labelValign"
|
|
14
|
+
:star-position="starPosition"
|
|
15
|
+
:label-width="labelWidth"
|
|
16
|
+
></slot>
|
|
17
|
+
</view>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
|
|
22
|
+
import { useFormItem } from "../form-item/useFormItem";
|
|
23
|
+
import { defaultFormItemProps } from "../form/common";
|
|
24
|
+
export default _defineComponent({
|
|
25
|
+
...{
|
|
26
|
+
options: {
|
|
27
|
+
virtualHost: true,
|
|
28
|
+
styleIsolation: "shared"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
__name: "form-item-plain",
|
|
32
|
+
props: _mergeDefaults({
|
|
33
|
+
rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
34
|
+
rootClass: { type: String, required: false },
|
|
35
|
+
direction: { type: String, required: false },
|
|
36
|
+
labelWidth: { type: String, required: false },
|
|
37
|
+
labelAlign: { type: String, required: false },
|
|
38
|
+
labelValign: { type: String, required: false },
|
|
39
|
+
starPosition: { type: String, required: false },
|
|
40
|
+
label: { type: String, required: false },
|
|
41
|
+
hideStar: { type: Boolean, required: false },
|
|
42
|
+
required: { type: Boolean, required: false, skipCheck: true },
|
|
43
|
+
name: { type: [String, Number, Array], required: false },
|
|
44
|
+
rules: { type: [Object, Array], required: false },
|
|
45
|
+
validateTrigger: { type: [String, Array], required: false },
|
|
46
|
+
error: { type: String, required: false },
|
|
47
|
+
showError: { type: Boolean, required: false },
|
|
48
|
+
inlaid: { type: Boolean, required: false }
|
|
49
|
+
}, defaultFormItemProps()),
|
|
50
|
+
setup(__props, { expose: __expose }) {
|
|
51
|
+
const props = __props;
|
|
52
|
+
const {
|
|
53
|
+
expose,
|
|
54
|
+
fieldId,
|
|
55
|
+
validateState,
|
|
56
|
+
shouldShowStar,
|
|
57
|
+
validateMessage,
|
|
58
|
+
shouldShowError,
|
|
59
|
+
direction,
|
|
60
|
+
labelAlign,
|
|
61
|
+
labelValign,
|
|
62
|
+
starPosition,
|
|
63
|
+
labelWidth
|
|
64
|
+
} = useFormItem(props);
|
|
65
|
+
__expose(expose);
|
|
66
|
+
const __returned__ = { props, expose, fieldId, validateState, shouldShowStar, validateMessage, shouldShowError, direction, labelAlign, labelValign, starPosition, labelWidth };
|
|
67
|
+
return __returned__;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type FormExpose, type FormProps, type FormSlots, type FormItemProps, type FormItemExpose, type ValidateState } from '../form/common';
|
|
2
|
+
export interface FormPlainProps extends FormProps {
|
|
3
|
+
}
|
|
4
|
+
export interface FormPlainSlots extends FormSlots {
|
|
5
|
+
}
|
|
6
|
+
export interface FormPlainExpose extends FormExpose {
|
|
7
|
+
}
|
|
8
|
+
export interface FormItemPlainProps extends FormItemProps {
|
|
9
|
+
}
|
|
10
|
+
export interface FormItemPlainSlotsProps {
|
|
11
|
+
fieldId: string;
|
|
12
|
+
validateState: ValidateState;
|
|
13
|
+
shouldShowStar: boolean;
|
|
14
|
+
validateMessage: string;
|
|
15
|
+
shouldShowError: boolean;
|
|
16
|
+
direction: FormProps['direction'];
|
|
17
|
+
labelAlign: FormProps['labelAlign'];
|
|
18
|
+
labelValign: FormProps['labelValign'];
|
|
19
|
+
starPosition: FormProps['starPosition'];
|
|
20
|
+
labelWidth: FormProps['labelWidth'];
|
|
21
|
+
}
|
|
22
|
+
export interface FormItemPlainSlots {
|
|
23
|
+
default?(props: Record<string, never>): any;
|
|
24
|
+
custom?(props: FormItemPlainSlotsProps): any;
|
|
25
|
+
}
|
|
26
|
+
export interface FormItemPlainExpose extends FormItemExpose {
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type FormPlainProps, type FormPlainSlots } from './common';
|
|
2
|
+
declare function __VLS_template(): Readonly<FormPlainSlots> & FormPlainSlots;
|
|
3
|
+
declare const __VLS_component: import("vue").DefineComponent<FormPlainProps, {
|
|
4
|
+
validate: (nameList?: import("../form/common").FieldName[]) => Promise<void>;
|
|
5
|
+
reset: (nameList?: import("../form/common").FieldName[]) => Promise<void>;
|
|
6
|
+
clearValidate: (nameList?: import("../form/common").FieldName[]) => Promise<void>;
|
|
7
|
+
scrollToField: (name: import("../form/common").FieldName) => void;
|
|
8
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<FormPlainProps> & Readonly<{}>, {
|
|
9
|
+
direction: "horizontal" | "vertical";
|
|
10
|
+
labelAlign: "start" | "center" | "end";
|
|
11
|
+
labelValign: "start" | "center" | "end";
|
|
12
|
+
starPosition: "left" | "right";
|
|
13
|
+
validateOnRuleChange: boolean;
|
|
14
|
+
showError: boolean;
|
|
15
|
+
scrollDuration: number;
|
|
16
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
18
|
+
export default _default;
|
|
19
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
20
|
+
new (): {
|
|
21
|
+
$slots: S;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="rootClass" :style="rootStyle">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</view>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
|
|
9
|
+
import { useForm } from "../form/useForm";
|
|
10
|
+
import { defaultFormProps } from "../form/common";
|
|
11
|
+
export default _defineComponent({
|
|
12
|
+
...{
|
|
13
|
+
options: {
|
|
14
|
+
virtualHost: true,
|
|
15
|
+
styleIsolation: "shared"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
__name: "form-plain",
|
|
19
|
+
props: _mergeDefaults({
|
|
20
|
+
rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
|
|
21
|
+
rootClass: { type: String, required: false },
|
|
22
|
+
model: { type: Object, required: false },
|
|
23
|
+
rules: { type: Object, required: false },
|
|
24
|
+
validateTrigger: { type: [String, Array], required: false },
|
|
25
|
+
validateOnRuleChange: { type: Boolean, required: false },
|
|
26
|
+
direction: { type: String, required: false },
|
|
27
|
+
labelWidth: { type: String, required: false },
|
|
28
|
+
labelAlign: { type: String, required: false },
|
|
29
|
+
labelValign: { type: String, required: false },
|
|
30
|
+
starPosition: { type: String, required: false },
|
|
31
|
+
hideStar: { type: Boolean, required: false },
|
|
32
|
+
showError: { type: Boolean, required: false },
|
|
33
|
+
scrollToFirstError: { type: Boolean, required: false },
|
|
34
|
+
scrollIntoViewOptions: { type: Object, required: false },
|
|
35
|
+
scrollDuration: { type: Number, required: false },
|
|
36
|
+
disabled: { type: Boolean, required: false },
|
|
37
|
+
readonly: { type: Boolean, required: false },
|
|
38
|
+
card: { type: Boolean, required: false }
|
|
39
|
+
}, defaultFormProps),
|
|
40
|
+
setup(__props, { expose: __expose }) {
|
|
41
|
+
const props = __props;
|
|
42
|
+
const { expose } = useForm(props);
|
|
43
|
+
__expose(expose);
|
|
44
|
+
const __returned__ = { props, expose };
|
|
45
|
+
return __returned__;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type FormPlainProps, type FormPlainSlots, type FormPlainExpose, type FormItemPlainProps, type FormItemPlainSlots, type FormItemPlainExpose, } from './common';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/global.d.ts
CHANGED
|
@@ -45,6 +45,8 @@ declare module 'vue' {
|
|
|
45
45
|
SarFloatingPanel: typeof import('./components/floating-panel/floating-panel').default
|
|
46
46
|
SarForm: typeof import('./components/form/form').default
|
|
47
47
|
SarFormItem: typeof import('./components/form-item/form-item').default
|
|
48
|
+
SarFormItemPlain: typeof import('./components/form-item-plain/form-item-plain').default
|
|
49
|
+
SarFormPlain: typeof import('./components/form-plain/form-plain').default
|
|
48
50
|
SarGrid: typeof import('./components/grid/grid').default
|
|
49
51
|
SarGridItem: typeof import('./components/grid-item/grid-item').default
|
|
50
52
|
SarIcon: typeof import('./components/icon/icon').default
|
package/index.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export * from './components/fab';
|
|
|
39
39
|
export * from './components/floating-bubble';
|
|
40
40
|
export * from './components/floating-panel';
|
|
41
41
|
export * from './components/form';
|
|
42
|
+
export * from './components/form-plain';
|
|
42
43
|
export * from './components/grid';
|
|
43
44
|
export * from './components/icon';
|
|
44
45
|
export * from './components/indexes';
|
package/index.js
CHANGED
|
@@ -39,6 +39,7 @@ export * from './components/fab';
|
|
|
39
39
|
export * from './components/floating-bubble';
|
|
40
40
|
export * from './components/floating-panel';
|
|
41
41
|
export * from './components/form';
|
|
42
|
+
export * from './components/form-plain';
|
|
42
43
|
export * from './components/grid';
|
|
43
44
|
export * from './components/icon';
|
|
44
45
|
export * from './components/indexes';
|
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.23.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.7",
|
|
127
127
|
"sass": "^1.69.7",
|
|
128
128
|
"tailwindcss": "^3.4.17",
|
|
129
129
|
"tel-area-code": "^1.1.0",
|
package/utils/dom.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type NodeRect } from './geometry';
|
|
|
6
6
|
* @param instance 父组件实例
|
|
7
7
|
* @returns Promise<NodeRect>
|
|
8
8
|
*/
|
|
9
|
-
export declare function getBoundingClientRect(selector: string, instance
|
|
9
|
+
export declare function getBoundingClientRect(selector: string, instance?: ComponentInternalInstance | null): Promise<NodeRect>;
|
|
10
10
|
/**
|
|
11
11
|
* 获取可使用窗口尺寸
|
|
12
12
|
*/
|
package/utils/dom.js
CHANGED
|
@@ -6,11 +6,14 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export function getBoundingClientRect(selector, instance) {
|
|
8
8
|
return new Promise((resolve) => {
|
|
9
|
-
uni
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
let selectorQuery = uni.createSelectorQuery();
|
|
10
|
+
// #ifndef MP-ALIPAY
|
|
11
|
+
const proxy = instance?.proxy;
|
|
12
|
+
if (proxy) {
|
|
13
|
+
selectorQuery = selectorQuery.in(proxy);
|
|
14
|
+
}
|
|
15
|
+
// #endif
|
|
16
|
+
selectorQuery
|
|
14
17
|
.select(selector)
|
|
15
18
|
.boundingClientRect((data) => {
|
|
16
19
|
resolve(data);
|
package/utils/is.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare function isPlainObject(target: any): target is Record<PropertyKey
|
|
|
9
9
|
* @param {any} target
|
|
10
10
|
* @return {boolean}
|
|
11
11
|
*/
|
|
12
|
-
export declare function isEmptyArray(target: any):
|
|
12
|
+
export declare function isEmptyArray(target: any): target is [];
|
|
13
13
|
/**
|
|
14
14
|
* @description: 判断是否为对象
|
|
15
15
|
* @param {any} target
|