5htp-core 0.6.0-71 → 0.6.0-73

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.
@@ -61,8 +61,8 @@ export default (initProps: Props) => {
61
61
  props.min = props.min ?? 0;
62
62
  } else if (props.type === 'longtext' && typeof document !== 'undefined') {
63
63
  Component = Textarea;
64
- props.autosize = true;
65
- props.minRows = 2;
64
+ props.autosize = props.autosize || true;
65
+ props.minRows = props.minRows || 2;
66
66
  } else {
67
67
  Component = TextInput;
68
68
  }
@@ -22,7 +22,8 @@ import Popover, { Props as PopoverProps } from '@client/components/containers/Po
22
22
  ----------------------------------*/
23
23
 
24
24
  export type Props = SelectProps & InputBaseProps<ComboboxItem> & {
25
- popoverProps?: PopoverProps
25
+ popoverProps?: PopoverProps,
26
+ buttonProps?: ButtonProps,
26
27
  }
27
28
 
28
29
  export type Choice = ComboboxItem;
@@ -63,7 +64,7 @@ export default (initProps: Props) => {
63
64
  onChange, value: current,
64
65
  required
65
66
  }, {
66
- multiple, choices: initChoices, enableSearch, popoverProps,
67
+ multiple, choices: initChoices, enableSearch, popoverProps, buttonProps,
67
68
  ...props
68
69
  }] = useMantineInput<Props, string|number>(initProps);
69
70
 
