oiu-core 0.0.27 → 0.0.29

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.
@@ -11,6 +11,6 @@ export type ErrorCodeProps = {
11
11
  */
12
12
  export declare function ErrorCode({ code, args }: ErrorCodeProps): string;
13
13
  export declare namespace ErrorCode {
14
- var text: (_intl: IntlShape, code: number, errors: ErrorStore["errors"], ...args: unknown[]) => string;
14
+ var text: (_intl: IntlShape, code: number, errors: ErrorStore["errors"], ...args: unknown[]) => string | undefined;
15
15
  }
16
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/ErrorCode/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAW,MAAM,YAAY,CAAC;AAGhD,OAAO,EAAiB,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAI1E,MAAM,MAAM,cAAc,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;CACpB,CAAC;AACF;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,cAAc,UAQvD;yBARe,SAAS;sBAiBA,SAAS,QAAQ,MAAM,UAAU,UAAU,CAAC,QAAQ,CAAC,WAAW,OAAO,EAAE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/ErrorCode/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAW,MAAM,YAAY,CAAC;AAGhD,OAAO,EAAiB,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAI1E,MAAM,MAAM,cAAc,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;CACpB,CAAC;AACF;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,cAAc,UAQvD;yBARe,SAAS;sBAiBA,SAAS,QAAQ,MAAM,UAAU,UAAU,CAAC,QAAQ,CAAC,WAAW,OAAO,EAAE,KAAG,MAAM,GAAG,SAAS"}
@@ -0,0 +1,10 @@
1
+ import { FormInstance } from 'antd';
2
+ import { IBadResModel } from '../../redux/slices/errorSlice';
3
+ export type ContentProps = React.HTMLAttributes<HTMLDivElement> & {
4
+ /** Antd form instance */
5
+ form?: FormInstance;
6
+ /** Indicate the error associated with every form field */
7
+ errors: IBadResModel;
8
+ };
9
+ export default function Content({ form, errors, ...html }: ContentProps): import("react/jsx-runtime").JSX.Element;
10
+ //# sourceMappingURL=Content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../../lib/components/FormErrorSummary/Content.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAe,YAAY,EAAE,MAAM,MAAM,CAAC;AAGjD,OAAO,EAAc,YAAY,EAAiB,MAAM,+BAA+B,CAAC;AAQxF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG;IAC9D,yBAAyB;IACzB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,0DAA0D;IAC1D,MAAM,EAAE,YAAY,CAAC;CACxB,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,EAAE,YAAY,2CAoEtE"}
@@ -0,0 +1,28 @@
1
+ import { FormInstance } from 'antd';
2
+ import { IBadResModel } from '../../redux/slices/errorSlice';
3
+ export type WithErrorFieldsMapProps = React.HTMLAttributes<HTMLDivElement> & {
4
+ /** Antd form instance used to bind field-level messages */
5
+ form?: FormInstance;
6
+ /**
7
+ * Backend errors grouped by backend field name.
8
+ * @example { '': ['1', '3'], Value1: ['105', '104'], Value2: [ '15' ], app: [ '4' ] }
9
+ */
10
+ errors?: IBadResModel;
11
+ /**
12
+ * Optional backend-to-frontend field mapping.
13
+ * Use this when API field names are different from form field names.
14
+ * If a backend field is not mapped, behavior depends on `skipUnmapFields`.
15
+ * @example { Value1: nameof<DataForm>('email'), Value2: nameof<DataForm>('phone'), app: '' }
16
+ */
17
+ fieldsMap?: Record<string, string>;
18
+ /** If true, ignores backend fields that are not present in `fieldsMap` */
19
+ skipUnmapFields?: boolean;
20
+ };
21
+ /**
22
+ * Renders the form error summary using preloaded redux error descriptions.
23
+ *
24
+ * This component only remaps backend field keys to frontend form field keys,
25
+ * then delegates message resolution/rendering to `Content`.
26
+ */
27
+ export default function WithErrorFieldsMap({ form, errors, fieldsMap, skipUnmapFields, ...html }: WithErrorFieldsMapProps): import("react/jsx-runtime").JSX.Element;
28
+ //# sourceMappingURL=WithErrorFieldsMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WithErrorFieldsMap.d.ts","sourceRoot":"","sources":["../../../lib/components/FormErrorSummary/WithErrorFieldsMap.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAK7D,MAAM,MAAM,uBAAuB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG;IACzE,2DAA2D;IAC3D,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,0EAA0E;IAC1E,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AACF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACvC,IAAI,EACJ,MAAM,EACN,SAAS,EACT,eAAe,EACf,GAAG,IAAI,EACV,EAAE,uBAAuB,2CAezB"}
@@ -0,0 +1,11 @@
1
+ import { MSId } from '../../redux/slices/errorSlice';
2
+ import { WithErrorFieldsMapProps } from './WithErrorFieldsMap';
3
+ /**
4
+ * Properties asociate to the FormErrorSummary
5
+ */
6
+ export type FormErrorSummaryProps = WithErrorFieldsMapProps & {
7
+ /** Array of services used to load the errors */
8
+ services: MSId[];
9
+ };
10
+ export declare function FormErrorSummary({ services, ...props }: FormErrorSummaryProps): import("react/jsx-runtime").JSX.Element;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/FormErrorSummary/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAA2B,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAInF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,uBAAuB,GAAG;IAC1D,gDAAgD;IAChD,QAAQ,EAAE,IAAI,EAAE,CAAC;CACpB,CAAC;AACF,wBAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,2CAS7E"}
@@ -1,2 +1,3 @@
1
+ export * from './withError';
1
2
  export * from './wl';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/hoc/index.tsx"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/hoc/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,MAAM,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { ComponentType } from 'react';
2
+ import { SpinProps } from '../components/Wait';
3
+ import { MSId, IErrorModel } from '../redux/slices/errorSlice';
4
+ export type LoadErrorsCallback = (ms: MSId) => Promise<IErrorModel[]>;
5
+ export type WithErrorProps<TSpin, TSkeleton> = {
6
+ className?: string;
7
+ showChildren?: boolean;
8
+ services?: MSId[];
9
+ spin?: SpinProps<TSpin>;
10
+ skeleton?: SpinProps<TSkeleton>;
11
+ };
12
+ /**
13
+ * Load all error in redux asociate with the specified services and after display the component
14
+ * @param Component
15
+ * @param props
16
+ */
17
+ export declare function withError<TSpin, TSkeleton, P extends object>(Component: ComponentType<P>, { className, showChildren, services, skeleton, spin }: WithErrorProps<TSpin, TSkeleton>): (props: P) => import("react/jsx-runtime").JSX.Element;
18
+ export declare namespace withError {
19
+ var loadErrors: LoadErrorsCallback;
20
+ }
21
+ //# sourceMappingURL=withError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withError.d.ts","sourceRoot":"","sources":["../../lib/hoc/withError.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmC,aAAa,EAAE,MAAM,OAAO,CAAC;AAIvE,OAAO,EAAQ,SAAS,EAAa,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAA6B,IAAI,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAQ1F,MAAM,MAAM,kBAAkB,GAAG,CAAC,EAAE,EAAE,IAAI,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;AACtE,MAAM,MAAM,cAAc,CAAC,KAAK,EAAE,SAAS,IAAI;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACnC,CAAC;AACF;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC,SAAS,MAAM,EACxD,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,EAC3B,EAAE,SAAS,EAAE,YAAmB,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,cAAc,CAAC,KAAK,EAAE,SAAS,CAAC,WAI3D,CAAC,6CAgEvC;yBAtEe,SAAS"}
@@ -1,4 +1,4 @@
1
- import { A as Re, P as f, a as $, d as Ue } from "./main-iElb4SaI.js";
1
+ import { A as Re, P as f, a as $, d as Ue } from "./main-aB7OFizY.js";
2
2
  class j extends Error {
3
3
  }
4
4
  j.prototype.name = "InvalidTokenError";
@@ -1,3 +1,4 @@
1
+ import { IntlShape } from 'react-intl';
1
2
  export type GL = {
2
3
  spin: {
3
4
  loading: string;
@@ -39,11 +40,17 @@ export declare function setDefaultTranslation(defaultLang: LangInfo, langs: Reco
39
40
  */
40
41
  export declare function t<T>(path: JsonPath<T>): import("react/jsx-runtime").JSX.Element;
41
42
  /**
42
- * Allow safe access to json file properties
43
+ * Allow safe access to json key properties
43
44
  * @param path
44
45
  * @returns
45
46
  */
46
- export declare function tt<T>(path: JsonPath<T>): string;
47
+ export declare function tkey<T>(path: JsonPath<T>): string;
48
+ /**
49
+ * Allow safe access to text mapped with the json file properties
50
+ * @param path
51
+ * @returns
52
+ */
53
+ export declare function ttext<T>(intl: IntlShape, path: JsonPath<T>): string;
47
54
  /**
48
55
  * Get the language @see {@link LangInfo} for the given language code. Example: 'en', 'es', 'fr', 'en-GB', etc.
49
56
  * @param lang
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/language/index.tsx"],"names":[],"mappings":"AAMA,MAAM,MAAM,EAAE,GAAG;IAGb,IAAI,EAAE;QACF,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;KACpB,CAAC;CACL,CAAC;AACF,8CAA8C;AAC9C,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GACpC;KAAG,CAAC,IAAI,MAAM,CAA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