@visns-studio/visns-components 5.15.10 → 5.15.12

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.
package/package.json CHANGED
@@ -13,10 +13,10 @@
13
13
  "@nivo/line": "^0.99.0",
14
14
  "@nivo/pie": "^0.99.0",
15
15
  "@react-pdf/renderer": "^4.3.0",
16
- "@tanstack/react-query": "^5.84.2",
16
+ "@tanstack/react-query": "^5.85.5",
17
17
  "@tinymce/miniature": "^6.0.0",
18
18
  "@tinymce/tinymce-react": "^6.3.0",
19
- "@uiw/react-color": "^2.7.3",
19
+ "@uiw/react-color": "^2.8.0",
20
20
  "@visns-studio/visns-datagrid-community": "1.1.0",
21
21
  "@visns-studio/visns-datagrid-enterprise": "1.1.0",
22
22
  "@vitejs/plugin-react": "^4.7.0",
@@ -32,7 +32,7 @@
32
32
  "html2canvas": "^1.4.1",
33
33
  "lodash": "^4.17.21",
34
34
  "lodash.debounce": "^4.0.8",
35
- "lucide-react": "^0.536.0",
35
+ "lucide-react": "^0.540.0",
36
36
  "mapbox-gl": "^3.14.0",
37
37
  "moment": "^2.30.1",
38
38
  "motion": "^12.23.12",
@@ -43,7 +43,7 @@
43
43
  "react-big-calendar": "^1.19.4",
44
44
  "react-copy-to-clipboard": "^5.1.0",
45
45
  "react-currency-input-field": "^3.10.0",
46
- "react-datepicker": "^8.4.0",
46
+ "react-datepicker": "^8.7.0",
47
47
  "react-dropzone": "^14.3.8",
48
48
  "react-grid-gallery": "^1.0.1",
49
49
  "react-number-format": "^5.4.4",
@@ -64,7 +64,7 @@
64
64
  "reactjs-popup": "^2.0.6",
65
65
  "style-loader": "^4.0.0",
66
66
  "swapy": "^1.0.5",
67
- "sweetalert2": "^11.22.3",
67
+ "sweetalert2": "^11.22.4",
68
68
  "tesseract.js": "^6.0.1",
69
69
  "truncate": "^3.0.0",
70
70
  "uuid": "^11.1.0",
@@ -75,12 +75,12 @@
75
75
  "yet-another-react-lightbox": "^3.25.0"
76
76
  },
77
77
  "devDependencies": {
78
- "@babel/core": "^7.28.0",
79
- "@babel/plugin-transform-runtime": "^7.28.0",
80
- "@babel/preset-env": "^7.28.0",
78
+ "@babel/core": "^7.28.3",
79
+ "@babel/plugin-transform-runtime": "^7.28.3",
80
+ "@babel/preset-env": "^7.28.3",
81
81
  "@babel/preset-react": "^7.27.1",
82
82
  "babel-loader": "^10.0.0",
83
- "copy-webpack-plugin": "^13.0.0",
83
+ "copy-webpack-plugin": "^13.0.1",
84
84
  "css-loader": "^7.1.2",
85
85
  "css-minimizer-webpack-plugin": "^7.0.2",
86
86
  "mini-css-extract-plugin": "^2.9.4",
@@ -94,7 +94,7 @@
94
94
  "react-dom": "^17.0.0 || ^18.0.0"
95
95
  },
96
96
  "name": "@visns-studio/visns-components",
97
- "version": "5.15.10",
97
+ "version": "5.15.12",
98
98
  "description": "Various packages to assist in the development of our Custom Applications.",
99
99
  "main": "src/index.js",
