@evoke-platform/ui-components 1.0.0-dev.199 → 1.0.0-dev.201

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.
@@ -14,13 +14,13 @@ import UIThemeProvider from '../../../theme';
14
14
  import { DateTimePicker as MUIDateTimePicker, } from '@mui/x-date-pickers';
15
15
  import TextField from '../TextField';
16
16
  import { InvalidDate } from '../../../util';
17
- import { LocalDateTime } from '@js-joda/core';
17
+ import { LocalDateTime, nativeJs } from '@js-joda/core';
18
18
  const DateTimePicker = (props) => {
19
19
  var _a;
20
20
  const { value: inputValue, onChange: handleChange } = props, rest = __rest(props, ["value", "onChange"]);
21
21
  let value = null;
22
22
  try {
23
- value = typeof inputValue === 'string' ? LocalDateTime.parse(inputValue) : inputValue;
23
+ value = typeof inputValue === 'string' ? LocalDateTime.from(nativeJs(new Date(inputValue))) : inputValue;
24
24
  }
25
25
  catch (err) {
26
26
  // If we fail to parse the input string, log the error and continue as if no value was set.
@@ -3,6 +3,8 @@ import { DateTimePicker, LocalizationProvider, TextField } from '../../../core';
3
3
  import InputFieldComponent from '../InputFieldComponent/InputFieldComponent';
4
4
  import { LocalDate, LocalDateTime, LocalTime, nativeJs } from '@js-joda/core';
5
5
  import { InvalidDate } from '../../../../util';
6
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
7
+ const { format } = require('small-date');
6
8
  function asCalendarDate(value) {
7
9
  if (!value) {
8
10
  return null;
@@ -19,6 +21,11 @@ function asCalendarDate(value) {
19
21
  }
20
22
  return value.toString();
21
23
  }
24
+ const formatDateTime = (date) => {
25
+ if (date) {
26
+ return format(new Date(date), 'MM-dd-yyyy hh:mm a');
27
+ }
28
+ };
22
29
  const DateTimePickerSelect = (props) => {
23
30
  const { id, property, defaultValue, error, errorMessage, readOnly, required, size, onBlur, additionalProps } = props;
24
31
  const [value, setValue] = useState(asCalendarDate(defaultValue));
@@ -35,7 +42,7 @@ const DateTimePickerSelect = (props) => {
35
42
  setValue(date);
36
43
  props.onChange(property.id, date, property);
37
44
  };
38
- return readOnly ? (React.createElement(InputFieldComponent, Object.assign({}, Object.assign(Object.assign({}, props), { defaultValue: value })))) : (React.createElement(LocalizationProvider, null,
45
+ return readOnly ? (React.createElement(InputFieldComponent, Object.assign({}, Object.assign(Object.assign({}, props), { defaultValue: formatDateTime(value) })))) : (React.createElement(LocalizationProvider, null,
39
46
  React.createElement(DateTimePicker, { value: value, onChange: handleChange, renderInput: (params) => (React.createElement(TextField, Object.assign({}, params, { id: id, error: error, errorMessage: errorMessage, onBlur: onBlur, fullWidth: true, required: required, sx: { background: 'white', borderRadius: '8px' }, size: size !== null && size !== void 0 ? size : 'medium' }, (additionalProps !== null && additionalProps !== void 0 ? additionalProps : {})))) })));
40
47
  };
41
48
  export default DateTimePickerSelect;
@@ -156,7 +156,9 @@ export default function MultiSelect(props) {
156
156
  padding: '4px',
157
157
  borderRadius: '8px',
158
158
  }, size: 'small', variant: 'outlined', onClick: (e) => handleDeletedOptions(e) }, "Clear all") },
159
- React.createElement(AlertTitle, { sx: { fontWeight: 700, lineHeight: '22px', fontSize: '13px', color: '#7A4F01' } }, `${deletedOptions.length} fields has been deleted`),
159
+ React.createElement(AlertTitle, { sx: { fontWeight: 700, lineHeight: '22px', fontSize: '13px', color: '#7A4F01' } }, deletedOptions.length > 1
160
+ ? `${deletedOptions.length} fields have been deleted`
161
+ : `${deletedOptions.length} field has been deleted`),
160
162
  React.createElement(Typography, { sx: { fontWeight: 400, lineHeight: '18px', fontSize: '12px', color: '#7A4F01' } }, "Any cleared deleted fields will be removed after saving."))),
