argous 1.2.134 → 1.2.138

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 (263) hide show
  1. package/dist/actions/index.d.ts +58 -0
  2. package/dist/actions/index.js +59 -0
  3. package/dist/api/WebSocket.d.ts +25 -0
  4. package/dist/api/WebSocket.js +170 -0
  5. package/dist/api/index.d.ts +63 -0
  6. package/dist/api/index.js +762 -0
  7. package/dist/api/ws.d.ts +4 -0
  8. package/dist/api/ws.js +36 -0
  9. package/dist/components/Alert/Alert.d.ts +8 -0
  10. package/dist/components/Alert/Alert.js +68 -0
  11. package/dist/components/Alert/index.d.ts +2 -0
  12. package/dist/components/Alert/index.js +8 -0
  13. package/dist/components/ArgousAction/ArgousAction.d.ts +8 -0
  14. package/dist/components/ArgousAction/ArgousAction.js +87 -0
  15. package/dist/components/ArgousAction/index.d.ts +2 -0
  16. package/dist/components/ArgousAction/index.js +8 -0
  17. package/dist/components/ArgousAvatar/ArgousAvatar.d.ts +14 -0
  18. package/dist/components/ArgousAvatar/ArgousAvatar.js +124 -0
  19. package/dist/components/ArgousAvatar/index.d.ts +2 -0
  20. package/dist/components/ArgousAvatar/index.js +8 -0
  21. package/dist/components/ArgousComplexPagination/ArgousComplexPagination.d.ts +76 -0
  22. package/dist/components/ArgousComplexPagination/ArgousComplexPagination.js +156 -0
  23. package/dist/components/ArgousComplexPagination/index.d.ts +2 -0
  24. package/dist/components/ArgousComplexPagination/index.js +8 -0
  25. package/dist/components/ArgousComplexTable/ArgousComplexTable.d.ts +131 -0
  26. package/dist/components/ArgousComplexTable/ArgousComplexTable.js +333 -0
  27. package/dist/components/ArgousComplexTable/index.d.ts +2 -0
  28. package/dist/components/ArgousComplexTable/index.js +8 -0
  29. package/dist/components/ArgousComplexTableBody/ArgousComplexTableBody.d.ts +177 -0
  30. package/dist/components/ArgousComplexTableBody/ArgousComplexTableBody.js +155 -0
  31. package/dist/components/ArgousComplexTableBody/index.d.ts +2 -0
  32. package/dist/components/ArgousComplexTableBody/index.js +8 -0
  33. package/dist/components/ArgousComplexTableHead/ArgousComplexTableHead.d.ts +73 -0
  34. package/dist/components/ArgousComplexTableHead/ArgousComplexTableHead.js +88 -0
  35. package/dist/components/ArgousComplexTableHead/index.d.ts +2 -0
  36. package/dist/components/ArgousComplexTableHead/index.js +8 -0
  37. package/dist/components/ArgousComplexTableToolbar/ArgousComplexTableToolBar.d.ts +58 -0
  38. package/dist/components/ArgousComplexTableToolbar/ArgousComplexTableToolBar.js +70 -0
  39. package/dist/components/ArgousComplexTableToolbar/index.d.ts +2 -0
  40. package/dist/components/ArgousComplexTableToolbar/index.js +8 -0
  41. package/dist/components/ArgousInput/ArgousInput.d.ts +8 -0
  42. package/dist/components/ArgousInput/ArgousInput.js +578 -0
  43. package/dist/components/ArgousInput/index.d.ts +2 -0
  44. package/dist/components/ArgousInput/index.js +8 -0
  45. package/dist/components/ArgousPagination/ArgousPagination.d.ts +8 -0
  46. package/dist/components/ArgousPagination/ArgousPagination.js +29 -0
  47. package/dist/components/ArgousPagination/index.d.ts +2 -0
  48. package/dist/components/ArgousPagination/index.js +8 -0
  49. package/dist/components/ArgousProgressBar/ArgousProgressBar.d.ts +22 -0
  50. package/dist/components/ArgousProgressBar/ArgousProgressBar.js +162 -0
  51. package/dist/components/ArgousProgressBar/index.d.ts +2 -0
  52. package/dist/components/ArgousProgressBar/index.js +8 -0
  53. package/dist/components/ArgousSimpleTable/ArgousSimpleTable.d.ts +8 -0
  54. package/dist/components/ArgousSimpleTable/ArgousSimpleTable.js +201 -0
  55. package/dist/components/ArgousSimpleTable/index.d.ts +2 -0
  56. package/dist/components/ArgousSimpleTable/index.js +8 -0
  57. package/dist/components/AutoComplete/AutoComplete.d.ts +8 -0
  58. package/dist/components/AutoComplete/AutoComplete.js +185 -0
  59. package/dist/components/AutoComplete/index.d.ts +2 -0
  60. package/dist/components/AutoComplete/index.js +8 -0
  61. package/dist/components/AutoCompleteFavorites/AutoCompleteFavorites.d.ts +20 -0
  62. package/dist/components/AutoCompleteFavorites/AutoCompleteFavorites.js +331 -0
  63. package/dist/components/AutoCompleteFavorites/index.d.ts +1 -0
  64. package/dist/components/AutoCompleteFavorites/index.js +8 -0
  65. package/dist/components/BarChart/BarChart.d.ts +8 -0
  66. package/dist/components/BarChart/BarChart.js +125 -0
  67. package/dist/components/BarChart/index.d.ts +2 -0
  68. package/dist/components/BarChart/index.js +8 -0
  69. package/dist/components/BarraFerramentas/BarraFerramentas.d.ts +21 -0
  70. package/dist/components/BarraFerramentas/BarraFerramentas.js +228 -0
  71. package/dist/components/BarraFerramentas/index.d.ts +2 -0
  72. package/dist/components/BarraFerramentas/index.js +8 -0
  73. package/dist/components/Button/Button.d.ts +8 -0
  74. package/dist/components/Button/Button.js +144 -0
  75. package/dist/components/Button/index.d.ts +2 -0
  76. package/dist/components/Button/index.js +8 -0
  77. package/dist/components/Cabecalho/Cabecalho.d.ts +8 -0
  78. package/dist/components/Cabecalho/Cabecalho.js +231 -0
  79. package/dist/components/Cabecalho/index.d.ts +2 -0
  80. package/dist/components/Cabecalho/index.js +8 -0
  81. package/dist/components/Calendar/Calendar.d.ts +8 -0
  82. package/dist/components/Calendar/Calendar.js +171 -0
  83. package/dist/components/Calendar/index.d.ts +2 -0
  84. package/dist/components/Calendar/index.js +8 -0
  85. package/dist/components/CartaoUsuario/CartaoUsuario.d.ts +9 -0
  86. package/dist/components/CartaoUsuario/CartaoUsuario.js +165 -0
  87. package/dist/components/CartaoUsuario/index.d.ts +2 -0
  88. package/dist/components/CartaoUsuario/index.js +8 -0
  89. package/dist/components/Collapse/Collapse.d.ts +60 -0
  90. package/dist/components/Collapse/Collapse.js +290 -0
  91. package/dist/components/Collapse/index.d.ts +3 -0
  92. package/dist/components/Collapse/index.js +8 -0
  93. package/dist/components/Compartilhar/Compartilhar.d.ts +7 -0
  94. package/dist/components/Compartilhar/Compartilhar.js +266 -0
  95. package/dist/components/Compartilhar/index.d.ts +2 -0
  96. package/dist/components/Compartilhar/index.js +8 -0
  97. package/dist/components/ConfirmModal/BasicModal.d.ts +38 -0
  98. package/dist/components/ConfirmModal/BasicModal.js +29 -0
  99. package/dist/components/ConfirmModal/ModalProvider.d.ts +5 -0
  100. package/dist/components/ConfirmModal/ModalProvider.js +108 -0
  101. package/dist/components/ConfirmModal/WrapperModal.d.ts +18 -0
  102. package/dist/components/ConfirmModal/WrapperModal.js +41 -0
  103. package/dist/components/ConfirmModal/index.d.ts +20 -0
  104. package/dist/components/ConfirmModal/index.js +25 -0
  105. package/dist/components/DropArea/DropArea.d.ts +21 -0
  106. package/dist/components/DropArea/DropArea.js +149 -0
  107. package/dist/components/DropArea/Html5FileSelector.d.ts +16 -0
  108. package/dist/components/DropArea/Html5FileSelector.js +229 -0
  109. package/dist/components/DropArea/index.d.ts +2 -0
  110. package/dist/components/DropArea/index.js +8 -0
  111. package/dist/components/Editor/Events.d.ts +79 -0
  112. package/dist/components/Editor/Events.js +9 -0
  113. package/dist/components/Editor/ScriptLoader.d.ts +20 -0
  114. package/dist/components/Editor/ScriptLoader.js +70 -0
  115. package/dist/components/Editor/TinyMCE.d.ts +10 -0
  116. package/dist/components/Editor/TinyMCE.js +16 -0
  117. package/dist/components/Editor/Utils.d.ts +19 -0
  118. package/dist/components/Editor/Utils.js +62 -0
  119. package/dist/components/Editor/components/Editor.d.ts +67 -0
  120. package/dist/components/Editor/components/Editor.js +351 -0
  121. package/dist/components/Editor/components/EditorPropTypes.d.ts +18 -0
  122. package/dist/components/Editor/components/EditorPropTypes.js +110 -0
  123. package/dist/components/Editor/index.d.ts +9 -0
  124. package/dist/components/Editor/index.js +12 -0
  125. package/dist/components/Editor/tinymce/tinymce.d.ts +2963 -0
  126. package/dist/components/FilePreparer/FilePreparer.d.ts +26 -0
  127. package/dist/components/FilePreparer/FilePreparer.js +279 -0
  128. package/dist/components/FilePreparer/index.d.ts +2 -0
  129. package/dist/components/FilePreparer/index.js +8 -0
  130. package/dist/components/FileUploader/FileUploader.d.ts +9 -0
  131. package/dist/components/FileUploader/FileUploader.js +445 -0
  132. package/dist/components/FileUploader/index.d.ts +2 -0
  133. package/dist/components/FileUploader/index.js +8 -0
  134. package/dist/components/FormVisualizer/FormVisualizer.d.ts +92 -0
  135. package/dist/components/FormVisualizer/FormVisualizer.js +264 -0
  136. package/dist/components/FormVisualizer/index.d.ts +2 -0
  137. package/dist/components/FormVisualizer/index.js +8 -0
  138. package/dist/components/Highlight/Highlight.d.ts +7 -0
  139. package/dist/components/Highlight/Highlight.js +75 -0
  140. package/dist/components/Highlight/index.d.ts +2 -0
  141. package/dist/components/Highlight/index.js +8 -0
  142. package/dist/components/ImageResize/ImageResize.d.ts +28 -0
  143. package/dist/components/ImageResize/ImageResize.js +472 -0
  144. package/dist/components/ImageResize/index.d.ts +2 -0
  145. package/dist/components/ImageResize/index.js +8 -0
  146. package/dist/components/ImageResizeButton/ImageResizeButton.d.ts +26 -0
  147. package/dist/components/ImageResizeButton/ImageResizeButton.js +89 -0
  148. package/dist/components/ImageResizeButton/index.d.ts +2 -0
  149. package/dist/components/ImageResizeButton/index.js +8 -0
  150. package/dist/components/Input/Input.d.ts +8 -0
  151. package/dist/components/Input/Input.js +328 -0
  152. package/dist/components/Input/index.d.ts +2 -0
  153. package/dist/components/Input/index.js +8 -0
  154. package/dist/components/InputTags/InputTags.d.ts +8 -0
  155. package/dist/components/InputTags/InputTags.js +129 -0
  156. package/dist/components/InputTags/index.d.ts +2 -0
  157. package/dist/components/InputTags/index.js +8 -0
  158. package/dist/components/ListSelect/ListSelect.d.ts +8 -0
  159. package/dist/components/ListSelect/ListSelect.js +126 -0
  160. package/dist/components/ListSelect/index.d.ts +2 -0
  161. package/dist/components/ListSelect/index.js +8 -0
  162. package/dist/components/MaterialButton/MaterialButton.d.ts +13 -0
  163. package/dist/components/MaterialButton/MaterialButton.js +192 -0
  164. package/dist/components/MaterialButton/index.d.ts +2 -0
  165. package/dist/components/MaterialButton/index.js +8 -0
  166. package/dist/components/MenuBar/MenuBar.d.ts +8 -0
  167. package/dist/components/MenuBar/MenuBar.js +157 -0
  168. package/dist/components/MenuBar/index.d.ts +2 -0
  169. package/dist/components/MenuBar/index.js +8 -0
  170. package/dist/components/MonthPicker/MonthPicker.d.ts +8 -0
  171. package/dist/components/MonthPicker/MonthPicker.js +288 -0
  172. package/dist/components/MonthPicker/index.d.ts +2 -0
  173. package/dist/components/MonthPicker/index.js +8 -0
  174. package/dist/components/MultipleSelect/MultipleSelect.d.ts +8 -0
  175. package/dist/components/MultipleSelect/MultipleSelect.js +139 -0
  176. package/dist/components/MultipleSelect/index.d.ts +2 -0
  177. package/dist/components/MultipleSelect/index.js +8 -0
  178. package/dist/components/OtpInput/OtpInput.d.ts +18 -0
  179. package/dist/components/OtpInput/OtpInput.js +207 -0
  180. package/dist/components/OtpInput/index.d.ts +2 -0
  181. package/dist/components/OtpInput/index.js +8 -0
  182. package/dist/components/OutputText/OutputText.d.ts +8 -0
  183. package/dist/components/OutputText/OutputText.js +89 -0
  184. package/dist/components/OutputText/index.d.ts +2 -0
  185. package/dist/components/OutputText/index.js +8 -0
  186. package/dist/components/Pagination/Pagination.d.ts +8 -0
  187. package/dist/components/Pagination/Pagination.js +64 -0
  188. package/dist/components/Pagination/index.d.ts +2 -0
  189. package/dist/components/Pagination/index.js +8 -0
  190. package/dist/components/Programa/Programa.d.ts +31 -0
  191. package/dist/components/Programa/Programa.js +201 -0
  192. package/dist/components/Programa/index.d.ts +2 -0
  193. package/dist/components/Programa/index.js +8 -0
  194. package/dist/components/ProgressBar/ProgressBar.d.ts +8 -0
  195. package/dist/components/ProgressBar/ProgressBar.js +98 -0
  196. package/dist/components/ProgressBar/index.d.ts +2 -0
  197. package/dist/components/ProgressBar/index.js +8 -0
  198. package/dist/components/Select/Select.d.ts +8 -0
  199. package/dist/components/Select/Select.js +142 -0
  200. package/dist/components/Select/index.d.ts +2 -0
  201. package/dist/components/Select/index.js +8 -0
  202. package/dist/components/SimpleTable/SimpleTable.d.ts +13 -0
  203. package/dist/components/SimpleTable/SimpleTable.js +390 -0
  204. package/dist/components/SimpleTable/index.d.ts +2 -0
  205. package/dist/components/SimpleTable/index.js +10 -0
  206. package/dist/components/Stepper/Stepper.d.ts +54 -0
  207. package/dist/components/Stepper/Stepper.js +157 -0
  208. package/dist/components/Stepper/index.d.ts +2 -0
  209. package/dist/components/Stepper/index.js +8 -0
  210. package/dist/components/TablePicker/TablePicker.d.ts +8 -0
  211. package/dist/components/TablePicker/TablePicker.js +222 -0
  212. package/dist/components/TablePicker/index.d.ts +2 -0
  213. package/dist/components/TablePicker/index.js +8 -0
  214. package/dist/components/Tabs/Tabs.d.ts +8 -0
  215. package/dist/components/Tabs/Tabs.js +76 -0
  216. package/dist/components/Tabs/index.d.ts +2 -0
  217. package/dist/components/Tabs/index.js +8 -0
  218. package/dist/components/TextArea/TextArea.d.ts +8 -0
  219. package/dist/components/TextArea/TextArea.js +148 -0
  220. package/dist/components/TextArea/index.d.ts +2 -0
  221. package/dist/components/TextArea/index.js +8 -0
  222. package/dist/components/ThreadLog/ThreadLog.d.ts +8 -0
  223. package/dist/components/ThreadLog/ThreadLog.js +225 -0
  224. package/dist/components/ThreadLog/index.d.ts +2 -0
  225. package/dist/components/ThreadLog/index.js +8 -0
  226. package/dist/components/UtilAutoComplete/UtilAutoComplete.d.ts +93 -0
  227. package/dist/components/UtilAutoComplete/UtilAutoComplete.js +188 -0
  228. package/dist/components/UtilAutoComplete/index.d.ts +2 -0
  229. package/dist/components/UtilAutoComplete/index.js +8 -0
  230. package/dist/components/index.d.ts +148 -0
  231. package/dist/components/index.js +165 -0
  232. package/dist/fieldsRedux/createField.d.ts +8 -0
  233. package/dist/fieldsRedux/createField.js +149 -0
  234. package/dist/fieldsRedux/fieldsRedux.d.ts +71 -0
  235. package/dist/fieldsRedux/fieldsRedux.js +436 -0
  236. package/dist/fieldsRedux/index.d.ts +4 -0
  237. package/dist/fieldsRedux/index.js +27 -0
  238. package/dist/fieldsRedux/passFields.d.ts +5 -0
  239. package/dist/fieldsRedux/passFields.js +107 -0
  240. package/dist/reducers/argous.d.ts +76 -0
  241. package/dist/reducers/argous.js +63 -0
  242. package/dist/reducers/index.d.ts +4 -0
  243. package/dist/reducers/index.js +9 -0
  244. package/dist/types.d.ts +144 -0
  245. package/dist/utils/api.d.ts +29 -0
  246. package/dist/utils/api.js +255 -0
  247. package/dist/utils/config.d.ts +3 -0
  248. package/dist/utils/config.js +13 -0
  249. package/dist/utils/date.d.ts +8 -0
  250. package/dist/utils/date.js +60 -0
  251. package/dist/utils/index.d.ts +61 -0
  252. package/dist/utils/index.js +383 -0
  253. package/dist/utils/rippleEffect.d.ts +2 -0
  254. package/dist/utils/rippleEffect.js +173 -0
  255. package/dist/utils/store.d.ts +3 -0
  256. package/dist/utils/store.js +12 -0
  257. package/dist/utils/xmlToJson.d.ts +2 -0
  258. package/dist/utils/xmlToJson.js +158 -0
  259. package/lib/api/index.js +16 -0
  260. package/lib/components/AutoCompleteFavorites/AutoCompleteFavorites.js +298 -0
  261. package/lib/components/AutoCompleteFavorites/index.js +1 -0
  262. package/lib/components/index.js +4 -1
  263. package/package.json +1 -1
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseXml = exports.xmlStringToJson = void 0;
4
+ var xmlStringToJson = function (xml, prefixToRemove) {
5
+ if (prefixToRemove === void 0) { prefixToRemove = ''; }
6
+ return JSON.parse(xml2json(exports.parseXml(xml)).replaceAll(prefixToRemove, ''));
7
+ };
8
+ exports.xmlStringToJson = xmlStringToJson;
9
+ var parseXml = function (xml) {
10
+ return (new DOMParser()).parseFromString(xml, 'text/xml');
11
+ };
12
+ exports.parseXml = parseXml;
13
+ var xml2json = function (xml) {
14
+ var toObj = function (xml) {
15
+ var o = {};
16
+ if (xml.nodeType === 1) { // element node ..
17
+ if (xml.firstChild) { // element has child nodes ..
18
+ var textChild = 0, cdataChild = 0, hasElementChild = false;
19
+ for (var n = xml.firstChild; n; n = n.nextSibling) {
20
+ if (n.nodeType === 1)
21
+ hasElementChild = true;
22
+ else if (n.nodeType === 3 && n.nodeValue.match(/[^ \f\n\r\t\v]/))
23
+ textChild++; // non-whitespace text
24
+ else if (n.nodeType === 4)
25
+ cdataChild++; // cdata section node
26
+ }
27
+ if (hasElementChild) {
28
+ if (textChild < 2 && cdataChild < 2) { // structured element with evtl. a single text or/and cdata node ..
29
+ removeWhite(xml);
30
+ for (var n = xml.firstChild; n; n = n.nextSibling) {
31
+ if (n.nodeType === 3)
32
+ o['#text'] = escape(n.nodeValue); // text node
33
+ else if (n.nodeType === 4)
34
+ o['#cdata'] = escape(n.nodeValue); // cdata node
35
+ else if (o[n.nodeName]) { // multiple occurence of element ..
36
+ if (o[n.nodeName] instanceof Array)
37
+ o[n.nodeName][o[n.nodeName].length] = toObj(n);
38
+ else
39
+ o[n.nodeName] = [o[n.nodeName], toObj(n)];
40
+ }
41
+ else
42
+ o[n.nodeName] = toObj(n); // first occurence of element..
43
+ }
44
+ }
45
+ else if (!xml.attributes.length)
46
+ o = escape(innerXml(xml));
47
+ else
48
+ o['#text'] = escape(innerXml(xml));
49
+ }
50
+ else if (textChild) { // pure text
51
+ if (!xml.attributes.length)
52
+ o = escape(innerXml(xml));
53
+ else
54
+ o['#text'] = escape(innerXml(xml));
55
+ }
56
+ else if (cdataChild) { // cdata
57
+ if (cdataChild > 1)
58
+ o = escape(innerXml(xml));
59
+ else
60
+ for (var n = xml.firstChild; n; n = n.nextSibling)
61
+ o['#cdata'] = escape(n.nodeValue);
62
+ }
63
+ }
64
+ if (!xml.attributes.length && !xml.firstChild)
65
+ o = null;
66
+ }
67
+ else if (xml.nodeType === 9) { // document.node
68
+ o = toObj(xml.documentElement);
69
+ }
70
+ else
71
+ console.error('unhandled node type: ' + xml.nodeType);
72
+ return o;
73
+ };
74
+ var toJson = function (o, name, ind) {
75
+ var json = name ? ('"' + name + '"') : '';
76
+ if (o instanceof Array) {
77
+ for (var i = 0, n = o.length; i < n; i++)
78
+ o[i] = toJson(o[i], '', ind + '\t');
79
+ json += (name ? ':[' : '[') + (o.length > 1 ? ('\n' + ind + '\t' + o.join(',\n' + ind + '\t') + '\n' + ind) : o.join('')) + ']';
80
+ }
81
+ else if (!o)
82
+ json += (name && ':') + 'null';
83
+ else if (typeof (o) == 'object') {
84
+ var arr = [];
85
+ for (var m in o)
86
+ if (Object.prototype.hasOwnProperty.call(o, m))
87
+ arr[arr.length] = toJson(o[m], m, ind + '\t');
88
+ json += (name ? ':{' : '{') + (arr.length > 1 ? ('\n' + ind + '\t' + arr.join(',\n' + ind + '\t') + '\n' + ind) : arr.join('')) + '}';
89
+ }
90
+ else if (typeof (o) == 'string')
91
+ json += (name && ':') + '"' + o.toString() + '"';
92
+ else
93
+ json += (name && ':') + o.toString();
94
+ return json;
95
+ };
96
+ var innerXml = function (node) {
97
+ var s = '';
98
+ if ('innerHTML' in node)
99
+ s = node.innerHTML;
100
+ else {
101
+ var asXml_1 = function (n) {
102
+ var s = '';
103
+ if (n.nodeType === 1) {
104
+ s += '<' + n.nodeName;
105
+ for (var i = 0; i < n.attributes.length; i++)
106
+ s += ' ' + n.attributes[i].nodeName + '="' + (n.attributes[i].nodeValue || '').toString() + '"';
107
+ if (n.firstChild) {
108
+ s += '>';
109
+ for (var c = n.firstChild; c; c = c.nextSibling)
110
+ s += asXml_1(c);
111
+ s += '</' + n.nodeName + '>';
112
+ }
113
+ else
114
+ s += '/>';
115
+ }
116
+ else if (n.nodeType === 3)
117
+ s += n.nodeValue;
118
+ else if (n.nodeType === 4)
119
+ s += '<![CDATA[' + n.nodeValue + ']]>';
120
+ return s;
121
+ };
122
+ for (var c = node.firstChild; c; c = c.nextSibling)
123
+ s += asXml_1(c);
124
+ }
125
+ return s;
126
+ };
127
+ var escape = function (txt) {
128
+ return txt.replace(/[\\]/g, '\\\\')
129
+ .replace(/["]/g, '\\"')
130
+ .replace(/[\n]/g, '\\n')
131
+ .replace(/[\r]/g, '\\r');
132
+ };
133
+ var removeWhite = function (e) {
134
+ e.normalize();
135
+ for (var n = e.firstChild; n;) {
136
+ if (n.nodeType === 3) { // text node
137
+ if (!n.nodeValue.match(/[^ \f\n\r\t\v]/)) { // pure whitespace text node
138
+ var nxt = n.nextSibling;
139
+ e.removeChild(n);
140
+ n = nxt;
141
+ }
142
+ else
143
+ n = n.nextSibling;
144
+ }
145
+ else if (n.nodeType === 1) { // element node
146
+ removeWhite(n);
147
+ n = n.nextSibling;
148
+ }
149
+ else
150
+ n = n.nextSibling; // any other node
151
+ }
152
+ return e;
153
+ };
154
+ if (xml.nodeType === 9)
155
+ xml = xml.documentElement; // document node
156
+ var json = toJson(toObj(removeWhite(xml)), xml.nodeName, '\t');
157
+ return '{\n' + json.replace(/\t|\n/g, '') + '\n}';
158
+ };
package/lib/api/index.js CHANGED
@@ -48,6 +48,22 @@ export const validaToken = async () => {
48
48
  return await res.json();
49
49
  };
50
50
 
51
+ export const getMenu = async () => {
52
+ const res = await fetch(`${api()}agetmenu.rslvr`, {
53
+ method: 'POST',
54
+ headers: headers()
55
+ });
56
+ return await res.json();
57
+ };
58
+
59
+ export const getPostsTimeline = async (data) => {
60
+ const res = await fetch(`${api()}agtimeline.rslvr`, {
61
+ method: 'POST',
62
+ body: JSON.stringify(data),
63
+ headers: headers()
64
+ });
65
+ return await res.json();
66
+ };
51
67
 
52
68
  export const addCommentPost = async (data) => {
53
69
  const res = await fetch(`${api()}agpostcomment.rslvr`, {
@@ -0,0 +1,298 @@
1
+ import { serverAction, setError } from '../../utils/api';
2
+ import { Chip, CircularProgress, Fade, ListItem, ListItemText, ListSubheader, makeStyles, Slide, TextField, Tooltip, withStyles } from '@material-ui/core';
3
+ import { Autocomplete } from '@material-ui/lab';
4
+ import clsx from 'clsx';
5
+ import { isObject, isString } from 'lodash';
6
+ import React, { forwardRef, useCallback, useEffect, useState } from 'react';
7
+
8
+ const useStyles = makeStyles((theme) => ({
9
+ subHeader: {
10
+ display: 'flex',
11
+ alignItems: 'center',
12
+ justifyContent: 'space-between',
13
+ backgroundColor: theme.palette.background.default,
14
+ height: 25
15
+ },
16
+ divButton: {
17
+ display: 'flex',
18
+ alignItems: 'center',
19
+ justifyContent: 'center',
20
+ },
21
+ areaButton: {
22
+ padding: '0px 8px 0px 8px'
23
+ },
24
+ button: theme.palette.type === 'light' ? {
25
+ width: 15,
26
+ height: 15,
27
+ display: 'flex',
28
+ alignItems: 'center',
29
+ justifyContent: 'center',
30
+ cursor: 'pointer',
31
+ color: 'rgba(0, 0, 0, 0.4)',
32
+ '&:hover': {
33
+ fontWeight: 500,
34
+ color: '#000000',
35
+ }
36
+ } : {
37
+ width: 15,
38
+ height: 15,
39
+ display: 'flex',
40
+ alignItems: 'center',
41
+ justifyContent: 'center',
42
+ cursor: 'pointer',
43
+ color: 'rgba(255, 255, 255, 0.4)',
44
+ '&:hover': {
45
+ fontWeight: 500,
46
+ color: '#ffffff',
47
+ }
48
+ },
49
+ buttonActive: theme.palette.type === 'light' ? {
50
+ color: 'rgba(0, 0, 0, 0.8)',
51
+ '&:hover': {
52
+ fontWeight: 600,
53
+ }
54
+ } : {
55
+ color: 'rgba(255, 255, 255, 0.8)',
56
+ '&:hover': {
57
+ fontWeight: 600,
58
+ }
59
+ },
60
+ listItem: {
61
+ padding: 0,
62
+ width: '100%',
63
+ cursor: 'pointer',
64
+ '&:hover': {
65
+ background: theme.palette.type === 'light' ? 'rgba(0, 0, 0, 0.05)' : 'rgba(255, 255, 255, 0.08)'
66
+ }
67
+ },
68
+ listItemText: {
69
+ margin: 0,
70
+ width: '100%',
71
+ direction: 'ltr',
72
+ overflow: 'visible',
73
+ whiteSpace: 'nowrap',
74
+ textOverflow: 'ellipsis',
75
+ padding: '0px 0px 0px 6px',
76
+ },
77
+ box: {
78
+ padding: 0,
79
+ overflowX: 'hidden',
80
+ '&::-webkit-scrollbar': {
81
+ width: 5
82
+ },
83
+ '&::-webkit-scrollbar-track': {
84
+ background: '#0000'
85
+ },
86
+ '&::-webkit-scrollbar-thumb': {
87
+ background: theme.palette.type === 'light' ? 'rgba(0, 0, 0, 0.1)' : 'rgba(255, 255, 255, 0.1)'
88
+ }
89
+ }
90
+ }));
91
+
92
+ const CustomTooltip = withStyles((theme) => ({
93
+ tooltip: theme.palette.type === 'light' ? {
94
+ fontSize: 15,
95
+ fontWeight: 400,
96
+ color: 'rgb(255, 255, 255)',
97
+ backgroundColor: '#333333e3',
98
+ } : {
99
+ fontSize: 15,
100
+ fontWeight: 400,
101
+ color: 'rgb(0, 0, 0)',
102
+ backgroundColor: '#fbfbfbd1',
103
+ },
104
+ arrow: {
105
+ color: theme.palette.type === 'light' ? '#333333e3' : '#fbfbfbd1'
106
+ }
107
+ }))(Tooltip);
108
+
109
+ const ListboxFavorites = forwardRef((props, ref) => {
110
+
111
+ const classes = useStyles();
112
+ const { children, favoritePage, dados, setDados, groupHeaderColor, groupTitleColor } = props;
113
+ const { pageNumber, favoritosLength, direction, slide } = dados;
114
+
115
+ function retornaInicio() {
116
+ switch (pageNumber) {
117
+ case 1:
118
+ return 0;
119
+ case 2:
120
+ return 7;
121
+ case 3:
122
+ return 14;
123
+ default: return;
124
+ }
125
+ }
126
+
127
+ function retornaFim() {
128
+ switch (pageNumber) {
129
+ case 1:
130
+ return 7;
131
+ case 2:
132
+ return 14;
133
+ case 3:
134
+ return favoritosLength;
135
+ default: return;
136
+ }
137
+ }
138
+
139
+ function retornaArray(sectionIndex, section) {
140
+ if (sectionIndex === 0 && favoritePage && favoritosLength > 7) return section.props.children[1].props.children.slice(retornaInicio(), retornaFim());
141
+ return section.props.children[1].props.children;
142
+ }
143
+
144
+ function retornaEstrutura(sectionIndex, item) {
145
+ if (sectionIndex === 0 && favoritePage && favoritosLength > 7) {
146
+ return (
147
+ <Slide in={slide} direction={direction}>
148
+ <CustomTooltip title={item.props.children} arrow enterDelay='1000' enterNextDelay='1000' placement='top-end' TransitionComponent={Fade} TransitionProps={{ timeout: { enter: 100, exit: 500 } }}>
149
+ <ListItem {...item.props} key={item.key} className={classes.listItem}>
150
+ <ListItemText primary={item.props.children} className={classes.listItemText} />
151
+ </ListItem>
152
+ </CustomTooltip>
153
+ </Slide>
154
+ );
155
+ } return (
156
+ <CustomTooltip title={item.props.children} arrow enterDelay='1000' enterNextDelay='1000' placement='top-end' TransitionComponent={Fade} TransitionProps={{ timeout: { enter: 100, exit: 500 } }}>
157
+ <ListItem {...item.props} key={item.key} className={classes.listItem}>
158
+ <ListItemText primary={item.props.children} className={classes.listItemText} />
159
+ </ListItem>
160
+ </CustomTooltip>
161
+ );
162
+ }
163
+
164
+ function buttonClick(evento, value) {
165
+ evento.preventDefault();
166
+ evento.stopPropagation();
167
+ if (value !== pageNumber) {
168
+ verificaSaidaSlide(value);
169
+ setDados(v => ({ ...v, slide: false }));
170
+ setTimeout(() => {
171
+ setDados(v => ({ ...v, pageNumber: value, direction: retornaDirection(value) }));
172
+ setTimeout(() => setDados(v => ({ ...v, slide: true })), 100);
173
+ }, 200);
174
+ }
175
+ }
176
+
177
+ function verificaSaidaSlide(value) {
178
+ let direction = '';
179
+ if ((value === 2 || value === 3) && pageNumber === 1) direction = 'right';
180
+ else if (value === 3 && pageNumber === 2) direction = 'right';
181
+ else if (value === 1 && pageNumber === 2) direction = 'left';
182
+ direction && setDados(v => ({ ...v, direction: direction }));
183
+ }
184
+
185
+ function retornaDirection(value) {
186
+ if (value < pageNumber) return 'right';
187
+ return 'left';
188
+ }
189
+
190
+ return children.map((section, sectionIndex) => (
191
+ <ul {...props} className={clsx('MuiAutocomplete-listbox', classes.box)}>
192
+ <ListSubheader className={classes.subHeader} style={{ backgroundColor: groupHeaderColor?.[sectionIndex], color: groupTitleColor?.[sectionIndex] }}>
193
+ {section.props.children[0].props.children}
194
+ <Fade in={sectionIndex === 0 && favoritePage && favoritosLength > 7}>
195
+ <div className={classes.divButton}>
196
+ <div className={classes.areaButton}>
197
+ <div onClick={e => buttonClick(e, 1)} className={clsx({ [classes.buttonActive]: pageNumber === 1 }, classes.button)}>1</div>
198
+ </div>
199
+ <div className={classes.areaButton}>
200
+ <div onClick={e => buttonClick(e, 2)} className={clsx({ [classes.buttonActive]: pageNumber === 2 }, classes.button)}>2</div>
201
+ </div>
202
+ {favoritosLength > 14 &&
203
+ <>
204
+ <div className={classes.areaButton}>
205
+ <div onClick={e => buttonClick(e, 3)} className={clsx({ [classes.buttonActive]: pageNumber === 3 }, classes.button)}>3</div>
206
+ </div>
207
+ </>
208
+ }
209
+ </div>
210
+ </Fade>
211
+ </ListSubheader>
212
+ {retornaArray(sectionIndex, section).map((item, itemIndex) => retornaEstrutura(sectionIndex, item))}
213
+ </ul>
214
+ ));
215
+ });
216
+
217
+ const AutoCompleteFavorites = ({ action, busca, resposta, label, value, pgCode, favoritePage, groupName, groupHeaderColor, groupTitleColor, loadingColor, filterFunction, getOptionLabel, onChange = e => e, textFieldProps = {}, searchParams, ...props }) => {
218
+
219
+ const [dados, setDados] = useState({
220
+ lista: [],
221
+ slide: true,
222
+ direction: '',
223
+ favoritosLength: '',
224
+ pageNumber: favoritePage ? 1 : '',
225
+ });
226
+ const [loading, setLoading] = useState(false);
227
+ const [inputValue, setInputValue] = useState('');
228
+
229
+ const buscar = useCallback(async valor => {
230
+ setLoading(true);
231
+ const res = await serverAction(action, { [busca]: valor || inputValue, ...searchParams }, true, pgCode);
232
+ if (res[resposta || 'result']?.length > 1) carimbaLista(res[resposta || 'result']);
233
+ else if (res[resposta || 'result']) setDados(v => ({ ...v, lista: res[resposta || 'result'] || [] }));
234
+ else setError('Erro ao tentar buscar dados.');
235
+ setLoading(false);
236
+ }, [inputValue, searchParams]);
237
+
238
+ function carimbaLista(lista) {
239
+ let completo = [];
240
+ lista.map((arr, index) => {
241
+ index === 0 && favoritePage && setDados(v => ({ ...v, favoritosLength: arr.length }));
242
+ return arr.map(itemArr => itemArr.length < 3 && itemArr.push(groupName[index]));
243
+ });
244
+ lista.forEach(v => {
245
+ for (let item of v.values()) {
246
+ completo.push(item);
247
+ }
248
+ });
249
+ setDados(v => ({ ...v, lista: completo }));
250
+ }
251
+
252
+ useEffect(() => buscar(), [inputValue, buscar]);
253
+ useEffect(() => isString(value) && buscar(value), []);
254
+
255
+ return (
256
+ <Autocomplete
257
+ autoComplete
258
+ autoHighlight
259
+ openText='Abrir'
260
+ clearText='Limpar'
261
+ filterSelectedOptions
262
+ onInputChange={e => setInputValue(e?.target?.value || '')}
263
+ options={isObject(value) ? dados?.lista.filter(v => filterFunction ? filterFunction(v, value) : true || v[0] !== value[0]) : dados?.lista}
264
+ getOptionLabel={getOptionLabel && (option => getOptionLabel(option, dados?.lista))}
265
+ getOptionSelected={(o, v) => o[0] === v}
266
+ renderTags={(value, getTagProps) =>
267
+ value.map((option, index) => (
268
+ <Chip variant='outlined' size='small' label={option} {...getTagProps({ index })} />
269
+ ))
270
+ }
271
+ renderInput={params => (
272
+ <TextField
273
+ margin='dense'
274
+ variant='outlined'
275
+ label={label}
276
+ {...params}
277
+ {...textFieldProps}
278
+ InputProps={{
279
+ ...textFieldProps.InputProps,
280
+ ...params.InputProps,
281
+ endAdornment: (
282
+ <>
283
+ {params.InputProps.endAdornment}
284
+ <Fade in={loading}><CircularProgress disableShrink color={loadingColor || 'inherit'} size={20} /></Fade>
285
+ </>
286
+ )
287
+ }}
288
+ />
289
+ )}
290
+ {...props}
291
+ {...{ value, onChange }}
292
+ ListboxComponent={ListboxFavorites}
293
+ ListboxProps={{ dados, setDados, favoritePage, groupHeaderColor, groupTitleColor }}
294
+ />
295
+ );
296
+ };
297
+
298
+ export default AutoCompleteFavorites;
@@ -0,0 +1 @@
1
+ export { default } from './AutoCompleteFavorites';
@@ -143,4 +143,7 @@ export { default as ThreadLog } from './ThreadLog';
143
143
  export * from './ThreadLog';
144
144
 
145
145
  export { default as UtilAutoComplete } from './UtilAutoComplete';
146
- export * from './UtilAutoComplete';
146
+ export * from './UtilAutoComplete';
147
+
148
+ export { default as AutoCompleteFavorites } from './AutoCompleteFavorites';
149
+ export * from './AutoCompleteFavorites';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "argous",
3
- "version": "1.2.134",
3
+ "version": "1.2.138",
4
4
  "description": "Argous.",
5
5
  "main": "lib/index.js",
6
6
  "author": "Carlos Schneider",