@addev-be/ui 1.1.3 → 1.1.5
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/dist/components/data/DataGrid/helpers/columns.d.ts +11 -9
- package/dist/components/data/DataGrid/helpers/columns.js +17 -12
- package/dist/components/data/DataGrid/index.d.ts +1 -1
- package/dist/components/data/DataGrid/index.js +2 -2
- package/dist/components/data/DataGrid/styles.d.ts +1 -1
- package/dist/components/data/DataGrid/styles.js +2 -2
- package/dist/components/data/DataGrid/types.d.ts +8 -1
- package/dist/components/data/SqlRequestDataGrid/helpers/columns.js +11 -10
- package/dist/components/layout/Columns.d.ts +1 -1
- package/dist/components/layout/Columns.js +3 -3
- package/dist/components/layout/Flexbox.d.ts +1 -1
- package/dist/components/layout/Flexbox.js +2 -2
- package/dist/components/ui/TabsView/TabsList.d.ts +1 -1
- package/dist/components/ui/TabsView/styles.d.ts +1 -1
- package/dist/components/ui/TabsView/styles.js +2 -2
- package/dist/helpers/index.d.ts +0 -1
- package/dist/helpers/index.js +0 -1
- package/dist/helpers/styled/typography.d.ts +9 -0
- package/dist/helpers/styled/typography.js +51 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/package.json +2 -2
- package/src/components/data/DataGrid/helpers/columns.tsx +68 -9
- package/src/components/data/DataGrid/index.tsx +1 -1
- package/src/components/data/DataGrid/styles.ts +1 -1
- package/src/components/data/DataGrid/types.ts +9 -1
- package/src/components/data/SqlRequestDataGrid/helpers/columns.tsx +57 -10
- package/src/components/layout/Columns.ts +2 -1
- package/src/components/layout/Flexbox.ts +1 -1
- package/src/components/ui/TabsView/TabsList.tsx +1 -1
- package/src/components/ui/TabsView/styles.ts +1 -1
- package/src/helpers/index.ts +0 -1
- package/src/helpers/styled/typography.ts +25 -0
- package/src/index.ts +4 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/helpers/styled/index.ts +0 -1
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { DataGridCheckboxColumn, DataGridColorColumn, DataGridColumn, DataGridDateColumn, DataGridNumberColumn, DataGridSelectColumn, DataGridSettings, DataGridTextColumn } from '../types';
|
|
2
|
+
import { DeepPartial } from '../../../../typings';
|
|
3
|
+
import { SqlRequestDataGridTextColumn } from '../../SqlRequestDataGrid/types';
|
|
2
4
|
export declare const isColumnVisible: <R>(obj: DataGridColumn<R> | DataGridSettings) => boolean;
|
|
3
5
|
export declare const buildExcelFormat: (decimals?: number, suffix?: string) => string;
|
|
4
|
-
export declare const textColumn: <R extends Record<string, any>>(key: string, title: string, otherOptions?: Partial<DataGridTextColumn<R>>) => DataGridTextColumn<R>;
|
|
5
|
-
export declare const mailColumn: <R extends Record<string, any>>(key: string, title: string, otherOptions?: Partial<DataGridTextColumn<R>>) => DataGridTextColumn<R>;
|
|
6
|
-
export declare const phoneColumn: <R extends Record<string, any>>(key: string, title: string, otherOptions?: Partial<DataGridTextColumn<R>>) => DataGridTextColumn<R>;
|
|
7
|
-
export declare const dateColumn: <R extends Record<string, any>>(key: string, title: string, otherOptions?: Partial<DataGridDateColumn<R>>) => DataGridDateColumn<R>;
|
|
8
|
-
export declare const dateTimeColumn: <R extends Record<string, any>>(key: string, title: string, otherOptions?: Partial<DataGridDateColumn<R>>) => DataGridDateColumn<R>;
|
|
9
|
-
export declare const monthColumn: <R extends Record<string, any>>(key: string, title: string, otherOptions?: Partial<DataGridTextColumn<R>>) => DataGridTextColumn<R>;
|
|
10
|
-
export declare const numberColumn: <R extends Record<string, any>>(key: string, title: string, decimals?: number, otherOptions?: Partial<DataGridNumberColumn<R>>) => DataGridNumberColumn<R>;
|
|
11
|
-
export declare const moneyColumn: <R extends Record<string, any>>(key: string, title: string, decimals?: number, otherOptions?: Partial<DataGridNumberColumn<R>>) => DataGridNumberColumn<R>;
|
|
12
|
-
export declare const percentageColumn: <R extends Record<string, any>>(key: string, title: string, decimals?: number, otherOptions?: Partial<DataGridNumberColumn<R>>) => DataGridNumberColumn<R>;
|
|
6
|
+
export declare const textColumn: <R extends Record<string, any>>(key: string, title: string, options?: DeepPartial<SqlRequestDataGridTextColumn<R>>, otherOptions?: Partial<DataGridTextColumn<R>>) => DataGridTextColumn<R>;
|
|
7
|
+
export declare const mailColumn: <R extends Record<string, any>>(key: string, title: string, options?: DeepPartial<SqlRequestDataGridTextColumn<R>>, otherOptions?: Partial<DataGridTextColumn<R>>) => DataGridTextColumn<R>;
|
|
8
|
+
export declare const phoneColumn: <R extends Record<string, any>>(key: string, title: string, options?: DeepPartial<SqlRequestDataGridTextColumn<R>>, otherOptions?: Partial<DataGridTextColumn<R>>) => DataGridTextColumn<R>;
|
|
9
|
+
export declare const dateColumn: <R extends Record<string, any>>(key: string, title: string, options?: DeepPartial<SqlRequestDataGridTextColumn<R>>, otherOptions?: Partial<DataGridDateColumn<R>>) => DataGridDateColumn<R>;
|
|
10
|
+
export declare const dateTimeColumn: <R extends Record<string, any>>(key: string, title: string, options?: DeepPartial<SqlRequestDataGridTextColumn<R>>, otherOptions?: Partial<DataGridDateColumn<R>>) => DataGridDateColumn<R>;
|
|
11
|
+
export declare const monthColumn: <R extends Record<string, any>>(key: string, title: string, options?: DeepPartial<SqlRequestDataGridTextColumn<R>>, otherOptions?: Partial<DataGridTextColumn<R>>) => DataGridTextColumn<R>;
|
|
12
|
+
export declare const numberColumn: <R extends Record<string, any>>(key: string, title: string, decimals?: number, options?: DeepPartial<SqlRequestDataGridTextColumn<R>>, otherOptions?: Partial<DataGridNumberColumn<R>>) => DataGridNumberColumn<R>;
|
|
13
|
+
export declare const moneyColumn: <R extends Record<string, any>>(key: string, title: string, decimals?: number, currency?: string | ((row: R) => string), options?: DeepPartial<SqlRequestDataGridTextColumn<R>>, otherOptions?: Partial<DataGridNumberColumn<R>>) => DataGridNumberColumn<R>;
|
|
14
|
+
export declare const percentageColumn: <R extends Record<string, any>>(key: string, title: string, decimals?: number, options?: DeepPartial<SqlRequestDataGridTextColumn<R>>, otherOptions?: Partial<DataGridNumberColumn<R>>) => DataGridNumberColumn<R>;
|
|
13
15
|
export declare const checkboxColumn: <R extends Record<string, any>>(key: string, title: string, otherOptions?: Partial<DataGridCheckboxColumn<R>>) => DataGridCheckboxColumn<R>;
|
|
14
16
|
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>;
|
|
15
17
|
export declare const colorColumn: <R extends Record<string, any>>(key: string, title: string, otherOptions?: Partial<DataGridColorColumn<R>>) => DataGridColorColumn<R>;
|
|
@@ -17,11 +17,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.colorColumn = exports.selectColumn = exports.checkboxColumn = exports.percentageColumn = exports.moneyColumn = exports.numberColumn = exports.monthColumn = exports.dateTimeColumn = exports.dateColumn = exports.phoneColumn = exports.mailColumn = exports.textColumn = exports.buildExcelFormat = exports.isColumnVisible = void 0;
|
|
18
18
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
var filters_1 = require("./filters");
|
|
20
|
+
var helpers_1 = require("../../../../helpers");
|
|
20
21
|
var numbers_1 = require("../../../../helpers/numbers");
|
|
21
22
|
var CheckboxEditableCell_1 = require("../DataGridEditableCell/CheckboxEditableCell");
|
|
22
23
|
var DateEditableCell_1 = require("../DataGridEditableCell/DateEditableCell");
|
|
23
24
|
var NumberEditableCell_1 = require("../DataGridEditableCell/NumberEditableCell");
|
|
24
25
|
var Select_1 = require("../../../forms/Form/Select");
|
|
26
|
+
var typography_1 = require("../../../../helpers/styled/typography");
|
|
25
27
|
var TextEditableCell_1 = require("../DataGridEditableCell/TextEditableCell");
|
|
26
28
|
var components_1 = require("../../../../helpers/components");
|
|
27
29
|
var moment_1 = __importDefault(require("moment"));
|
|
@@ -34,27 +36,27 @@ var buildExcelFormat = function (decimals, suffix) {
|
|
|
34
36
|
return "#0".concat(decimals > 0 ? ".".concat((0, lodash_1.repeat)('0', decimals)) : '').concat(suffix);
|
|
35
37
|
};
|
|
36
38
|
exports.buildExcelFormat = buildExcelFormat;
|
|
37
|
-
var textColumn = function (key, title, otherOptions) { return (__assign({ key: key, type: 'text', name: title, render: function (value
|
|
39
|
+
var textColumn = function (key, title, options, otherOptions) { 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 }, otherOptions)); };
|
|
38
40
|
exports.textColumn = textColumn;
|
|
39
|
-
var mailColumn = function (key, title, otherOptions) { return (__assign({ key: key, type: 'text', name: title, render: function (value
|
|
41
|
+
var mailColumn = function (key, title, options, otherOptions) { 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 }, otherOptions)); };
|
|
40
42
|
exports.mailColumn = mailColumn;
|
|
41
|
-
var phoneColumn = function (key, title, otherOptions) { return (__assign({ key: key, type: 'text', name: title, render: function (value
|
|
43
|
+
var phoneColumn = function (key, title, options, otherOptions) { 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 }, otherOptions)); };
|
|
42
44
|
exports.phoneColumn = phoneColumn;
|
|
43
|
-
var dateColumn = function (key, title, otherOptions) { return (__assign({ key: key, type: 'date', name: title, render: function (value
|
|
45
|
+
var dateColumn = function (key, title, options, otherOptions) { 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, helpers_1.formatDate)(value) }))); }, excelOptions: {
|
|
44
46
|
formatter: function () { return 'dd/mm/yyyy'; },
|
|
45
47
|
valueGetter: function (value) { var _a; return (_a = (0, moment_1.default)(value).format('DD/MM/YYYY')) !== null && _a !== void 0 ? _a : ''; },
|
|
46
48
|
}, 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 }, otherOptions)); };
|
|
47
49
|
exports.dateColumn = dateColumn;
|
|
48
|
-
var dateTimeColumn = function (key, title, otherOptions) { return (__assign({ key: key, type: 'date', name: title, render: function (value
|
|
50
|
+
var dateTimeColumn = function (key, title, options, otherOptions) { 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, helpers_1.formatDateTime)(value) }))); }, excelOptions: {
|
|
49
51
|
formatter: function () { return 'dd/mm/yyyy hh:mm:ss'; },
|
|
50
52
|
valueGetter: function (value) { var _a; return (_a = (0, moment_1.default)(value).format('DD/MM/YYYY HH:mm:ss')) !== null && _a !== void 0 ? _a : ''; },
|
|
51
53
|
}, 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 }, otherOptions)); };
|
|
52
54
|
exports.dateTimeColumn = dateTimeColumn;
|
|
53
|
-
var monthColumn = function (key, title, otherOptions) { return (__assign({ key: key, type: 'text', name: title, render: function (value
|
|
55
|
+
var monthColumn = function (key, title, options, otherOptions) { 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) }, otherOptions)); };
|
|
54
56
|
exports.monthColumn = monthColumn;
|
|
55
|
-
var numberColumn = function (key, title, decimals, otherOptions) {
|
|
57
|
+
var numberColumn = function (key, title, decimals, options, otherOptions) {
|
|
56
58
|
if (decimals === void 0) { decimals = 2; }
|
|
57
|
-
var column = __assign({ key: key, type: 'number', name: title, render: function (value
|
|
59
|
+
var column = __assign({ key: key, type: 'number', 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, numbers_1.formatNumber)(value, decimals) }))); }, excelOptions: {
|
|
58
60
|
formatter: function () { return (0, exports.buildExcelFormat)(decimals); },
|
|
59
61
|
valueGetter: function (value) { return (0, numbers_1.formatNumberInvariant)(value, decimals); },
|
|
60
62
|
}, 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: {
|
|
@@ -76,9 +78,12 @@ var numberColumn = function (key, title, decimals, otherOptions) {
|
|
|
76
78
|
return column;
|
|
77
79
|
};
|
|
78
80
|
exports.numberColumn = numberColumn;
|
|
79
|
-
var moneyColumn = function (key, title, decimals, otherOptions) {
|
|
81
|
+
var moneyColumn = function (key, title, decimals, currency, options, otherOptions) {
|
|
80
82
|
if (decimals === void 0) { decimals = 2; }
|
|
81
|
-
|
|
83
|
+
if (currency === void 0) { currency = '€'; }
|
|
84
|
+
var column = __assign({ key: key, type: 'number', name: title, render: typeof currency === 'function'
|
|
85
|
+
? function (value, row) { return ((0, jsx_runtime_1.jsx)(typography_1.StyledTypography, __assign({}, options === null || options === void 0 ? void 0 : options.typography, { children: (0, numbers_1.formatMoney)(value, decimals, currency(row)) }))); }
|
|
86
|
+
: function (value) { return ((0, jsx_runtime_1.jsx)(typography_1.StyledTypography, __assign({}, options === null || options === void 0 ? void 0 : options.typography, { children: (0, numbers_1.formatMoney)(value, decimals, currency) }))); }, excelOptions: {
|
|
82
87
|
formatter: function () { return (0, exports.buildExcelFormat)(decimals, ' €'); },
|
|
83
88
|
valueGetter: function (value) { return (0, numbers_1.formatNumberInvariant)(value, decimals); },
|
|
84
89
|
}, 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 : ''; }, filter: __assign(__assign({}, (0, filters_1.numberFilter)(key)), { renderer: function (value) { var _a; return (_a = (0, numbers_1.formatMoney)(value, decimals)) !== null && _a !== void 0 ? _a : ''; } }), footer: {
|
|
@@ -100,9 +105,9 @@ var moneyColumn = function (key, title, decimals, otherOptions) {
|
|
|
100
105
|
return column;
|
|
101
106
|
};
|
|
102
107
|
exports.moneyColumn = moneyColumn;
|
|
103
|
-
var percentageColumn = function (key, title, decimals, otherOptions) {
|
|
108
|
+
var percentageColumn = function (key, title, decimals, options, otherOptions) {
|
|
104
109
|
if (decimals === void 0) { decimals = 2; }
|
|
105
|
-
var column = __assign({ key: key, type: 'number', name: title, render: function (value
|
|
110
|
+
var column = __assign({ key: key, type: 'number', 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, numbers_1.formatPercentage)(value) }))); }, excelOptions: {
|
|
106
111
|
formatter: function () { return (0, exports.buildExcelFormat)(decimals, '%'); },
|
|
107
112
|
valueGetter: function (value) { return (0, numbers_1.formatNumberInvariant)(value, decimals); },
|
|
108
113
|
}, 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 : ''; }, filter: (0, filters_1.numberFilter)(key), footer: {
|
|
@@ -41,6 +41,6 @@ export declare const DataGrid: <R>(props: {
|
|
|
41
41
|
onSaveClicked?: ((addedRows: import("./types").DataGridEditedRows<R>, editedRows: import("./types").DataGridEditedRows<R>) => Promise<string[]>) | undefined;
|
|
42
42
|
onAddClicked?: (() => Promise<R>) | undefined;
|
|
43
43
|
headerContent?: import("react").ReactNode;
|
|
44
|
-
} & import("../../../helpers/styled").MarginProps & import("../../../helpers/styled").PaddingProps & {
|
|
44
|
+
} & import("../../../helpers/styled/space").MarginProps & import("../../../helpers/styled/space").PaddingProps & {
|
|
45
45
|
contextOverride?: Partial<DataGridContextProps<R>>;
|
|
46
46
|
} & import("react").RefAttributes<DataGridRefProps<R>>) => import("react").JSX.Element | null;
|
|
@@ -64,13 +64,13 @@ var DataGridHeader_1 = require("./DataGridHeader");
|
|
|
64
64
|
var DataGridRowTemplate_1 = require("./DataGridRowTemplate");
|
|
65
65
|
var DataGridToolbar_1 = require("./DataGridToolbar");
|
|
66
66
|
var VirtualScroller_1 = require("../VirtualScroller");
|
|
67
|
-
var
|
|
67
|
+
var space_1 = require("../../../helpers/styled/space");
|
|
68
68
|
var hooks_1 = require("./hooks");
|
|
69
69
|
var DataGridInner = function (_a, ref) {
|
|
70
70
|
var contextOverride = _a.contextOverride, props = __rest(_a, ["contextOverride"]);
|
|
71
71
|
var scrollableRef = (0, react_1.useRef)(null);
|
|
72
72
|
var className = props.className;
|
|
73
|
-
var spaceProps = (0,
|
|
73
|
+
var spaceProps = (0, space_1.extractSpaceProps)(props);
|
|
74
74
|
var _b = (0, hooks_1.useDataGrid)(props, contextOverride), contextProps = _b[0], DataGridContext = _b[1];
|
|
75
75
|
var columns = contextProps.columns, selectable = contextProps.selectable, _c = contextProps.rowHeight, rowHeight = _c === void 0 ? constants_1.DEFAULT_ROW_HEIGHT : _c, _d = contextProps.headerRowHeight, headerRowHeight = _d === void 0 ? 40 : _d, gridTemplateColumns = contextProps.gridTemplateColumns, sortedRows = contextProps.sortedRows, onVisibleRowsChange = contextProps.onVisibleRowsChange, refresh = contextProps.refresh, setSelectedKeys = contextProps.setSelectedKeys, addRows = contextProps.addRows, fixedColumnsCount = contextProps.fixedColumnsCount, resizingColumnKey = contextProps.resizingColumnKey, moveResizing = contextProps.moveResizing, endResizing = contextProps.endResizing, footerFunctions = contextProps.footerFunctions;
|
|
76
76
|
(0, react_1.useImperativeHandle)(ref, function () { return ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SpaceProps } from '../../../helpers/styled';
|
|
1
|
+
import { SpaceProps } from '../../../helpers/styled/space';
|
|
2
2
|
import { DataGridCellFCProps } from './types';
|
|
3
3
|
import { ThemeColor } from '../../../providers/ThemeProvider/types';
|
|
4
4
|
export declare const DataGridWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, SpaceProps>> & string;
|
|
@@ -29,10 +29,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.ResizeBackdrop = exports.HeaderSelectionCell = exports.SelectionCell = exports.LoadingCell = exports.DataGridRow = exports.DataGridFooterRow = exports.DataGridHeaderRow = exports.DataGridContainer = exports.DataGridToolsRowButtonsContainer = exports.DataGridToolsRowHeaderContent = exports.DataGridToolsRow = exports.DataGridHeaderTitle = exports.DataGridCell = exports.dataGridCellCss = exports.DataGridHeaderTextContainer = exports.DataGridHeaderCellContainer = exports.DataGridResizeGrip = exports.DataGridWrapper = void 0;
|
|
31
31
|
var constants_1 = require("./constants");
|
|
32
|
-
var
|
|
32
|
+
var space_1 = require("../../../helpers/styled/space");
|
|
33
33
|
var styled_components_1 = __importStar(require("styled-components"));
|
|
34
34
|
var styles_1 = require("../VirtualScroller/styles");
|
|
35
|
-
exports.DataGridWrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n overflow: hidden;\n width: 100%;\n height: 100%;\n\n ", "\n"], ["\n display: flex;\n flex-direction: column;\n overflow: hidden;\n width: 100%;\n height: 100%;\n\n ", "\n"])),
|
|
35
|
+
exports.DataGridWrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n overflow: hidden;\n width: 100%;\n height: 100%;\n\n ", "\n"], ["\n display: flex;\n flex-direction: column;\n overflow: hidden;\n width: 100%;\n height: 100%;\n\n ", "\n"])), space_1.space);
|
|
36
36
|
exports.DataGridResizeGrip = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n right: 0;\n width: var(--space-1);\n height: 100%;\n\n ", "\n\n cursor: col-resize;\n display: none;\n"], ["\n position: absolute;\n top: 0;\n right: 0;\n width: var(--space-1);\n height: 100%;\n\n ", "\n\n cursor: col-resize;\n display: none;\n"])), function (_a) {
|
|
37
37
|
var _b = _a.$headerColor, $headerColor = _b === void 0 ? 'base' : _b;
|
|
38
38
|
return (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: var(--color-", "-400);\n &:hover,\n &.active {\n background-color: var(--color-", "-500);\n }\n "], ["\n background-color: var(--color-", "-400);\n &:hover,\n &.active {\n background-color: var(--color-", "-500);\n }\n "])), $headerColor, $headerColor);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
2
|
import { CSSProperties, Context, Dispatch, FC, MouseEvent, MouseEventHandler, ReactNode, SetStateAction } from 'react';
|
|
3
3
|
import { DataGridEditableCellFC } from './DataGridEditableCell/types';
|
|
4
|
-
import { SpaceProps } from '../../../helpers/styled';
|
|
4
|
+
import { SpaceProps } from '../../../helpers/styled/space';
|
|
5
5
|
import { ThemeColor } from '../../../providers/ThemeProvider/types';
|
|
6
6
|
export type DataGridCellFCProps = {
|
|
7
7
|
onDoubleClick?: MouseEventHandler;
|
|
@@ -24,6 +24,13 @@ type CommonGridColumnProps<R, T> = {
|
|
|
24
24
|
component?: DataGridCellFC;
|
|
25
25
|
color?: ThemeColor;
|
|
26
26
|
excelOptions?: ExcelOptions;
|
|
27
|
+
typography?: {
|
|
28
|
+
bold?: boolean;
|
|
29
|
+
italic?: boolean;
|
|
30
|
+
underline?: boolean;
|
|
31
|
+
ellipsis?: boolean;
|
|
32
|
+
lineClamp?: number;
|
|
33
|
+
};
|
|
27
34
|
textAlign?: 'left' | 'right' | 'center';
|
|
28
35
|
filter?: DataGridFilter;
|
|
29
36
|
footer?: DataGridFooterFunction<R> | Record<string, DataGridFooterFunction<R> | null>;
|
|
@@ -26,13 +26,14 @@ var constants_1 = require("../../DataGrid/constants");
|
|
|
26
26
|
var DateEditableCell_1 = require("../../DataGrid/DataGridEditableCell/DateEditableCell");
|
|
27
27
|
var NumberEditableCell_1 = require("../../DataGrid/DataGridEditableCell/NumberEditableCell");
|
|
28
28
|
var SqlRequestForeignList_1 = require("../../SqlRequestForeignList");
|
|
29
|
+
var typography_1 = require("../../../../helpers/styled/typography");
|
|
29
30
|
var TextEditableCell_1 = require("../../DataGrid/DataGridEditableCell/TextEditableCell");
|
|
30
31
|
var sqlTextColumn = function (key, title, options) {
|
|
31
32
|
return (0, lodash_1.merge)({
|
|
32
33
|
key: key,
|
|
33
34
|
type: 'text',
|
|
34
35
|
name: title,
|
|
35
|
-
render: function (value) { return
|
|
36
|
+
render: function (value) { return ((0, jsx_runtime_1.jsx)(typography_1.StyledTypography, __assign({}, options === null || options === void 0 ? void 0 : options.typography, { children: value }))); },
|
|
36
37
|
getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
37
38
|
sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
38
39
|
filter: __assign(__assign({}, (0, helpers_1.textFilter)(key)), { getter: function (value) { var _a; return (_a = value[key]) !== null && _a !== void 0 ? _a : ''; } }),
|
|
@@ -46,7 +47,7 @@ var sqlMailColumn = function (key, title, options) {
|
|
|
46
47
|
key: key,
|
|
47
48
|
type: 'text',
|
|
48
49
|
name: title,
|
|
49
|
-
render: function (value) { return (0, jsx_runtime_1.jsx)(
|
|
50
|
+
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 }))); },
|
|
50
51
|
getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
51
52
|
sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
52
53
|
filter: __assign(__assign({}, (0, helpers_1.textFilter)(key)), { getter: function (value) { var _a; return (_a = value[key]) !== null && _a !== void 0 ? _a : ''; } }),
|
|
@@ -60,7 +61,7 @@ var sqlPhoneColumn = function (key, title, options) {
|
|
|
60
61
|
key: key,
|
|
61
62
|
type: 'text',
|
|
62
63
|
name: title,
|
|
63
|
-
render: function (value) { return (0, jsx_runtime_1.jsx)(
|
|
64
|
+
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 }))); },
|
|
64
65
|
getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
65
66
|
sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
66
67
|
filter: __assign(__assign({}, (0, helpers_1.textFilter)(key)), { getter: function (value) { var _a; return (_a = value[key]) !== null && _a !== void 0 ? _a : ''; } }),
|
|
@@ -74,7 +75,7 @@ var sqlDateColumn = function (key, title, options) {
|
|
|
74
75
|
key: key,
|
|
75
76
|
name: title,
|
|
76
77
|
type: 'date',
|
|
77
|
-
render: function (value) { return (0, dates_1.formatDate)(value); },
|
|
78
|
+
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) }))); },
|
|
78
79
|
getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
79
80
|
sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
80
81
|
excelOptions: {
|
|
@@ -92,7 +93,7 @@ var sqlDateTimeColumn = function (key, title, options) {
|
|
|
92
93
|
key: key,
|
|
93
94
|
name: title,
|
|
94
95
|
type: 'date',
|
|
95
|
-
render: function (value) { return (0, dates_1.formatDateTime)(value); },
|
|
96
|
+
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) }))); },
|
|
96
97
|
getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
97
98
|
sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
98
99
|
excelOptions: {
|
|
@@ -110,7 +111,7 @@ var sqlMonthColumn = function (key, title, options) {
|
|
|
110
111
|
key: key,
|
|
111
112
|
type: 'text',
|
|
112
113
|
name: title,
|
|
113
|
-
render: function (value) { return (
|
|
114
|
+
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' }))); },
|
|
114
115
|
getter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
115
116
|
sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : ''; },
|
|
116
117
|
filter: __assign(__assign({}, (0, helpers_1.textFilter)(key)), { getter: function (value) { var _a; return (_a = value[key]) !== null && _a !== void 0 ? _a : ''; } }),
|
|
@@ -126,7 +127,7 @@ var sqlNumberColumn = function (key, title, decimals, options) {
|
|
|
126
127
|
type: 'number',
|
|
127
128
|
decimals: decimals,
|
|
128
129
|
textAlign: 'right',
|
|
129
|
-
render: function (value) {
|
|
130
|
+
render: function (value) { return ((0, jsx_runtime_1.jsx)(typography_1.StyledTypography, __assign({}, options === null || options === void 0 ? void 0 : options.typography, { children: (0, numbers_1.formatNumber)(value, decimals) }))); },
|
|
130
131
|
excelOptions: {
|
|
131
132
|
formatter: function () { return (0, helpers_1.buildExcelFormat)(decimals); },
|
|
132
133
|
valueGetter: function (value) { return (0, numbers_1.formatNumberInvariant)(value, decimals); },
|
|
@@ -157,8 +158,8 @@ var sqlMoneyColumn = function (key, title, decimals, currency, options) {
|
|
|
157
158
|
currency: currency,
|
|
158
159
|
textAlign: 'right',
|
|
159
160
|
render: typeof currency === 'function'
|
|
160
|
-
? function (value, row) {
|
|
161
|
-
: function (value) {
|
|
161
|
+
? function (value, row) { return ((0, jsx_runtime_1.jsx)(typography_1.StyledTypography, __assign({}, options === null || options === void 0 ? void 0 : options.typography, { children: (0, numbers_1.formatMoney)(value, decimals, currency(row)) }))); }
|
|
162
|
+
: function (value) { return ((0, jsx_runtime_1.jsx)(typography_1.StyledTypography, __assign({}, options === null || options === void 0 ? void 0 : options.typography, { children: (0, numbers_1.formatMoney)(value, decimals, currency) }))); },
|
|
162
163
|
excelOptions: {
|
|
163
164
|
formatter: typeof currency === 'function'
|
|
164
165
|
? function (row) { return (0, helpers_1.buildExcelFormat)(decimals, currency(row)); }
|
|
@@ -188,7 +189,7 @@ var sqlPercentageColumn = function (key, title, decimals, options) {
|
|
|
188
189
|
key: key,
|
|
189
190
|
name: title,
|
|
190
191
|
type: 'number',
|
|
191
|
-
render: function (value) {
|
|
192
|
+
render: function (value) { return ((0, jsx_runtime_1.jsx)(typography_1.StyledTypography, __assign({}, options === null || options === void 0 ? void 0 : options.typography, { children: (0, numbers_1.formatPercentage)(value) }))); },
|
|
192
193
|
excelOptions: {
|
|
193
194
|
formatter: function () { return (0, helpers_1.buildExcelFormat)(decimals, '%'); },
|
|
194
195
|
valueGetter: function (value) { return (0, numbers_1.formatNumberInvariant)(value, decimals); },
|
|
@@ -8,14 +8,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.Column = exports.Columns = void 0;
|
|
11
|
-
var
|
|
11
|
+
var space_1 = require("../../helpers/styled/space");
|
|
12
12
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
13
|
-
exports.Columns = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: grid;\n grid-gap: var(--space-6);\n width: 100%;\n\n grid-template-columns: ", ";\n\n ", ";\n"], ["\n display: grid;\n grid-gap: var(--space-6);\n width: 100%;\n\n grid-template-columns: ", ";\n\n ", ";\n"])), function (_a) {
|
|
13
|
+
exports.Columns = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: grid;\n grid-gap: var(--space-6);\n width: 100%;\n box-sizing: border-box;\n\n grid-template-columns: ", ";\n\n ", ";\n"], ["\n display: grid;\n grid-gap: var(--space-6);\n width: 100%;\n box-sizing: border-box;\n\n grid-template-columns: ", ";\n\n ", ";\n"])), function (_a) {
|
|
14
14
|
var _b;
|
|
15
15
|
var _c = _a.columns, columns = _c === void 0 ? 1 : _c, _d = _a.$maxColumnWidth, $maxColumnWidth = _d === void 0 ? '1fr' : _d;
|
|
16
16
|
return typeof columns === 'number'
|
|
17
17
|
? "repeat(".concat(columns, ", minmax(0, ").concat($maxColumnWidth, "))")
|
|
18
18
|
: (_b = columns === null || columns === void 0 ? void 0 : columns.join(' ')) !== null && _b !== void 0 ? _b : 'none';
|
|
19
|
-
},
|
|
19
|
+
}, space_1.space);
|
|
20
20
|
exports.Column = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: var(--space-6);\n"], ["\n display: flex;\n flex-direction: column;\n gap: var(--space-6);\n"])));
|
|
21
21
|
var templateObject_1, templateObject_2;
|
|
@@ -8,7 +8,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.Flexbox = void 0;
|
|
11
|
-
var
|
|
11
|
+
var space_1 = require("../../helpers/styled/space");
|
|
12
12
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
13
13
|
exports.Flexbox = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: ", ";\n justify-content: ", ";\n align-items: ", ";\n gap: ", ";\n ", "\n"], ["\n display: flex;\n flex-direction: ", ";\n justify-content: ", ";\n align-items: ", ";\n gap: ", ";\n ", "\n"])), function (_a) {
|
|
14
14
|
var direction = _a.direction;
|
|
@@ -22,5 +22,5 @@ exports.Flexbox = styled_components_1.default.div(templateObject_1 || (templateO
|
|
|
22
22
|
}, function (_a) {
|
|
23
23
|
var gap = _a.gap;
|
|
24
24
|
return (gap ? "var(--s-".concat(gap, ")") : undefined);
|
|
25
|
-
},
|
|
25
|
+
}, space_1.space);
|
|
26
26
|
var templateObject_1;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SpaceProps } from '../../../helpers/styled';
|
|
1
|
+
import { SpaceProps } from '../../../helpers/styled/space';
|
|
2
2
|
import { ThemeColor, ThemeColorWithIntensity } from '../../../providers';
|
|
3
3
|
export declare const TabsViewContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
4
|
export declare const TabsListContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, SpaceProps>> & string;
|
|
@@ -28,11 +28,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
30
|
exports.TabContentContainer = exports.TabContainer = exports.TabsListContainer = exports.TabsViewContainer = void 0;
|
|
31
|
-
var
|
|
31
|
+
var space_1 = require("../../../helpers/styled/space");
|
|
32
32
|
var styled_components_1 = __importStar(require("styled-components"));
|
|
33
33
|
var helpers_1 = require("../../../providers/ThemeProvider/helpers");
|
|
34
34
|
exports.TabsViewContainer = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n height: 100%;\n"], ["\n display: flex;\n flex-direction: column;\n height: 100%;\n"])));
|
|
35
|
-
exports.TabsListContainer = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n gap: var(--space-4);\n flex-shrink: 0;\n overflow-x: scroll;\n scrollbar-width: none;\n font-size: var(--text-lg);\n white-space: nowrap;\n\n ", "\n"], ["\n display: flex;\n gap: var(--space-4);\n flex-shrink: 0;\n overflow-x: scroll;\n scrollbar-width: none;\n font-size: var(--text-lg);\n white-space: nowrap;\n\n ", "\n"])),
|
|
35
|
+
exports.TabsListContainer = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n gap: var(--space-4);\n flex-shrink: 0;\n overflow-x: scroll;\n scrollbar-width: none;\n font-size: var(--text-lg);\n white-space: nowrap;\n\n ", "\n"], ["\n display: flex;\n gap: var(--space-4);\n flex-shrink: 0;\n overflow-x: scroll;\n scrollbar-width: none;\n font-size: var(--text-lg);\n white-space: nowrap;\n\n ", "\n"])), space_1.space);
|
|
36
36
|
exports.TabContainer = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n height: var(--space-8);\n gap: var(--space-2);\n cursor: pointer;\n padding: 0 var(--space-2);\n color: var(--color-text-800);\n\n svg {\n height: var(--space-4);\n width: var(--space-4);\n fill: var(--color-base-800);\n }\n\n ", ";\n\n ", "\n"], ["\n display: flex;\n align-items: center;\n height: var(--space-8);\n gap: var(--space-2);\n cursor: pointer;\n padding: 0 var(--space-2);\n color: var(--color-text-800);\n\n svg {\n height: var(--space-4);\n width: var(--space-4);\n fill: var(--color-base-800);\n }\n\n ", ";\n\n ", "\n"])), function (_a) {
|
|
37
37
|
var _b = _a.$color, $color = _b === void 0 ? 'primary' : _b;
|
|
38
38
|
return (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n &:hover {\n color: var(--color-", ");\n svg {\n fill: var(--color-", ");\n }\n }\n "], ["\n &:hover {\n color: var(--color-", ");\n svg {\n fill: var(--color-", ");\n }\n }\n "])), (0, helpers_1.getColorWithIntensity)($color, 500), (0, helpers_1.getColorWithIntensity)($color, 500));
|
package/dist/helpers/index.d.ts
CHANGED
package/dist/helpers/index.js
CHANGED
|
@@ -18,5 +18,4 @@ __exportStar(require("./dates"), exports);
|
|
|
18
18
|
__exportStar(require("./numbers"), exports);
|
|
19
19
|
__exportStar(require("./text"), exports);
|
|
20
20
|
__exportStar(require("./responsive"), exports);
|
|
21
|
-
__exportStar(require("./styled"), exports);
|
|
22
21
|
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type TypographyProps = {
|
|
2
|
+
ellipsis?: boolean;
|
|
3
|
+
bold?: boolean;
|
|
4
|
+
italic?: boolean;
|
|
5
|
+
underline?: boolean;
|
|
6
|
+
lineClamp?: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const typography: import("styled-components").RuleSet<TypographyProps>;
|
|
9
|
+
export declare const StyledTypography: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, TypographyProps>> & string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
|
+
if (mod && mod.__esModule) return mod;
|
|
24
|
+
var result = {};
|
|
25
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
26
|
+
__setModuleDefault(result, mod);
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.StyledTypography = exports.typography = void 0;
|
|
31
|
+
var styled_components_1 = __importStar(require("styled-components"));
|
|
32
|
+
exports.typography = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n ", "\n ", "\n ", "\n ", "\n"], ["\n ", "\n ", "\n ", "\n ", "\n ", "\n"])), function (_a) {
|
|
33
|
+
var ellipsis = _a.ellipsis;
|
|
34
|
+
return ellipsis &&
|
|
35
|
+
'white-space: nowrap; overflow: hidden; text-overflow: ellipsis;';
|
|
36
|
+
}, function (_a) {
|
|
37
|
+
var bold = _a.bold;
|
|
38
|
+
return bold && 'font-weight: bold;';
|
|
39
|
+
}, function (_a) {
|
|
40
|
+
var italic = _a.italic;
|
|
41
|
+
return italic && 'font-style: italic;';
|
|
42
|
+
}, function (_a) {
|
|
43
|
+
var underline = _a.underline;
|
|
44
|
+
return underline && 'text-decoration: underline;';
|
|
45
|
+
}, function (_a) {
|
|
46
|
+
var lineClamp = _a.lineClamp;
|
|
47
|
+
return lineClamp &&
|
|
48
|
+
"display: -webkit-box; -webkit-line-clamp: ".concat(lineClamp, "; -webkit-box-orient: vertical; overflow: hidden;");
|
|
49
|
+
});
|
|
50
|
+
exports.StyledTypography = styled_components_1.default.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), exports.typography);
|
|
51
|
+
var templateObject_1, templateObject_2;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -21,3 +21,6 @@ __exportStar(require("./config"), exports);
|
|
|
21
21
|
__exportStar(require("./helpers"), exports);
|
|
22
22
|
__exportStar(require("./hooks"), exports);
|
|
23
23
|
__exportStar(require("./services"), exports);
|
|
24
|
+
// helpers
|
|
25
|
+
__exportStar(require("./helpers/styled/typography"), exports);
|
|
26
|
+
__exportStar(require("./helpers/styled/space"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@addev-be/ui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
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": "^1.1.
|
|
23
|
+
"@addev-be/framework-utils": "^1.1.5",
|
|
24
24
|
"@types/lodash": "^4",
|
|
25
25
|
"@types/react": "^18.3.3",
|
|
26
26
|
"@types/react-dom": "^18.3.0",
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
DataGridTextColumn,
|
|
12
12
|
} from '../types';
|
|
13
13
|
import { dateFilter, numberFilter, textFilter } from './filters';
|
|
14
|
+
import { formatDate, formatDateTime } from '../../../../helpers';
|
|
14
15
|
import {
|
|
15
16
|
formatMoney,
|
|
16
17
|
formatNumber,
|
|
@@ -20,9 +21,12 @@ import {
|
|
|
20
21
|
|
|
21
22
|
import { CheckboxEditableCell } from '../DataGridEditableCell/CheckboxEditableCell';
|
|
22
23
|
import { DateEditableCell } from '../DataGridEditableCell/DateEditableCell';
|
|
24
|
+
import { DeepPartial } from '../../../../typings';
|
|
23
25
|
import { NumberEditableCell } from '../DataGridEditableCell/NumberEditableCell';
|
|
24
26
|
import { Ref } from 'react';
|
|
25
27
|
import { Select } from '../../../forms/Form/Select';
|
|
28
|
+
import { SqlRequestDataGridTextColumn } from '../../SqlRequestDataGrid/types';
|
|
29
|
+
import { StyledTypography } from '../../../../helpers/styled/typography';
|
|
26
30
|
import { TextEditableCell } from '../DataGridEditableCell/TextEditableCell';
|
|
27
31
|
import { forwardRefWithName } from '../../../../helpers/components';
|
|
28
32
|
import moment from 'moment';
|
|
@@ -38,12 +42,15 @@ export const buildExcelFormat = (decimals = 2, suffix = '') =>
|
|
|
38
42
|
export const textColumn = <R extends Record<string, any>>(
|
|
39
43
|
key: string,
|
|
40
44
|
title: string,
|
|
45
|
+
options?: DeepPartial<SqlRequestDataGridTextColumn<R>>,
|
|
41
46
|
otherOptions?: Partial<DataGridTextColumn<R>>
|
|
42
47
|
): DataGridTextColumn<R> => ({
|
|
43
48
|
key,
|
|
44
49
|
type: 'text',
|
|
45
50
|
name: title,
|
|
46
|
-
render: (value
|
|
51
|
+
render: (value) => (
|
|
52
|
+
<StyledTypography {...options?.typography}>{value}</StyledTypography>
|
|
53
|
+
),
|
|
47
54
|
getter: (row) => row[key] ?? '',
|
|
48
55
|
sortGetter: (row) => row[key] ?? '',
|
|
49
56
|
footer: (_, filteredRows) => `${filteredRows.length} éléments`,
|
|
@@ -55,12 +62,21 @@ export const textColumn = <R extends Record<string, any>>(
|
|
|
55
62
|
export const mailColumn = <R extends Record<string, any>>(
|
|
56
63
|
key: string,
|
|
57
64
|
title: string,
|
|
65
|
+
options?: DeepPartial<SqlRequestDataGridTextColumn<R>>,
|
|
58
66
|
otherOptions?: Partial<DataGridTextColumn<R>>
|
|
59
67
|
): DataGridTextColumn<R> => ({
|
|
60
68
|
key,
|
|
61
69
|
type: 'text',
|
|
62
70
|
name: title,
|
|
63
|
-
render: (value
|
|
71
|
+
render: (value) => (
|
|
72
|
+
<StyledTypography
|
|
73
|
+
href={`mailto:${value}`}
|
|
74
|
+
{...options?.typography}
|
|
75
|
+
as={'a'}
|
|
76
|
+
>
|
|
77
|
+
{value}
|
|
78
|
+
</StyledTypography>
|
|
79
|
+
),
|
|
64
80
|
getter: (row) => row[key] ?? '',
|
|
65
81
|
sortGetter: (row) => row[key] ?? '',
|
|
66
82
|
footer: (_, filteredRows) => `${filteredRows.length} éléments`,
|
|
@@ -72,12 +88,17 @@ export const mailColumn = <R extends Record<string, any>>(
|
|
|
72
88
|
export const phoneColumn = <R extends Record<string, any>>(
|
|
73
89
|
key: string,
|
|
74
90
|
title: string,
|
|
91
|
+
options?: DeepPartial<SqlRequestDataGridTextColumn<R>>,
|
|
75
92
|
otherOptions?: Partial<DataGridTextColumn<R>>
|
|
76
93
|
): DataGridTextColumn<R> => ({
|
|
77
94
|
key,
|
|
78
95
|
type: 'text',
|
|
79
96
|
name: title,
|
|
80
|
-
render: (value
|
|
97
|
+
render: (value) => (
|
|
98
|
+
<StyledTypography href={`tel:${value}`} {...options?.typography} as={'a'}>
|
|
99
|
+
{value}
|
|
100
|
+
</StyledTypography>
|
|
101
|
+
),
|
|
81
102
|
getter: (row) => row[key] ?? '',
|
|
82
103
|
sortGetter: (row) => row[key] ?? '',
|
|
83
104
|
footer: (_, filteredRows) => `${filteredRows.length} éléments`,
|
|
@@ -89,12 +110,17 @@ export const phoneColumn = <R extends Record<string, any>>(
|
|
|
89
110
|
export const dateColumn = <R extends Record<string, any>>(
|
|
90
111
|
key: string,
|
|
91
112
|
title: string,
|
|
113
|
+
options?: DeepPartial<SqlRequestDataGridTextColumn<R>>,
|
|
92
114
|
otherOptions?: Partial<DataGridDateColumn<R>>
|
|
93
115
|
): DataGridDateColumn<R> => ({
|
|
94
116
|
key,
|
|
95
117
|
type: 'date',
|
|
96
118
|
name: title,
|
|
97
|
-
render: (value
|
|
119
|
+
render: (value) => (
|
|
120
|
+
<StyledTypography {...options?.typography}>
|
|
121
|
+
{formatDate(value)}
|
|
122
|
+
</StyledTypography>
|
|
123
|
+
),
|
|
98
124
|
excelOptions: {
|
|
99
125
|
formatter: () => 'dd/mm/yyyy',
|
|
100
126
|
valueGetter: (value) => moment(value).format('DD/MM/YYYY') ?? '',
|
|
@@ -113,12 +139,17 @@ export const dateColumn = <R extends Record<string, any>>(
|
|
|
113
139
|
export const dateTimeColumn = <R extends Record<string, any>>(
|
|
114
140
|
key: string,
|
|
115
141
|
title: string,
|
|
142
|
+
options?: DeepPartial<SqlRequestDataGridTextColumn<R>>,
|
|
116
143
|
otherOptions?: Partial<DataGridDateColumn<R>>
|
|
117
144
|
): DataGridDateColumn<R> => ({
|
|
118
145
|
key,
|
|
119
146
|
type: 'date',
|
|
120
147
|
name: title,
|
|
121
|
-
render: (value
|
|
148
|
+
render: (value) => (
|
|
149
|
+
<StyledTypography {...options?.typography}>
|
|
150
|
+
{formatDateTime(value)}
|
|
151
|
+
</StyledTypography>
|
|
152
|
+
),
|
|
122
153
|
excelOptions: {
|
|
123
154
|
formatter: () => 'dd/mm/yyyy hh:mm:ss',
|
|
124
155
|
valueGetter: (value) => moment(value).format('DD/MM/YYYY HH:mm:ss') ?? '',
|
|
@@ -137,12 +168,17 @@ export const dateTimeColumn = <R extends Record<string, any>>(
|
|
|
137
168
|
export const monthColumn = <R extends Record<string, any>>(
|
|
138
169
|
key: string,
|
|
139
170
|
title: string,
|
|
171
|
+
options?: DeepPartial<SqlRequestDataGridTextColumn<R>>,
|
|
140
172
|
otherOptions?: Partial<DataGridTextColumn<R>>
|
|
141
173
|
): DataGridTextColumn<R> => ({
|
|
142
174
|
key,
|
|
143
175
|
type: 'text',
|
|
144
176
|
name: title,
|
|
145
|
-
render: (value
|
|
177
|
+
render: (value) => (
|
|
178
|
+
<StyledTypography {...options?.typography}>
|
|
179
|
+
{value + 'Mois'}
|
|
180
|
+
</StyledTypography>
|
|
181
|
+
),
|
|
146
182
|
getter: (row) => row[key] ?? '',
|
|
147
183
|
sortGetter: (row) => row[key] ?? '',
|
|
148
184
|
footer: (_, filteredRows) => `${filteredRows.length} éléments`,
|
|
@@ -154,13 +190,18 @@ export const numberColumn = <R extends Record<string, any>>(
|
|
|
154
190
|
key: string,
|
|
155
191
|
title: string,
|
|
156
192
|
decimals = 2,
|
|
193
|
+
options?: DeepPartial<SqlRequestDataGridTextColumn<R>>,
|
|
157
194
|
otherOptions?: Partial<DataGridNumberColumn<R>>
|
|
158
195
|
): DataGridNumberColumn<R> => {
|
|
159
196
|
const column: DataGridNumberColumn<R> = {
|
|
160
197
|
key,
|
|
161
198
|
type: 'number',
|
|
162
199
|
name: title,
|
|
163
|
-
render: (value
|
|
200
|
+
render: (value) => (
|
|
201
|
+
<StyledTypography {...options?.typography}>
|
|
202
|
+
{formatNumber(value, decimals)}
|
|
203
|
+
</StyledTypography>
|
|
204
|
+
),
|
|
164
205
|
excelOptions: {
|
|
165
206
|
formatter: () => buildExcelFormat(decimals),
|
|
166
207
|
valueGetter: (value) => formatNumberInvariant(value, decimals),
|
|
@@ -215,13 +256,26 @@ export const moneyColumn = <R extends Record<string, any>>(
|
|
|
215
256
|
key: string,
|
|
216
257
|
title: string,
|
|
217
258
|
decimals = 2,
|
|
259
|
+
currency: string | ((row: R) => string) = '€',
|
|
260
|
+
options?: DeepPartial<SqlRequestDataGridTextColumn<R>>,
|
|
218
261
|
otherOptions?: Partial<DataGridNumberColumn<R>>
|
|
219
262
|
): DataGridNumberColumn<R> => {
|
|
220
263
|
const column: DataGridNumberColumn<R> = {
|
|
221
264
|
key,
|
|
222
265
|
type: 'number',
|
|
223
266
|
name: title,
|
|
224
|
-
render:
|
|
267
|
+
render:
|
|
268
|
+
typeof currency === 'function'
|
|
269
|
+
? (value, row) => (
|
|
270
|
+
<StyledTypography {...options?.typography}>
|
|
271
|
+
{formatMoney(value, decimals, currency(row))}
|
|
272
|
+
</StyledTypography>
|
|
273
|
+
)
|
|
274
|
+
: (value) => (
|
|
275
|
+
<StyledTypography {...options?.typography}>
|
|
276
|
+
{formatMoney(value, decimals, currency)}
|
|
277
|
+
</StyledTypography>
|
|
278
|
+
),
|
|
225
279
|
excelOptions: {
|
|
226
280
|
formatter: () => buildExcelFormat(decimals, ' €'),
|
|
227
281
|
valueGetter: (value) => formatNumberInvariant(value, decimals),
|
|
@@ -265,13 +319,18 @@ export const percentageColumn = <R extends Record<string, any>>(
|
|
|
265
319
|
key: string,
|
|
266
320
|
title: string,
|
|
267
321
|
decimals = 2,
|
|
322
|
+
options?: DeepPartial<SqlRequestDataGridTextColumn<R>>,
|
|
268
323
|
otherOptions?: Partial<DataGridNumberColumn<R>>
|
|
269
324
|
): DataGridNumberColumn<R> => {
|
|
270
325
|
const column: DataGridNumberColumn<R> = {
|
|
271
326
|
key,
|
|
272
327
|
type: 'number',
|
|
273
328
|
name: title,
|
|
274
|
-
render: (value
|
|
329
|
+
render: (value) => (
|
|
330
|
+
<StyledTypography {...options?.typography}>
|
|
331
|
+
{formatPercentage(value)}
|
|
332
|
+
</StyledTypography>
|
|
333
|
+
),
|
|
275
334
|
excelOptions: {
|
|
276
335
|
formatter: () => buildExcelFormat(decimals, '%'),
|
|
277
336
|
valueGetter: (value) => formatNumberInvariant(value, decimals),
|
|
@@ -20,7 +20,7 @@ import { DataGridHeader } from './DataGridHeader';
|
|
|
20
20
|
import { DataGridRowTemplate } from './DataGridRowTemplate';
|
|
21
21
|
import { DataGridToolbar } from './DataGridToolbar';
|
|
22
22
|
import { VirtualScroller } from '../VirtualScroller';
|
|
23
|
-
import { extractSpaceProps } from '../../../helpers/styled';
|
|
23
|
+
import { extractSpaceProps } from '../../../helpers/styled/space';
|
|
24
24
|
import { useDataGrid } from './hooks';
|
|
25
25
|
|
|
26
26
|
export const DataGridInner = <R,>(
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
SELECTION_CELL_WIDTH,
|
|
6
6
|
TOOLBAR_HEIGHT,
|
|
7
7
|
} from './constants';
|
|
8
|
-
import { SpaceProps, space } from '../../../helpers/styled';
|
|
8
|
+
import { SpaceProps, space } from '../../../helpers/styled/space';
|
|
9
9
|
import styled, { css } from 'styled-components';
|
|
10
10
|
|
|
11
11
|
import { DataGridCellFCProps } from './types';
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from 'react';
|
|
15
15
|
|
|
16
16
|
import { DataGridEditableCellFC } from './DataGridEditableCell/types';
|
|
17
|
-
import { SpaceProps } from '../../../helpers/styled';
|
|
17
|
+
import { SpaceProps } from '../../../helpers/styled/space';
|
|
18
18
|
import { ThemeColor } from '../../../providers/ThemeProvider/types';
|
|
19
19
|
|
|
20
20
|
export type DataGridCellFCProps = {
|
|
@@ -52,6 +52,14 @@ type CommonGridColumnProps<R, T> = {
|
|
|
52
52
|
component?: DataGridCellFC;
|
|
53
53
|
color?: ThemeColor;
|
|
54
54
|
excelOptions?: ExcelOptions;
|
|
55
|
+
typography?: {
|
|
56
|
+
bold?: boolean;
|
|
57
|
+
italic?: boolean;
|
|
58
|
+
underline?: boolean;
|
|
59
|
+
ellipsis?: boolean;
|
|
60
|
+
lineClamp?: number;
|
|
61
|
+
};
|
|
62
|
+
|
|
55
63
|
textAlign?: 'left' | 'right' | 'center';
|
|
56
64
|
filter?: DataGridFilter;
|
|
57
65
|
footer?:
|
|
@@ -32,6 +32,7 @@ import { DeepPartial } from '../../../../typings';
|
|
|
32
32
|
import { NumberEditableCell } from '../../DataGrid/DataGridEditableCell/NumberEditableCell';
|
|
33
33
|
import { SqlRequestForeignList } from '../../SqlRequestForeignList';
|
|
34
34
|
import { SqlRequestForeignListItemFC } from '../../SqlRequestForeignList/types';
|
|
35
|
+
import { StyledTypography } from '../../../../helpers/styled/typography';
|
|
35
36
|
import { TextEditableCell } from '../../DataGrid/DataGridEditableCell/TextEditableCell';
|
|
36
37
|
|
|
37
38
|
export const sqlTextColumn = <R extends Record<string, any>>(
|
|
@@ -44,7 +45,9 @@ export const sqlTextColumn = <R extends Record<string, any>>(
|
|
|
44
45
|
key,
|
|
45
46
|
type: 'text',
|
|
46
47
|
name: title,
|
|
47
|
-
render: (value) =>
|
|
48
|
+
render: (value) => (
|
|
49
|
+
<StyledTypography {...options?.typography}>{value}</StyledTypography>
|
|
50
|
+
),
|
|
48
51
|
getter: (row) => row[key] ?? '',
|
|
49
52
|
sortGetter: (row) => row[key] ?? '',
|
|
50
53
|
filter: { ...textFilter(key), getter: (value) => value[key] ?? '' },
|
|
@@ -64,7 +67,15 @@ export const sqlMailColumn = <R extends Record<string, any>>(
|
|
|
64
67
|
key,
|
|
65
68
|
type: 'text',
|
|
66
69
|
name: title,
|
|
67
|
-
render: (value) =>
|
|
70
|
+
render: (value) => (
|
|
71
|
+
<StyledTypography
|
|
72
|
+
href={`mailto:${value}`}
|
|
73
|
+
{...options?.typography}
|
|
74
|
+
as={'a'}
|
|
75
|
+
>
|
|
76
|
+
{value}
|
|
77
|
+
</StyledTypography>
|
|
78
|
+
),
|
|
68
79
|
getter: (row) => row[key] ?? '',
|
|
69
80
|
sortGetter: (row) => row[key] ?? '',
|
|
70
81
|
filter: { ...textFilter(key), getter: (value) => value[key] ?? '' },
|
|
@@ -84,7 +95,15 @@ export const sqlPhoneColumn = <R extends Record<string, any>>(
|
|
|
84
95
|
key,
|
|
85
96
|
type: 'text',
|
|
86
97
|
name: title,
|
|
87
|
-
render: (value) =>
|
|
98
|
+
render: (value) => (
|
|
99
|
+
<StyledTypography
|
|
100
|
+
href={`tel:${value}`}
|
|
101
|
+
{...options?.typography}
|
|
102
|
+
as={'a'}
|
|
103
|
+
>
|
|
104
|
+
{value}
|
|
105
|
+
</StyledTypography>
|
|
106
|
+
),
|
|
88
107
|
getter: (row) => row[key] ?? '',
|
|
89
108
|
sortGetter: (row) => row[key] ?? '',
|
|
90
109
|
filter: { ...textFilter(key), getter: (value) => value[key] ?? '' },
|
|
@@ -104,7 +123,11 @@ export const sqlDateColumn = <R extends Record<string, any>>(
|
|
|
104
123
|
key,
|
|
105
124
|
name: title,
|
|
106
125
|
type: 'date',
|
|
107
|
-
render: (value) =>
|
|
126
|
+
render: (value) => (
|
|
127
|
+
<StyledTypography {...options?.typography}>
|
|
128
|
+
{formatDate(value)}
|
|
129
|
+
</StyledTypography>
|
|
130
|
+
),
|
|
108
131
|
getter: (row) => row[key] ?? '',
|
|
109
132
|
sortGetter: (row) => row[key] ?? '',
|
|
110
133
|
excelOptions: {
|
|
@@ -133,7 +156,11 @@ export const sqlDateTimeColumn = <R extends Record<string, any>>(
|
|
|
133
156
|
key,
|
|
134
157
|
name: title,
|
|
135
158
|
type: 'date',
|
|
136
|
-
render: (value) =>
|
|
159
|
+
render: (value) => (
|
|
160
|
+
<StyledTypography {...options?.typography}>
|
|
161
|
+
{formatDateTime(value)}
|
|
162
|
+
</StyledTypography>
|
|
163
|
+
),
|
|
137
164
|
getter: (row) => row[key] ?? '',
|
|
138
165
|
sortGetter: (row) => row[key] ?? '',
|
|
139
166
|
excelOptions: {
|
|
@@ -162,7 +189,11 @@ export const sqlMonthColumn = <R extends Record<string, any>>(
|
|
|
162
189
|
key,
|
|
163
190
|
type: 'text',
|
|
164
191
|
name: title,
|
|
165
|
-
render: (value) => (
|
|
192
|
+
render: (value) => (
|
|
193
|
+
<StyledTypography {...options?.typography}>
|
|
194
|
+
{value + 'Mois'}
|
|
195
|
+
</StyledTypography>
|
|
196
|
+
),
|
|
166
197
|
getter: (row) => row[key] ?? '',
|
|
167
198
|
sortGetter: (row) => row[key] ?? '',
|
|
168
199
|
filter: { ...textFilter(key), getter: (value) => value[key] ?? '' },
|
|
@@ -183,7 +214,11 @@ export const sqlNumberColumn = <R extends Record<string, any>>(
|
|
|
183
214
|
type: 'number',
|
|
184
215
|
decimals,
|
|
185
216
|
textAlign: 'right',
|
|
186
|
-
render: (value) =>
|
|
217
|
+
render: (value) => (
|
|
218
|
+
<StyledTypography {...options?.typography}>
|
|
219
|
+
{formatNumber(value, decimals)}
|
|
220
|
+
</StyledTypography>
|
|
221
|
+
),
|
|
187
222
|
excelOptions: {
|
|
188
223
|
formatter: () => buildExcelFormat(decimals),
|
|
189
224
|
valueGetter: (value) => formatNumberInvariant(value, decimals),
|
|
@@ -232,8 +267,16 @@ export const sqlMoneyColumn = <R extends Record<string, any>>(
|
|
|
232
267
|
textAlign: 'right',
|
|
233
268
|
render:
|
|
234
269
|
typeof currency === 'function'
|
|
235
|
-
? (value, row) =>
|
|
236
|
-
|
|
270
|
+
? (value, row) => (
|
|
271
|
+
<StyledTypography {...options?.typography}>
|
|
272
|
+
{formatMoney(value, decimals, currency(row))}
|
|
273
|
+
</StyledTypography>
|
|
274
|
+
)
|
|
275
|
+
: (value) => (
|
|
276
|
+
<StyledTypography {...options?.typography}>
|
|
277
|
+
{formatMoney(value, decimals, currency)}
|
|
278
|
+
</StyledTypography>
|
|
279
|
+
),
|
|
237
280
|
excelOptions: {
|
|
238
281
|
formatter:
|
|
239
282
|
typeof currency === 'function'
|
|
@@ -280,7 +323,11 @@ export const sqlPercentageColumn = <R extends Record<string, any>>(
|
|
|
280
323
|
key,
|
|
281
324
|
name: title,
|
|
282
325
|
type: 'number',
|
|
283
|
-
render: (value) =>
|
|
326
|
+
render: (value) => (
|
|
327
|
+
<StyledTypography {...options?.typography}>
|
|
328
|
+
{formatPercentage(value)}
|
|
329
|
+
</StyledTypography>
|
|
330
|
+
),
|
|
284
331
|
excelOptions: {
|
|
285
332
|
formatter: () => buildExcelFormat(decimals, '%'),
|
|
286
333
|
valueGetter: (value) => formatNumberInvariant(value, decimals),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SpaceProps, space } from '../../helpers';
|
|
1
|
+
import { SpaceProps, space } from '../../helpers/styled/space';
|
|
2
2
|
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
|
|
@@ -11,6 +11,7 @@ export const Columns = styled.div<ColumnsProps>`
|
|
|
11
11
|
display: grid;
|
|
12
12
|
grid-gap: var(--space-6);
|
|
13
13
|
width: 100%;
|
|
14
|
+
box-sizing: border-box;
|
|
14
15
|
|
|
15
16
|
grid-template-columns: ${({ columns = 1, $maxColumnWidth = '1fr' }) =>
|
|
16
17
|
typeof columns === 'number'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FC, useEffect, useState } from 'react';
|
|
2
2
|
import { TabContainer, TabsListContainer } from './styles';
|
|
3
3
|
|
|
4
|
-
import { SpaceProps } from '../../../helpers';
|
|
4
|
+
import { SpaceProps } from '../../../helpers/styled/space';
|
|
5
5
|
import { Tab } from './types';
|
|
6
6
|
|
|
7
7
|
type TabsListProps = {
|
package/src/helpers/index.ts
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
export type TypographyProps = {
|
|
4
|
+
ellipsis?: boolean;
|
|
5
|
+
bold?: boolean;
|
|
6
|
+
italic?: boolean;
|
|
7
|
+
underline?: boolean;
|
|
8
|
+
lineClamp?: number;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const typography = css<TypographyProps>`
|
|
12
|
+
${({ ellipsis }) =>
|
|
13
|
+
ellipsis &&
|
|
14
|
+
'white-space: nowrap; overflow: hidden; text-overflow: ellipsis;'}
|
|
15
|
+
${({ bold }) => bold && 'font-weight: bold;'}
|
|
16
|
+
${({ italic }) => italic && 'font-style: italic;'}
|
|
17
|
+
${({ underline }) => underline && 'text-decoration: underline;'}
|
|
18
|
+
${({ lineClamp }) =>
|
|
19
|
+
lineClamp &&
|
|
20
|
+
`display: -webkit-box; -webkit-line-clamp: ${lineClamp}; -webkit-box-orient: vertical; overflow: hidden;`}
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
export const StyledTypography = styled.span<TypographyProps>`
|
|
24
|
+
${typography}
|
|
25
|
+
`;
|
package/src/index.ts
CHANGED
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/icons.tsx","./src/index.ts","./src/typings.d.ts","./src/components/index.ts","./src/components/auth/loginform.tsx","./src/components/auth/loginpage.tsx","./src/components/auth/passwordrecoveryform.tsx","./src/components/auth/passwordresetform.tsx","./src/components/auth/index.ts","./src/components/auth/styles.ts","./src/components/data/index.ts","./src/components/data/datagrid/datagridcell.tsx","./src/components/data/datagrid/datagridfooter.tsx","./src/components/data/datagrid/datagridheader.tsx","./src/components/data/datagrid/datagridheadercell.tsx","./src/components/data/datagrid/datagridrowtemplate.tsx","./src/components/data/datagrid/datagridtoolbar.tsx","./src/components/data/datagrid/constants.ts","./src/components/data/datagrid/index.tsx","./src/components/data/datagrid/styles.ts","./src/components/data/datagrid/types.ts","./src/components/data/datagrid/datagridcolumnsmodal/helpers.ts","./src/components/data/datagrid/datagridcolumnsmodal/hooks.tsx","./src/components/data/datagrid/datagridcolumnsmodal/index.tsx","./src/components/data/datagrid/datagridcolumnsmodal/styles.ts","./src/components/data/datagrid/datagrideditablecell/checkboxeditablecell.tsx","./src/components/data/datagrid/datagrideditablecell/dateeditablecell.tsx","./src/components/data/datagrid/datagrideditablecell/numbereditablecell.tsx","./src/components/data/datagrid/datagrideditablecell/texteditablecell.tsx","./src/components/data/datagrid/datagrideditablecell/index.tsx","./src/components/data/datagrid/datagrideditablecell/styles.ts","./src/components/data/datagrid/datagrideditablecell/types.ts","./src/components/data/datagrid/datagridfiltermenu/filtervaluesscroller.tsx","./src/components/data/datagrid/datagridfiltermenu/helpers.ts","./src/components/data/datagrid/datagridfiltermenu/hooks.tsx","./src/components/data/datagrid/datagridfiltermenu/index.tsx","./src/components/data/datagrid/datagridfiltermenu/styles.ts","./src/components/data/datagrid/filtermodalcontent/index.tsx","./src/components/data/datagrid/filtermodalcontent/styles.ts","./src/components/data/datagrid/helpers/columns.tsx","./src/components/data/datagrid/helpers/filters.ts","./src/components/data/datagrid/helpers/index.ts","./src/components/data/datagrid/hooks/index.ts","./src/components/data/datagrid/hooks/usedatagrid.tsx","./src/components/data/datagrid/hooks/usedatagridchangedrows.ts","./src/components/data/datagrid/hooks/usedatagridcopy.ts","./src/components/data/datagrid/hooks/usedatagridsettings.ts","./src/components/data/datagrid/hooks/userefreshmodal.tsx","./src/components/data/sqlrequestdatagrid/sqlrequestforeignlisteditablecell.tsx","./src/components/data/sqlrequestdatagrid/index.tsx","./src/components/data/sqlrequestdatagrid/styles.ts","./src/components/data/sqlrequestdatagrid/types.ts","./src/components/data/sqlrequestdatagrid/helpers/columns.tsx","./src/components/data/sqlrequestdatagrid/helpers/index.ts","./src/components/data/sqlrequestdatagrid/helpers/sqlrequests.ts","./src/components/data/sqlrequestforeignlist/index.tsx","./src/components/data/sqlrequestforeignlist/styles.ts","./src/components/data/sqlrequestforeignlist/types.ts","./src/components/data/sqlrequestgrid/index.tsx","./src/components/data/sqlrequestgrid/styles.ts","./src/components/data/sqlrequestgrid/types.ts","./src/components/data/sqlrequestgrid/filters/filterssidebar.tsx","./src/components/data/sqlrequestgrid/filters/styles.ts","./src/components/data/sqlrequestgrid/helpers/index.ts","./src/components/data/sqlrequestgrid/helpers/sqlrequests.ts","./src/components/data/virtualscroller/hooks.ts","./src/components/data/virtualscroller/index.tsx","./src/components/data/virtualscroller/styles.ts","./src/components/data/virtualscroller/types.ts","./src/components/forms/autotextarea.tsx","./src/components/forms/button.tsx","./src/components/forms/iconbutton.tsx","./src/components/forms/indeterminatecheckbox.tsx","./src/components/forms/numberinput.tsx","./src/components/forms/select.tsx","./src/components/forms/verticallabel.tsx","./src/components/forms/index.ts","./src/components/forms/styles.ts","./src/components/forms/form/checkbox.tsx","./src/components/forms/form/formgroup.tsx","./src/components/forms/form/input.tsx","./src/components/forms/form/row.tsx","./src/components/forms/form/select.tsx","./src/components/forms/form/textarea.tsx","./src/components/forms/form/index.tsx","./src/components/forms/form/styles.ts","./src/components/layout/columns.ts","./src/components/layout/flexbox.ts","./src/components/layout/index.ts","./src/components/layout/dropdown/index.tsx","./src/components/layout/dropdown/styles.ts","./src/components/layout/grid/index.tsx","./src/components/layout/grid/styles.ts","./src/components/layout/loading/index.tsx","./src/components/layout/loading/styles.ts","./src/components/layout/masonry/index.tsx","./src/components/layout/masonry/styles.ts","./src/components/layout/modal/index.tsx","./src/components/layout/modal/styles.ts","./src/components/search/highlightedtext.tsx","./src/components/search/quicksearchbar.tsx","./src/components/search/quicksearchresults.tsx","./src/components/search/index.ts","./src/components/search/styles.ts","./src/components/search/types.ts","./src/components/ui/ellipsis.tsx","./src/components/ui/label.tsx","./src/components/ui/index.ts","./src/components/ui/avatar/index.tsx","./src/components/ui/avatar/styles.ts","./src/components/ui/card/index.tsx","./src/components/ui/card/styles.ts","./src/components/ui/contextmenu/index.tsx","./src/components/ui/contextmenu/styles.ts","./src/components/ui/message/index.tsx","./src/components/ui/message/styles.ts","./src/components/ui/tabsview/tabslist.tsx","./src/components/ui/tabsview/tabsview.tsx","./src/components/ui/tabsview/index.ts","./src/components/ui/tabsview/styles.ts","./src/components/ui/tabsview/types.ts","./src/config/index.ts","./src/helpers/components.ts","./src/helpers/dates.ts","./src/helpers/getscrollbarsize.ts","./src/helpers/index.ts","./src/helpers/numbers.ts","./src/helpers/responsive.ts","./src/helpers/text.ts","./src/helpers/types.ts","./src/helpers/styled/
|
|
1
|
+
{"root":["./src/icons.tsx","./src/index.ts","./src/typings.d.ts","./src/components/index.ts","./src/components/auth/loginform.tsx","./src/components/auth/loginpage.tsx","./src/components/auth/passwordrecoveryform.tsx","./src/components/auth/passwordresetform.tsx","./src/components/auth/index.ts","./src/components/auth/styles.ts","./src/components/data/index.ts","./src/components/data/datagrid/datagridcell.tsx","./src/components/data/datagrid/datagridfooter.tsx","./src/components/data/datagrid/datagridheader.tsx","./src/components/data/datagrid/datagridheadercell.tsx","./src/components/data/datagrid/datagridrowtemplate.tsx","./src/components/data/datagrid/datagridtoolbar.tsx","./src/components/data/datagrid/constants.ts","./src/components/data/datagrid/index.tsx","./src/components/data/datagrid/styles.ts","./src/components/data/datagrid/types.ts","./src/components/data/datagrid/datagridcolumnsmodal/helpers.ts","./src/components/data/datagrid/datagridcolumnsmodal/hooks.tsx","./src/components/data/datagrid/datagridcolumnsmodal/index.tsx","./src/components/data/datagrid/datagridcolumnsmodal/styles.ts","./src/components/data/datagrid/datagrideditablecell/checkboxeditablecell.tsx","./src/components/data/datagrid/datagrideditablecell/dateeditablecell.tsx","./src/components/data/datagrid/datagrideditablecell/numbereditablecell.tsx","./src/components/data/datagrid/datagrideditablecell/texteditablecell.tsx","./src/components/data/datagrid/datagrideditablecell/index.tsx","./src/components/data/datagrid/datagrideditablecell/styles.ts","./src/components/data/datagrid/datagrideditablecell/types.ts","./src/components/data/datagrid/datagridfiltermenu/filtervaluesscroller.tsx","./src/components/data/datagrid/datagridfiltermenu/helpers.ts","./src/components/data/datagrid/datagridfiltermenu/hooks.tsx","./src/components/data/datagrid/datagridfiltermenu/index.tsx","./src/components/data/datagrid/datagridfiltermenu/styles.ts","./src/components/data/datagrid/filtermodalcontent/index.tsx","./src/components/data/datagrid/filtermodalcontent/styles.ts","./src/components/data/datagrid/helpers/columns.tsx","./src/components/data/datagrid/helpers/filters.ts","./src/components/data/datagrid/helpers/index.ts","./src/components/data/datagrid/hooks/index.ts","./src/components/data/datagrid/hooks/usedatagrid.tsx","./src/components/data/datagrid/hooks/usedatagridchangedrows.ts","./src/components/data/datagrid/hooks/usedatagridcopy.ts","./src/components/data/datagrid/hooks/usedatagridsettings.ts","./src/components/data/datagrid/hooks/userefreshmodal.tsx","./src/components/data/sqlrequestdatagrid/sqlrequestforeignlisteditablecell.tsx","./src/components/data/sqlrequestdatagrid/index.tsx","./src/components/data/sqlrequestdatagrid/styles.ts","./src/components/data/sqlrequestdatagrid/types.ts","./src/components/data/sqlrequestdatagrid/helpers/columns.tsx","./src/components/data/sqlrequestdatagrid/helpers/index.ts","./src/components/data/sqlrequestdatagrid/helpers/sqlrequests.ts","./src/components/data/sqlrequestforeignlist/index.tsx","./src/components/data/sqlrequestforeignlist/styles.ts","./src/components/data/sqlrequestforeignlist/types.ts","./src/components/data/sqlrequestgrid/index.tsx","./src/components/data/sqlrequestgrid/styles.ts","./src/components/data/sqlrequestgrid/types.ts","./src/components/data/sqlrequestgrid/filters/filterssidebar.tsx","./src/components/data/sqlrequestgrid/filters/styles.ts","./src/components/data/sqlrequestgrid/helpers/index.ts","./src/components/data/sqlrequestgrid/helpers/sqlrequests.ts","./src/components/data/virtualscroller/hooks.ts","./src/components/data/virtualscroller/index.tsx","./src/components/data/virtualscroller/styles.ts","./src/components/data/virtualscroller/types.ts","./src/components/forms/autotextarea.tsx","./src/components/forms/button.tsx","./src/components/forms/iconbutton.tsx","./src/components/forms/indeterminatecheckbox.tsx","./src/components/forms/numberinput.tsx","./src/components/forms/select.tsx","./src/components/forms/verticallabel.tsx","./src/components/forms/index.ts","./src/components/forms/styles.ts","./src/components/forms/form/checkbox.tsx","./src/components/forms/form/formgroup.tsx","./src/components/forms/form/input.tsx","./src/components/forms/form/row.tsx","./src/components/forms/form/select.tsx","./src/components/forms/form/textarea.tsx","./src/components/forms/form/index.tsx","./src/components/forms/form/styles.ts","./src/components/layout/columns.ts","./src/components/layout/flexbox.ts","./src/components/layout/index.ts","./src/components/layout/dropdown/index.tsx","./src/components/layout/dropdown/styles.ts","./src/components/layout/grid/index.tsx","./src/components/layout/grid/styles.ts","./src/components/layout/loading/index.tsx","./src/components/layout/loading/styles.ts","./src/components/layout/masonry/index.tsx","./src/components/layout/masonry/styles.ts","./src/components/layout/modal/index.tsx","./src/components/layout/modal/styles.ts","./src/components/search/highlightedtext.tsx","./src/components/search/quicksearchbar.tsx","./src/components/search/quicksearchresults.tsx","./src/components/search/index.ts","./src/components/search/styles.ts","./src/components/search/types.ts","./src/components/ui/ellipsis.tsx","./src/components/ui/label.tsx","./src/components/ui/index.ts","./src/components/ui/avatar/index.tsx","./src/components/ui/avatar/styles.ts","./src/components/ui/card/index.tsx","./src/components/ui/card/styles.ts","./src/components/ui/contextmenu/index.tsx","./src/components/ui/contextmenu/styles.ts","./src/components/ui/message/index.tsx","./src/components/ui/message/styles.ts","./src/components/ui/tabsview/tabslist.tsx","./src/components/ui/tabsview/tabsview.tsx","./src/components/ui/tabsview/index.ts","./src/components/ui/tabsview/styles.ts","./src/components/ui/tabsview/types.ts","./src/config/index.ts","./src/helpers/components.ts","./src/helpers/dates.ts","./src/helpers/getscrollbarsize.ts","./src/helpers/index.ts","./src/helpers/numbers.ts","./src/helpers/responsive.ts","./src/helpers/text.ts","./src/helpers/types.ts","./src/helpers/styled/space.ts","./src/helpers/styled/typography.ts","./src/hooks/index.ts","./src/hooks/usecontainermediaquery.ts","./src/hooks/useelementsize.ts","./src/hooks/usemediaquery.ts","./src/hooks/usemediaqueryforwidth.ts","./src/hooks/usemutablestate.ts","./src/hooks/useshowarchived.ts","./src/hooks/usewindowsize.ts","./src/providers/hooks.ts","./src/providers/index.ts","./src/providers/authenticationprovider/helpers.ts","./src/providers/authenticationprovider/index.tsx","./src/providers/loadingprovider/index.tsx","./src/providers/portalsprovider/index.tsx","./src/providers/portalsprovider/styles.ts","./src/providers/settingsprovider/index.tsx","./src/providers/themeprovider/themeprovider.ts","./src/providers/themeprovider/defaulttheme.ts","./src/providers/themeprovider/helpers.ts","./src/providers/themeprovider/index.ts","./src/providers/themeprovider/types.ts","./src/providers/toastprovider/index.tsx","./src/providers/trackingprovider/hooks.ts","./src/providers/trackingprovider/index.tsx","./src/providers/uiproviders/index.tsx","./src/providers/uiproviders/styles.ts","./src/services/httpservice.ts","./src/services/websocketservice.ts","./src/services/advancedrequests.ts","./src/services/base.ts","./src/services/globalsearch.ts","./src/services/hooks.ts","./src/services/index.ts","./src/services/smartqueries.ts","./src/services/smartrequests.ts","./src/services/sqlrequests.ts","./src/services/updatesqlrequests.ts","./src/services/requests/auth.ts","./src/services/requests/generic.ts","./src/services/requests/tracking.ts","./src/services/requests/userprofiles.ts","./src/services/requests/users.ts","./src/services/types/auth.ts","./src/services/types/base.ts","./src/services/types/generic.ts","./src/services/types/tracking.ts","./src/services/types/userprofiles.ts","./src/services/types/users.ts"],"version":"5.6.2"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './space';
|