@majoo-ui/react 2.2.0 → 2.3.0
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/components/editableTable/EditableMobile.esm.js +4 -6
- package/components/editableTable/EditableTable.esm.js +7 -7
- package/components/form/components/InputSelect/InputSelect.esm.js +38 -29
- package/components/form/components/InputSelectCheck/InputSelectCheck.esm.js +166 -158
- package/components/mapPicker/MapPicker.esm.js +5 -3
- package/components/mapPicker/hooks/useMapSearch.esm.js +24 -5
- package/components/popover/Popover.esm.js +12 -3
- package/components/popover/middleware.esm.js +43 -0
- package/components/table/MobileTable.esm.js +4 -6
- package/components/table/Table.esm.js +63 -95
- package/components/table/components/columns/RowMenuColumn.esm.js +0 -5
- package/components/table/locale.esm.js +91 -0
- package/config/locale/LocaleTextContext.esm.js +5 -0
- package/index.esm.css +4 -4
- package/index.esm.js +1 -0
- package/majoo-provider/MajooProvider.esm.js +16 -3
- package/package.json +2 -2
- package/src/components/editableTable/EditableMobile.d.ts +1 -0
- package/src/components/editableTable/EditableTable.d.ts +9 -18
- package/src/components/table/MobileTable.d.ts +1 -0
- package/src/components/table/index.d.ts +2 -0
- package/src/components/table/locale.d.ts +40 -0
- package/src/config/locale/LocaleTextContext.d.ts +10 -0
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Column, Row, SortingRule } from 'react-table';
|
|
3
3
|
import { CSS } from '../../config/stitches.config';
|
|
4
4
|
import { EmptyDataProps } from '../table/Table';
|
|
5
|
+
import { TableLocaleText } from '../table/locale';
|
|
5
6
|
interface CustomRows {
|
|
6
7
|
predicate: boolean;
|
|
7
8
|
css?: CSS;
|
|
@@ -88,6 +89,11 @@ interface EditableTableProps<Data extends object> {
|
|
|
88
89
|
* Sort by changes callback
|
|
89
90
|
*/
|
|
90
91
|
onSortByChange?: (sortBy: SortingRule<object>[]) => void;
|
|
92
|
+
/**
|
|
93
|
+
* Texts of this table, same as `Table`'s `localeText`. Only `sortColumnTitle`, `emptyDataTitle`
|
|
94
|
+
* and `emptyDataDescription` apply.
|
|
95
|
+
*/
|
|
96
|
+
localeText?: Partial<TableLocaleText>;
|
|
91
97
|
}
|
|
92
98
|
interface RemoveProps {
|
|
93
99
|
position?: 'leftBottom' | 'rightBottom' | 'leftTop' | 'rightTop';
|
|
@@ -160,9 +166,7 @@ declare namespace EditableTable {
|
|
|
160
166
|
}) => {
|
|
161
167
|
marginBottom: {
|
|
162
168
|
readonly [$$ScaleValue]: "space";
|
|
163
|
-
};
|
|
164
|
-
* Additional height of the rows.
|
|
165
|
-
*/
|
|
169
|
+
};
|
|
166
170
|
};
|
|
167
171
|
ml: (value: {
|
|
168
172
|
readonly [$$ScaleValue]: "space";
|
|
@@ -194,9 +198,6 @@ declare namespace EditableTable {
|
|
|
194
198
|
size: (value: {
|
|
195
199
|
readonly [$$PropertyValue]: "width";
|
|
196
200
|
}) => {
|
|
197
|
-
/**
|
|
198
|
-
* Change event handler table selection.
|
|
199
|
-
*/
|
|
200
201
|
width: {
|
|
201
202
|
readonly [$$PropertyValue]: "width";
|
|
202
203
|
};
|
|
@@ -273,9 +274,7 @@ declare namespace EditableTable {
|
|
|
273
274
|
}) => {
|
|
274
275
|
marginBottom: {
|
|
275
276
|
readonly [$$ScaleValue]: "space";
|
|
276
|
-
};
|
|
277
|
-
* Additional height of the rows.
|
|
278
|
-
*/
|
|
277
|
+
};
|
|
279
278
|
};
|
|
280
279
|
ml: (value: {
|
|
281
280
|
readonly [$$ScaleValue]: "space";
|
|
@@ -307,9 +306,6 @@ declare namespace EditableTable {
|
|
|
307
306
|
size: (value: {
|
|
308
307
|
readonly [$$PropertyValue]: "width";
|
|
309
308
|
}) => {
|
|
310
|
-
/**
|
|
311
|
-
* Change event handler table selection.
|
|
312
|
-
*/
|
|
313
309
|
width: {
|
|
314
310
|
readonly [$$PropertyValue]: "width";
|
|
315
311
|
};
|
|
@@ -384,9 +380,7 @@ declare namespace EditableTable {
|
|
|
384
380
|
}) => {
|
|
385
381
|
marginBottom: {
|
|
386
382
|
readonly [$$ScaleValue]: "space";
|
|
387
|
-
};
|
|
388
|
-
* Additional height of the rows.
|
|
389
|
-
*/
|
|
383
|
+
};
|
|
390
384
|
};
|
|
391
385
|
ml: (value: {
|
|
392
386
|
readonly [$$ScaleValue]: "space";
|
|
@@ -418,9 +412,6 @@ declare namespace EditableTable {
|
|
|
418
412
|
size: (value: {
|
|
419
413
|
readonly [$$PropertyValue]: "width";
|
|
420
414
|
}) => {
|
|
421
|
-
/**
|
|
422
|
-
* Change event handler table selection.
|
|
423
|
-
*/
|
|
424
415
|
width: {
|
|
425
416
|
readonly [$$PropertyValue]: "width";
|
|
426
417
|
};
|
|
@@ -38,6 +38,7 @@ interface MobileTableProps {
|
|
|
38
38
|
footerColumnIds?: Set<string>;
|
|
39
39
|
headerRowSpan?: boolean;
|
|
40
40
|
keyId?: string;
|
|
41
|
+
sortColumnTitle?: string;
|
|
41
42
|
}
|
|
42
43
|
declare const MobileTable: React.ForwardRefExoticComponent<MobileTableProps & React.RefAttributes<HTMLDivElement>>;
|
|
43
44
|
export default MobileTable;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface PaginationLabel {
|
|
3
|
+
showingText?: string;
|
|
4
|
+
showingCountText?: string | ((params: {
|
|
5
|
+
from: number;
|
|
6
|
+
to: number;
|
|
7
|
+
total: number;
|
|
8
|
+
}) => string);
|
|
9
|
+
dialogShowingText?: string;
|
|
10
|
+
previousButton?: string;
|
|
11
|
+
nextButton?: string;
|
|
12
|
+
gotoPageText?: string;
|
|
13
|
+
goToPagePlaceholder?: string;
|
|
14
|
+
btnCancelText?: string;
|
|
15
|
+
btnSubmitText?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface TableLocaleText {
|
|
18
|
+
/** Tooltip (`title` attribute) of a sortable header. */
|
|
19
|
+
sortColumnTitle: string;
|
|
20
|
+
/** Title of the show/hide column dialog on mobile. */
|
|
21
|
+
showColumnTitle: ReactNode;
|
|
22
|
+
emptyDataTitle: ReactNode;
|
|
23
|
+
emptyDataDescription: ReactNode;
|
|
24
|
+
/** Receives the `searchQuery` so each language can place it where its grammar needs it. */
|
|
25
|
+
emptySearchTitle: (params: {
|
|
26
|
+
query: string;
|
|
27
|
+
}) => ReactNode;
|
|
28
|
+
emptySearchDescription: ReactNode;
|
|
29
|
+
pagination: PaginationLabel;
|
|
30
|
+
}
|
|
31
|
+
export declare const defaultTableLocaleText: TableLocaleText;
|
|
32
|
+
export declare const i18nTableLocaleText: (t: any) => TableLocaleText;
|
|
33
|
+
/** Later sources win; an `undefined` value never erases an earlier one. */
|
|
34
|
+
export declare const mergeTableLocaleText: (base: TableLocaleText, ...overrides: (Partial<TableLocaleText> | undefined)[]) => TableLocaleText;
|
|
35
|
+
/**
|
|
36
|
+
* Resolves the table texts. Precedence: the table's own `localeText`, then `MajooProvider`'s
|
|
37
|
+
* `localeText.table`, then the app's `MajooUI/table` translations, then the Indonesian defaults.
|
|
38
|
+
* Several table-level overrides may be passed; later ones win. Pass the same number on every render.
|
|
39
|
+
*/
|
|
40
|
+
export declare const useTableLocaleText: (...localeTexts: (Partial<TableLocaleText> | undefined)[]) => TableLocaleText;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { TableLocaleText } from '../../components/table/locale';
|
|
3
|
+
/**
|
|
4
|
+
* Component texts supplied once for the whole app through `MajooProvider`'s `localeText`.
|
|
5
|
+
* Each component reads its own key; any text left unset keeps the component's default.
|
|
6
|
+
*/
|
|
7
|
+
export interface MajooLocaleText {
|
|
8
|
+
table?: Partial<TableLocaleText>;
|
|
9
|
+
}
|
|
10
|
+
export declare const LocaleTextContext: React.Context<MajooLocaleText>;
|