@visns-studio/visns-components 4.7.0 → 4.7.2

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.
Files changed (110) hide show
  1. package/dist/104e5636d8ddb791614c.woff2 +0 -0
  2. package/dist/11fe6a83d647de5daf95.woff +0 -0
  3. package/dist/141e2a8c7836495afe2a.woff +0 -0
  4. package/dist/2ba5877f7079830b5383.woff +0 -0
  5. package/dist/2d6836f45b2037be41f3.woff +0 -0
  6. package/dist/399.0a0f3e0d21be1057d599.css +8 -0
  7. package/dist/399.b8f57fa3f8c0c10119e4.js +1 -0
  8. package/dist/47d566c3b1293dfd9d77.woff +0 -0
  9. package/dist/6282a13cbba671a71913.woff2 +0 -0
  10. package/dist/78266f551031aa9db127.woff +0 -0
  11. package/dist/7b7da89f1e3fdcbfe36c.woff2 +0 -0
  12. package/dist/7e78e8338af7efeda712.woff2 +0 -0
  13. package/dist/7fa387951673abf164b1.woff2 +0 -0
  14. package/dist/819d59862c2d0640aad8.woff +0 -0
  15. package/dist/b615e1a6c838ea059a56.woff +0 -0
  16. package/dist/b9b1aa739c660c4ce67c.woff2 +0 -0
  17. package/dist/c5f3640b11df9414facb.woff +0 -0
  18. package/dist/da26d162ff5af71d6590.woff2 +0 -0
  19. package/dist/dd5b2912dbf896310865.woff2 +0 -0
  20. package/dist/f282b331272463c1aa6c.woff2 +0 -0
  21. package/dist/index.css +2902 -0
  22. package/dist/index.js +2 -0
  23. package/dist/index.js.LICENSE.txt +150 -0
  24. package/dist/main.83b033670d64419bb497.css +1 -0
  25. package/dist/main.b1723d17cd2d3513ab62.js +1 -0
  26. package/dist/report.html +39 -0
  27. package/dist/runtime.33c276593b23f8035b8d.js +1 -0
  28. package/package.json +26 -6
  29. package/.idea/codeStyles/Project.xml +0 -50
  30. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  31. package/.idea/deployment.xml +0 -4
  32. package/.idea/modules.xml +0 -8
  33. package/.idea/php.xml +0 -19
  34. package/.idea/vcs.xml +0 -6
  35. package/.idea/visns-components.iml +0 -8
  36. package/.prettierrc.json +0 -7
  37. package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +0 -541
  38. package/.yarn/releases/yarn-3.6.1.cjs +0 -874
  39. package/.yarnrc.yml +0 -7
  40. package/components/cms/DataGrid.jsx +0 -1461
  41. package/components/cms/DropZone.jsx +0 -349
  42. package/components/cms/Field.jsx +0 -802
  43. package/components/cms/Form.jsx +0 -476
  44. package/components/cms/generic/CmsDetail.jsx +0 -36
  45. package/components/cms/generic/CmsIndex.jsx +0 -73
  46. package/components/cms/generic/CmsSort.jsx +0 -125
  47. package/components/cms/sorting/Item.jsx +0 -115
  48. package/components/cms/sorting/List.jsx +0 -30
  49. package/components/crm/AsyncSelect.jsx +0 -125
  50. package/components/crm/Autocomplete.jsx +0 -174
  51. package/components/crm/Breadcrumb.jsx +0 -52
  52. package/components/crm/Call.jsx +0 -220
  53. package/components/crm/DataGrid.jsx +0 -2701
  54. package/components/crm/Download.jsx +0 -101
  55. package/components/crm/Fetch.jsx +0 -119
  56. package/components/crm/Field.jsx +0 -1557
  57. package/components/crm/Form.jsx +0 -1409
  58. package/components/crm/Loader.jsx +0 -29
  59. package/components/crm/MultiSelect.jsx +0 -78
  60. package/components/crm/Navigation.jsx +0 -619
  61. package/components/crm/Notification.jsx +0 -197
  62. package/components/crm/QrCode.jsx +0 -83
  63. package/components/crm/Select.jsx +0 -58
  64. package/components/crm/SelectList.jsx +0 -21
  65. package/components/crm/TableFilter.jsx +0 -198
  66. package/components/crm/auth/Login.jsx +0 -223
  67. package/components/crm/auth/Profile.jsx +0 -280
  68. package/components/crm/auth/Reset.jsx +0 -111
  69. package/components/crm/auth/Verify.jsx +0 -174
  70. package/components/crm/auth/styles/Login.module.css +0 -243
  71. package/components/crm/auth/styles/Profile.module.css +0 -222
  72. package/components/crm/auth/styles/Reset.module.css +0 -216
  73. package/components/crm/auth/styles/Verify.module.css +0 -216
  74. package/components/crm/generic/AuditLog.jsx +0 -108
  75. package/components/crm/generic/AuditLogs.jsx +0 -115
  76. package/components/crm/generic/GenericAuth.jsx +0 -166
  77. package/components/crm/generic/GenericDashboard.jsx +0 -42
  78. package/components/crm/generic/GenericDetail.jsx +0 -1499
  79. package/components/crm/generic/GenericDynamic.jsx +0 -915
  80. package/components/crm/generic/GenericFormBuilder.jsx +0 -1765
  81. package/components/crm/generic/GenericIndex.jsx +0 -376
  82. package/components/crm/generic/GenericMain.jsx +0 -129
  83. package/components/crm/generic/GenericSort.jsx +0 -188
  84. package/components/crm/generic/NotificationList.jsx +0 -64
  85. package/components/crm/generic/styles/AuditLog.module.css +0 -147
  86. package/components/crm/generic/styles/AuditLogs.module.css +0 -92
  87. package/components/crm/generic/styles/GenericDetail.module.css +0 -634
  88. package/components/crm/generic/styles/GenericDynamic.module.css +0 -932
  89. package/components/crm/generic/styles/GenericFormBuilder.module.css +0 -944
  90. package/components/crm/generic/styles/GenericIndex.module.css +0 -247
  91. package/components/crm/generic/styles/GenericMain.module.css +0 -91
  92. package/components/crm/generic/styles/GenericSort.module.css +0 -123
  93. package/components/crm/generic/styles/NotificationList.module.css +0 -67
  94. package/components/crm/sorting/Item.jsx +0 -117
  95. package/components/crm/sorting/List.jsx +0 -32
  96. package/components/crm/sorting/styles/Item.module.css +0 -68
  97. package/components/crm/sorting/styles/List.module.css +0 -68
  98. package/components/crm/styles/AsyncSelect.module.css +0 -8
  99. package/components/crm/styles/Autocomplete.module.css +0 -44
  100. package/components/crm/styles/DataGrid.module.css +0 -210
  101. package/components/crm/styles/Field.module.css +0 -311
  102. package/components/crm/styles/Form.module.css +0 -499
  103. package/components/crm/styles/Loader.module.css +0 -94
  104. package/components/crm/styles/MultiSelect.module.css +0 -8
  105. package/components/crm/styles/Navigation.module.css +0 -978
  106. package/components/crm/styles/Notification.module.css +0 -147
  107. package/components/crm/styles/QrCode.module.css +0 -87
  108. package/components/crm/styles/TableFilter.module.css +0 -52
  109. package/components/styles/global.css +0 -73
  110. package/index.js +0 -86
