react-hook-core 0.1.4 → 0.1.7

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/src/components.ts CHANGED
@@ -1,17 +1,18 @@
1
1
  import * as React from 'react';
2
- import {RouteComponentProps} from 'react-router';
3
- import {clone, diff, makeDiff} from 'reflectx';
4
- import {addParametersIntoUrl, append, buildMessage, changePage, changePageSize, formatResults, getFieldsFromForm, getModel, handleAppend, handleSortEvent, initFilter, mergeFilter as mergeFilter2, more, reset, Searchable, showPaging, validate} from 'search-core';
5
2
  import {BaseDiffState, createDiffStatus, createEditStatus, DiffApprService, DiffParameter, DiffState, DiffStatusConfig, handleToggle, hideLoading, showLoading} from './core';
6
- import {Attributes, buildId, EditStatusConfig, error, ErrorMessage, Filter, getCurrencyCode, getModelName as getModelName2, initForm, LoadingService, Locale, message, messageByHttpStatus, PageChange, pageSizes, removePhoneFormat, ResourceService, SearchParameter, SearchResult, SearchService, SearchState, StringMap, UIService, ViewParameter, ViewService} from './core';
3
+ import {Attributes, EditStatusConfig, error, ErrorMessage, Filter, getCurrencyCode, getModelName as getModelName2, initForm, LoadingService, Locale, message, messageByHttpStatus, PageChange, pageSizes, removePhoneFormat, ResourceService, SearchParameter, SearchResult, SearchService, SearchState, StringMap, UIService, ViewParameter, ViewService} from './core';
7
4
  import {formatDiffModel, getDataFields} from './diff';
8
5
  import {build, createModel as createModel2, EditParameter, GenericService, handleStatus, handleVersion, initPropertyNullInModel, ResultInfo} from './edit';
9
6
  import {focusFirstError, readOnly} from './formutil';
10
7
  import {getAutoSearch, getConfirmFunc, getDiffStatusFunc, getEditStatusFunc, getErrorFunc, getLoadingFunc, getLocaleFunc, getMsgFunc, getResource, getUIService} from './input';
8
+ import {clone, diff, makeDiff} from './reflect';
11
9
  import {buildFromUrl} from './route';
10
+ import {addParametersIntoUrl, append, buildMessage, changePage, changePageSize, formatResults, getFieldsFromForm, getModel, handleAppend, handleSortEvent, initFilter, mergeFilter as mergeFilter2, more, Pagination, reset, showPaging, Sortable, validate} from './search';
12
11
  import {buildFlatState, buildState, enLocale, handleEvent, handleProps, localeOf} from './state';
13
12
 
14
- export class ViewComponent<T, ID, P extends RouteComponentProps, S> extends React.Component<P, S> {
13
+ interface Searchable extends Pagination, Sortable {
14
+ }
15
+ export class ViewComponent<T, ID, P, S> extends React.Component<P, S> {
15
16
  constructor(props: P, sv: ((id: ID, ctx?: any) => Promise<T>)|ViewService<T, ID>,
16
17
  param: ResourceService|ViewParameter,
17
18
  showError?: (msg: string, title?: string, detail?: string, callback?: () => void) => void,
@@ -40,7 +41,6 @@ export class ViewComponent<T, ID, P extends RouteComponentProps, S> extends Reac
40
41
  }
41
42
  }
42
43
  }
43
- this.back = this.back.bind(this);
44
44
  this.getModelName = this.getModelName.bind(this);
45
45
  this.load = this.load.bind(this);
46
46
  this.getModel = this.getModel.bind(this);
@@ -61,12 +61,6 @@ export class ViewComponent<T, ID, P extends RouteComponentProps, S> extends Reac
61
61
  keys?: string[];
62
62
  metadata?: Attributes;
63
63
 
