plain-design 1.0.0-beta.51 → 1.0.0-beta.53

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.51",
3
+ "version": "1.0.0-beta.53",
4
4
  "description": "",
5
5
  "main": "dist/plain-design.min.js",
6
6
  "module": "dist/plain-design.commonjs.min.js",
@@ -3,7 +3,7 @@ import {createCache} from "../../utils/createCache";
3
3
  import {InputMode, ThemeMode, ThemeShape, ThemeSize} from "../../uses/useStyle";
4
4
  import {DeepPartial} from "../../utils/type";
5
5
  import {iApplicationConfiguration} from "../Application/utils/application.utils";
6
- import {iThemeConfiguration} from "../Application/theme/theme";
6
+ import {BaseColors, iThemeConfiguration} from "../Application/theme/theme";
7
7
  import {deepmerge} from "./deepmerge";
8
8
  import {PlainObject} from "plain-utils/utils/event";
9
9
 
@@ -235,3 +235,24 @@ export const ThemePrimaryColors: Record<string, {
235
235
  };
236
236
 
237
237
  export default PageThemeUtils;
238
+
239
+ export function getPrimaryColor(primaryKey?: string | undefined): { light: string, dark: string } {
240
+ const baseColor = {
241
+ light: BaseColors.light.primary,
242
+ dark: BaseColors.dark.primary,
243
+ };
244
+ if (!primaryKey) {
245
+ return baseColor;
246
+ }
247
+ const themeConfig = ThemePrimaryColors[primaryKey]?.themeConfig;
248
+
249
+ if (!themeConfig) {return baseColor;}
250
+
251
+ return typeof themeConfig === "string" ? {
252
+ dark: themeConfig,
253
+ light: themeConfig,
254
+ } : {
255
+ dark: themeConfig.dark.base!.primary!,
256
+ light: themeConfig.light.base!.primary!
257
+ };
258
+ }
@@ -196,7 +196,8 @@ export type {
196
196
  iTableOptionCacheRegistryConfig,
197
197
  iTableOptionGetCacheParam
198
198
  } from './components/AutoTable/use/useTableOption.cache.utils';
199
- export {PageThemeUtils} from './components/PageThemeUtils';
199
+ export {PageThemeUtils, getPrimaryColor} from './components/PageThemeUtils';
200
+ export {BaseColors, BaseGrayColors} from './components/Application/theme/theme';
200
201
  export {ThemePrimaryColors} from './components/ThemePrimaryColors';
201
202
  export {ThemeEditor} from './components/ThemeEditor';
202
203
  export {useReferenceTrigger} from './components/useReferenceTrigger';
@@ -132,7 +132,7 @@ export const i18n = (() => {
132
132
  */
133
133
  const use = (lang: string, locale: any) => {
134
134
  state.currentLang = lang;
135
- state.langs[lang] = locale;
135
+ state.langs[lang] = deepmerge(state.langs[lang], locale);
136
136
  hooks.onChangeLang.exec(undefined);
137
137
  };
138
138
  /**
@@ -54,31 +54,31 @@ export const EnUsLocale: tZhCnLocale = {
54
54
  operation: 'operation',
55
55
  noFilter: 'no filter',
56
56
  validate: {
57
- require: 'require',
58
- notMatchPattern: 'not match patter',
59
- canNotUseMinInAnyType: 'any type cannot use min validation',
60
- canNotUseMaxInAnyType: 'any type cannot use max validation',
61
- canNotUseLenInAnyType: 'any type cannot use len validation',
62
- outOfRange: 'value "{value}" is out of range {range}',
63
- pleaseEnterArrayValue: 'please enter array value',
64
- arrayCannotUsePatternValidation: 'array cannot use pattern validation',
65
- minimunValues: 'minimun {num} values',
66
- maximunValues: 'maximun {num} values',
67
- minimunCharacters: 'minimun {num} characters',
68
- maximunCharacters: 'maximun {num} characters',
69
- fixedValues: 'fixed {num} values',
70
- fixedCharacters: 'fixed {num} characters',
71
- notLessThan: 'not less than {num}',
72
- notLargerThan: 'not larger than{num}',
73
- minValue: 'min {num}',
74
- maxValue: 'max {num}',
75
- fixedLength: 'fixed length {num} characters',
76
- pleaseEnterCorrectEmail: 'please enter correct email',
77
- pleaseEnterCorrectIdCard: 'please enter correct idcard',
78
- pleaseEnterNumber: 'please enter correct number',
79
- pleaseEnterCorrectPhoneNumber: 'please enter correct phone number',
80
- pleaseEnterCorrectQQNum: 'please enter correct qq',
81
- valueShouldBeStringOrNumber: 'please enter correct string or number',
57
+ require: ' require',
58
+ notMatchPattern: ' not match patter',
59
+ canNotUseMinInAnyType: ' any type cannot use min validation',
60
+ canNotUseMaxInAnyType: ' any type cannot use max validation',
61
+ canNotUseLenInAnyType: ' any type cannot use len validation',
62
+ outOfRange: ' value "{value}" is out of range {range}',
63
+ pleaseEnterArrayValue: ' please enter array value',
64
+ arrayCannotUsePatternValidation: ' array cannot use pattern validation',
65
+ minimunValues: ' minimun {num} values',
66
+ maximunValues: ' maximun {num} values',
67
+ minimunCharacters: ' minimun {num} characters',
68
+ maximunCharacters: ' maximun {num} characters',
69
+ fixedValues: ' fixed {num} values',
70
+ fixedCharacters: ' fixed {num} characters',
71
+ notLessThan: ' not less than {num}',
72
+ notLargerThan: ' not larger than{num}',
73
+ minValue: ' min {num}',
74
+ maxValue: ' max {num}',
75
+ fixedLength: ' fixed length {num} characters',
76
+ pleaseEnterCorrectEmail: ' please enter correct email',
77
+ pleaseEnterCorrectIdCard: ' please enter correct idcard',
78
+ pleaseEnterNumber: ' please enter correct number',
79
+ pleaseEnterCorrectPhoneNumber: ' please enter correct phone number',
80
+ pleaseEnterCorrectQQNum: ' please enter correct qq',
81
+ valueShouldBeStringOrNumber: ' please enter correct string or number',
82
82
 
83
83
  },
84
84
  filter: {