5htp-core 0.6.0-87 → 0.6.0-89
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.
|
@@ -178,16 +178,22 @@ export default (initProps: Props) => {
|
|
|
178
178
|
<Button key={choice.value}
|
|
179
179
|
size="s"
|
|
180
180
|
suffix={isSelected ? <i src="check" /> : null}
|
|
181
|
-
onClick={() =>
|
|
182
|
-
|
|
183
|
-
?
|
|
184
|
-
|
|
181
|
+
onClick={() => {
|
|
182
|
+
onChange( multiple
|
|
183
|
+
? (isSelected
|
|
184
|
+
? current.filter(c => c.value !== choice.value)
|
|
185
|
+
: [...(current || []), choice]
|
|
186
|
+
)
|
|
187
|
+
: ((isSelected && !required)
|
|
188
|
+
? null
|
|
189
|
+
: choice
|
|
190
|
+
)
|
|
185
191
|
)
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
192
|
+
|
|
193
|
+
if (!multiple)
|
|
194
|
+
setOpened(false);
|
|
195
|
+
|
|
196
|
+
}}>
|
|
191
197
|
{choice.label}
|
|
192
198
|
</Button>
|
|
193
199
|
)
|
|
@@ -32,8 +32,7 @@ export type Props<TRow> = {
|
|
|
32
32
|
empty?: ComponentChild | false,
|
|
33
33
|
|
|
34
34
|
// Interactions
|
|
35
|
-
|
|
36
|
-
onSort?: (columnId: string | null, order: TSortOptions["order"]) => void,
|
|
35
|
+
sortState?: [TSortOptions, React.SetStateAction<TSortOptions>],
|
|
37
36
|
onCellClick?: (row: TRow) => void,
|
|
38
37
|
|
|
39
38
|
selection?: [TRow[], React.SetStateAction<TRow[]>],
|
|
@@ -57,7 +56,7 @@ type TSortOptions = {
|
|
|
57
56
|
- COMPOSANTS
|
|
58
57
|
----------------------------------*/
|
|
59
58
|
export default function Liste<TRow extends TDonneeInconnue>({
|
|
60
|
-
stickyHeader,
|
|
59
|
+
stickyHeader, sortState,
|
|
61
60
|
data: rows, setData, empty,
|
|
62
61
|
onCellClick,
|
|
63
62
|
selection: selectionState, maxSelection,
|
|
@@ -84,6 +83,23 @@ export default function Liste<TRow extends TDonneeInconnue>({
|
|
|
84
83
|
</div>
|
|
85
84
|
);
|
|
86
85
|
|
|
86
|
+
const sortBy = (columnId: string | null, defaultOrder: 'asc' | 'desc') => {
|
|
87
|
+
|
|
88
|
+
if (!sortState) return;
|
|
89
|
+
|
|
90
|
+
const [sort, setSort] = sortState;
|
|
91
|
+
|
|
92
|
+
if (columnId === sort.id) {
|
|
93
|
+
setSort({
|
|
94
|
+
id: columnId,
|
|
95
|
+
order: defaultOrder === 'asc' ? 'desc' : 'asc'
|
|
96
|
+
});
|
|
97
|
+
} else {
|
|
98
|
+
setSort({ columnId, order: defaultOrder });
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
}
|
|
102
|
+
|
|
87
103
|
/*----------------------------------
|
|
88
104
|
- RENDU COLONNES / LIGNES
|
|
89
105
|
----------------------------------*/
|
|
@@ -141,15 +157,15 @@ export default function Liste<TRow extends TDonneeInconnue>({
|
|
|
141
157
|
if (iDonnee === 0) {
|
|
142
158
|
|
|
143
159
|
const headerProps = { className: '', ...cellProps };
|
|
144
|
-
const isCurrentlySorted = sort &&
|
|
145
|
-
const isSortable = sort
|
|
146
|
-
if (isSortable) {
|
|
160
|
+
const isCurrentlySorted = sort && sort.id === sort.id;
|
|
161
|
+
const isSortable = sort;
|
|
162
|
+
if (isSortable && sortState[1]) {
|
|
147
163
|
headerProps.className += ' clickable';
|
|
148
164
|
headerProps.onClick = () => {
|
|
149
165
|
if (isCurrentlySorted)
|
|
150
|
-
|
|
166
|
+
sortBy(null, sort.order);
|
|
151
167
|
else
|
|
152
|
-
|
|
168
|
+
sortBy(sort.id, sort.order);
|
|
153
169
|
}
|
|
154
170
|
}
|
|
155
171
|
|
package/common/errors/index.tsx
CHANGED
|
@@ -20,9 +20,16 @@ export type TJsonError = {
|
|
|
20
20
|
} & TErrorDetails
|
|
21
21
|
|
|
22
22
|
type TErrorDetails = {
|
|
23
|
+
|
|
23
24
|
// Allow to identify the error catched (ex: displaying custop content, running custom actions, ...)
|
|
24
25
|
id?: string,
|
|
25
26
|
data?: {},
|
|
27
|
+
|
|
28
|
+
cta?: {
|
|
29
|
+
label: string,
|
|
30
|
+
link: string,
|
|
31
|
+
},
|
|
32
|
+
|
|
26
33
|
// For debugging
|
|
27
34
|
stack?: string,
|
|
28
35
|
origin?: string,
|
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-
|
|
4
|
+
"version": "0.6.0-89",
|
|
5
5
|
"author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
|
|
6
6
|
"repository": "git://github.com/gaetanlegac/5htp-core.git",
|
|
7
7
|
"license": "MIT",
|
|
@@ -41,7 +41,7 @@ export type TConfig = {
|
|
|
41
41
|
jwt: {
|
|
42
42
|
// 2048 bits
|
|
43
43
|
key: string,
|
|
44
|
-
expiration:
|
|
44
|
+
expiration: number,
|
|
45
45
|
},
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -173,7 +173,9 @@ export default abstract class AuthService<
|
|
|
173
173
|
|
|
174
174
|
this.config.debug && console.info(LogPrefix, `Generated JWT token for session:` + token);
|
|
175
175
|
|
|
176
|
-
request.res.cookie('authorization', token
|
|
176
|
+
request.res.cookie('authorization', token, {
|
|
177
|
+
maxAge: this.config.jwt.expiration,
|
|
178
|
+
});
|
|
177
179
|
|
|
178
180
|
return token;
|
|
179
181
|
}
|
package/types/global/utils.d.ts
CHANGED
|
@@ -82,26 +82,4 @@ type TServiceRef = {
|
|
|
82
82
|
|
|
83
83
|
type TServiceSubservices = {
|
|
84
84
|
[key: string]: TServiceSetup | TServiceRef
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
declare module '@cli/app' {
|
|
88
|
-
type App = {
|
|
89
|
-
|
|
90
|
-
env: TEnvConfig;
|
|
91
|
-
|
|
92
|
-
use: (referenceName: string) => TServiceRef;
|
|
93
|
-
|
|
94
|
-
setup: (...args: [
|
|
95
|
-
// { user: app.setup('Core/User') }
|
|
96
|
-
servicePath: string,
|
|
97
|
-
serviceConfig?: {}
|
|
98
|
-
] | [
|
|
99
|
-
// app.setup('User', 'Core/User')
|
|
100
|
-
serviceName: string,
|
|
101
|
-
servicePath: string,
|
|
102
|
-
serviceConfig?: {}
|
|
103
|
-
]) => TServiceSetup;
|
|
104
|
-
}
|
|
105
|
-
const app: App;
|
|
106
|
-
export = app;
|
|
107
85
|
}
|
package/types/icons.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export type TIcones = "
|
|
1
|
+
export type TIcones = "solid/spinner-third"|"long-arrow-right"|"traffic-light-stop"|"times-circle"|"search"|"times"|"brands/whatsapp"|"comment-alt"|"solid/download"|"angle-down"|"mouse-pointer"|"thumbs-up"|"dollar-sign"|"info-circle"|"check-circle"|"exclamation-circle"|"heart"|"bell"|"chart-bar"|"power-off"|"chart-line"|"lock"|"eye"|"credit-card"|"at"|"brands/linkedin"|"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"|"newspaper"|"pills"|"medal"|"capsules"|"balance-scale"|"home"|"praying-hands"|"shopping-cart"|"flask"|"futbol"|"microchip"|"satellite-dish"|"shipping-fast"|"passport"|"tools"|"paper-plane"|"brands/google"|"check"|"database"|"brain"|"download"|"code"|"money-bill"|"bars"|"rocket"|"user-circle"|"plus-circle"|"brands/twitter"|"brands/facebook"|"books"|"box-full"|"planet-ringed"|"solid/heart"|"regular/heart"|"trash"|"meh-rolling-eyes"|"arrow-left"|"arrow-right"|"unlink"|"pen"|"bold"|"italic"|"underline"|"strikethrough"|"subscript"|"superscript"|"link"|"file"|"plus"|"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"
|