@addev-be/ui 2.1.2 → 2.1.4

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.
@@ -147,11 +147,11 @@ var sqlNumberColumn = function (key, title, decimals, options) {
147
147
  sortGetter: function (row) { var _a; return (_a = row[key]) !== null && _a !== void 0 ? _a : 0; },
148
148
  filter: __assign(__assign({}, (0, helpers_1.numberFilter)(key)), { getter: function (value) { var _a; return (_a = value[key]) !== null && _a !== void 0 ? _a : 0; }, renderer: function (value) { var _a; return (_a = (0, numbers_1.formatNumber)(value, decimals)) !== null && _a !== void 0 ? _a : ''; } }),
149
149
  footer: {
150
- sum: null,
151
- avg: null,
152
- count: null,
153
- max: null,
154
- min: null,
150
+ sum: function (rows) { var _a, _b; return (0, numbers_1.formatNumber)((_b = (_a = rows[0]) === null || _a === void 0 ? void 0 : _a[key]) !== null && _b !== void 0 ? _b : 0, decimals); },
151
+ avg: function (rows) { var _a, _b; return (0, numbers_1.formatNumber)((_b = (_a = rows[0]) === null || _a === void 0 ? void 0 : _a[key]) !== null && _b !== void 0 ? _b : 0, decimals); },
152
+ count: function (rows) { var _a, _b; return "".concat((_b = (_a = rows[0]) === null || _a === void 0 ? void 0 : _a[key]) !== null && _b !== void 0 ? _b : 0, " \u00E9l\u00E9ments"); },
153
+ max: function (rows) { var _a, _b; return (0, numbers_1.formatNumber)((_b = (_a = rows[0]) === null || _a === void 0 ? void 0 : _a[key]) !== null && _b !== void 0 ? _b : 0, decimals); },
154
+ min: function (rows) { var _a, _b; return (0, numbers_1.formatNumber)((_b = (_a = rows[0]) === null || _a === void 0 ? void 0 : _a[key]) !== null && _b !== void 0 ? _b : 0, decimals); },
155
155
  },
156
156
  editComponent: function (_a) {
157
157
  var ref = _a.ref, otherProps = __rest(_a, ["ref"]);
@@ -186,11 +186,23 @@ var sqlMoneyColumn = function (key, title, decimals, currency, options) {
186
186
  ? function (value) { var _a; return (_a = (0, numbers_1.formatMoney)(value, decimals, currency(value))) !== null && _a !== void 0 ? _a : ''; }
187
187
  : function (value) { var _a; return (_a = (0, numbers_1.formatMoney)(value, decimals, currency)) !== null && _a !== void 0 ? _a : ''; } }),
188
188
  footer: {
189
- sum: null,
190
- avg: null,
191
- count: null,
192
- max: null,
193
- min: null,
189
+ sum: function (rows) {
190
+ var _a, _b;
191
+ return (0, numbers_1.formatMoney)((_b = (_a = rows[0]) === null || _a === void 0 ? void 0 : _a[key]) !== null && _b !== void 0 ? _b : 0, decimals, typeof currency === 'function' ? 'EUR' : currency);
192
+ },
193
+ avg: function (rows) {
194
+ var _a, _b;
195
+ return (0, numbers_1.formatMoney)((_b = (_a = rows[0]) === null || _a === void 0 ? void 0 : _a[key]) !== null && _b !== void 0 ? _b : 0, decimals, typeof currency === 'function' ? 'EUR' : currency);
196
+ },
197
+ count: function (rows) { var _a, _b; return "".concat((_b = (_a = rows[0]) === null || _a === void 0 ? void 0 : _a[key]) !== null && _b !== void 0 ? _b : 0, " \u00E9l\u00E9ments"); },
198
+ max: function (rows) {
199
+ var _a, _b;
200
+ return (0, numbers_1.formatMoney)((_b = (_a = rows[0]) === null || _a === void 0 ? void 0 : _a[key]) !== null && _b !== void 0 ? _b : 0, decimals, typeof currency === 'function' ? 'EUR' : currency);
201
+ },
202
+ min: function (rows) {
203
+ var _a, _b;
204
+ return (0, numbers_1.formatMoney)((_b = (_a = rows[0]) === null || _a === void 0 ? void 0 : _a[key]) !== null && _b !== void 0 ? _b : 0, decimals, typeof currency === 'function' ? 'EUR' : currency);
205
+ },
194
206
  },
195
207
  editComponent: function (_a) {
196
208
  var ref = _a.ref, otherProps = __rest(_a, ["ref"]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@addev-be/ui",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
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.1.2",
23
+ "@addev-be/framework-utils": "^2.1.4",
24
24
  "@types/lodash": "^4.17.20",
25
25
  "@types/react": "^19.1.13",
26
26
  "@types/react-dom": "^19.1.9",
@@ -231,11 +231,11 @@ export const sqlNumberColumn = <R extends Record<string, any>>(
231
231
  renderer: (value) => formatNumber(value, decimals) ?? '',
232
232
  },
233
233
  footer: {
234
- sum: null,
235
- avg: null,
236
- count: null,
237
- max: null,
238
- min: null,
234
+ sum: (rows) => formatNumber(rows[0]?.[key] ?? 0, decimals),
235
+ avg: (rows) => formatNumber(rows[0]?.[key] ?? 0, decimals),
236
+ count: (rows) => `${rows[0]?.[key] ?? 0} éléments`,
237
+ max: (rows) => formatNumber(rows[0]?.[key] ?? 0, decimals),
238
+ min: (rows) => formatNumber(rows[0]?.[key] ?? 0, decimals),
239
239
  },
240
240
  editComponent: ({ ref, ...otherProps }) => (
241
241
  <NumberEditableCell<R>
@@ -295,11 +295,31 @@ export const sqlMoneyColumn = <R extends Record<string, any>>(
295
295
  : (value) => formatMoney(value, decimals, currency) ?? '',
296
296
  },
297
297
  footer: {
298
- sum: null,
299
- avg: null,
300
- count: null,
301
- max: null,
302
- min: null,
298
+ sum: (rows) =>
299
+ formatMoney(
300
+ rows[0]?.[key] ?? 0,
301
+ decimals,
302
+ typeof currency === 'function' ? 'EUR' : currency
303
+ ),
304
+ avg: (rows) =>
305
+ formatMoney(
306
+ rows[0]?.[key] ?? 0,
307
+ decimals,
308
+ typeof currency === 'function' ? 'EUR' : currency
309
+ ),
310
+ count: (rows) => `${rows[0]?.[key] ?? 0} éléments`,
311
+ max: (rows) =>
312
+ formatMoney(
313
+ rows[0]?.[key] ?? 0,
314
+ decimals,
315
+ typeof currency === 'function' ? 'EUR' : currency
316
+ ),
317
+ min: (rows) =>
318
+ formatMoney(
319
+ rows[0]?.[key] ?? 0,
320
+ decimals,
321
+ typeof currency === 'function' ? 'EUR' : currency
322
+ ),
303
323
  },
304
324
  editComponent: ({ ref, ...otherProps }) => (
305
325
  <NumberEditableCell<R>