100
100
  "files": [
@@ -70,9 +70,13 @@ function Breadcrumb({ data, page }) {
70
70
 
71
71
  return (
72
72
  <h1>
73
- {page?.parentTitle && page?.parentUrl && (
73
+ {page?.parentTitle && (
74
74
  <>
75
- <Link to={page.parentUrl}>{parse(page.parentTitle)}</Link>
75
+ {page?.parentUrl ? (
76
+ <Link to={page.parentUrl}>{parse(page.parentTitle)}</Link>
77
+ ) : (
78
+ <span>{parse(page.parentTitle)}</span>
79
+ )}
76
80
  <ChevronRight strokeWidth={2} size={18} />
77
81
  </>
78
82
  )}
@@ -92,15 +96,19 @@ function Breadcrumb({ data, page }) {
92
96
  page &&
93
97
  page.title && (
94
98
  <>
95
- <Link
96
- to={`${page.previousUrl}${
97
- page.previousUrlKey && data[page.previousUrlKey]
98
- ? '/' + data[page.previousUrlKey]
99
- : ''
100
- }`}
101
- >
102
- {parse(page.title)}
103
- </Link>
99
+ {page.previousUrl ? (
100
+ <Link
101
+ to={`${page.previousUrl}${
102
+ page.previousUrlKey && data[page.previousUrlKey]
103
+ ? '/' + data[page.previousUrlKey]
104
+ : ''
105
+ }`}
106
+ >
107
+ {parse(page.title)}
108
+ </Link>
109
+ ) : (
110
+ <span>{parse(page.title)}</span>
111
+ )}
104
112
  </>
105
113
  )
106
114
  )}
@@ -309,11 +309,6 @@ const DataGrid = forwardRef(
309
309
 
310
310
  /** Modal Functions */
311
311
  const modalOpen = (formType, formId) => {
312
- console.log('🔍 modalOpen called:', {
313
- formType: formType,
314
- formId: formId,
315
- timestamp: new Date().toISOString(),
316
- });
317
312
  setModalShow(true);
318
313
  setFormType(formType);
319
314
  setFormId(formId);
@@ -23,6 +23,7 @@ import {
23
23
  ArrowLeft,
24
24
  Trash2,
25
25
  X,
26
+ Lightbulb,
26
27
  } from 'lucide-react';
27
28
  import { toast } from 'react-toastify';
28
29
  import validator from 'validator';
@@ -38,6 +39,7 @@ import Tools from './sketch/tools';
38
39
  import VisnsAsyncSelect from './AsyncSelect';
39
40
  import VisnsAutocomplete from './Autocomplete';
40
41
  import VisnsDropZone from './DropZone';
42
+ import MultiCheckbox from './MultiCheckbox';
41
43
  import DatePickerPortal from './utils/DatePickerPortal';
42
44
 
43
45
  import 'react-toggle/style.css';
@@ -338,6 +340,7 @@ function Field({
338
340
  break;
339
341
  case 'dropdown-ajax':
340
342
  case 'multi-dropdown-ajax':
343
+ case 'multi-checkbox-ajax':
341
344
  case 'radio-ajax':
342
345
  // Only fetch if there are no dependent fields (no 'where' conditions)
343
346
  if (!settings.where || settings.where.length === 0) {
@@ -375,7 +378,7 @@ function Field({
375
378
 
376
379
  // Separate useEffect for handling dependent form data changes for dropdown refetch
377
380
  useEffect(() => {
378
- if (['dropdown-ajax', 'multi-dropdown-ajax', 'radio-ajax'].includes(settings.type) && settings.where?.length > 0) {
381
+ if (['dropdown-ajax', 'multi-dropdown-ajax', 'multi-checkbox-ajax', 'radio-ajax'].includes(settings.type) && settings.where?.length > 0) {
379
382
  let filter = {};
380
383
 
381
384
  const processedWhere = settings.where.map((whereItem) => {
@@ -567,6 +570,7 @@ function Field({
567
570
  'image',
568
571
  'multi-dropdown',
569
572
  'multi-dropdown-ajax',
573
+ 'multi-checkbox-ajax',
570
574
  'plaindate',
571
575
  'plaindatetime',
572
576
  'plainrelation',
@@ -708,6 +712,7 @@ function Field({
708
712
  options={options}
709
713
  dataOptions={dataOptions}
710
714
  isCreatable={settings.isCreatable || false}
715
+ creatableConfig={settings.creatableConfig || {}}
711
716
  />
712
717
  {settings.create && (
713
718
  <button
@@ -1655,7 +1660,7 @@ function Field({
1655
1660
  return (
1656
1661
  <div style={{ display: 'flex', justifyContent: 'center' }}>
1657
1662
  <Toggle
1658
- checked={cellValue || false}
1663
+ checked={Boolean(cellValue) || false}
1659
1664
  onChange={(e) =>
1660
1665
  onChangeJsonTable && onChangeJsonTable(e, rowIndex, column.id, 'toggle')
1661
1666
  }
@@ -1888,6 +1893,7 @@ function Field({
1888
1893
  }
1889
1894
  isSearchable={settings.isSearchable ?? true}
1890
1895
  isCreatable={settings.isCreatable ?? false}
1896
+ creatableConfig={settings.creatableConfig || {}}
1891
1897
  dataOptions={dataOptions}
1892
1898
  style={style}
1893
1899
  />
@@ -1922,6 +1928,35 @@ function Field({
1922
1928
  )}
1923
1929
  </div>
1924
1930
  );
1931
+ case 'multi-checkbox-ajax':
1932
+ return (
1933
+ <MultiCheckbox
1934
+ settings={settings}
1935
+ className={inputClass[settings.id]}
1936
+ inputValue={
1937
+ inputValue === null || inputValue === undefined
1938
+ ? []
1939
+ : inputValue
1940
+ }
1941
+ onChange={(newSelected, action, fieldId) => {
1942
+ // Call the original onChangeSelect handler
1943
+ if (onChangeSelect) {
1944
+ onChangeSelect(newSelected, action, fieldId);
1945
+ }
1946
+
1947
+ // If a new option was created, refresh the options list
1948
+ if (action && action.action === 'create-option') {
1949
+ setCounter(prev => prev + 1);
1950
+ }
1951
+ }}
1952
+ options={options}
1953
+ isCreatable={settings.isCreatable ?? false}
1954
+ isEditable={settings.isEditable ?? false}
1955
+ creatableConfig={settings.creatableConfig || {}}
1956
+ editableConfig={settings.editableConfig || {}}
1957
+ style={style}
1958
+ />
1959
+ );
1925
1960
  case 'percentage':
1926
1961
  return (
1927
1962
  <NumericFormat
@@ -2250,7 +2285,7 @@ function Field({
2250
2285
  ? false
2251
2286
  : cell[cellKey] === 'on'
2252
2287
  ? false
2253
- : cell[cellKey]
2288
+ : Boolean(cell[cellKey])
2254
2289
  : false
2255
2290
  }
2256
2291
  onChange={(e) => {
@@ -2448,7 +2483,7 @@ function Field({
2448
2483
  ? false
2449
2484
  : cell === 'on'
2450
2485
  ? false
2451
- : cell
2486
+ : Boolean(cell)
2452
2487
  : false
2453
2488
  }
2454
2489
  onChange={(e) => {
@@ -2644,6 +2679,7 @@ function Field({
2644
2679
  'line-break',
2645
2680
  'multi-dropdown',
2646
2681
  'multi-dropdown-ajax',
2682
+ 'multi-checkbox-ajax',
2647
2683
  'plaindate',
2648
2684
  'plaindatetime',
2649
2685
  'plainrelation',
@@ -2847,7 +2883,7 @@ function Field({
2847
2883
  ? false
2848
2884
  : inputValue === 'on'
2849
2885
  ? false
2850
- : inputValue
2886
+ : Boolean(inputValue)
2851
2887
  : false
2852
2888
  }
2853
2889
  onChange={onChangeToggle}
@@ -2906,7 +2942,7 @@ function Field({
2906
2942
  // Get options based on dropdown type
2907
2943
  if (['dropdown', 'multi-dropdown'].includes(settings.type) && settings.options) {
2908
2944
  existingOptions = settings.options;
2909
- } else if (['dropdown-ajax', 'multi-dropdown-ajax', 'async-dropdown-ajax'].includes(settings.type) && options) {
2945
+ } else if (['dropdown-ajax', 'multi-dropdown-ajax', 'multi-checkbox-ajax', 'async-dropdown-ajax'].includes(settings.type) && options) {
2910
2946
  existingOptions = options;
2911
2947
  }
2912
2948
 
@@ -2977,7 +3013,7 @@ function Field({
2977
3013
  [settings.id]: createdItem.id
2978
3014
  }));
2979
3015
  }
2980
- } else if (['multi-dropdown', 'multi-dropdown-ajax', 'async-dropdown-ajax'].includes(settings.type)) {
3016
+ } else if (['multi-dropdown', 'multi-dropdown-ajax', 'multi-checkbox-ajax', 'async-dropdown-ajax'].includes(settings.type)) {
2981
3017
  // For multi-select fields, we need to handle existing selections
2982
3018
  if (onChangeSelect) {
2983
3019
  // Get current value to determine if it's multi-select
@@ -3068,7 +3104,7 @@ function Field({
3068
3104
 
3069
3105
  useEffect(() => {
3070
3106
  if (counter > 0) {
3071
- if (settings.create.parent_id !== '') {
3107
+ if (settings.create && settings.create.parent_id !== '') {
3072
3108
  formSettings.fields.forEach((item) => {
3073
3109
  if (item.id === settings.create.parent_id) {
3074
3110
  fetchChildDropdownData(
@@ -3094,6 +3130,20 @@ function Field({
3094
3130
  {renderInput()}
3095
3131
  {renderFieldLabel()}
3096
3132
  </label>
3133
+ {(settings.type === 'multi-dropdown-ajax' || settings.type === 'multi-dropdown') && settings.isCreatable && (
3134
+ <div style={{
3135
+ fontSize: '0.75rem',
3136
+ color: '#6b7280',
3137
+ marginTop: '4px',
3138
+ fontStyle: 'italic',
3139
+ display: 'flex',
3140
+ alignItems: 'center',
3141
+ gap: '4px'
3142
+ }}>
3143
+ <Lightbulb size={12} />
3144
+ Tip: Type to create new entries and press Enter
3145
+ </div>
3146
+ )}
3097
3147
  {renderAdditionalContainer()}
3098
3148
  <StandardModal
3099
3149
  isOpen={childFormShow}