@@ -95,7 +96,8 @@ export default (initProps: Props) => {
95
96
  /*----------------------------------
96
97
  - ACTIONS
97
98
  ----------------------------------*/
98
-
99
+
100
+ // Load search results
99
101
  React.useEffect(() => {
100
102
 
101
103
  if (choicesViaFunc && opened) {
@@ -113,12 +115,16 @@ export default (initProps: Props) => {
113
115
 
114
116
  }, [
115
117
  opened,
116
- search.keywords,
117
- // When initChoices is a function, React considers it's always different
118
- // It avoids the choices are fetched everytimle the parent component is re-rendered
119
- typeof initChoices === 'function' ? true : initChoices
118
+ search.keywords
120
119
  ]);
121
120
 
121
+ // When initChoices is not a function and has changed
122
+ React.useEffect(() => {
123
+ if (!choicesViaFunc) {
124
+ setChoices(initChoices);
125
+ }
126
+ }, [initChoices]);
127
+
122
128
  /*----------------------------------
123
129
  - RENDER
124
130
  ----------------------------------*/
@@ -189,6 +195,7 @@ export default (initProps: Props) => {
189
195
  </div>
190
196
  )}>
191
197
  <Button
198
+ {...buttonProps}
192
199
  prefix={(
193
200
  (multiple && current?.length) ? (
194
201
  <span class="badge bg info s">
@@ -168,7 +168,7 @@ export default class ClientRouter<
168
168
 
169
169
  // Error code
170
170
  if (typeof url === 'number') {
171
- this.createResponse( this.errors[url], this.context.request ).then(( page ) => {
171
+ this.createResponse( this.errors[url], this.context.request, data ).then(( page ) => {
172
172
  this.navigate(page, data);
173
173
  })
174
174
  return;
@@ -335,10 +335,10 @@ export default class ClientRouter<
335
335
 
336
336
  };
337
337
 
338
- console.log("404 error page not found.", this.errors, this.routes);
339
-
340
338
  const notFoundRoute = this.errors[404];
341
- return await this.createResponse(notFoundRoute, request);
339
+ return await this.createResponse(notFoundRoute, request, {
340
+ error: new Error("Page not found")
341
+ });
342
342
  }
343
343
 
344
344
  private async load(route: TUnresolvedNormalRoute): Promise<TRoute>;
@@ -504,7 +504,9 @@ export default class ClientRouter<
504
504
  // Listener remover
505
505
  return () => {
506
506
  debug && console.info(LogPrefix, `De-register hook ${hookName} (index ${cbIndex})`);
507
- delete (callbacks as THookCallback<this>[])[cbIndex];
507
+ this.hooks[hookName] = this.hooks[hookName]?.filter(
508
+ (_, index) => index !== cbIndex
509
+ );
508
510
  }
509
511
 
510
512
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "5htp-core",
3
3
  "description": "Convenient TypeScript framework designed for Performance and Productivity.",
4
- "version": "0.6.0-71",
4
+ "version": "0.6.0-73",
5
5
  "author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
6
6
  "repository": "git://github.com/gaetanlegac/5htp-core.git",
7
7
  "license": "MIT",
@@ -63,7 +63,6 @@
63
63
  "md5": "^2.3.0",
64
64
  "mime-types": "^2.1.35",
65
65
  "module-alias": "^2.2.2",
66
- "morgan": "^1.10.0",
67
66
  "mysql2": "^2.3.0",
68
67
  "object-sizeof": "^1.6.3",
69
68
  "path-to-regexp": "^6.2.0",
@@ -73,6 +72,7 @@
73
72
  "prettier": "^3.3.3",
74
73
  "react-scrollbars-custom": "^4.0.27",
75
74
  "react-slider": "^2.0.1",
75
+ "react-textarea-autosize": "^8.5.9",
76
76
  "regenerator-runtime": "^0.13.9",
77
77
  "request": "^2.88.2",
78
78
  "slugify": "^1.6.6",
@@ -144,8 +144,6 @@ export default class HttpServer {
144
144
 
145
145
  routes.get("/ping", (req, res) => res.send("pong"));
146
146
 
147
- routes.all('*', morgan('short'));
148
-
149
147
  /*----------------------------------
150
148
  - SESSION & SECURITE
151
149
  ----------------------------------*/
@@ -468,7 +468,9 @@ export default class ServerRouter
468
468
 
469
469
  public async resolve(request: ServerRequest<this>): Promise<ServerResponse<this>> {
470
470
 
471
- const logId = LogPrefix + ' ' + (request.isVirtual ? ' ---- ' : '') + request.ip + ' ' + request.method + ' ' + request.domain + ' ' + request.path;
471
+ const logId = LogPrefix + ' ' + (request.isVirtual ? ' ---- ' : '')
472
+ + request.ip + ' ' + request.user?.email + ' '
473
+ + request.method + ' ' + /*request.domain + ' ' +*/ request.path;
472
474
  console.info(logId);
473
475
  const timeStart = Date.now();
474
476
 
package/types/icons.d.ts CHANGED
@@ -1 +1 @@
1
- export type TIcones = "times"|"solid/spinner-third"|"long-arrow-right"|"sack-dollar"|"bell"|"bullseye"|"project-diagram"|"user-friends"|"eye"|"lock"|"comments"|"phone"|"chalkboard-teacher"|"rocket"|"planet-ringed"|"brands/linkedin"|"user-circle"|"chart-bar"|"crosshairs"|"user-shield"|"shield-alt"|"chart-line"|"money-bill-wave"|"star"|"link"|"file-alt"|"long-arrow-left"|"plus-circle"|"comments-alt"|"arrow-right"|"at"|"calendar-alt"|"paper-plane"|"search"|"lightbulb"|"magnet"|"solid/crown"|"brands/discord"|"pen"|"plus"|"file"|"envelope"|"user-plus"|"mouse-pointer"|"thumbs-up"|"dollar-sign"|"angle-up"|"angle-down"|"key"|"user"|"binoculars"|"times-circle"|"info-circle"|"check-circle"|"exclamation-circle"|"check"|"users"|"bug"|"arrow-left"|"meh-rolling-eyes"|"bars"|"trash"|"solid/star"|"solid/star-half-alt"|"regular/star"|"chevron-left"|"cog"|"power-off"|"play"|"minus-circle"|"plane-departure"|"brands/whatsapp"|"wind"|"external-link"|"arrow-to-bottom"|"question-circle"|"map-marker-alt"|"clock"|"ellipsis-h"|"broom"|"exclamation-triangle"|"solid/magic"|"briefcase"|"map-marker"|"fire"|"industry"|"calendar"|"magic"|"globe"|"minus"|"building"|"graduation-cap"|"bold"|"italic"|"underline"|"strikethrough"|"subscript"|"superscript"|"code"|"unlink"|"font"|"empty-set"|"horizontal-rule"|"page-break"|"image"|"table"|"poll"|"columns"|"sticky-note"|"caret-right"|"list-ul"|"check-square"|"h1"|"h2"|"h3"|"h4"|"list-ol"|"paragraph"|"quote-left"|"align-left"|"align-center"|"align-right"|"align-justify"|"indent"|"outdent"
1
+ export type TIcones = "times"|"solid/spinner-third"|"long-arrow-right"|"sack-dollar"|"bell"|"bullseye"|"project-diagram"|"user-friends"|"eye"|"lock"|"comments"|"phone"|"chalkboard-teacher"|"rocket"|"chart-bar"|"crosshairs"|"user-circle"|"plus-circle"|"comments-alt"|"arrow-right"|"user-shield"|"shield-alt"|"chart-line"|"money-bill-wave"|"star"|"link"|"file-alt"|"long-arrow-left"|"user-plus"|"mouse-pointer"|"thumbs-up"|"dollar-sign"|"key"|"user"|"at"|"search"|"lightbulb"|"magnet"|"brands/linkedin"|"angle-up"|"angle-down"|"paper-plane"|"solid/crown"|"brands/discord"|"pen"|"plus"|"file"|"envelope"|"calendar-alt"|"clock"|"cog"|"trash"|"ellipsis-h"|"binoculars"|"times-circle"|"coins"|"angle-right"|"download"|"check"|"info-circle"|"check-circle"|"exclamation-circle"|"meh-rolling-eyes"|"arrow-left"|"bars"|"solid/star"|"solid/star-half-alt"|"regular/star"|"chevron-left"|"power-off"|"question-circle"|"plane-departure"|"brands/whatsapp"|"wind"|"play"|"minus-circle"|"external-link"|"map-marker-alt"|"arrow-to-bottom"|"broom"|"solid/check-circle"|"solid/exclamation-triangle"|"solid/times-circle"|"exclamation-triangle"|"minus"|"users"|"bug"|"comment-alt"|"solid/magic"|"briefcase"|"map-marker"|"fire"|"industry"|"calendar"|"globe"|"magic"|"building"|"graduation-cap"|"coin"|"unlink"|"bold"|"italic"|"underline"|"strikethrough"|"subscript"|"superscript"|"code"|"font"|"empty-set"|"horizontal-rule"|"page-break"|"image"|"table"|"poll"|"columns"|"sticky-note"|"caret-right"|"align-left"|"align-center"|"align-right"|"align-justify"|"indent"|"outdent"|"list-ul"|"check-square"|"h1"|"h2"|"h3"|"h4"|"list-ol"|"paragraph"|"quote-left"