@plasmicpkgs/plasmic-rich-components 1.0.112 → 1.0.114
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.
|
@@ -4,6 +4,7 @@ import React, { useState, useEffect, useRef } from 'react';
|
|
|
4
4
|
import { Result, Checkbox, Switch, Empty, Descriptions, theme, ConfigProvider, Dropdown, Button, Input, List, Tag, Card } from 'antd';
|
|
5
5
|
import 'lodash/get';
|
|
6
6
|
import { normalizeData, deriveFieldConfigs } from '@plasmicapp/data-sources';
|
|
7
|
+
import { DateTime } from 'luxon';
|
|
7
8
|
import { tinycolor } from '@ctrl/tinycolor';
|
|
8
9
|
import { LogoutOutlined, PlusOutlined, EllipsisOutlined } from '@ant-design/icons';
|
|
9
10
|
import { ProLayout, ProConfigProvider, ProTable } from '@ant-design/pro-components';
|
|
@@ -647,6 +648,12 @@ function renderBoolean(value, cconfig) {
|
|
|
647
648
|
return value ? "true" : "false";
|
|
648
649
|
}
|
|
649
650
|
}
|
|
651
|
+
const dateTimeParsers = [
|
|
652
|
+
DateTime.fromISO,
|
|
653
|
+
DateTime.fromRFC2822,
|
|
654
|
+
DateTime.fromHTTP,
|
|
655
|
+
DateTime.fromSQL
|
|
656
|
+
];
|
|
650
657
|
const CANNOT_COERCE = Symbol("plasmic-cannot-coerce");
|
|
651
658
|
function coerceValue(value, dataType) {
|
|
652
659
|
if (value == null) {
|
|
@@ -668,9 +675,11 @@ function coerceValue(value, dataType) {
|
|
|
668
675
|
} else if (typeof value === "number") {
|
|
669
676
|
return new Date(value);
|
|
670
677
|
} else if (typeof value === "string") {
|
|
671
|
-
const
|
|
672
|
-
|
|
673
|
-
|
|
678
|
+
for (const parser of dateTimeParsers) {
|
|
679
|
+
const parsed = parser(value);
|
|
680
|
+
if (parsed.isValid) {
|
|
681
|
+
return parsed.toJSDate();
|
|
682
|
+
}
|
|
674
683
|
}
|
|
675
684
|
}
|
|
676
685
|
} else if (dataType === "boolean") {
|
|
@@ -846,7 +855,7 @@ function registerRichDetails(loader) {
|
|
|
846
855
|
bordered: {
|
|
847
856
|
displayName: "Show borders?",
|
|
848
857
|
type: "boolean",
|
|
849
|
-
|
|
858
|
+
defaultValue: true
|
|
850
859
|
}
|
|
851
860
|
},
|
|
852
861
|
importPath: "@plasmicpkgs/plasmic-rich-components",
|
|
@@ -1186,11 +1195,7 @@ const richLayoutMeta = {
|
|
|
1186
1195
|
navMenuItems: generateNavMenuType(false, 2, "Nav menu items", [
|
|
1187
1196
|
{
|
|
1188
1197
|
path: "/",
|
|
1189
|
-
name: "
|
|
1190
|
-
},
|
|
1191
|
-
{
|
|
1192
|
-
path: "/",
|
|
1193
|
-
name: "Link 2"
|
|
1198
|
+
name: "Home"
|
|
1194
1199
|
}
|
|
1195
1200
|
]),
|
|
1196
1201
|
layout: {
|