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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plain-design",
3
- "version": "1.0.0-beta.67",
3
+ "version": "1.0.0-beta.68",
4
4
  "description": "",
5
5
  "main": "dist/plain-design.min.js",
6
6
  "module": "dist/plain-design.commonjs.min.js",
@@ -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
  }
@@ -43,6 +43,7 @@ export const Form = designComponent({
43
43
  {
44
44
  ['form-vertical-label']: !!props.verticalLabel,
45
45
  ['form-column-center']: !!props.singleColumnCenter,
46
+ ['form-hide-label']: !!props.hideLabel,
46
47
  },
47
48
  ]);
48
49
 
@@ -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 (!!labelWidth.value && !form.props.verticalLabel) {
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 (!!labelWidth.value && !form.props.verticalLabel) {
252
+ if (labelWidth.value != null && !form.props.verticalLabel) {
249
253
  style.width = `calc(100% - ${unit(labelWidth.value)})`;
250
254
  }
251
255
  } else {
@@ -7,9 +7,6 @@ import './theme-locale-selector.scss';
7
7
 
8
8
  export const ThemeLocaleSelector = designComponent({
9
9
  name: 'theme-locale-selector',
10
- props: {
11
- i18nManager: {},
12
- },
13
10
  setup({}) {
14
11
  const classes = useClassCache(() => [
15
12
  getComponentCls('theme-selector'),
@@ -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 ? state.langs[lang] : await 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 cache = createCache<string>('@@I18N_LANG');
217
-
218
- if (cache.get()) {switchTo(cache.get()!);}
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