@@ -1,197 +0,0 @@
1
- import React, { useState, useEffect, useRef } from 'react';
2
- import { useNavigate } from 'react-router-dom';
3
- import moment from 'moment';
4
- import parse from 'html-react-parser';
5
- import { toast } from 'react-toastify';
6
- import { Bell, CircleX } from 'akar-icons';
7
- import CustomFetch from './Fetch';
8
- import styles from './styles/Notification.module.css';
9
-
10
- function Notification(props) {
11
- let interval;
12
- const navigate = useNavigate();
13
- const wrapperRef = useRef(null);
14
- const [items, setItems] = useState([]);
15
- const [show, setShow] = useState(false);
16
- const { setSystemAuth } = props;
17
-
18
- const fetchNotification = () => {
19
- CustomFetch(
20
- '/ajax/user/notifications',
21
- 'POST',
22
- {},
23
- function (result) {
24
- setItems(result.data);
25
- },
26
- function (error) {
27
- if (String(error) === 'CSRF token mismatch.') {
28
- window.open('/login');
29
- } else {
30
- if (error === 'Unauthenticated.') {
31
- setSystemAuth(false);
32
- }
33
- toast.error(String(error));
34
- }
35
- }
36
- );
37
- };
38
-
39
- const handleClick = (e) => {
40
- if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
41
- setShow(false);
42
- }
43
- };
44
-
45
- const markAsRead = (e) => {
46
- e.preventDefault();
47
-
48
- let array = items;
49
- let index = e.target.dataset.index;
50
- let id = e.target.dataset.id;
51
-
52
- if (index >= 0) {
53
- array.splice(index, 1);
54
- setItems(array);
55
- }
56
-
57
- let formData = { id: id };
58
-
59
- CustomFetch(
60
- '/ajax/user/notification/markasread',
61
- 'POST',
62
- formData,
63
- function () {
64
- fetchNotification();
65
- }
66
- );
67
- };
68
-
69
- const markAllAsRead = (e) => {
70
- e.preventDefault();
71
-
72
- let array = items;
73
- setItems([]);
74
-
75
- array.map((item) => {
76
- let formData = { id: item.id };
77
-
78
- CustomFetch(
79
- '/ajax/user/notification/markasread',
80
- 'POST',
81
- formData,
82
- function () {
83
- fetchNotification();
84
- }
85
- );
86
- });
87
- };
88
-
89
- const toggleNotification = () => {
90
- setShow(!show);
91
- };
92
-
93
- const showAllNotifications = () => {
94
- navigate('/notifications');
95
- setShow(false);
96
- };
97
-
98
- useEffect(() => {
99
- fetchNotification();
100
-
101
- interval = setInterval(() => {
102
- if (!document.hidden) {
103
- fetchNotification();
104
- }
105
- }, 60000);
106
-
107
- document.addEventListener('mousedown', handleClick, false);
108
-
109
- return function cleanup() {
110
- clearInterval(interval);
111
- document.removeEventListener('mousedown', handleClick, false);
112
- };
113
- }, []);
114
-
115
- return (
116
- <>
117
- <a
118
- href="#"
119
- onClick={toggleNotification}
120
- data-tooltip-id="system-tooltip"
121
- data-tooltip-content="Notification"
122
- >
123
- <Bell
124
- size={19}
125
- strokeWidth={2}
126
- className={
127
- items.length > 0
128
- ? styles.noti
129
- : styles['cis-bell-exclamation']
130
- }
131
- />
132
- </a>
133
-
134
- {show && (
135
- <div ref={wrapperRef}>
136
- {items.length > 0 ? (
137
- <div className={styles.notibox}>
138
- <div className={styles.notiscrollwrap}>
139
- {items.map((item, index) => (
140
- <div
141
- className={styles['notibox-item']}
142
- key={item.id}
143
- >
144
- <Bell
145
- size={19}
146
- strokeWidth={2}
147
- className={
148
- styles.cisBellExclamation
149
- }
150
- />{' '}
151
- {parse(item.data.label)}{' '}
152
- <span>
153
- [
154
- {moment(item.created_at).format(
155
- 'DD/MM - H:mma'
156
- )}
157
- ]
158
- </span>{' '}
159
- <button onClick={markAsRead}>
160
- <CircleX
161
- size={24}
162
- data-id={item.id}
163
- data-index={index}
164
- className={styles.notiRead}
165
- />
166
- </button>
167
- </div>
168
- ))}
169
- </div>
170
- <div className={styles['notibox-actions']}>
171
- <button onClick={showAllNotifications}>
172
- View All
173
- </button>
174
- <button onClick={markAllAsRead}>
175
- Clear All
176
- </button>
177
- </div>
178
- </div>
179
- ) : (
180
- <div className={styles.notibox}>
181
- <div className={styles['notibox-item']}>
182
- No new notifications available.
183
- </div>
184
- <div className={styles['notibox-actions']}>
185
- <button onClick={showAllNotifications}>
186
- View All
187
- </button>
188
- </div>
189
- </div>
190
- )}
191
- </div>
192
- )}
193
- </>
194
- );
195
- }
196
-
197
- export default Notification;
@@ -1,83 +0,0 @@
1
- import { useEffect, useRef, useState } from 'react';
2
- import ReactToPrint from 'react-to-print';
3
-
4
- import CustomFetch from './Fetch';
5
- import styles from './styles/QrCode.module.css';
6
-
7
- const QrCode = ({ config, dataId }) => {
8
- const printComponentRef = useRef();
9
- const [qrCodeData, setQrCodeData] = useState({
10
- logo: '',
11
- qrCode: '',
12
- title: '',
13
- });
14
-
15
- const fetchQrCode = async ({ url }) => {
16
- try {
17
- const res = await CustomFetch(`${url}/${dataId}`, 'POST', {});
18
-
19
- setQrCodeData((prevState) => ({ ...prevState, ...res.data }));
20
- } catch (error) {
21
- console.error(error);
22
- }
23
- };
24
-
25
- useEffect(() => {
26
- fetchQrCode(config);
27
- }, []);
28
-
29
- return (
30
- <>
31
- <div className={styles.gridtxt} ref={printComponentRef}>
32
- {qrCodeData.logo && qrCodeData.logo !== '' && (
33
- <ul className={styles.customer__overview}>
34
- <li
35
- className={styles['fw-grid-item']}
36
- style={{
37
- textAlign: 'center',
38
- }}
39
- >
40
- <img
41
- src={qrCodeData.logo}
42
- alt="Dawn Projects"
43
- width="40%"
44
- />
45
- </li>
46
- </ul>
47
- )}
48
- <ul className={styles.customer__overview}>
49
- <li
50
- className={styles['fw-grid-item']}
51
- style={{
52
- textAlign: 'center',
53
- }}
54
- >
55
- {qrCodeData.title}
56
- </li>
57
- </ul>
58
- <ul className={styles.customer__overview}>
59
- <li
60
- className={styles['fw-grid-item']}
61
- style={{ textAlign: 'center' }}
62
- >
63
- {qrCodeData.qrCode && qrCodeData.qrCode !== '' && (
64
- <img
65
- src={`data:image/svg+xml;base64, ${qrCodeData.qrCode}`}
66
- alt="SVG Image"
67
- width="80%"
68
- />
69
- )}
70
- </li>
71
- </ul>
72
- </div>
73
- <div className={styles.polActions}>
74
- <ReactToPrint
75
- trigger={() => <button className="btn">Print</button>}
76
- content={() => printComponentRef.current}
77
- />
78
- </div>
79
- </>
80
- );
81
- };
82
-
83
- export default QrCode;
@@ -1,58 +0,0 @@
1
- import React from 'react';
2
-
3
- const Select = (props) => {
4
- const { className, dataOptions, inputValue, onChange, options, settings } =
5
- props;
6
-
7
- return (
8
- <select
9
- data-name={settings.id}
10
- className={className}
11
- onChange={onChange}
12
- value={inputValue}
13
- data-show={settings.show ? JSON.stringify(settings.show) : ''}
14
- >
15
- <option value="">
16
- {settings.placeholder
17
- ? settings.placeholder
18
- : 'Please select an option'}
19
- </option>
20
- {options.map((item, index) =>
21
- item.options ? (
22
- item.options.length > 0 ? ( // Check if the item contains nested options (indicating an optgroup)
23
- <optgroup
24
- key={settings.id + '-' + item.id}
25
- label={item.label}
26
- >
27
- {item.options.map((subItem, subIndex) => (
28
- <option
29
- key={
30
- settings.id +
31
- '-' +
32
- item.id +
33
- '-' +
34
- subItem.id
35
- }
36
- value={subItem.id}
37
- {...dataOptions[subIndex]}
38
- >
39
- {subItem.label}
40
- </option>
41
- ))}
42
- </optgroup>
43
- ) : null
44
- ) : (
45
- <option
46
- key={settings.id + '-' + item.id}
47
- value={item.id}
48
- {...dataOptions[index]}
49
- >
50
- {item.label}
51
- </option>
52
- )
53
- )}
54
- </select>
55
- );
56
- };
57
-
58
- export default Select;
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import { FixedSizeList } from 'react-window';
3
-
4
- function SelectList(props) {
5
- const { options, children, maxHeight, getValue } = props;
6
- const [value] = getValue();
7
- const initialOffset = options.indexOf(value) * 50;
8
-
9
- return (
10
- <FixedSizeList
11
- height={maxHeight}
12
- itemCount={children.length}
13
- itemSize={height}
14
- initialScrollOffset={initialOffset}
15
- >
16
- {({ index, style }) => <div style={style}>{children[index]}</div>}
17
- </FixedSizeList>
18
- );
19
- }
20
-
21
- export default SelectList;
@@ -1,198 +0,0 @@
1
- import React, { useState, useEffect, useRef } from 'react';
2
- import styles from './styles/TableFilter.module.css';
3
-
4
- function TableFilter({
5
- collapsible = false,
6
- filters,
7
- setFilters,
8
- setSettings,
9
- type,
10
- }) {
11
- const [visibleChildren, setVisibleChildren] = useState(null);
12
- const isFirstRender = useRef(true);
13
-
14
- useEffect(() => {
15
- if (
16
- isFirstRender.current &&
17
- filters.length > 0 &&
18
- filters[0].children &&
19
- filters[0].children.length > 0
20
- ) {
21
- setVisibleChildren(filters[0].id);
22
- isFirstRender.current = false;
23
- }
24
- }, [filters]);
25
-
26
- const filterTable = (e) => {
27
- const { id, parent, filtertype, url, value } = e.target.dataset;
28
-
29
- const updateFilter = (filter) => {
30
- let isActive = false;
31
-
32
- if (filter.hasOwnProperty('value')) {
33
- isActive = parseInt(value) === parseInt(filter.value);
34
- } else {
35
- isActive = filter.id === id;
36
- }
37
-
38
- const isParent =
39
- parent && filtertype === 'children' && filter.id === parent;
40
-
41
- const updatedChildren = isParent
42
- ? filter.children.map((child) => ({
43
- ...child,
44
- class: child.id === id ? 'subactivechildren' : '',
45
- show: child.id === id ? true : false,
46
- }))
47
- : filter.children
48
- ? filter.children.map((child, childKey) => ({
49
- ...child,
50
- class:
51
- childKey === 0 && isActive ? 'subactivechildren' : '',
52
- show: childKey === 0 && isActive ? true : false,
53
- }))
54
- : [];
55
-
56
- return {
57
- ...filter,
58
- class:
59
- isActive || isParent
60
- ? type === 'simple'
61
- ? 'activetab'
62
- : 'subactive'
63
- : '',
64
- show: isActive || isParent,
65
- children: updatedChildren,
66
- };
67
- };
68
-
69
- setFilters((prevFilters) => prevFilters.map(updateFilter));
70
-
71
- if (url && url !== '') {
72
- window.open(url);
73
- } else {
74
- if (setSettings) {
75
- setSettings((prevState) => {
76
- if (prevState.ajaxSetting) {
77
- let _where = prevState.ajaxSetting.where.reduce(
78
- (acc, a) => {
79
- if (
80
- a.id === id &&
81
- !acc.some((b) => b.id === id)
82
- ) {
83
- acc.push({ id: id, value: value });
84
- } else {
85
- acc.push(a);
86
- }
87
- return acc;
88
- },
89
- []
90
- );
91
-
92
- return {
93
- ...prevState,
94
- ajaxSetting: {
95
- ...prevState.ajaxSetting,
96
- where: _where,
97
- },
98
- };
99
- } else {
100
- let w = prevState.where
101
- ? prevState.where.map((a) => {
102
- if (id === a.id) {
103
- return { ...a, value: value };
104
- }
105
- return a;
106
- })
107
- : [];
108
-
109
- return { ...prevState, where: w };
110
- }
111
- });
112
- }
113
- }
114
-
115
- // Handle collapsible functionality
116
- if (collapsible && filtertype === 'parent') {
117
- setVisibleChildren(id);
118
- }
119
- };
120
-
121
- const renderContent = (d) => {
122
- const parentClass = `${styles.link} ${styles[d.class] || ''}`;
123
- const childClass = (child) =>
124
- `${styles.link} ${styles[child.class] || ''}`;
125
-
126
- if (type === 'simple') {
127
- return (
128
- <li className={styles[d.class]}>
129
- <button
130
- data-id={d.id}
131
- data-filtertype="parent"
132
- data-url={d.url || ''}
133
- data-value={d.hasOwnProperty('value') ? d.value : ''}
134
- onClick={filterTable}
135
- >
136
- {d.label}
137
- </button>
138
- </li>
139
- );
140
- } else {
141
- return (
142
- <li>
143
- <a
144
- data-id={d.id}
145
- data-filtertype="parent"
146
- data-url={d.url || ''}
147
- data-value={d.hasOwnProperty('value') ? d.value : ''}
148
- onClick={filterTable}
149
- className={parentClass}
150
- >
151
- {d.label}
152
- </a>
153
- {d.children && d.children.length > 0 && (
154
- <ul
155
- className={`${styles.collapsibleMenu} ${
156
- visibleChildren === d.id
157
- ? styles.visibleMenu
158
- : ''
159
- }`}
160
- >
161
- {d.children.map((child, key) => (
162
- <li key={`table-filter-child-${d.id}-${key}`}>
163
- <a
164
- className={childClass(child)}
165
- data-id={child.id}
166
- data-value={
167
- child.hasOwnProperty('value')
168
- ? child.value
169
- : ''
170
- }
171
- data-url={child.url || ''}
172
- data-filtertype="children"
173
- data-parent={d.id}
174
- onClick={filterTable}
175
- >
176
- {child.label}
177
- </a>
178
- </li>
179
- ))}
180
- </ul>
181
- )}
182
- </li>
183
- );
184
- }
185
- };
186
-
187
- return (
188
- <ul className={styles.tableFilter}>
189
- {filters.map((item, key) => (
190
- <React.Fragment key={'table-filter-' + key}>
191
- {renderContent(item)}
192
- </React.Fragment>
193
- ))}
194
- </ul>
195
- );
196
- }
197
-
198
- export default TableFilter;