64
- back(event: any) {
65
- if (event) {
66
- event.preventDefault();
67
- }
68
- this.props.history.goBack();
69
- }
70
64
  getModelName(): string {
71
65
  if (this.name && this.name.length > 0) {
72
66
  return this.name;
@@ -78,13 +72,6 @@ export class ViewComponent<T, ID, P extends RouteComponentProps, S> extends Reac
78
72
  return n;
79
73
  }
80
74
  }
81
- componentDidMount() {
82
- this.form = this.ref.current;
83
- const id = buildId<ID>(this.props, this.keys);
84
- if (id) {
85
- this.load(id);
86
- }
87
- }
88
75
  load(_id: ID, callback?: (m: T, showF: (model: T) => void) => void) {
89
76
  const id: any = _id;
90
77
  if (id != null && id !== '' && this.loadData) {
@@ -619,7 +606,7 @@ export class BaseSearchComponent<T, F extends Filter, P, I extends SearchState<T
619
606
  this.doSearch();
620
607
  }
621
608
  }
622
- export class SearchComponent<T, S extends Filter, P extends RouteComponentProps, I extends SearchState<T, S>> extends BaseSearchComponent<T, S, P, I> {
609
+ export class SearchComponent<T, S extends Filter, P, I extends SearchState<T, S>> extends BaseSearchComponent<T, S, P, I> {
623
610
  constructor(props: P, sv: ((s: S, ctx?: any) => Promise<SearchResult<T>>) | SearchService<T, S>,
624
611
  param: ResourceService|SearchParameter,
625
612
  showMessage?: (msg: string, option?: string) => void,
@@ -641,7 +628,6 @@ export class SearchComponent<T, S extends Filter, P extends RouteComponentProps,
641
628
  }
642
629
  }
643
630
  }
644
- this.add = this.add.bind(this);
645
631
  this.call = this.call.bind(this);
646
632
  this.showError = getErrorFunc(param, showError);
647
633
  this.componentDidMount = this.componentDidMount.bind(this);
@@ -667,11 +653,6 @@ export class SearchComponent<T, S extends Filter, P extends RouteComponentProps,
667
653
  const s: any = {};
668
654
  return s;
669
655
  }
670
- add = (event: any) => {
671
- event.preventDefault();
672
- const url = this.url + '/add';
673
- this.props.history.push(url);
674
- }
675
656
  call(se: S) {
676
657
  this.running = true;
677
658
  const s = clone(se);
@@ -711,7 +692,7 @@ export class SearchComponent<T, S extends Filter, P extends RouteComponentProps,
711
692
  }
712
693
  }
713
694
 
