plain-design 1.0.0-beta.67 → 1.0.0-beta.68
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/plain-design.commonjs.min.js +2 -2
- package/dist/plain-design.min.css +1 -1
- package/dist/plain-design.min.js +2 -2
- package/dist/report.html +2 -2
- package/package.json +1 -1
- package/src/packages/components/Form/form.scss +7 -0
- package/src/packages/components/Form/index.tsx +1 -0
- package/src/packages/components/Form/layout/useFormLayout.tsx +6 -2
- package/src/packages/components/ThemeLocaleSelector/index.tsx +0 -3
- package/src/packages/i18n/i18n.utils.ts +9 -8
package/package.json
CHANGED
@@ -209,6 +209,7 @@
|
|
209
209
|
}
|
210
210
|
}
|
211
211
|
}
|
212
|
+
|
212
213
|
&:not(.form-vertical-label) {
|
213
214
|
@include prefix(form-item) {
|
214
215
|
.form-item-label {
|
@@ -216,4 +217,10 @@
|
|
216
217
|
}
|
217
218
|
}
|
218
219
|
}
|
220
|
+
|
221
|
+
&.form-hide-label {
|
222
|
+
.form-item-label {
|
223
|
+
display: none;
|
224
|
+
}
|
225
|
+
}
|
219
226
|
}
|
@@ -42,6 +42,7 @@ export const FormLayoutPropsOption = {
|
|
42
42
|
gutter: { type: Number }, // 列间隔
|
43
43
|
rowGutter: { type: Number }, // 行间隔
|
44
44
|
validateMessagePosition: { type: String as PropType<typeof FormValidateMessagePosition.TYPE> }, // 校验消息的位置
|
45
|
+
hideLabel: { type: Boolean }, // 隐藏form-item的label
|
45
46
|
} as const;
|
46
47
|
|
47
48
|
/**
|
@@ -152,6 +153,9 @@ export const useFormLayout = (() => {
|
|
152
153
|
* @date 2022.9.4 23:21
|
153
154
|
*/
|
154
155
|
const labelWidth = computed((): number | string => {
|
156
|
+
if (form.props.hideLabel) {
|
157
|
+
return 0;
|
158
|
+
}
|
155
159
|
/*纵向文本表单情况下,文本宽度占用整行*/
|
156
160
|
if (form.props.verticalLabel) {
|
157
161
|
return '100%';
|
@@ -233,7 +237,7 @@ export const useFormLayout = (() => {
|
|
233
237
|
*/
|
234
238
|
const labelStyles = useStyles(style => {
|
235
239
|
if (!form.isSingleColumn.value) {
|
236
|
-
if (
|
240
|
+
if (labelWidth.value != null && !form.props.verticalLabel) {
|
237
241
|
style.width = unit(labelWidth.value);
|
238
242
|
}
|
239
243
|
}
|
@@ -245,7 +249,7 @@ export const useFormLayout = (() => {
|
|
245
249
|
*/
|
246
250
|
const contentStyles = useStyles(style => {
|
247
251
|
if (!form.isSingleColumn.value) {
|
248
|
-
if (
|
252
|
+
if (labelWidth.value != null && !form.props.verticalLabel) {
|
249
253
|
style.width = `calc(100% - ${unit(labelWidth.value)})`;
|
250
254
|
}
|
251
255
|
} else {
|
@@ -131,7 +131,7 @@ export const i18n = (() => {
|
|
131
131
|
*/
|
132
132
|
const use = (lang: string, locale: any) => {
|
133
133
|
state.currentLang = lang;
|
134
|
-
state.langs[lang] = deepmerge(state.langs[lang], locale);
|
134
|
+
if (!!locale) {state.langs[lang] = deepmerge(state.langs[lang], locale);}
|
135
135
|
hooks.onChangeLang.exec(undefined);
|
136
136
|
};
|
137
137
|
/**
|
@@ -140,7 +140,7 @@ export const i18n = (() => {
|
|
140
140
|
* @date 2023/10/11 9:30
|
141
141
|
*/
|
142
142
|
const switchTo = async (lang: string, loadMethod?: () => any) => {
|
143
|
-
let locale = !loadMethod ?
|
143
|
+
let locale = !loadMethod ? undefined : await loadMethod();
|
144
144
|
use(lang, locale);
|
145
145
|
};
|
146
146
|
/**
|
@@ -148,9 +148,7 @@ export const i18n = (() => {
|
|
148
148
|
* @author 韦胜健
|
149
149
|
* @date 2023/10/11 9:30
|
150
150
|
*/
|
151
|
-
const getCurrentLanguage = () => {
|
152
|
-
return state.currentLang;
|
153
|
-
};
|
151
|
+
const getCurrentLanguage = () => {return state.currentLang;};
|
154
152
|
/**
|
155
153
|
* 设置语言
|
156
154
|
* @author 韦胜健
|
@@ -213,9 +211,11 @@ export const i18n = (() => {
|
|
213
211
|
return result;
|
214
212
|
};
|
215
213
|
|
216
|
-
const
|
217
|
-
|
218
|
-
|
214
|
+
const applyCache = () => {
|
215
|
+
const cache = createCache<string>('@@I18N_LANG');
|
216
|
+
if (cache.get()) {switchTo(cache.get()!);}
|
217
|
+
hooks.onChangeLang.use(() => {cache.set(state.currentLang);});
|
218
|
+
};
|
219
219
|
|
220
220
|
return {
|
221
221
|
$t,
|
@@ -228,6 +228,7 @@ export const i18n = (() => {
|
|
228
228
|
DEFAULT_LANG,
|
229
229
|
state,
|
230
230
|
hooks,
|
231
|
+
applyCache,
|
231
232
|
};
|
232
233
|
})();
|
233
234
|
|