@harbor-design/proform 1.4.19 → 1.4.21

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.
@@ -1,6 +1,20 @@
1
- import { FormPresets, UIName } from "../../types";
1
+ import { FormPresets, ProFormLocalePack, UIName } from "../../types";
2
2
  export default class Context {
3
3
  static presets: FormPresets;
4
+ static localePackCache: Record<string, ProFormLocalePack>;
5
+ static localePackPromiseCache: Map<string, Promise<ProFormLocalePack | undefined>>;
6
+ static internalI18nVersion: import("vue").Ref<number>;
7
+ static setPresets(presets: FormPresets): void;
4
8
  static getPreset(ui: UIName): import("../../types").FormPreset | undefined;
5
9
  static getUI(ui: UIName): UIName;
10
+ static getI18nConfig(): any;
11
+ static getCurrentLocale(): any;
12
+ static getLocalePack(locale?: any): ProFormLocalePack | undefined;
13
+ static ensureLocalePackLoaded(locale?: any): Promise<any>;
14
+ static formatTemplate(template: string, values: Record<string, string | number | undefined>): string;
15
+ static translateMessage(message?: string): string;
16
+ static translateLabel(label?: string): any;
17
+ static buildRequiredMessage(label?: string): string;
18
+ static buildPlaceholder(componentName: string | undefined, label?: string, defaultPrefixMap?: Record<string, string>): string;
19
+ static applyPlaceholderTemplate(prefix: string, label: string): string;
6
20
  }
@@ -28,6 +28,7 @@ export default class RuntimeCore {
28
28
  runtimeAdapter: RuntimeAdpter;
29
29
  shared: AnyObject;
30
30
  shareHistory: Map<any, any>;
31
+ specialFormIdPrefix: string;
31
32
  constructor(setup: Setup);
32
33
  getRuntimeMeta(): {
33
34
  model: AnyObject;
@@ -1,4 +1,5 @@
1
1
  import { AdaptedInterface, DisplayOptions, NativeCustomizationOptions } from ".";
2
+ import type { Ref } from "vue";
2
3
  import { AnyObject } from "./utilTypes";
3
4
  export type DomType = new (...args: any) => AnyObject & {
4
5
  $props: AnyObject;
@@ -17,9 +18,27 @@ export interface FormPreset {
17
18
  native?: NativeCustomizationOptions;
18
19
  display?: DisplayOptions;
19
20
  }
21
+ export interface ProFormLocalePack {
22
+ messages?: Record<string, string>;
23
+ placeholderPrefixByComponentName?: Record<string, string>;
24
+ templates?: {
25
+ placeholder?: string;
26
+ required?: string;
27
+ };
28
+ }
29
+ export interface ProFormI18nOptions {
30
+ localeRef: Ref<string>;
31
+ versionRef?: Ref<number>;
32
+ loadLocalePack?: (locale: string) => Promise<ProFormLocalePack>;
33
+ translateLabel?: (label: string, context: {
34
+ locale: string;
35
+ pack?: ProFormLocalePack;
36
+ }) => string;
37
+ }
20
38
  export type UIName = "ArcoVue" | "NutUI" | "NaiveUI" | (string & {});
21
39
  export type AdaptedInterfacePreset = Record<UIName, AdaptedInterface>;
22
40
  export type FormPresets = {
23
41
  ui: UIName;
24
42
  uiPresets: Partial<Record<UIName, FormPreset>>;
43
+ i18n?: any;
25
44
  };
@@ -108,6 +108,7 @@ export interface FormCustomization {
108
108
  native?: NativeCustomizationOptions;
109
109
  runtime?: Runtime;
110
110
  schemas: Ref<ProxyedSchema[]> | ProxyedSchema[];
111
+ specialFormIdPrefix?: any;
111
112
  }
112
113
  export type NativeCustomizationOptions = {
113
114
  props?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harbor-design/proform",
3
- "version": "1.4.19",
3
+ "version": "1.4.21",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",