kelt-ui-kit-react 2.1.5 → 2.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/README.md +27 -0
- package/dist/addressSearch/AddressSearch.d.ts +6 -2
- package/dist/dataTable/dataTable.interface.d.ts +2 -0
- package/dist/form/form.interface.d.ts +4 -1
- package/dist/geocoding/CityGeocodingService.d.ts +23 -0
- package/dist/geocoding/geocoding.interface.d.ts +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1285 -1194
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/addressSearch/AddressSearch.tsx +27 -7
- package/src/card/Card.tsx +5 -0
- package/src/card/cardAction/CardAction.tsx +1 -1
- package/src/dataTable/dataTable.interface.ts +2 -0
- package/src/dataTable/dataTableActions/DataTableAction.tsx +11 -9
- package/src/form/Form.tsx +4 -0
- package/src/form/form.interface.tsx +4 -0
- package/src/geocoding/CityGeocodingService.ts +144 -0
- package/src/geocoding/GeocodingService.ts +1 -0
- package/src/geocoding/geocoding.interface.ts +8 -0
- package/src/index.ts +5 -0
- package/src/sidebar/Sidebar.tsx +32 -0
- package/src/sidebar/sidebar.css +8 -0
- package/tests/dataTable.test.mjs +29 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/vite.config.ts +7 -0
package/README.md
CHANGED
|
@@ -85,6 +85,10 @@ The shared `DataTable` supports both applications with one rendering engine:
|
|
|
85
85
|
`{ startDate, endDate }` date ranges). Filtering remains the consumer's responsibility.
|
|
86
86
|
Sorting uses a copy of the supplied rows; original data is never reordered.
|
|
87
87
|
- Numeric action widths are summed when no explicit column width is provided.
|
|
88
|
+
- Inline actions (`button`, `icon`, `link`) accept `align: "left" | "center" | "right"`
|
|
89
|
+
to position their content within `width` / `minWidth`, for example
|
|
90
|
+
`{ id: "delete", label: "Delete", type: "icon", classIcon: "bi-trash", width: 50, align: "right", onClick: deleteRow }`.
|
|
91
|
+
Omitting `align` preserves each action type's default alignment.
|
|
88
92
|
- `Tabs.keepMountedVisited` retains visited panels for Hub; the default remains
|
|
89
93
|
unmounting inactive panels for Kelt. Controlled tabs track the actual active index.
|
|
90
94
|
- `Select` keeps searchable portal menus and empty-string options. Dynamic forms
|
|
@@ -122,3 +126,26 @@ populate the rest of the form:
|
|
|
122
126
|
|
|
123
127
|
Use `addressSearch.provider` to inject another service implementing
|
|
124
128
|
`GeocodingProvider`. The default provider does not require an API key.
|
|
129
|
+
|
|
130
|
+
To search cities from a postal code field, use `cityGeocodingService`: it
|
|
131
|
+
suggests cities while typing a postal code start ("292") or a city name start
|
|
132
|
+
("bre"). Choose the value written in the field; free entry is still kept:
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
{
|
|
136
|
+
name: "codePostal",
|
|
137
|
+
label: "Code postal",
|
|
138
|
+
type: TypeInputEnum.ADDRESS,
|
|
139
|
+
value: "",
|
|
140
|
+
addressSearch: {
|
|
141
|
+
provider: cityGeocodingService,
|
|
142
|
+
minimumQueryLength: 2,
|
|
143
|
+
formatValue: (address) => address.postalCode,
|
|
144
|
+
emptyLabel: "Aucune ville trouvée.",
|
|
145
|
+
mapAddress: (address) => ({
|
|
146
|
+
codePostal: address.postalCode,
|
|
147
|
+
ville: address.city,
|
|
148
|
+
}),
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GeocodedAddress, GeocodingProvider } from '../geocoding/geocoding.interface';
|
|
1
|
+
import { GeocodedAddress, GeocodingProvider, GeocodingSearchType } from '../geocoding/geocoding.interface';
|
|
2
2
|
export interface AddressSearchProps {
|
|
3
3
|
id?: string;
|
|
4
4
|
className?: string;
|
|
@@ -10,10 +10,14 @@ export interface AddressSearchProps {
|
|
|
10
10
|
debounceTime?: number;
|
|
11
11
|
limit?: number;
|
|
12
12
|
provider?: GeocodingProvider;
|
|
13
|
+
searchType?: GeocodingSearchType;
|
|
14
|
+
formatValue?: (address: GeocodedAddress) => string;
|
|
15
|
+
emptyLabel?: string;
|
|
16
|
+
required?: boolean;
|
|
13
17
|
allowManualEntry?: boolean;
|
|
14
18
|
manualEntryLabel?: string;
|
|
15
19
|
onChange?: (value: string) => void;
|
|
16
20
|
onManualEntry?: (addressLine: string) => void;
|
|
17
21
|
onSelect: (address: GeocodedAddress) => void;
|
|
18
22
|
}
|
|
19
|
-
export declare const AddressSearch: ({ id, className, label, placeholder, value, disabled, minimumQueryLength, debounceTime, limit, provider, allowManualEntry, manualEntryLabel, onChange, onManualEntry, onSelect, }: AddressSearchProps) => import('react/jsx-runtime').JSX.Element;
|
|
23
|
+
export declare const AddressSearch: ({ id, className, label, placeholder, value, disabled, minimumQueryLength, debounceTime, limit, provider, searchType, formatValue, emptyLabel, required, allowManualEntry, manualEntryLabel, onChange, onManualEntry, onSelect, }: AddressSearchProps) => import('react/jsx-runtime').JSX.Element;
|
|
@@ -67,6 +67,8 @@ export interface dataTableActionsInterface<T> {
|
|
|
67
67
|
visible?: boolean;
|
|
68
68
|
width?: string | number;
|
|
69
69
|
minWidth?: string | number;
|
|
70
|
+
/** Aligns inline action content within its width; omitted preserves the action type's default. */
|
|
71
|
+
align?: "right" | "left" | "center";
|
|
70
72
|
focusNextRow?: boolean;
|
|
71
73
|
/** "inline" (défaut) : affichée dans la ligne ; "menu" : regroupée dans le menu « ⋮ » en fin de ligne */
|
|
72
74
|
display?: "inline" | "menu";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TypeInputEnum } from './form.enum';
|
|
2
2
|
import { GridBreakpoints } from '../grid/grid.interface';
|
|
3
|
-
import { GeocodedAddress, GeocodingProvider } from '../geocoding/geocoding.interface';
|
|
3
|
+
import { GeocodedAddress, GeocodingProvider, GeocodingSearchType } from '../geocoding/geocoding.interface';
|
|
4
4
|
export type FormMode = "read" | "edit";
|
|
5
5
|
export type FormValuesInterface<T extends {
|
|
6
6
|
[key: string]: string | number | boolean | Date | string[];
|
|
@@ -42,6 +42,9 @@ export interface FormInterface {
|
|
|
42
42
|
debounceTime?: number;
|
|
43
43
|
limit?: number;
|
|
44
44
|
provider?: GeocodingProvider;
|
|
45
|
+
searchType?: GeocodingSearchType;
|
|
46
|
+
formatValue?: (address: GeocodedAddress) => string;
|
|
47
|
+
emptyLabel?: string;
|
|
45
48
|
manualEntryLabel?: string;
|
|
46
49
|
mapAddress?: (address: GeocodedAddress) => Record<string, string | number | boolean | Date | string[]>;
|
|
47
50
|
onSelect?: (address: GeocodedAddress) => void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { GeocodedAddress, GeocodingProvider, GeocodingSearchOptions } from './geocoding.interface';
|
|
2
|
+
export interface CityGeocodingServiceOptions {
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
fetcher?: typeof fetch;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Recherche de communes au fil de la saisie (API Découpage administratif) :
|
|
8
|
+
* - chiffres : début de code postal ("292" propose 29200 Brest),
|
|
9
|
+
* - texte : début de nom de commune ("bre" propose Brest, Brech...).
|
|
10
|
+
* Une commune à plusieurs codes postaux donne un résultat par code postal.
|
|
11
|
+
*/
|
|
12
|
+
export declare class CityGeocodingService implements GeocodingProvider {
|
|
13
|
+
private readonly baseUrl;
|
|
14
|
+
private readonly fetcher;
|
|
15
|
+
private readonly departements;
|
|
16
|
+
constructor(options?: CityGeocodingServiceOptions);
|
|
17
|
+
search(query: string, options?: GeocodingSearchOptions): Promise<GeocodedAddress[]>;
|
|
18
|
+
private communesDuCodePostal;
|
|
19
|
+
private communesDuDepartement;
|
|
20
|
+
private get;
|
|
21
|
+
private toAddress;
|
|
22
|
+
}
|
|
23
|
+
export declare const cityGeocodingService: CityGeocodingService;
|
|
@@ -11,9 +11,11 @@ export interface GeocodedAddress {
|
|
|
11
11
|
score?: number;
|
|
12
12
|
type?: string;
|
|
13
13
|
}
|
|
14
|
+
export type GeocodingSearchType = "housenumber" | "street" | "locality" | "municipality";
|
|
14
15
|
export interface GeocodingSearchOptions {
|
|
15
16
|
limit?: number;
|
|
16
17
|
signal?: AbortSignal;
|
|
18
|
+
type?: GeocodingSearchType;
|
|
17
19
|
}
|
|
18
20
|
export interface GeocodingProvider {
|
|
19
21
|
search(query: string, options?: GeocodingSearchOptions): Promise<GeocodedAddress[]>;
|
package/dist/index.d.ts
CHANGED
|
@@ -36,7 +36,8 @@ export { InputPrice } from './form/inputPrice/InputPrice';
|
|
|
36
36
|
export { TextArea } from './form/textArea/TextArea';
|
|
37
37
|
export { Grid } from './grid/Grid';
|
|
38
38
|
export { GeocodingService, geocodingService, } from './geocoding/GeocodingService';
|
|
39
|
-
export
|
|
39
|
+
export { CityGeocodingService, cityGeocodingService, } from './geocoding/CityGeocodingService';
|
|
40
|
+
export type { GeocodedAddress, GeocodingProvider, GeocodingSearchOptions, GeocodingSearchType, } from './geocoding/geocoding.interface';
|
|
40
41
|
export { Header } from './header/Header';
|
|
41
42
|
export { Icon } from './icon/Icon';
|
|
42
43
|
export { IconSizeEnum } from './icon/iconSize.enum';
|