@visns-studio/visns-components 1.4.8 → 1.4.9

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.
@@ -544,7 +544,13 @@ const DataGrid = ({
544
544
  filterEditor: filterEditor,
545
545
  filterEditorProps: filterEditorProps,
546
546
  render: ({ data }) => {
547
- if (data && data[column.id]) {
547
+ if (
548
+ data &&
549
+ data[column.id] &&
550
+ moment(data[column.id]).isValid() &&
551
+ moment(data[column.id]).format("YYYY-MM-DD") !==
552
+ "1970-01-01"
553
+ ) {
548
554
  const value = moment(data[column.id]).format(
549
555
  column.format || "DD-MM-YYYY"
550
556
  );
@@ -593,7 +599,13 @@ const DataGrid = ({
593
599
  filterEditor: filterEditor,
594
600
  filterEditorProps: filterEditorProps,
595
601
  render: ({ data }) => {
596
- if (data && data[column.id]) {
602
+ if (
603
+ data &&
604
+ data[column.id] &&
605
+ moment(data[column.id]).isValid() &&
606
+ moment(data[column.id]).format("YYYY-MM-DD") !==
607
+ "1970-01-01"
608
+ ) {
597
609
  data = moment(data[column.id]).format(
598
610
  column.format
599
611
  ? column.format
@@ -986,7 +998,13 @@ const DataGrid = ({
986
998
  ...commonProps,
987
999
  name: column.id,
988
1000
  render: ({ data }) => {
989
- if (data && data[column.id]) {
1001
+ if (
1002
+ data &&
1003
+ data[column.id] &&
1004
+ moment(data[column.id]).isValid() &&
1005
+ moment(data[column.id]).format("YYYY-MM-DD") !==
1006
+ "1970-01-01"
1007
+ ) {
990
1008
  data = moment(data[column.id]).format(
991
1009
  column.format ? column.format : "hh:mm A"
992
1010
  );
@@ -4,7 +4,8 @@ import AwesomeDebouncePromise from "awesome-debounce-promise";
4
4
  import { ToggleOffFill, ToggleOnFill } from "akar-icons";
5
5
 
6
6
  const VisnsAutocomplete = (props) => {
7
- const { api, country, onSelect, setFormData, field, inputValue } = props;
7
+ const { api, country, field, inputValue, onSelect, setFormData, style } =
8
+ props;
8
9
  const [search, setSearch] = useState("");
9
10
  const [results, setResults] = useState([]);
10
11
  const [isLoading, setIsLoading] = useState(false);
@@ -18,8 +19,8 @@ const VisnsAutocomplete = (props) => {
18
19
  } else {
19
20
  let url = `https://api.mapbox.com/geocoding/v5/mapbox.places/${value}.json?types=address,poi&access_token=${api}`;
20
21
 
21
- if (import.meta.env.VITE_MAPBOX_COUNTRY) {
22
- url += `&country=${import.meta.env.VITE_MAPBOX_COUNTRY}`;
22
+ if (country) {
23
+ url += `&country=${country}`;
23
24
  }
24
25
 
25
26
  if (import.meta.env.hasOwnProperty("VITE_MAPBOX_PROXIMITY")) {
@@ -95,7 +96,12 @@ const VisnsAutocomplete = (props) => {
95
96
  <div className="AutocompletePlace">
96
97
  <input
97
98
  className="AutocompletePlace-input"
98
- style={{ height: "53px" }}
99
+ style={{
100
+ height:
101
+ style && style.multi_select_height
102
+ ? style.multi_select_height
103
+ : "52px",
104
+ }}
99
105
  type="text"
100
106
  value={search || ""}
101
107
  onChange={handleSearchChange}
@@ -720,7 +720,14 @@ const DataGrid = forwardRef(
720
720
  filterEditor: filterEditor,
721
721
  filterEditorProps: filterEditorProps,
722
722
  render: ({ data }) => {
723
- if (data && data[column.id]) {
723
+ if (
724
+ data &&
725
+ data[column.id] &&
726
+ moment(data[column.id]).isValid() &&
727
+ moment(data[column.id]).format(
728
+ "YYYY-MM-DD"
729
+ ) !== "1970-01-01"
730
+ ) {
724
731
  const value = moment(
725
732
  data[column.id]
726
733
  ).format(column.format || "DD-MM-YYYY");
@@ -769,7 +776,14 @@ const DataGrid = forwardRef(
769
776
  filterEditor: filterEditor,
770
777
  filterEditorProps: filterEditorProps,
771
778
  render: ({ data }) => {
772
- if (data && data[column.id]) {
779
+ if (
780
+ data &&
781
+ data[column.id] &&
782
+ moment(data[column.id]).isValid() &&
783
+ moment(data[column.id]).format(
784
+ "YYYY-MM-DD"
785
+ ) !== "1970-01-01"
786
+ ) {
773
787
  data = moment(data[column.id]).format(
774
788
  column.format
775
789
  ? column.format
@@ -1186,7 +1200,14 @@ const DataGrid = forwardRef(
1186
1200
  ...commonProps,
1187
1201
  name: column.id,
1188
1202
  render: ({ data }) => {
1189
- if (data && data[column.id]) {
1203
+ if (
1204
+ data &&
1205
+ data[column.id] &&
1206
+ moment(data[column.id]).isValid() &&
1207
+ moment(data[column.id]).format(
1208
+ "YYYY-MM-DD"
1209
+ ) !== "1970-01-01"
1210
+ ) {
1190
1211
  data = moment(data[column.id]).format(
1191
1212
  column.format
1192
1213
  ? column.format
@@ -1445,6 +1466,7 @@ const DataGrid = forwardRef(
1445
1466
  updateForm={setFormData}
1446
1467
  columnId={formId}
1447
1468
  childDropdownCallback={childDropdownCallback}
1469
+ style={style}
1448
1470
  />
1449
1471
  </Popup>
1450
1472
  </>
@@ -15,25 +15,25 @@ import "react-toggle/style.css";
15
15
  import "react-quill/dist/quill.snow.css";
16
16
  import "react-datepicker/dist/react-datepicker.css";
17
17
 
18
- function Field(props) {
18
+ function Field({
19
+ childDropdownCallback,
20
+ inputValue,
21
+ inputClass,
22
+ onChange,
23
+ onChangeDate,
24
+ onChangeSelect,
25
+ onChangeRicheditor,
26
+ onChangeToggle,
27
+ onChangeNumberFormat,
28
+ autocompleteCallback,
29
+ setFormData,
30
+ settings,
31
+ style,
32
+ }) {
19
33
  const [options, setOptions] = useState([]);
20
34
  const [dataOptions, setDataOptions] = useState([]);
21
35
  const [formItemStyle, setFormItemStyle] = useState({});
22
36
  const [formItemClass, setFormItemClass] = useState("formItem");
23
- const {
24
- settings,
25
- inputValue,
26
- inputClass,
27
- childDropdownCallback,
28
- onChange,
29
- onChangeDate,
30
- onChangeSelect,
31
- onChangeRicheditor,
32
- onChangeToggle,
33
- onChangeNumberFormat,
34
- autocompleteCallback,
35
- setFormData,
36
- } = props;
37
37
 
38
38
  useEffect(() => {
39
39
  switch (settings.type) {
@@ -426,14 +426,13 @@ function Field(props) {
426
426
  case "address":
427
427
  htmlContainer = (
428
428
  <VisnsAutocomplete
429
- onSelect={(place) =>
430
- autocompleteCallback(place)
431
- }
432
- field={settings.id}
433
- setFormData={setFormData}
434
429
  api="pk.eyJ1IjoidmlzbnMtc3R1ZGlvIiwiYSI6ImNrbGlraW5vZDBhMDYycHBsdmk5b3ljbGQifQ.ZGUBk0PWac5GahUeVHdTpg"
435
- inputValue={inputValue}
436
430
  country="AU"
431
+ field={settings.id}
432
+ inputValue={inputValue}
433
+ onSelect={autocompleteCallback}
434
+ setFormData={setFormData}
435
+ style={style}
437
436
  />
438
437
  );
439
438
  break;
@@ -481,6 +480,7 @@ function Field(props) {
481
480
  }
482
481
  options={settings.options}
483
482
  dataOptions={dataOptions}
483
+ style={style}
484
484
  />
485
485
  );
486
486
  break;
@@ -500,6 +500,7 @@ function Field(props) {
500
500
  }
501
501
  options={options}
502
502
  dataOptions={dataOptions}
503
+ style={style}
503
504
  />
504
505
  );
505
506
  break;