714
- export abstract class BaseEditComponent<T, P extends RouteComponentProps, S> extends BaseComponent<P, S> {
695
+ export abstract class BaseEditComponent<T, P, S> extends BaseComponent<P, S> {
715
696
  constructor(props: P,
716
697
  protected resourceService: ResourceService,
717
698
  protected showMessage: (msg: string) => void,
@@ -779,7 +760,6 @@ export abstract class BaseEditComponent<T, P extends RouteComponentProps, S> ext
779
760
  if (event) {
780
761
  event.preventDefault();
781
762
  }
782
- this.props.history.goBack();
783
763
  }
784
764
  resetState(newMod: boolean, model: T, originalModel?: T) {
785
765
  this.newMode = newMod;
@@ -986,7 +966,7 @@ export abstract class BaseEditComponent<T, P extends RouteComponentProps, S> ext
986
966
  this.showError(msg.message, msg.title);
987
967
  }
988
968
  }
989
- export class EditComponent<T, ID, P extends RouteComponentProps, S> extends BaseEditComponent<T, P, S> {
969
+ export class EditComponent<T, ID, P, S> extends BaseEditComponent<T, P, S> {
990
970
  constructor(props: P, protected service: GenericService<T, ID, number|ResultInfo<T>>,
991
971
  param: ResourceService|EditParameter,
992
972
  showMessage?: (msg: string, option?: string) => void,
@@ -1018,16 +998,9 @@ export class EditComponent<T, ID, P extends RouteComponentProps, S> extends Base
1018
998
  }
1019
999
  this.load = this.load.bind(this);
1020
1000
  this.doSave = this.doSave.bind(this);
1021
- this.componentDidMount = this.componentDidMount.bind(this);
1022
1001
  this.ref = React.createRef();
1023
1002
  }
1024
1003
  ref: any;
1025
- componentDidMount() {
1026
- const k = (this.ui ? this.ui.registerEvents : undefined);
1027
- this.form = initForm(this.ref.current, k);
1028
- const id = buildId<ID>(this.props, this.keys);
1029
- this.load(id);
1030
- }
1031
1004
  load(_id: ID|null, callback?: (m: T, showM: (m2: T) => void) => void) {
1032
1005
  const id: any = _id;
1033
1006
  if (id != null && id !== '') {
@@ -1105,7 +1078,7 @@ export class EditComponent<T, ID, P extends RouteComponentProps, S> extends Base
1105
1078
  }
1106
1079
  }
1107
1080
 
1108
- export class BaseDiffApprComponent<T, ID, P extends RouteComponentProps, S extends BaseDiffState> extends React.Component<P, S & any> {
1081
+ export class BaseDiffApprComponent<T, ID, P, S extends BaseDiffState> extends React.Component<P, S & any> {
1109
1082
  constructor(props: P, protected keys: string[], protected resourceService: ResourceService,
1110
1083
  protected showMessage: (msg: string, option?: string) => void,
1111
1084
  protected showError: (m: string, title?: string, detail?: string, callback?: () => void) => void,
@@ -1118,7 +1091,6 @@ export class BaseDiffApprComponent<T, ID, P extends RouteComponentProps, S exten
1118
1091
  this.resource = resourceService.resource();
1119
1092
  this.showMessage = this.showMessage.bind(this);
1120
1093
  this.showError = this.showError.bind(this);
1121
- this.back = this.back.bind(this);
1122
1094
  this.initModel = this.initModel.bind(this);
1123
1095
  this.postApprove = this.postApprove.bind(this);
1124
1096
  this.postReject = this.postReject.bind(this);
@@ -1135,13 +1107,6 @@ export class BaseDiffApprComponent<T, ID, P extends RouteComponentProps, S exten
1135
1107
  running?: boolean;
1136
1108
  resource: StringMap;
1137
1109
 
1138
- back(event: any) {
1139
- if (event) {
1140
- event.preventDefault();
1141
- }
1142
- this.props.history.goBack();
1143
- }
1144
-
1145
1110
  initModel(): T {
1146
1111
  const x: any = {};
1147
1112
  return x;
@@ -1224,7 +1189,7 @@ export class BaseDiffApprComponent<T, ID, P extends RouteComponentProps, S exten
1224
1189
  this.showError(msg.message, msg.title);
1225
1190
  }
1226
1191
  }
1227
- export class DiffApprComponent<T, ID, P extends RouteComponentProps, S extends DiffState<T>> extends BaseDiffApprComponent<T, ID, P, S> {
1192
+ export class DiffApprComponent<T, ID, P, S extends DiffState<T>> extends BaseDiffApprComponent<T, ID, P, S> {
1228
1193
  constructor(props: P, protected service: DiffApprService<T, ID>,
1229
1194
  param: ResourceService|DiffParameter,
1230
1195
  showMessage?: (msg: string, option?: string) => void,
@@ -1244,14 +1209,6 @@ export class DiffApprComponent<T, ID, P extends RouteComponentProps, S extends D
1244
1209
  }
1245
1210
  ref: any;
1246
1211
 
1247
- componentDidMount() {
1248
- this.form = this.ref.current;
1249
- const id = buildId<ID>(this.props, this.keys);
1250
- if (id) {
1251
- this.load(id);
1252
- }
1253
- }
1254
-
1255
1212
  formatFields(value: T): T {
1256
1213
  return value;
1257
1214
  }
package/src/core.ts CHANGED
@@ -1,7 +1,8 @@
1
- import {RouteComponentProps} from 'react-router';
2
- import {focusFirstElement} from './formutil';
1
+ import { Params } from 'react-router';
2
+ import { focusFirstElement } from './formutil';
3
3
 
4
4
  export const pageSizes = [12, 24, 60, 100, 120, 180, 300, 600];
5
+ export const size = pageSizes;
5
6
  export interface ModelMap {
6
7
  [key: string]: any;
7
8
  }
@@ -35,12 +36,12 @@ export interface SearchParameter {
35
36
  auto?: boolean;
36
37
  }
37
38
  export interface EditStatusConfig {
38
- duplicate_key: number|string;
39
- not_found: number|string;
40
- success: number|string;
41
- version_error: number|string;
42
- error?: number|string;
43
- data_corrupt?: number|string;
39
+ duplicate_key: number | string;
40
+ not_found: number | string;
41
+ success: number | string;
42
+ version_error: number | string;
43
+ error?: number | string;
44
+ data_corrupt?: number | string;
44
45
  }
45
46
  export function createEditStatus(status?: EditStatusConfig): EditStatusConfig {
46
47
  if (status) {
@@ -57,10 +58,10 @@ export function createEditStatus(status?: EditStatusConfig): EditStatusConfig {
57
58
  return s;
58
59
  }
59
60
  export interface DiffStatusConfig {
60
- not_found: number|string;
61
- success: number|string;
62
- version_error: number|string;
63
- error?: number|string;
61
+ not_found: number | string;
62
+ success: number | string;
63
+ version_error: number | string;
64
+ error?: number | string;
64
65
  }
65
66
  export function createDiffStatus(status?: DiffStatusConfig): DiffStatusConfig {
66
67
  if (status) {
@@ -96,7 +97,7 @@ export interface SearchState<T, S extends Filter> {
96
97
  }
97
98
  export interface SearchService<T, S extends Filter> {
98
99
  keys?(): string[];
99
- search(s: S, limit?: number, offset?: number|string, fields?: string[]): Promise<SearchResult<T>>;
100
+ search(s: S, limit?: number, offset?: number | string, fields?: string[]): Promise<SearchResult<T>>;
100
101
  }
101
102
  export interface ViewParameter {
102
103
  resource: ResourceService;
@@ -105,9 +106,9 @@ export interface ViewParameter {
105
106
  loading?: LoadingService;
106
107
  }
107
108
  export interface ViewService<T, ID> {
108
- metadata?(): Attributes|undefined;
109
+ metadata?(): Attributes | undefined;
109
110
  keys?(): string[];
110
- load(id: ID, ctx?: any): Promise<T|null>;
111
+ load(id: ID, ctx?: any): Promise<T | null>;
111
112
  }
112
113
 
113
114
  export interface DiffParameter {
@@ -131,8 +132,8 @@ export interface DiffModel<T, ID> {
131
132
  value: T;
132
133
  }
133
134
  export interface ApprService<ID> {
134
- approve(id: ID, ctx?: any): Promise<number|string>;
135
- reject(id: ID, ctx?: any): Promise<number|string>;
135
+ approve(id: ID, ctx?: any): Promise<number | string>;
136
+ reject(id: ID, ctx?: any): Promise<number | string>;
136
137
  }
137
138
  export interface DiffService<T, ID> {
138
139
  keys(): string[];
@@ -148,11 +149,11 @@ export interface DiffState<T> {
148
149
 
149
150
  // tslint:disable-next-line:class-name
150
151
  export class resource {
151
- static phone = / |\-|\.|\(|\)/g;
152
+ static phone = / |-|\.|\(|\)/g;
152
153
  static _cache: any = {};
153
154
  static cache = true;
154
155
  }
155
- export function getCurrencyCode(form?: HTMLFormElement|null): string|undefined {
156
+ export function getCurrencyCode(form?: HTMLFormElement | null): string | undefined {
156
157
  if (form) {
157
158
  const x = form.getAttribute('currency-code');
158
159
  if (x) {
@@ -182,34 +183,34 @@ export interface Message {
182
183
  yes?: string;
183
184
  no?: string;
184
185
  }
185
- export function getString(key: string, gv: StringMap|((key: string) => string)): string {
186
+ export function getString(key: string, gv: StringMap | ((key: string) => string)): string {
186
187
  if (typeof gv === 'function') {
187
188
  return gv(key);
188
189
  } else {
189
190
  return gv[key];
190
191
  }
191
192
  }
192
- export function message(gv: StringMap|((key: string) => string), msg: string, title?: string, yes?: string, no?: string): Message {
193
+ export function message(gv: StringMap | ((key: string) => string), msg: string, title?: string, yes?: string, no?: string): Message {
193
194
  const m2 = (msg && msg.length > 0 ? getString(msg, gv) : '');
194
- const m: Message = { message: m2, title: '' };
195
- if (title && title.length > 0) {
196
- m.title = getString(title, gv);
197
- }
198
- if (yes && yes.length > 0) {
199
- m.yes = getString(yes, gv);
200
- }
201
- if (no && no.length > 0) {
202
- m.no = getString(no, gv);
203
- }
204
- return m;
195
+ const m: Message = { message: m2, title: '' };
196
+ if (title && title.length > 0) {
197
+ m.title = getString(title, gv);
198
+ }
199
+ if (yes && yes.length > 0) {
200
+ m.yes = getString(yes, gv);
201
+ }
202
+ if (no && no.length > 0) {
203
+ m.no = getString(no, gv);
204
+ }
205
+ return m;
205
206
  }
206
- export function messageByHttpStatus(status: number, gv: StringMap|((key: string) => string)): string {
207
+ export function messageByHttpStatus(status: number, gv: StringMap | ((key: string) => string)): string {
207
208
  const k = 'status_' + status;
208
209
  let msg = getString(k, gv);
209
- if (!msg || msg.length === 0) {
210
- msg = getString('error_internal', gv);
211
- }
212
- return msg;
210
+ if (!msg || msg.length === 0) {
211
+ msg = getString('error_internal', gv);
212
+ }
213
+ return msg;
213
214
  }
214
215
 
215
216
  export interface Locale {
@@ -232,12 +233,12 @@ export interface LoadingService {
232
233
  export interface ErrorMessage {
233
234
  field: string;
234
235
  code: string;
235
- param?: string|number|Date;
236
+ param?: string | number | Date;
236
237
  message?: string;
237
238
  }
238
239
  export interface UIService {
239
- getValue(el: HTMLInputElement, locale?: Locale, currencyCode?: string): string|number|boolean|null|undefined;
240
- decodeFromForm(form: HTMLFormElement, locale?: Locale, currencyCode?: string|null): any;
240
+ getValue(el: HTMLInputElement, locale?: Locale, currencyCode?: string): string | number | boolean | null | undefined;
241
+ decodeFromForm(form: HTMLFormElement, locale?: Locale, currencyCode?: string | null): any;
241
242
 
242
243
  validateForm(form?: HTMLFormElement, locale?: Locale, focusFirst?: boolean, scroll?: boolean): boolean;
243
244
  removeFormError(form: HTMLFormElement): void;
@@ -284,26 +285,23 @@ export function buildKeys(attributes: Attributes): string[] {
284
285
  }
285
286
  return ps;
286
287
  }
287
-
288
- export function buildId<ID>(props: RouteComponentProps, keys?: string[]): ID|null {
289
- if (!props) {
290
- return null;
291
- }
292
- const sp: any = ((props as any).match ? props : (props as any)['props']);
288
+ type Readonly<T> = {
289
+ readonly [P in keyof T]: T[P];
290
+ };
291
+ export function buildId<ID>(p: Readonly<Params<string>>, keys?: string[]): ID | null {
293
292
  if (!keys || keys.length === 0 || keys.length === 1) {
294
293
  if (keys && keys.length === 1) {
295
- const x = sp.match.params[keys[0]];
296
- if (x && x !== '') {
297
- return x;
294
+ if (p[keys[0]]) {
295
+ return p[keys[0]] as any;
298
296
  }
299
297
  }
300
- return sp.match.params['id'];
298
+ return p['id'] as any;
301
299
  }
302
300
  const id: any = {};
303
301
  for (const key of keys) {
304
- let v = sp.match.params[key];
302
+ let v = p[key];
305
303
  if (!v) {
306
- v = sp[key];
304
+ v = p[key];
307
305
  if (!v) {
308
306
  return null;
309
307
  }
@@ -312,8 +310,6 @@ export function buildId<ID>(props: RouteComponentProps, keys?: string[]): ID|nul
312
310
  }
313
311
  return id;
314
312
  }
315
-
316
-
317
313
  export function dateToDefaultString(date: Date): string {
318
314
  return '' + date.getFullYear() + '-' + addZero(date.getMonth() + 1, 2) + '-' + addZero(date.getDate(), 2); // DateUtil.formatDate(date, 'YYYY-MM-DD');
319
315
  }
@@ -380,7 +376,7 @@ export function formatCurrency(currency: string|number, locale?: Locale, currenc
380
376
  }
381
377
  */
382
378
 
383
- export function initForm(form?: HTMLFormElement, initMat?: (f: HTMLFormElement) => void): HTMLFormElement|undefined {
379
+ export function initForm(form?: HTMLFormElement, initMat?: (f: HTMLFormElement) => void): HTMLFormElement | undefined {
384
380
  if (form) {
385
381
  setTimeout(() => {
386
382
  if (initMat) {
@@ -412,7 +408,7 @@ export function error(err: any, gv: (key: string) => string, ae: (msg: string, h
412
408
  export function getName(d: string, n?: string): string {
413
409
  return (n && n.length > 0 ? n : d);
414
410
  }
415
- export function getModelName(form?: HTMLFormElement|null, name?: string): string {
411
+ export function getModelName(form?: HTMLFormElement | null, name?: string): string {
416
412
  if (form) {
417
413
  const a = form.getAttribute('model-name');
418
414
  if (a && a.length > 0) {
@@ -473,7 +469,7 @@ export function hideLoading(s?: LoadingService): void {
473
469
  export interface UIParameter {
474
470
  ui?: UIService;
475
471
  }
476
- export function getRemoveError(u?: UIParameter, rmErr?: (el: HTMLInputElement) => void): ((el: HTMLInputElement) => void)|undefined {
472
+ export function getRemoveError(u?: UIParameter, rmErr?: (el: HTMLInputElement) => void): ((el: HTMLInputElement) => void) | undefined {
477
473
  if (rmErr) {
478
474
  return rmErr;
479
475
  }
@@ -484,13 +480,13 @@ export function removeFormError(u?: UIParameter, f?: HTMLFormElement): void {
484
480
  u.ui.removeFormError(f);
485
481
  }
486
482
  }
487
- export function getValidateForm(u?: UIParameter, vf?: (form: HTMLFormElement, locale?: Locale, focusFirst?: boolean, scroll?: boolean) => boolean): ((form: HTMLFormElement, locale?: Locale, focusFirst?: boolean, scroll?: boolean) => boolean)|undefined {
483
+ export function getValidateForm(u?: UIParameter, vf?: (form: HTMLFormElement, locale?: Locale, focusFirst?: boolean, scroll?: boolean) => boolean): ((form: HTMLFormElement, locale?: Locale, focusFirst?: boolean, scroll?: boolean) => boolean) | undefined {
488
484
  if (vf) {
489
485
  return vf;
490
486
  }
491
487
  return (u && u.ui ? u.ui.validateForm : undefined);
492
488
  }
493
- export function getDecodeFromForm(u?: UIParameter, d?: (form: HTMLFormElement, locale?: Locale, currencyCode?: string) => any): ((form: HTMLFormElement, locale?: Locale, currencyCode?: string) => any)|undefined {
489
+ export function getDecodeFromForm(u?: UIParameter, d?: (form: HTMLFormElement, locale?: Locale, currencyCode?: string) => any): ((form: HTMLFormElement, locale?: Locale, currencyCode?: string) => any) | undefined {
494
490
  if (d) {
495
491
  return d;
496
492
  }
package/src/diff.ts CHANGED
@@ -1,5 +1,5 @@
1
- import {clone} from 'reflectx';
2
1
  import {DiffModel} from './core';
2
+ import {clone} from './reflect';
3
3
 
4
4
  export function formatDiffModel<T, ID>(obj: DiffModel<T, ID>, formatFields?: (obj3: T) => T): DiffModel<T, ID> {
5
5
  if (!obj) {
package/src/formutil.ts CHANGED
@@ -74,7 +74,7 @@ export function focusFirstError(form?: HTMLFormElement|null, className?: string)
74
74
  const ctrl = form[i] as HTMLInputElement;
75
75
  const parent = ctrl.parentElement;
76
76
  if (ctrl.classList.contains(className)
77
- || parent && parent.classList.contains(className)) {
77
+ || (parent && parent.classList.contains(className))) {
78
78
  ctrl.focus();
79
79
  ctrl.scrollIntoView();
80
80
  return;
@@ -86,7 +86,7 @@ export function focusFirstError(form?: HTMLFormElement|null, className?: string)
86
86
  const parent = ctrl.parentElement;
87
87
  if (ctrl.classList.contains('invalid')
88
88
  || ctrl.classList.contains('.ng-invalid')
89
- || parent && parent.classList.contains('invalid')) {
89
+ || (parent && parent.classList.contains('invalid'))) {
90
90
  ctrl.focus();
91
91
  ctrl.scrollIntoView();
92
92
  return;
package/src/index.ts CHANGED
@@ -1,20 +1,20 @@
1
1
  import * as React from 'react';
2
- import { RouteComponentProps } from 'react-router';
3
2
  export * from './formutil';
4
3
  export * from './util';
5
4
  export * from './core';
6
5
  export * from './state';
7
6
  export * from './edit';
8
7
  export * from './route';
9
- export * from './components';
10
8
  export * from './diff';
11
- export * from './router';
12
9
  export * from './merge';
13
10
  export * from './update';
14
- export * from './useView';
15
- export * from './useEdit';
16
11
  export * from './useSearch';
17
12
  export * from './useMessage';
13
+ export * from './useEdit';
14
+ export * from './components';
15
+ export * from './search';
16
+ export * from './reflect';
17
+ export * from './com';
18
18
 
19
19
  export function checked(s: string[]|string|undefined, v: string): boolean|undefined {
20
20
  if (s) {
@@ -29,10 +29,6 @@ export function checked(s: string[]|string|undefined, v: string): boolean|undefi
29
29
  export function value<T>(obj?: T): T {
30
30
  return (obj ? obj : {} as any);
31
31
  }
32
- export const withDefaultProps = (Component: any) => (props: RouteComponentProps) => {
33
- // return <Component props={props} history={props.history} />;
34
- return React.createElement(Component, { props, history: props.history });
35
- };
36
32
  export interface LoadingProps {
37
33
  error?: any;
38
34
  }
@@ -58,3 +54,4 @@ export const Loading = (props: LoadingProps) => {
58
54
  );*/
59
55
  }
60
56
  };
57
+ export type OnClick = React.MouseEvent<HTMLElement, MouseEvent>;