5htp-core 0.6.0-3 → 0.6.0-6

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.
@@ -101,15 +101,6 @@
101
101
  }
102
102
  }
103
103
 
104
- &.active {
105
-
106
- box-shadow: 0 0 0 3px @c1;
107
-
108
- > * {
109
- --cTxtImportant: @c1;
110
- }
111
- }
112
-
113
104
  /*----------------------------------
114
105
  - VARIANTS
115
106
  ----------------------------------*/
@@ -63,13 +63,14 @@
63
63
 
64
64
  .mantine-TextInput-input,
65
65
  .mantine-Input-input {
66
-
67
66
  border: solid 1px var(--cLine) !important;
67
+ }
68
68
 
69
- &:focus {
70
- border-color: @c1 !important;
71
- box-shadow: 0 0 0 4px fade(@c1, 20%) !important;
72
- }
69
+ .card.active,
70
+ .mantine-TextInput-input:focus,
71
+ .mantine-Input-input:focus {
72
+ border: solid 1px @c1 !important;
73
+ box-shadow: 0 0 0 4px fade(@c1, 20%) !important;
73
74
  }
74
75
 
75
76
  .mantine-MultiSelect-pill {
@@ -0,0 +1,34 @@
1
+ import React from "react";
2
+
3
+ import type { Choice } from '@client/components/Select';
4
+
5
+ const ConnectedInput = <TComponent extends React.ComponentType<any>>({
6
+ component: Component, data: dataInit, ...props
7
+ }: {
8
+ component: TComponent,
9
+ data?: Choice[] | ((search?: string) => Promise<Choice[]>),
10
+ } & Omit<React.ComponentProps<TComponent>, 'data' | 'onSearchChange'>) => {
11
+
12
+ const [data, setData] = React.useState<Choice[]>([]);
13
+ const [search, setSearch] = React.useState<string>('');
14
+
15
+ React.useEffect(() => {
16
+
17
+ if (!dataInit) return;
18
+ if (Array.isArray(dataInit))
19
+ setData(dataInit);
20
+ else
21
+ dataInit(search).then(setData);
22
+
23
+ }, [dataInit, search]);
24
+
25
+ return (
26
+ <Component
27
+ {...props}
28
+ data={data}
29
+ onSearchChange={setSearch}
30
+ />
31
+ )
32
+ }
33
+
34
+ export default ConnectedInput;
@@ -99,7 +99,7 @@ export default function Liste<TRow extends TDonneeInconnue>({
99
99
  <td>
100
100
  <Checkbox
101
101
  id={"selectionner" + iDonnee}
102
- value={selection.current.some(s => s.id === row.id)}
102
+ value={selection.current.some(s => s?.id === row?.id)}
103
103
  onChange={(isSelected: boolean) => {
104
104
  selection.set(current => isSelected
105
105
  // Ajoute
@@ -230,7 +230,7 @@ export default function Liste<TRow extends TDonneeInconnue>({
230
230
  <Checkbox
231
231
  value={selection.current.length >= rows.length}
232
232
  onChange={(status: boolean) => {
233
- selection.set(status ? rows : []);
233
+ selection.set(status ? rows.filter(r => r?.id) : []);
234
234
  }}
235
235
  />
236
236
  </th>
@@ -156,6 +156,8 @@ export default (props: Props) => {
156
156
  {React.cloneElement( children, {
157
157
  onClick: (e) => {
158
158
  show(isShown => !isShown);
159
+ e.stopPropagation();
160
+ return false;
159
161
  }
160
162
  })}
161
163
 
@@ -22,7 +22,9 @@ export { default as Date } from './Date';
22
22
  export { default as Select } from './Select';
23
23
  export { default as Checkbox } from './Checkbox';
24
24
  export { InputWrapper } from './utils';
25
- export { default as DropDown } from './DropDown';
25
+ export { default as DropDown } from './DropDown';
26
+
27
+ export { default as ConnectedInput } from './ConnectedInput';
26
28
 
27
29
  // Mantine
28
30
  export {
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-3",
4
+ "version": "0.6.0-6",
5
5
  "author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
6
6
  "repository": "git://github.com/gaetanlegac/5htp-core.git",
7
7
  "license": "MIT",
@@ -2,10 +2,6 @@
2
2
  - DEPENDANCES
3
3
  ----------------------------------*/
4
4
 
5
- /* NOTE: On évite d'utiliser les alias ici,
6
- Afin que l'envoi des rapports de bug fonctionne même en cas d'erreur avec les alias
7
- */
8
-
9
5
  // Core
10
6
  import type { Application } from '@server/app';
11
7
  import Service from '@server/app/service';
@@ -13,7 +9,6 @@ import markdown from '@common/data/markdown';
13
9
 
14
10
  // Speciic
15
11
  import { jsonToHtml } from './utils';
16
- import type { Transporter } from './transporter';
17
12
 
18
13
  /*----------------------------------
19
14
  - SERVICE CONFIG
@@ -25,16 +20,12 @@ export type Config = {
25
20
  debug: boolean,
26
21
  simulateWhenLocal: boolean,
27
22
  default: {
28
- transporter: string,
29
23
  from: TPerson
30
24
  },
31
25
  bugReport: {
32
26
  from: TPerson,
33
27
  to: TPerson
34
28
  },
35
- transporters: {
36
- [transporterId: string]: Transporter
37
- }
38
29
  }
39
30
 
40
31
  export type Hooks = {
@@ -49,9 +40,7 @@ export type Services = {
49
40
  - TYPES: EMAILS
50
41
  ----------------------------------*/
51
42
 
52
- export { Transporter } from './transporter';
53
-
54
- export type TEmail = THtmlEmail | TMarkdownEmail// | TTemplateEmail;
43
+ export type TEmail = THtmlEmail | TMarkdownEmail;
55
44
 
56
45
  type TPerson = {
57
46
  name?: string,
@@ -74,11 +63,6 @@ export type TMarkdownEmail = TBaseEmail & {
74
63
  markdown: string,
75
64
  }
76
65
 
77
- /*export type TTemplateEmail = TBaseEmail & {
78
- template: keyof typeof templates,
79
- data?: TObjetDonnees
80
- }*/
81
-
82
66
  export type TCompleteEmail = With<THtmlEmail, {
83
67
  to: TPerson[],
84
68
  from: TPerson,
@@ -109,14 +93,15 @@ type TOptions = {
109
93
  /*----------------------------------
110
94
  - FONCTIONS
111
95
  ----------------------------------*/
112
- export default class Email extends Service<Config, Hooks, Application> {
113
-
114
- private transporters = this.config.transporters;
96
+ export default abstract class Email<TConfig extends Config>
97
+ extends Service<TConfig, Hooks, Application> {
115
98
 
116
99
  /*----------------------------------
117
100
  - ACTIONS
118
101
  ----------------------------------*/
119
102
 
103
+ protected abstract sendNow( emails: TCompleteEmail[] ): Promise<void>;
104
+
120
105
  public async send( to: string, subject: string, markdown: string, options?: TOptions );
121
106
  public async send( emails: TEmail | TEmail[], options?: TOptions ): Promise<void>;
122
107
  public async send( ...args: TEmailSendArgs ): Promise<void> {
@@ -162,30 +147,7 @@ export default class Email extends Service<Config, Hooks, Application> {
162
147
  ? email.to
163
148
  : [email.to];
164
149
 
165
- // Via template
166
- // TODO: Restore templates feature
167
- /*if ('template' in email) {
168
-
169
- const template = templates[email.template];
170
-
171
- if (template === undefined)
172
- throw new Error(`Impossible de charger la template email ${email.template} depuis le cache (NotFound).`);
173
-
174
- const txt = template(email.data || {})
175
-
176
- const delimTitre = txt.indexOf('\n\n');
177
-
178
- return {
179
- ...email,
180
- // Vire le "> " au début
181
- subject: txt.substring(2, delimTitre),
182
- html: htmlWarning + txt.substring(delimTitre + 2),
183
- from,
184
- to,
185
- cc
186
- }
187
-
188
- } else */if ('markdown' in email) {
150
+ if ('markdown' in email) {
189
151
 
190
152
  return {
191
153
  ...email,
@@ -209,11 +171,7 @@ export default class Email extends Service<Config, Hooks, Application> {
209
171
 
210
172
  });
211
173
 
212
- const transporterName = options.transporter || this.config.default.transporter;
213
- if (transporterName === undefined)
214
- throw new Error(`Please define at least one mail transporter.`);
215
-
216
- console.info(LogPrefix, `Sending ${emailsToSend.length} emails via transporter "${transporterName}"`, emailsToSend[0].subject);
174
+ console.info(LogPrefix, `Sending ${emailsToSend.length} emails via transporter`, emailsToSend[0].subject);
217
175
 
218
176
  // Pas d'envoi d'email quand local
219
177
  if (this.app.env.name === 'local' && this.config.simulateWhenLocal === true) {
@@ -224,8 +182,7 @@ export default class Email extends Service<Config, Hooks, Application> {
224
182
  return;
225
183
  }
226
184
 
227
- const transporter = this.transporters[ transporterName ];
228
- await transporter.send(emailsToSend);
185
+ await this.sendNow(emailsToSend);
229
186
 
230
187
  }
231
188
  }
package/types/icons.d.ts CHANGED
@@ -1 +1 @@
1
- export type TIcones = "solid/spinner-third"|"long-arrow-right"|"traffic-light-stop"|"times-circle"|"search"|"mouse-pointer"|"thumbs-up"|"dollar-sign"|"paper-plane"|"bookmark"|"download"|"times"|"angle-down"|"th-large"|"table"|"info-circle"|"check-circle"|"exclamation-circle"|"heart"|"bell"|"chart-bar"|"power-off"|"home"|"books"|"newspaper"|"box-full"|"planet-ringed"|"brands/linkedin"|"brands/twitter"|"brands/facebook"|"bars"|"rocket"|"database"|"brain"|"code"|"money-bill"|"check"|"at"|"image"|"key"|"seedling"|"palette"|"car"|"plane"|"university"|"briefcase"|"hard-hat"|"graduation-cap"|"bolt"|"cogs"|"film"|"leaf"|"tshirt"|"utensils"|"globe"|"map-marked-alt"|"dumbbell"|"stethoscope"|"concierge-bell"|"book"|"shield-alt"|"gavel"|"industry"|"square-root-alt"|"pills"|"medal"|"capsules"|"balance-scale"|"praying-hands"|"shopping-cart"|"flask"|"futbol"|"microchip"|"satellite-dish"|"shipping-fast"|"passport"|"tools"|"brands/google"|"brands/github"|"solid/heart"|"regular/heart"|"eye"|"trash"|"arrow-left"|"arrow-right"|"meh-rolling-eyes"|"link"|"file"|"unlink"|"pen"|"bold"|"italic"|"underline"|"strikethrough"|"subscript"|"superscript"|"font"|"empty-set"|"plus-circle"|"horizontal-rule"|"page-break"|"poll"|"columns"|"sticky-note"|"caret-right"|"plus"|"align-left"|"align-center"|"align-right"|"align-justify"|"indent"|"outdent"|"list-ul"|"check-square"|"h1"|"h2"|"h3"|"h4"|"list-ol"|"paragraph"|"quote-left"
1
+ export type TIcones = "solid/spinner-third"|"long-arrow-right"|"search"|"paper-plane"|"bookmark"|"solid/download"|"mouse-pointer"|"thumbs-up"|"dollar-sign"|"times"|"angle-down"|"th-large"|"table"|"traffic-light-stop"|"times-circle"|"info-circle"|"check-circle"|"exclamation-circle"|"heart"|"bell"|"chart-bar"|"power-off"|"seedling"|"palette"|"car"|"plane"|"university"|"briefcase"|"hard-hat"|"graduation-cap"|"bolt"|"cogs"|"film"|"leaf"|"tshirt"|"utensils"|"globe"|"map-marked-alt"|"dumbbell"|"stethoscope"|"concierge-bell"|"book"|"shield-alt"|"gavel"|"industry"|"square-root-alt"|"newspaper"|"pills"|"medal"|"capsules"|"balance-scale"|"home"|"praying-hands"|"shopping-cart"|"flask"|"futbol"|"microchip"|"satellite-dish"|"shipping-fast"|"passport"|"tools"|"chart-line"|"lock"|"eye"|"credit-card"|"at"|"brands/linkedin"|"image"|"key"|"brands/google"|"check"|"bars"|"books"|"box-full"|"planet-ringed"|"brands/twitter"|"brands/facebook"|"database"|"brain"|"download"|"code"|"money-bill"|"rocket"|"user-circle"|"plus-circle"|"solid/heart"|"regular/heart"|"trash"|"arrow-left"|"arrow-right"|"meh-rolling-eyes"|"unlink"|"pen"|"bold"|"italic"|"underline"|"strikethrough"|"subscript"|"superscript"|"link"|"file"|"plus"|"font"|"empty-set"|"horizontal-rule"|"page-break"|"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,6 +0,0 @@
1
- {
2
- "id": "Core/Email",
3
- "name": "Email",
4
- "parent": "app",
5
- "dependences": []
6
- }
@@ -1,49 +0,0 @@
1
- /*----------------------------------
2
- - DEPENDANCES
3
- ----------------------------------*/
4
-
5
- import Handlebars, { TemplateDelegate } from 'handlebars';
6
-
7
- //import * as templates from '@cache/serveur/emails';
8
- import templatesDefault from '@root/default/serveur/emails/*.hbs';
9
- import templatesProjet from '@/*/serveur/emails/*.hbs';
10
- const templates = { ...templatesDefault, ...templatesProjet }
11
- import url from '@commun/routeur/url';
12
-
13
- /*----------------------------------
14
- - HELPERS
15
- ----------------------------------*/
16
-
17
- Handlebars.registerHelper('plur', (mot: string, nb: number) =>
18
- mot + (nb > 1 ? 's' : '')
19
- )
20
-
21
- Handlebars.registerHelper('url', (route: string, params?: any, absolu?: boolean) =>
22
- url(route, params, absolu)
23
- )
24
-
25
- /*----------------------------------
26
- - FONCTIONS
27
- ----------------------------------*/
28
- const cache: {[nomTemplate: string]: TemplateDelegate} = {}
29
-
30
- export const compiler = async () => {
31
-
32
- console.log(`[boot] Précompilation de ${Object.keys(templates).length} templates email`);
33
-
34
- try {
35
- for (const nomTemplate in templates) {
36
-
37
- const template = templates[nomTemplate];
38
-
39
- cache[ nomTemplate ] = Handlebars.compile(template, {
40
- strict: true, // Erreur quand variable inexistante
41
- });
42
-
43
- }
44
- } catch (error) {
45
- console.error(`Erreur lors de la précompilation des templates email:`, error);
46
- }
47
- }
48
-
49
- export default cache
@@ -1,31 +0,0 @@
1
- /*----------------------------------
2
- - DEPENDANCES
3
- ----------------------------------*/
4
-
5
- // Npm
6
-
7
- // Core
8
- import type Application from "@server/app";
9
- import Service from '@server/app/service';
10
- import type EmailService from '@server/services/email';
11
-
12
- // Specific
13
- import type { TCompleteEmail } from ".";
14
-
15
- /*----------------------------------
16
- - TYPES
17
- ----------------------------------*/
18
-
19
- export type TBasicConfig = {
20
- api: string,
21
- debug: boolean
22
- }
23
-
24
- /*----------------------------------
25
- - CLASS
26
- ----------------------------------*/
27
- export abstract class Transporter<TConfig extends TBasicConfig = TBasicConfig>
28
- extends Service<TConfig, {}, Application> {
29
-
30
- public abstract send( emails: TCompleteEmail[] ): Promise<void>;
31
- }