5htp-core 0.5.9-51 → 0.5.9-53
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/client/assets/css/components/card.less +4 -0
- package/client/assets/css/components/table.less +6 -3
- package/client/components/Select.tsx +21 -10
- package/client/components/Table/index.tsx +28 -24
- package/client/components/containers/Popover/index.tsx +1 -1
- package/client/components/containers/Popover/popover.less +1 -1
- package/client/components/index.ts +1 -0
- package/client/components/utils.tsx +5 -5
- package/package.json +1 -1
- package/server/services/auth/index.ts +2 -2
- package/types/icons.d.ts +1 -1
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
.table {
|
|
2
|
+
|
|
2
3
|
overflow: auto;
|
|
3
|
-
|
|
4
|
+
|
|
5
|
+
&.scrollable {
|
|
6
|
+
max-height: 90vh;
|
|
7
|
+
}
|
|
4
8
|
|
|
5
9
|
> table {
|
|
6
10
|
border-collapse: collapse;
|
|
@@ -27,7 +31,6 @@ table {
|
|
|
27
31
|
|
|
28
32
|
// By default, chrome disables text inherits
|
|
29
33
|
line-height: inherit;
|
|
30
|
-
font-size: 0.9em;
|
|
31
34
|
|
|
32
35
|
th {
|
|
33
36
|
font-weight: 500;
|
|
@@ -74,7 +77,7 @@ table {
|
|
|
74
77
|
top: 0;
|
|
75
78
|
background: var(--cBg);
|
|
76
79
|
white-space: break-spaces;
|
|
77
|
-
z-index:
|
|
80
|
+
z-index: 2;
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
tbody {
|
|
@@ -28,15 +28,24 @@ export type Props = SelectProps & InputBaseProps<ComboboxItem> & {
|
|
|
28
28
|
|
|
29
29
|
export type Choice = ComboboxItem;
|
|
30
30
|
|
|
31
|
-
const ensureChoice = (
|
|
31
|
+
const ensureChoice = (
|
|
32
|
+
choice: ComboboxItem | string,
|
|
33
|
+
choices: ComboboxItem[],
|
|
34
|
+
current: ComboboxItem | ComboboxItem[] | null
|
|
35
|
+
): ComboboxItem => {
|
|
32
36
|
|
|
33
37
|
// Allready a choice
|
|
34
38
|
if (typeof choice === 'object' && choice.label) {
|
|
35
39
|
return choice;
|
|
36
40
|
}
|
|
37
41
|
|
|
42
|
+
// Complete list of the choices
|
|
43
|
+
const allChoices = [...choices];
|
|
44
|
+
if (Array.isArray(current))
|
|
45
|
+
allChoices.push(...current);
|
|
46
|
+
|
|
38
47
|
// Find the choice
|
|
39
|
-
const found =
|
|
48
|
+
const found = allChoices.find( c => c.value === choice);
|
|
40
49
|
if (found)
|
|
41
50
|
return found;
|
|
42
51
|
|
|
@@ -69,16 +78,16 @@ export default (initProps: Props) => {
|
|
|
69
78
|
if (choicesViaFunc)
|
|
70
79
|
enableSearch = true;
|
|
71
80
|
else
|
|
72
|
-
initChoices = initChoices?.map( c => ensureChoice(c, []) ) || [];
|
|
81
|
+
initChoices = initChoices?.map( c => ensureChoice(c, [], current) ) || [];
|
|
73
82
|
|
|
74
83
|
if (enableSearch)
|
|
75
84
|
props.searchable = true;
|
|
76
85
|
|
|
77
86
|
let [choices, setChoices] = React.useState<ComboboxItem[]>( choicesViaFunc
|
|
78
87
|
? (Array.isArray(current)
|
|
79
|
-
? current.map( c => ensureChoice(c, []) )
|
|
88
|
+
? current.map( c => ensureChoice(c, [], current) )
|
|
80
89
|
: current
|
|
81
|
-
? [ensureChoice(current, [])]
|
|
90
|
+
? [ensureChoice(current, [], [])]
|
|
82
91
|
: []
|
|
83
92
|
) || []
|
|
84
93
|
: initChoices
|
|
@@ -127,16 +136,18 @@ export default (initProps: Props) => {
|
|
|
127
136
|
let Component: typeof MantineSelect | typeof MantineMultiSelect;
|
|
128
137
|
if (multiple) {
|
|
129
138
|
Component = MantineMultiSelect;
|
|
130
|
-
props.value = current ? current.map( c => ensureChoice(c, choices).value ) : [];
|
|
131
|
-
props.onChange = (value: string[]) =>
|
|
139
|
+
props.value = current ? current.map( c => ensureChoice(c, choices, current).value ) : [];
|
|
140
|
+
props.onChange = (value: string[]) => {
|
|
141
|
+
onChange( value.map(valueToChoice) )
|
|
142
|
+
};
|
|
132
143
|
} else {
|
|
133
144
|
Component = MantineSelect;
|
|
134
|
-
props.value = current ? ensureChoice(current, choices).value : '';
|
|
145
|
+
props.value = current ? ensureChoice(current, choices, current).value : '';
|
|
135
146
|
props.onChange = (value: string) => onChange( valueToChoice(value) );
|
|
136
147
|
}
|
|
137
148
|
|
|
138
|
-
if (props.placeholder === '
|
|
139
|
-
console.log(
|
|
149
|
+
if (props.placeholder === 'Languages') {
|
|
150
|
+
console.log("CHOICES", current, props.value);
|
|
140
151
|
}
|
|
141
152
|
|
|
142
153
|
/*----------------------------------
|
|
@@ -136,33 +136,37 @@ export default function Liste<TRow extends TDonneeInconnue>({
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
139
|
+
if (iDonnee === 0) {
|
|
140
|
+
|
|
141
|
+
const headerProps = { className: '', ...cellProps };
|
|
142
|
+
const isCurrentlySorted = sort && sorted && sorted.id === sort.id;
|
|
143
|
+
const isSortable = sort && onSort;
|
|
144
|
+
if (isSortable) {
|
|
145
|
+
headerProps.className += ' clickable';
|
|
146
|
+
headerProps.onClick = () => {
|
|
147
|
+
if (isCurrentlySorted)
|
|
148
|
+
onSort(null, sort.order);
|
|
149
|
+
else
|
|
150
|
+
onSort(sort.id, sort.order);
|
|
151
|
+
}
|
|
148
152
|
}
|
|
153
|
+
|
|
154
|
+
renduColonnes.push(
|
|
155
|
+
<th {...headerProps}>
|
|
156
|
+
<div class="row sp-btw">
|
|
157
|
+
|
|
158
|
+
{isSortable ? (
|
|
159
|
+
<a>{label}</a>
|
|
160
|
+
) : label}
|
|
161
|
+
|
|
162
|
+
{isCurrentlySorted && (
|
|
163
|
+
<i src={sort.order === "asc" ? "caret-up" : "caret-down"} />
|
|
164
|
+
)}
|
|
165
|
+
</div>
|
|
166
|
+
</th>
|
|
167
|
+
);
|
|
149
168
|
}
|
|
150
169
|
|
|
151
|
-
if (iDonnee === 0) renduColonnes.push(
|
|
152
|
-
<th class={classe} {...cellProps}>
|
|
153
|
-
<div class="row sp-btw">
|
|
154
|
-
|
|
155
|
-
{isSortable ? (
|
|
156
|
-
<a>{label}</a>
|
|
157
|
-
) : label}
|
|
158
|
-
|
|
159
|
-
{isCurrentlySorted && (
|
|
160
|
-
<i src={sort.order === "asc" ? "caret-up" : "caret-down"} />
|
|
161
|
-
)}
|
|
162
|
-
</div>
|
|
163
|
-
</th>
|
|
164
|
-
);
|
|
165
|
-
|
|
166
170
|
let render: ComponentChild;
|
|
167
171
|
if (Array.isArray(cell)) {
|
|
168
172
|
|
|
@@ -113,7 +113,7 @@ export default (props: Props) => {
|
|
|
113
113
|
renderedContent = React.cloneElement(
|
|
114
114
|
content,
|
|
115
115
|
{
|
|
116
|
-
className: 'card popover
|
|
116
|
+
className: 'card popover'
|
|
117
117
|
+ (position ? ' pos_' + position.cote : '')
|
|
118
118
|
+ ' ' + (content.props.className || ''),
|
|
119
119
|
|
|
@@ -57,7 +57,7 @@ const sizeAdapter = {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
export function useMantineInput<TProps extends __BaseInputProps & InputBaseProps<any>, TValue>({
|
|
60
|
-
title, wrapper, hint, errors, icon, iconR, minimal, onChange, value, ...props
|
|
60
|
+
title, wrapper, hint, errors, icon, iconR, prefix, suffix, minimal, onChange, value, ...props
|
|
61
61
|
}: InputBaseProps<TValue> & TProps): [
|
|
62
62
|
InputBaseProps<any>,
|
|
63
63
|
TProps
|
|
@@ -74,11 +74,11 @@ export function useMantineInput<TProps extends __BaseInputProps & InputBaseProps
|
|
|
74
74
|
props.description = hint;
|
|
75
75
|
}
|
|
76
76
|
// Prefix
|
|
77
|
-
if (props.leftSection === undefined
|
|
78
|
-
props.leftSection = <i src={icon}
|
|
77
|
+
if (props.leftSection === undefined)
|
|
78
|
+
props.leftSection = icon !== undefined ? <i src={icon} /> : prefix;
|
|
79
79
|
// Suffix
|
|
80
|
-
if (props.rightSection === undefined
|
|
81
|
-
props.rightSection = <i src={iconR}
|
|
80
|
+
if (props.rightSection === undefined)
|
|
81
|
+
props.rightSection = iconR !== undefined ? <i src={iconR} /> : suffix;
|
|
82
82
|
|
|
83
83
|
// Errors
|
|
84
84
|
if (errors?.length)
|
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.5.9-
|
|
4
|
+
"version": "0.5.9-53",
|
|
5
5
|
"author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
|
|
6
6
|
"repository": "git://github.com/gaetanlegac/5htp-core.git",
|
|
7
7
|
"license": "MIT",
|
|
@@ -220,13 +220,13 @@ export default abstract class AuthService<
|
|
|
220
220
|
// Insufficient permissions
|
|
221
221
|
} else if (!user.roles.includes(role)) {
|
|
222
222
|
|
|
223
|
-
console.warn(LogPrefix, "Refusé: " + role + " pour " + user.name + " (" + (user.roles
|
|
223
|
+
console.warn(LogPrefix, "Refusé: " + role + " pour " + user.name + " (" + (user.roles || 'role inconnu') + ")");
|
|
224
224
|
|
|
225
225
|
throw new Forbidden("You do not have sufficient permissions to access this resource.");
|
|
226
226
|
|
|
227
227
|
} else {
|
|
228
228
|
|
|
229
|
-
console.warn(LogPrefix, "Autorisé " + role + " pour " + user.name + " (" + user.roles
|
|
229
|
+
console.warn(LogPrefix, "Autorisé " + role + " pour " + user.name + " (" + user.roles + ")");
|
|
230
230
|
|
|
231
231
|
}
|
|
232
232
|
|
package/types/icons.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export type TIcones = "times"|"solid/spinner-third"|"
|
|
1
|
+
export type TIcones = "long-arrow-right"|"times"|"solid/spinner-third"|"sack-dollar"|"bell"|"bullseye"|"project-diagram"|"user-friends"|"eye"|"lock"|"comments"|"phone"|"chalkboard-teacher"|"rocket"|"chart-bar"|"planet-ringed"|"crosshairs"|"brands/linkedin"|"plus-circle"|"comments-alt"|"user-circle"|"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"|"times-circle"|"calendar-alt"|"paper-plane"|"search"|"lightbulb"|"magnet"|"solid/crown"|"brands/discord"|"pen"|"plus"|"file"|"envelope"|"angle-up"|"angle-down"|"binoculars"|"info-circle"|"check-circle"|"exclamation-circle"|"check"|"meh-rolling-eyes"|"trash"|"arrow-left"|"bars"|"solid/star"|"solid/star-half-alt"|"regular/star"|"chevron-left"|"cog"|"power-off"|"question-circle"|"play"|"minus-circle"|"external-link"|"plane-departure"|"wind"|"usd-circle"|"users"|"home-alt"|"trophy"|"arrow-to-bottom"|"map-marker-alt"|"clock"|"ellipsis-h"|"building"|"bold"|"italic"|"underline"|"strikethrough"|"subscript"|"superscript"|"code"|"unlink"|"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"
|