@addev-be/ui 2.5.8 → 2.5.11
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.
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { DataGridCheckboxColumn, DataGridColorColumn, DataGridColumn, DataGridDateColumn, DataGridNumberColumn, DataGridSelectColumn, DataGridSettings, DataGridTextColumn } from '../types';
|
|
2
2
|
import { SqlRequestDataGridCheckboxColumn, SqlRequestDataGridTextColumn } from '../../SqlRequestDataGrid/types';
|
|
3
|
-
import { DeepPartial } from '../../../../types';
|
|
4
3
|
export declare const isColumnVisible: <R>(obj: DataGridColumn<R> | DataGridSettings) => boolean;
|
|
5
4
|
export declare const buildExcelFormat: (decimals?: number, suffix?: string) => string;
|
|
6
|
-
export declare const textColumn: <R extends Record<string, any>>(key: string, title: string, options?:
|
|
7
|
-
export declare const mailColumn: <R extends Record<string, any>>(key: string, title: string, options?:
|
|
8
|
-
export declare const phoneColumn: <R extends Record<string, any>>(key: string, title: string, options?:
|
|
9
|
-
export declare const dateColumn: <R extends Record<string, any>>(key: string, title: string, options?:
|
|
10
|
-
export declare const dateTimeColumn: <R extends Record<string, any>>(key: string, title: string, options?:
|
|
11
|
-
export declare const monthColumn: <R extends Record<string, any>>(key: string, title: string, options?:
|
|
12
|
-
export declare const numberColumn: <R extends Record<string, any>>(key: string, title: string, decimals?: number, options?:
|
|
13
|
-
export declare const moneyColumn: <R extends Record<string, any>>(key: string, title: string, decimals?: number, currency?: string | ((row: R) => string), options?:
|
|
14
|
-
export declare const percentageColumn: <R extends Record<string, any>>(key: string, title: string, decimals?: number, options?:
|
|
15
|
-
export declare const checkboxColumn: <R extends Record<string, any>>(key: string, title: string, options?:
|
|
5
|
+
export declare const textColumn: <R extends Record<string, any>>(key: string, title: string, options?: Partial<DataGridTextColumn<R>>) => DataGridTextColumn<R>;
|
|
6
|
+
export declare const mailColumn: <R extends Record<string, any>>(key: string, title: string, options?: Partial<DataGridTextColumn<R>>) => DataGridTextColumn<R>;
|
|
7
|
+
export declare const phoneColumn: <R extends Record<string, any>>(key: string, title: string, options?: Partial<DataGridTextColumn<R>>) => DataGridTextColumn<R>;
|
|
8
|
+
export declare const dateColumn: <R extends Record<string, any>>(key: string, title: string, options?: Partial<DataGridDateColumn<R>>) => DataGridDateColumn<R>;
|
|
9
|
+
export declare const dateTimeColumn: <R extends Record<string, any>>(key: string, title: string, options?: Partial<DataGridDateColumn<R>>) => DataGridDateColumn<R>;
|
|
10
|
+
export declare const monthColumn: <R extends Record<string, any>>(key: string, title: string, options?: Partial<DataGridTextColumn<R>>) => DataGridTextColumn<R>;
|
|
11
|
+
export declare const numberColumn: <R extends Record<string, any>>(key: string, title: string, decimals?: number, options?: Partial<SqlRequestDataGridTextColumn<R>> & Partial<DataGridNumberColumn<R>>) => DataGridNumberColumn<R>;
|
|
12
|
+
export declare const moneyColumn: <R extends Record<string, any>>(key: string, title: string, decimals?: number, currency?: string | ((row: R) => string), options?: Partial<SqlRequestDataGridTextColumn<R>> & Partial<DataGridNumberColumn<R>>) => DataGridNumberColumn<R>;
|
|
13
|
+
export declare const percentageColumn: <R extends Record<string, any>>(key: string, title: string, decimals?: number, options?: Partial<SqlRequestDataGridTextColumn<R>> & Partial<DataGridNumberColumn<R>>) => DataGridNumberColumn<R>;
|
|
14
|
+
export declare const checkboxColumn: <R extends Record<string, any>>(key: string, title: string, options?: Partial<DataGridCheckboxColumn<R>>) => SqlRequestDataGridCheckboxColumn<R>;
|
|
16
15
|
export declare const selectColumn: <R extends Record<string, any>, T>(key: string, title: string, items: T[], itemKey: (item: T | null) => string, itemLabel: (item: T | null) => string, otherOptions?: Partial<DataGridSelectColumn<R, T>>) => DataGridSelectColumn<R, T>;
|
|
17
16
|
export declare const colorColumn: <R extends Record<string, any>>(key: string, title: string, otherOptions?: Partial<DataGridColorColumn<R>>) => DataGridColorColumn<R>;
|
|
@@ -47,23 +47,23 @@ var buildExcelFormat = function (decimals, suffix) {
|
|
|
47
47
|
return "#0".concat(decimals > 0 ? ".".concat((0, lodash_1.repeat)('0', decimals)) : '').concat(suffix);
|
|
48
48
|
};
|
|
49
49
|
exports.buildExcelFormat = buildExcelFormat;
|
|
50
|
-
var textColumn = function (key, title, options
|
|
50
|
+
var textColumn = function (key, title, options) { return (__assign({ key: key, type: 'text', name: title, render: function (value) { return ((0, jsx_runtime_1.jsx)(typography_1.StyledTypography, __assign({}, options === null || options === void 0 ? void 0 : options.typography, { children: value }))); }, getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; }, sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; }, footer: function (_, filteredRows) { return "".concat(filteredRows.length, " \u00E9l\u00E9ments"); }, filter: (0, filters_1.textFilter)(key), editComponent: TextEditableCell_1.TextEditableCell }, options)); };
|
|
51
51
|
exports.textColumn = textColumn;
|
|
52
|
-
var mailColumn = function (key, title, options
|
|
52
|
+
var mailColumn = function (key, title, options) { return (__assign({ key: key, type: 'text', name: title, render: function (value) { return ((0, jsx_runtime_1.jsx)(typography_1.StyledTypography, __assign({ href: "mailto:".concat(value) }, options === null || options === void 0 ? void 0 : options.typography, { as: 'a', children: value }))); }, getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; }, sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; }, footer: function (_, filteredRows) { return "".concat(filteredRows.length, " \u00E9l\u00E9ments"); }, filter: (0, filters_1.textFilter)(key), editComponent: TextEditableCell_1.TextEditableCell }, options)); };
|
|
53
53
|
exports.mailColumn = mailColumn;
|
|
54
|
-
var phoneColumn = function (key, title, options
|
|
54
|
+
var phoneColumn = function (key, title, options) { return (__assign({ key: key, type: 'text', name: title, render: function (value) { return ((0, jsx_runtime_1.jsx)(typography_1.StyledTypography, __assign({ href: "tel:".concat(value) }, options === null || options === void 0 ? void 0 : options.typography, { as: 'a', children: value }))); }, getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; }, sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; }, footer: function (_, filteredRows) { return "".concat(filteredRows.length, " \u00E9l\u00E9ments"); }, filter: (0, filters_1.textFilter)(key), editComponent: TextEditableCell_1.TextEditableCell }, options)); };
|
|
55
55
|
exports.phoneColumn = phoneColumn;
|
|
56
|
-
var dateColumn = function (key, title, options
|
|
56
|
+
var dateColumn = function (key, title, options) { return (__assign({ key: key, type: 'date', name: title, render: function (value) { return ((0, jsx_runtime_1.jsx)(typography_1.StyledTypography, __assign({}, options === null || options === void 0 ? void 0 : options.typography, { children: (0, dates_1.formatDate)(value) }))); }, excelOptions: {
|
|
57
57
|
formatter: function () { return 'dd/mm/yyyy'; },
|
|
58
58
|
valueGetter: function (value) { var _a; return (_a = (0, moment_1.default)(value).format('DD/MM/YYYY')) !== null && _a !== void 0 ? _a : ''; },
|
|
59
|
-
}, getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; }, sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; }, footer: function (_, filteredRows) { return "".concat(filteredRows.length, " \u00E9l\u00E9ments"); }, filter: __assign(__assign({}, (0, filters_1.dateFilter)(key)), { renderer: function (value) { var _a; return (_a = (0, moment_1.default)(value).format('DD/MM/YYYY')) !== null && _a !== void 0 ? _a : ''; } }), editComponent: DateEditableCell_1.DateEditableCell },
|
|
59
|
+
}, getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; }, sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; }, footer: function (_, filteredRows) { return "".concat(filteredRows.length, " \u00E9l\u00E9ments"); }, filter: __assign(__assign({}, (0, filters_1.dateFilter)(key)), { renderer: function (value) { var _a; return (_a = (0, moment_1.default)(value).format('DD/MM/YYYY')) !== null && _a !== void 0 ? _a : ''; } }), editComponent: DateEditableCell_1.DateEditableCell }, options)); };
|
|
60
60
|
exports.dateColumn = dateColumn;
|
|
61
|
-
var dateTimeColumn = function (key, title, options
|
|
61
|
+
var dateTimeColumn = function (key, title, options) { return (__assign({ key: key, type: 'date', name: title, render: function (value) { return ((0, jsx_runtime_1.jsx)(typography_1.StyledTypography, __assign({}, options === null || options === void 0 ? void 0 : options.typography, { children: (0, dates_1.formatDateTime)(value) }))); }, excelOptions: {
|
|
62
62
|
formatter: function () { return 'dd/mm/yyyy hh:mm:ss'; },
|
|
63
63
|
valueGetter: function (value) { var _a; return (_a = (0, moment_1.default)(value).format('DD/MM/YYYY HH:mm:ss')) !== null && _a !== void 0 ? _a : ''; },
|
|
64
|
-
}, getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; }, sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; }, footer: function (_, filteredRows) { return "".concat(filteredRows.length, " \u00E9l\u00E9ments"); }, filter: __assign(__assign({}, (0, filters_1.dateFilter)(key)), { renderer: function (value) { var _a; return (_a = (0, moment_1.default)(value).format('DD/MM/YYYY HH:mm:ss')) !== null && _a !== void 0 ? _a : ''; } }), editComponent: DateEditableCell_1.DateEditableCell },
|
|
64
|
+
}, getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; }, sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; }, footer: function (_, filteredRows) { return "".concat(filteredRows.length, " \u00E9l\u00E9ments"); }, filter: __assign(__assign({}, (0, filters_1.dateFilter)(key)), { renderer: function (value) { var _a; return (_a = (0, moment_1.default)(value).format('DD/MM/YYYY HH:mm:ss')) !== null && _a !== void 0 ? _a : ''; } }), editComponent: DateEditableCell_1.DateEditableCell }, options)); };
|
|
65
65
|
exports.dateTimeColumn = dateTimeColumn;
|
|
66
|
-
var monthColumn = function (key, title, options
|
|
66
|
+
var monthColumn = function (key, title, options) { return (__assign({ key: key, type: 'text', name: title, render: function (value) { return ((0, jsx_runtime_1.jsx)(typography_1.StyledTypography, __assign({}, options === null || options === void 0 ? void 0 : options.typography, { children: value + 'Mois' }))); }, getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; }, sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; }, footer: function (_, filteredRows) { return "".concat(filteredRows.length, " \u00E9l\u00E9ments"); }, filter: (0, filters_1.textFilter)(key) }, options)); };
|
|
67
67
|
exports.monthColumn = monthColumn;
|
|
68
68
|
var numberColumn = function (key, title, decimals, options) {
|
|
69
69
|
if (decimals === void 0) { decimals = 2; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@addev-be/ui",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"watch": "tsc -b --watch",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"update-version": "../../node/update-version.mjs"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@addev-be/framework-utils": "^2.5.
|
|
23
|
+
"@addev-be/framework-utils": "^2.5.11",
|
|
24
24
|
"@types/lodash": "^4.17.20",
|
|
25
25
|
"@types/react": "^19.1.13",
|
|
26
26
|
"@types/react-dom": "^19.1.9",
|
|
@@ -26,7 +26,6 @@ import { merge, repeat } from 'lodash';
|
|
|
26
26
|
|
|
27
27
|
import { CheckboxEditableCell } from '../DataGridEditableCell/CheckboxEditableCell';
|
|
28
28
|
import { DateEditableCell } from '../DataGridEditableCell/DateEditableCell';
|
|
29
|
-
import { DeepPartial } from '../../../../types';
|
|
30
29
|
import { NumberEditableCell } from '../DataGridEditableCell/NumberEditableCell';
|
|
31
30
|
import { Select } from '../../../forms/Form/Select';
|
|
32
31
|
import { SqlRequestGridCheckboxColumn } from '../../SqlRequestGrid/types';
|
|
@@ -45,8 +44,7 @@ export const buildExcelFormat = (decimals = 2, suffix = '') =>
|
|
|
45
44
|
export const textColumn = <R extends Record<string, any>>(
|
|
46
45
|
key: string,
|
|
47
46
|
title: string,
|
|
48
|
-
options?:
|
|
49
|
-
otherOptions?: Partial<DataGridTextColumn<R>>
|
|
47
|
+
options?: Partial<DataGridTextColumn<R>>
|
|
50
48
|
): DataGridTextColumn<R> => ({
|
|
51
49
|
key,
|
|
52
50
|
type: 'text',
|
|
@@ -59,14 +57,13 @@ export const textColumn = <R extends Record<string, any>>(
|
|
|
59
57
|
footer: (_, filteredRows) => `${filteredRows.length} éléments`,
|
|
60
58
|
filter: textFilter(key),
|
|
61
59
|
editComponent: TextEditableCell,
|
|
62
|
-
...
|
|
60
|
+
...options,
|
|
63
61
|
});
|
|
64
62
|
|
|
65
63
|
export const mailColumn = <R extends Record<string, any>>(
|
|
66
64
|
key: string,
|
|
67
65
|
title: string,
|
|
68
|
-
options?:
|
|
69
|
-
otherOptions?: Partial<DataGridTextColumn<R>>
|
|
66
|
+
options?: Partial<DataGridTextColumn<R>>
|
|
70
67
|
): DataGridTextColumn<R> => ({
|
|
71
68
|
key,
|
|
72
69
|
type: 'text',
|
|
@@ -85,14 +82,13 @@ export const mailColumn = <R extends Record<string, any>>(
|
|
|
85
82
|
footer: (_, filteredRows) => `${filteredRows.length} éléments`,
|
|
86
83
|
filter: textFilter(key),
|
|
87
84
|
editComponent: TextEditableCell,
|
|
88
|
-
...
|
|
85
|
+
...options,
|
|
89
86
|
});
|
|
90
87
|
|
|
91
88
|
export const phoneColumn = <R extends Record<string, any>>(
|
|
92
89
|
key: string,
|
|
93
90
|
title: string,
|
|
94
|
-
options?:
|
|
95
|
-
otherOptions?: Partial<DataGridTextColumn<R>>
|
|
91
|
+
options?: Partial<DataGridTextColumn<R>>
|
|
96
92
|
): DataGridTextColumn<R> => ({
|
|
97
93
|
key,
|
|
98
94
|
type: 'text',
|
|
@@ -107,14 +103,13 @@ export const phoneColumn = <R extends Record<string, any>>(
|
|
|
107
103
|
footer: (_, filteredRows) => `${filteredRows.length} éléments`,
|
|
108
104
|
filter: textFilter(key),
|
|
109
105
|
editComponent: TextEditableCell,
|
|
110
|
-
...
|
|
106
|
+
...options,
|
|
111
107
|
});
|
|
112
108
|
|
|
113
109
|
export const dateColumn = <R extends Record<string, any>>(
|
|
114
110
|
key: string,
|
|
115
111
|
title: string,
|
|
116
|
-
options?:
|
|
117
|
-
otherOptions?: Partial<DataGridDateColumn<R>>
|
|
112
|
+
options?: Partial<DataGridDateColumn<R>>
|
|
118
113
|
): DataGridDateColumn<R> => ({
|
|
119
114
|
key,
|
|
120
115
|
type: 'date',
|
|
@@ -136,14 +131,13 @@ export const dateColumn = <R extends Record<string, any>>(
|
|
|
136
131
|
renderer: (value) => moment(value).format('DD/MM/YYYY') ?? '',
|
|
137
132
|
},
|
|
138
133
|
editComponent: DateEditableCell,
|
|
139
|
-
...
|
|
134
|
+
...options,
|
|
140
135
|
});
|
|
141
136
|
|
|
142
137
|
export const dateTimeColumn = <R extends Record<string, any>>(
|
|
143
138
|
key: string,
|
|
144
139
|
title: string,
|
|
145
|
-
options?:
|
|
146
|
-
otherOptions?: Partial<DataGridDateColumn<R>>
|
|
140
|
+
options?: Partial<DataGridDateColumn<R>>
|
|
147
141
|
): DataGridDateColumn<R> => ({
|
|
148
142
|
key,
|
|
149
143
|
type: 'date',
|
|
@@ -165,14 +159,13 @@ export const dateTimeColumn = <R extends Record<string, any>>(
|
|
|
165
159
|
renderer: (value) => moment(value).format('DD/MM/YYYY HH:mm:ss') ?? '',
|
|
166
160
|
},
|
|
167
161
|
editComponent: DateEditableCell,
|
|
168
|
-
...
|
|
162
|
+
...options,
|
|
169
163
|
});
|
|
170
164
|
|
|
171
165
|
export const monthColumn = <R extends Record<string, any>>(
|
|
172
166
|
key: string,
|
|
173
167
|
title: string,
|
|
174
|
-
options?:
|
|
175
|
-
otherOptions?: Partial<DataGridTextColumn<R>>
|
|
168
|
+
options?: Partial<DataGridTextColumn<R>>
|
|
176
169
|
): DataGridTextColumn<R> => ({
|
|
177
170
|
key,
|
|
178
171
|
type: 'text',
|
|
@@ -186,14 +179,14 @@ export const monthColumn = <R extends Record<string, any>>(
|
|
|
186
179
|
sortGetter: (row) => row[key] ?? '',
|
|
187
180
|
footer: (_, filteredRows) => `${filteredRows.length} éléments`,
|
|
188
181
|
filter: textFilter(key),
|
|
189
|
-
...
|
|
182
|
+
...options,
|
|
190
183
|
});
|
|
191
184
|
|
|
192
185
|
export const numberColumn = <R extends Record<string, any>>(
|
|
193
186
|
key: string,
|
|
194
187
|
title: string,
|
|
195
188
|
decimals = 2,
|
|
196
|
-
options?:
|
|
189
|
+
options?: Partial<SqlRequestDataGridTextColumn<R>> &
|
|
197
190
|
Partial<DataGridNumberColumn<R>>
|
|
198
191
|
): DataGridNumberColumn<R> => {
|
|
199
192
|
const column: DataGridNumberColumn<R> = {
|
|
@@ -260,7 +253,7 @@ export const moneyColumn = <R extends Record<string, any>>(
|
|
|
260
253
|
title: string,
|
|
261
254
|
decimals = 2,
|
|
262
255
|
currency: string | ((row: R) => string) = '€',
|
|
263
|
-
options?:
|
|
256
|
+
options?: Partial<SqlRequestDataGridTextColumn<R>> &
|
|
264
257
|
Partial<DataGridNumberColumn<R>>
|
|
265
258
|
): DataGridNumberColumn<R> => {
|
|
266
259
|
const column: DataGridNumberColumn<R> = {
|
|
@@ -322,7 +315,7 @@ export const percentageColumn = <R extends Record<string, any>>(
|
|
|
322
315
|
key: string,
|
|
323
316
|
title: string,
|
|
324
317
|
decimals = 2,
|
|
325
|
-
options?:
|
|
318
|
+
options?: Partial<SqlRequestDataGridTextColumn<R>> &
|
|
326
319
|
Partial<DataGridNumberColumn<R>>
|
|
327
320
|
): DataGridNumberColumn<R> => {
|
|
328
321
|
const column: DataGridNumberColumn<R> = {
|
|
@@ -372,7 +365,7 @@ export const percentageColumn = <R extends Record<string, any>>(
|
|
|
372
365
|
export const checkboxColumn = <R extends Record<string, any>>(
|
|
373
366
|
key: string,
|
|
374
367
|
title: string,
|
|
375
|
-
options?:
|
|
368
|
+
options?: Partial<DataGridCheckboxColumn<R>>
|
|
376
369
|
): SqlRequestDataGridCheckboxColumn<R> =>
|
|
377
370
|
merge(
|
|
378
371
|
{
|