react-hook-core 0.2.8 → 0.3.0

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.
package/lib/core.js CHANGED
@@ -133,8 +133,8 @@ function initForm(form, initMat) {
133
133
  }
134
134
  exports.initForm = initForm;
135
135
  function error(err, gv, ae) {
136
- var title = gv('error');
137
- var msg = gv('error_internal');
136
+ var title = getString('error', gv);
137
+ var msg = getString('error_internal', gv);
138
138
  if (!err) {
139
139
  ae(msg, undefined, title);
140
140
  return;
@@ -235,13 +235,6 @@ function getValidateForm(u, vf) {
235
235
  return (u && u.ui ? u.ui.validateForm : undefined);
236
236
  }
237
237
  exports.getValidateForm = getValidateForm;
238
- function getDecodeFromForm(u, d) {
239
- if (d) {
240
- return d;
241
- }
242
- return (u && u.ui ? u.ui.decodeFromForm : undefined);
243
- }
244
- exports.getDecodeFromForm = getDecodeFromForm;
245
238
  function handleToggle(target, on) {
246
239
  if (target) {
247
240
  if (on) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-hook-core",
3
- "version": "0.2.8",
3
+ "version": "0.3.0",
4
4
  "description": "react",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./src/index.ts",
package/src/core.ts CHANGED
@@ -239,7 +239,7 @@ export interface ErrorMessage {
239
239
  }
240
240
  export interface UIService {
241
241
  getValue(el: HTMLInputElement, locale?: Locale, currencyCode?: string): string | number | boolean | null | undefined;
242
- decodeFromForm(form: HTMLFormElement, locale?: Locale, currencyCode?: string | null): any;
242
+ // decodeFromForm(form: HTMLFormElement, locale?: Locale, currencyCode?: string | null): any;
243
243
 
244
244
  validateForm(form?: HTMLFormElement, locale?: Locale, focusFirst?: boolean, scroll?: boolean): boolean;
245
245
  removeFormError(form: HTMLFormElement): void;
@@ -395,9 +395,9 @@ export function initForm(form?: HTMLFormElement, initMat?: (f: HTMLFormElement)
395
395
  }
396
396
  return form;
397
397
  }
398
- export function error(err: any, gv: (key: string) => string, ae: (msg: string, callback?: () => void, header?: string) => void) {
399
- const title = gv('error');
400
- let msg = gv('error_internal');
398
+ export function error(err: any, gv: StringMap | ((key: string) => string), ae: (msg: string, callback?: () => void, header?: string) => void) {
399
+ const title = getString('error', gv);
400
+ let msg = getString('error_internal', gv);
401
401
  if (!err) {
402
402
  ae(msg, undefined, title);
403
403
  return;
@@ -494,12 +494,14 @@ export function getValidateForm(u?: UIParameter, vf?: (form: HTMLFormElement, lo
494
494
  }
495
495
  return (u && u.ui ? u.ui.validateForm : undefined);
496
496
  }
497
+ /*
497
498
  export function getDecodeFromForm(u?: UIParameter, d?: (form: HTMLFormElement, locale?: Locale, currencyCode?: string) => any): ((form: HTMLFormElement, locale?: Locale, currencyCode?: string) => any) | undefined {
498
499
  if (d) {
499
500
  return d;
500
501
  }
501
502
  return (u && u.ui ? u.ui.decodeFromForm : undefined);
502
503
  }
504
+ */
503
505
  export function handleToggle(target?: HTMLInputElement, on?: boolean): void {
504
506
  if (target) {
505
507
  if (on) {
package/src/input.ts CHANGED
@@ -49,9 +49,9 @@ export function getMsgFunc(p: ResourceService|ShowMessageInput, showMsg?: (msg:
49
49
  return (p as any).showMessage;
50
50
  }
51
51
  interface ConfirmInput {
52
- confirm: (m2: string, header: string, yesCallback?: () => void, btnLeftText?: string, btnRightText?: string, noCallback?: () => void) => void;
52
+ confirm: (m2: string, yesCallback?: () => void, header?: string, btnLeftText?: string, btnRightText?: string, noCallback?: () => void) => void;
53
53
  }
54
- export function getConfirmFunc(p: ResourceService|ConfirmInput, cf?: (m2: string, header: string, yesCallback?: () => void, btnLeftText?: string, btnRightText?: string, noCallback?: () => void) => void): (m2: string, header: string, yesCallback?: () => void, btnLeftText?: string, btnRightText?: string, noCallback?: () => void) => void {
54
+ export function getConfirmFunc(p: ResourceService|ConfirmInput, cf?: (m2: string, yesCallback?: () => void, header?: string, btnLeftText?: string, btnRightText?: string, noCallback?: () => void) => void): (m2: string, yesCallback?: () => void, header?: string, btnLeftText?: string, btnRightText?: string, noCallback?: () => void) => void {
55
55
  if (cf) {
56
56
  return cf;
57
57
  }
@@ -67,9 +67,9 @@ export function getLocaleFunc(p: ResourceService|GetLocaleInput, getLoc?: () =>
67
67
  return (p as any).getLocale;
68
68
  }
69
69
  interface ShowErrorInput {
70
- showError: (m: string, header?: string, detail?: string, callback?: () => void) => void;
70
+ showError: (m: string, callback?: () => void, header?: string) => void;
71
71
  }
72
- export function getErrorFunc(p: ResourceService|ShowErrorInput, showErr?: (m: string, header?: string, detail?: string, callback?: () => void) => void): (m: string, header?: string, detail?: string, callback?: () => void) => void {
72
+ export function getErrorFunc(p: ResourceService|ShowErrorInput, showErr?: (m: string, callback?: () => void, header?: string) => void): (m: string, callback?: () => void, header?: string) => void {
73
73
  if (showErr) {
74
74
  return showErr;
75
75
  }