mig-schema-table 3.0.34 → 3.0.35
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/SchemaTable/index.js +13 -4
- package/package.json +1 -1
|
@@ -232,22 +232,31 @@ function SchemaTable({ Heading = VariableSizeList, checkedIndexes, disabledCheck
|
|
|
232
232
|
});
|
|
233
233
|
}
|
|
234
234
|
return filteredRenderData.sort((a, b) => {
|
|
235
|
+
var _a;
|
|
236
|
+
const isDate = sortSchema && ((_a = sortSchema.format) === null || _a === void 0 ? void 0 : _a.startsWith("date"));
|
|
235
237
|
const sortByValue = (propConfig === null || propConfig === void 0 ? void 0 : propConfig.sortByValue) === undefined
|
|
236
238
|
? !sortSchema ||
|
|
239
|
+
isDate ||
|
|
237
240
|
sortSchema.type === "boolean" ||
|
|
238
241
|
sortSchema.type === "integer" ||
|
|
239
|
-
sortSchema.format === "date" ||
|
|
240
|
-
sortSchema.format === "date-time" ||
|
|
241
242
|
(propConfig === null || propConfig === void 0 ? void 0 : propConfig.renderCell)
|
|
242
243
|
: propConfig.sortByValue;
|
|
243
|
-
|
|
244
|
+
let x = sortByValue && data[a._index]
|
|
244
245
|
? // @ts-ignore
|
|
245
246
|
data[a._index][sortColumn]
|
|
246
247
|
: a[sortColumn].toLowerCase();
|
|
247
|
-
|
|
248
|
+
let y = sortByValue && data[b._index]
|
|
248
249
|
? // @ts-ignore
|
|
249
250
|
data[b._index][sortColumn]
|
|
250
251
|
: b[sortColumn].toLowerCase();
|
|
252
|
+
if (sortByValue && isDate) {
|
|
253
|
+
if (x && typeof x === "string") {
|
|
254
|
+
x = new Date(x);
|
|
255
|
+
}
|
|
256
|
+
if (y && typeof y === "string") {
|
|
257
|
+
y = new Date(y);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
251
260
|
if (x === y) {
|
|
252
261
|
return 0;
|
|
253
262
|
}
|