@visns-studio/visns-components 3.3.12 → 3.3.13

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.
@@ -8,7 +8,7 @@ import { BlockPicker } from 'react-color';
8
8
  import { CopyToClipboard } from 'react-copy-to-clipboard';
9
9
  import { NumericFormat, PatternFormat } from 'react-number-format';
10
10
  import { Editor } from '@tinymce/tinymce-react';
11
- import { Copy, TrashCan } from 'akar-icons';
11
+ import { CloudDownload, Copy, TrashCan } from 'akar-icons';
12
12
 
13
13
  import CustomFetch from './Fetch';
14
14
  import MultiSelect from './MultiSelect';
@@ -36,6 +36,7 @@ function Field({
36
36
  onChangeRicheditor,
37
37
  onChangeToggle,
38
38
  onChangeNumberFormat,
39
+ onFileDownload,
39
40
  setFormData,
40
41
  settings,
41
42
  style,
@@ -234,6 +235,7 @@ function Field({
234
235
  'datetime',
235
236
  'file',
236
237
  'gallery',
238
+ 'image',
237
239
  'multi-dropdown',
238
240
  'multi-dropdown-ajax',
239
241
  'plaindate',
@@ -795,12 +797,40 @@ function Field({
795
797
  );
796
798
  } else {
797
799
  return (
798
- <input
799
- type="file"
800
- data-name={settings.id}
801
- className={inputClass[settings.id]}
802
- onChange={onChange}
803
- />
800
+ <div
801
+ style={{
802
+ display: 'inline-flex',
803
+ alignItems: 'center',
804
+ }}
805
+ >
806
+ <input
807
+ type="file"
808
+ data-name={settings.id}
809
+ className={inputClass[settings.id]}
810
+ onChange={onChange}
811
+ />{' '}
812
+ {inputValue &&
813
+ inputValue.key &&
814
+ inputValue.uuid && (
815
+ <div
816
+ style={{
817
+ marginLeft: '10px',
818
+ cursor: 'pointer',
819
+ }}
820
+ data-tooltip-id="system-tooltip"
821
+ data-tooltip-content={
822
+ inputValue.filename
823
+ }
824
+ onClick={(e) => {
825
+ e.preventDefault();
826
+
827
+ onFileDownload(inputValue);
828
+ }}
829
+ >
830
+ <CloudDownload size={24} />
831
+ </div>
832
+ )}
833
+ </div>
804
834
  );
805
835
  }
806
836
  case 'gallery':
@@ -828,12 +858,36 @@ function Field({
828
858
  return htmlContainer;
829
859
  case 'image':
830
860
  return (
831
- <input
832
- type="file"
833
- data-name={settings.id}
834
- className={inputClass[settings.id]}
835
- onChange={onChange}
836
- />
861
+ <div
862
+ style={{
863
+ display: 'inline-flex',
864
+ alignItems: 'center',
865
+ }}
866
+ >
867
+ <input
868
+ type="file"
869
+ data-name={settings.id}
870
+ className={inputClass[settings.id]}
871
+ onChange={onChange}
872
+ />{' '}
873
+ {inputValue && inputValue.key && inputValue.uuid && (
874
+ <div
875
+ style={{
876
+ marginLeft: '10px',
877
+ cursor: 'pointer',
878
+ }}
879
+ data-tooltip-id="system-tooltip"
880
+ data-tooltip-content={inputValue.filename}
881
+ onClick={(e) => {
882
+ e.preventDefault();
883
+
884
+ onFileDownload(inputValue);
885
+ }}
886
+ >
887
+ <CloudDownload size={24} />
888
+ </div>
889
+ )}
890
+ </div>
837
891
  );
838
892
  case 'richeditor':
839
893
  return (
@@ -893,6 +947,7 @@ function Field({
893
947
  'datetime',
894
948
  'file',
895
949
  'gallery',
950
+ 'image',
896
951
  'line-break',
897
952
  'multi-dropdown',
898
953
  'multi-dropdown-ajax',
@@ -320,6 +320,14 @@ function Form({
320
320
  }
321
321
  };
322
322
 
323
+ const handleFileDownload = (async = (d) => {
324
+ try {
325
+ console.info(d);
326
+ } catch (error) {
327
+ console.error(error);
328
+ }
329
+ });
330
+
323
331
  const autocompleteSelect = (place, id) => {
324
332
  const { address, text, context } = place;
325
333
 
@@ -1194,6 +1202,7 @@ function Form({
1194
1202
  }
1195
1203
  onChangeSelect={handleChangeSelect}
1196
1204
  onChangeToggle={handleChangeToggle}
1205
+ onFileDownload={handleFileDownload}
1197
1206
  settings={item}
1198
1207
  setFormData={setFormData}
1199
1208
  style={style}
package/package.json CHANGED
@@ -49,7 +49,7 @@
49
49
  "react-dom": "^17.0.1"
50
50
  },
51
51
  "name": "@visns-studio/visns-components",
52
- "version": "3.3.12",
52
+ "version": "3.3.13",
53
53
  "description": "Various packages to assist in the development of our Custom Applications.",
54
54
  "main": "index.js",
55
55
  "scripts": {