@dartech/arsenal-ui 1.3.98 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +23 -11
- package/package.json +1 -1
- package/src/interfaces/definition.d.ts +1 -1
- package/src/lib/Definition/CreateDefinition/CreateDefinition.d.ts +2 -1
- package/src/lib/Property/UpsertProperty/CreatePropertiesList.d.ts +8 -1
- package/src/lib/Property/UpsertProperty/PropertyValueField/BooleanValueField.d.ts +1 -0
- package/src/lib/Property/UpsertProperty/PropertyValueField/DateTimeValueField.d.ts +1 -0
- package/src/lib/Property/UpsertProperty/PropertyValueField/DateValueField.d.ts +1 -0
- package/src/lib/Property/UpsertProperty/PropertyValueField/JsonValueField.d.ts +1 -0
- package/src/lib/Property/UpsertProperty/PropertyValueField/TimeValueField.d.ts +1 -0
- package/src/lib/Property/ViewProperty/PropertyItem.d.ts +1 -0
package/index.js
CHANGED
@@ -34,7 +34,7 @@ import { abcdef } from '@uiw/codemirror-theme-abcdef';
|
|
34
34
|
import Typography from '@mui/material/Typography';
|
35
35
|
import Switch from '@mui/material/Switch';
|
36
36
|
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
|
37
|
-
import { format, isMatch, isValid
|
37
|
+
import { format, parse, isMatch, isValid } from 'date-fns';
|
38
38
|
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
|
39
39
|
import { TimePicker } from '@mui/x-date-pickers/TimePicker';
|
40
40
|
import Chip from '@mui/material/Chip';
|
@@ -111,7 +111,7 @@ var PropertyType;
|
|
111
111
|
})(PropertyType || (PropertyType = {}));
|
112
112
|
const DATE_DEFAULT_FORMAT = 'yyyy-MM-dd';
|
113
113
|
const TIME_DEFAULT_FORMAT = 'HH:mm:ss';
|
114
|
-
const DATE_TIME_DEFAULT_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.
|
114
|
+
const DATE_TIME_DEFAULT_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
|
115
115
|
|
116
116
|
var RoundingMode;
|
117
117
|
(function (RoundingMode) {
|
@@ -1531,7 +1531,14 @@ const formatPropertyValue = (propertyType, value, params) => {
|
|
1531
1531
|
case PropertyType.DATE_TIME:
|
1532
1532
|
case PropertyType.TIME:
|
1533
1533
|
{
|
1534
|
-
if (value)
|
1534
|
+
if (value) {
|
1535
|
+
try {
|
1536
|
+
const formatString = params.formatText.replace(/[Z,z,x]+/g, 'XX');
|
1537
|
+
parsedValue = format(parse(value, formatString, new Date()), formatString);
|
1538
|
+
} catch (e) {
|
1539
|
+
console.error(e);
|
1540
|
+
}
|
1541
|
+
}
|
1535
1542
|
break;
|
1536
1543
|
}
|
1537
1544
|
case PropertyType.JSON:
|
@@ -2090,8 +2097,10 @@ const ControlDate = _a => {
|
|
2090
2097
|
children: [label, " ", jsx("span", {
|
2091
2098
|
children: "*"
|
2092
2099
|
})]
|
2093
|
-
}) : label
|
2094
|
-
|
2100
|
+
}) : label
|
2101
|
+
}, localFormat ? {
|
2102
|
+
inputFormat: localFormat
|
2103
|
+
} : {}, {
|
2095
2104
|
value: localFormat ? parse(field.value, localFormat, new Date()) : field.value,
|
2096
2105
|
onChange: handleChange,
|
2097
2106
|
components: {
|
@@ -2131,7 +2140,7 @@ const ControlDateTime = _a => {
|
|
2131
2140
|
textFieldProps
|
2132
2141
|
} = _a,
|
2133
2142
|
dateTimePickerProps = __rest(_a, ["control", "name", "required", "label", "format", "hideErrorMessage", "textFieldProps"]);
|
2134
|
-
const [localFormat, setLocalFormat] = useState(
|
2143
|
+
const [localFormat, setLocalFormat] = useState();
|
2135
2144
|
const {
|
2136
2145
|
field,
|
2137
2146
|
fieldState: {
|
@@ -2169,8 +2178,10 @@ const ControlDateTime = _a => {
|
|
2169
2178
|
children: "*"
|
2170
2179
|
})]
|
2171
2180
|
}) : label,
|
2172
|
-
value: localFormat ? parse(field.value, localFormat, new Date()) : field.value
|
2173
|
-
|
2181
|
+
value: localFormat ? parse(field.value, localFormat, new Date()) : field.value
|
2182
|
+
}, localFormat ? {
|
2183
|
+
inputFormat: localFormat
|
2184
|
+
} : {}, {
|
2174
2185
|
onChange: handleChange,
|
2175
2186
|
components: {
|
2176
2187
|
OpenPickerIcon: DateIconComponent
|
@@ -5235,9 +5246,10 @@ const CreatePropertiesList = /*#__PURE__*/forwardRef(({
|
|
5235
5246
|
return {
|
5236
5247
|
getProperties: () => getValues('properties'),
|
5237
5248
|
addProperty: handleAddParameter,
|
5238
|
-
removeProperty: handleRemoveParameter
|
5249
|
+
removeProperty: handleRemoveParameter,
|
5250
|
+
trigger
|
5239
5251
|
};
|
5240
|
-
}, [getValues, handleAddParameter, handleRemoveParameter]);
|
5252
|
+
}, [getValues, handleAddParameter, handleRemoveParameter, trigger]);
|
5241
5253
|
return jsxs(Fragment, {
|
5242
5254
|
children: [error && error.message && jsx(Grid, Object.assign({
|
5243
5255
|
sm: 12
|
@@ -5252,7 +5264,7 @@ const CreatePropertiesList = /*#__PURE__*/forwardRef(({
|
|
5252
5264
|
ref: ref => refs.current[index] = ref
|
5253
5265
|
}, {
|
5254
5266
|
children: jsxs(Accordion, Object.assign({
|
5255
|
-
defaultExpanded:
|
5267
|
+
defaultExpanded: !(properties === null || properties === void 0 ? void 0 : properties.length),
|
5256
5268
|
elevation: 3
|
5257
5269
|
}, {
|
5258
5270
|
children: [jsx(AccordionSummary, Object.assign({
|
package/package.json
CHANGED
@@ -116,4 +116,4 @@ export interface FileReferenceProperty extends Property {
|
|
116
116
|
export type PropertyUnion<T = Record<string, never>> = BigDecimalProperty | BigIntegerProperty | BooleanProperty | DateProperty | DateTimeProperty | DoubleProperty | EntityTypeProperty<T> | EntityReferenceProperty | FloatProperty | StringProperty | IntegerProperty | JsonProperty | LongProperty | TimeProperty | AnyProperty | EntityReferenceProperty | FileProperty | FileReferenceProperty;
|
117
117
|
export declare const DATE_DEFAULT_FORMAT = "yyyy-MM-dd";
|
118
118
|
export declare const TIME_DEFAULT_FORMAT = "HH:mm:ss";
|
119
|
-
export declare const DATE_TIME_DEFAULT_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.
|
119
|
+
export declare const DATE_TIME_DEFAULT_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
|
@@ -1,4 +1,5 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
+
import { type RefMethods } from '../../Property/UpsertProperty/CreatePropertiesList';
|
2
3
|
import { EntityReferenceProperty } from '../../../interfaces';
|
3
4
|
type Props = {
|
4
5
|
definitionFieldName?: string;
|
@@ -19,5 +20,5 @@ type Props = {
|
|
19
20
|
name: string;
|
20
21
|
}>;
|
21
22
|
};
|
22
|
-
export declare const CreateDefinition: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<
|
23
|
+
export declare const CreateDefinition: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<RefMethods>>;
|
23
24
|
export default CreateDefinition;
|
@@ -1,4 +1,5 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
+
import { UseFormTrigger } from 'react-hook-form';
|
2
3
|
import { CustomPropertyFieldProps, EntityReferenceProperty, PropertiesArrayType } from '../../../interfaces';
|
3
4
|
type Props = {
|
4
5
|
properties: PropertiesArrayType<any>;
|
@@ -25,5 +26,11 @@ type Props = {
|
|
25
26
|
name: string;
|
26
27
|
}>;
|
27
28
|
};
|
28
|
-
export
|
29
|
+
export type RefMethods = {
|
30
|
+
getProperties: () => PropertiesArrayType<any>;
|
31
|
+
trigger: UseFormTrigger<{
|
32
|
+
properties: PropertiesArrayType<any>;
|
33
|
+
}>;
|
34
|
+
};
|
35
|
+
export declare const CreatePropertiesList: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<RefMethods>>;
|
29
36
|
export default CreatePropertiesList;
|