161
163
  options.length > 4 && (React.createElement(Grid, { item: true, p: 1 },
162
164
  React.createElement(TextField, { placeholder: "Search Properties", size: "small", InputProps: {
@@ -164,9 +166,9 @@ export default function MultiSelect(props) {
164
166
  React.createElement(Search, null))),
165
167
  }, fullWidth: true, sx: styles.textField, value: searchText, onChange: filterItems }))),
166
168
  (optionsArray === null || optionsArray === void 0 ? void 0 : optionsArray.length) > 1 && (React.createElement(Grid, { container: true },
167
- React.createElement(Grid, { item: true, xs: 3 },
169
+ React.createElement(Grid, { item: true, xs: 4, md: 3 },
168
170
  React.createElement(Button, { sx: Object.assign(Object.assign({}, styles.button), { fontWeight: 'bold' }), variant: "text", onClick: (e) => handleSelectAllChange(e), disabled: optionsArray.every((option) => option.disabled === true || selectAll) }, "Select All")),
169
- React.createElement(Grid, { item: true, xs: 9 },
171
+ React.createElement(Grid, { item: true, xs: 8, md: 9 },
170
172
  React.createElement(Button, { sx: Object.assign(Object.assign({}, styles.button), { fontWeight: 'bold' }), variant: "text", onClick: (e) => handleClearAll(e), disabled: optionsArray.every((option) => option.disabled === true) ||
171
173
  optionsArray.every((option) => option.value === false) }, "Clear All")))),
172
174
  React.createElement(Box, { sx: Object.assign(Object.assign({}, styles.list), { maxHeight: maxHeight !== null && maxHeight !== void 0 ? maxHeight : 'auto' }) }, isSortable ? (React.createElement(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, modifiers: [restrictToVerticalAxis, restrictToWindowEdges] },
@@ -20,4 +20,4 @@ export declare class InvalidDate implements Temporal {
20
20
  }
21
21
  export declare type CalendarDate = LocalDate | InvalidDate | LocalDateTime;
22
22
  export declare function isValidDate(date: CalendarDate): date is LocalDate | LocalDateTime;
23
- export { nativeJs, LocalDate, LocalDateTime, Instant, ZoneOffset } from '@js-joda/core';
23
+ export { nativeJs, LocalDate, LocalDateTime } from '@js-joda/core';
@@ -44,4 +44,4 @@ export function isValidDate(date) {
44
44
  return date.invalid !== true;
45
45
  }
46
46
  // Re-export type and utility function from Joda for convenience.
47
- export { nativeJs, LocalDate, LocalDateTime, Instant, ZoneOffset } from '@js-joda/core';
47
+ export { nativeJs, LocalDate, LocalDateTime } from '@js-joda/core';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evoke-platform/ui-components",
3
- "version": "1.0.0-dev.199",
3
+ "version": "1.0.0-dev.201",
4
4
  "description": "",
5
5
  "main": "dist/published/index.js",
6
6
  "module": "dist/published/index.js",
@@ -105,7 +105,8 @@
105
105
  "react-dropzone": "^14.2.2",
106
106
  "react-input-mask": "^2.0.4",
107
107
  "react-number-format": "^4.9.3",
108
- "react-querybuilder": "^6.0.2"
108
+ "react-querybuilder": "^6.0.2",
109
+ "small-date": "^2.0.0"
109
110
  },
110
111
  "lint-staged": {
111
112
  "*.{js,jsx,ts,tsx,json,css,md}": [