solid-ui 2.4.29 → 2.4.30-00b22a41

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 (261) hide show
  1. package/LICENSE.md +0 -0
  2. package/README.md +0 -0
  3. package/dist/670.solid-ui.min.js +0 -0
  4. package/dist/805.solid-ui.min.js +1 -1
  5. package/dist/805.solid-ui.min.js.LICENSE.txt +0 -0
  6. package/dist/805.solid-ui.min.js.map +1 -1
  7. package/dist/_2b19.solid-ui.js +0 -0
  8. package/dist/_2b19.solid-ui.js.map +1 -1
  9. package/dist/index.html +0 -0
  10. package/dist/solid-ui.js +3522 -1975
  11. package/dist/solid-ui.js.map +1 -1
  12. package/dist/solid-ui.min.js +1 -1
  13. package/dist/solid-ui.min.js.LICENSE.txt +0 -0
  14. package/dist/solid-ui.min.js.map +1 -1
  15. package/dist/vendors-node_modules_jsonld_lib_jsonld_js.solid-ui.js +191 -80
  16. package/dist/vendors-node_modules_jsonld_lib_jsonld_js.solid-ui.js.map +1 -1
  17. package/lib/acl/access-controller.d.ts +0 -0
  18. package/lib/acl/access-controller.d.ts.map +0 -0
  19. package/lib/acl/access-controller.js +0 -0
  20. package/lib/acl/access-controller.js.map +0 -0
  21. package/lib/acl/access-groups.d.ts +0 -0
  22. package/lib/acl/access-groups.d.ts.map +0 -0
  23. package/lib/acl/access-groups.js +0 -2
  24. package/lib/acl/access-groups.js.map +1 -1
  25. package/lib/acl/acl-control.d.ts +0 -0
  26. package/lib/acl/acl-control.d.ts.map +0 -0
  27. package/lib/acl/acl-control.js +0 -0
  28. package/lib/acl/acl-control.js.map +0 -0
  29. package/lib/acl/acl.d.ts +0 -0
  30. package/lib/acl/acl.d.ts.map +0 -0
  31. package/lib/acl/acl.js +0 -2
  32. package/lib/acl/acl.js.map +1 -1
  33. package/lib/acl/add-agent-buttons.d.ts +0 -0
  34. package/lib/acl/add-agent-buttons.d.ts.map +0 -0
  35. package/lib/acl/add-agent-buttons.js +0 -0
  36. package/lib/acl/add-agent-buttons.js.map +0 -0
  37. package/lib/acl/index.d.ts +0 -0
  38. package/lib/acl/index.d.ts.map +0 -0
  39. package/lib/acl/index.js +0 -0
  40. package/lib/acl/index.js.map +0 -0
  41. package/lib/acl/types.d.ts +0 -0
  42. package/lib/acl/types.d.ts.map +0 -0
  43. package/lib/acl/types.js +0 -0
  44. package/lib/acl/types.js.map +0 -0
  45. package/lib/chat/bookmarks.js +0 -0
  46. package/lib/chat/bookmarks.js.map +0 -0
  47. package/lib/chat/chatLogic.js +6 -4
  48. package/lib/chat/chatLogic.js.map +1 -1
  49. package/lib/chat/dateFolder.js +0 -0
  50. package/lib/chat/dateFolder.js.map +0 -0
  51. package/lib/chat/infinite.js +0 -5
  52. package/lib/chat/infinite.js.map +1 -1
  53. package/lib/chat/keys.d.ts +0 -0
  54. package/lib/chat/keys.d.ts.map +0 -0
  55. package/lib/chat/keys.js +0 -0
  56. package/lib/chat/keys.js.map +0 -0
  57. package/lib/chat/message.js +3 -7
  58. package/lib/chat/message.js.map +1 -1
  59. package/lib/chat/messageTools.js +1 -0
  60. package/lib/chat/messageTools.js.map +1 -1
  61. package/lib/chat/signature.d.ts +0 -0
  62. package/lib/chat/signature.d.ts.map +0 -0
  63. package/lib/chat/signature.js +0 -0
  64. package/lib/chat/signature.js.map +0 -0
  65. package/lib/chat/thread.js +0 -4
  66. package/lib/chat/thread.js.map +1 -1
  67. package/lib/create/create.d.ts +0 -0
  68. package/lib/create/create.d.ts.map +0 -0
  69. package/lib/create/create.js +0 -2
  70. package/lib/create/create.js.map +1 -1
  71. package/lib/create/index.d.ts +0 -0
  72. package/lib/create/index.d.ts.map +0 -0
  73. package/lib/create/index.js +0 -0
  74. package/lib/create/index.js.map +0 -0
  75. package/lib/create/types.d.ts +0 -0
  76. package/lib/create/types.d.ts.map +0 -0
  77. package/lib/create/types.js +0 -0
  78. package/lib/create/types.js.map +0 -0
  79. package/lib/debug.d.ts +0 -0
  80. package/lib/debug.d.ts.map +0 -0
  81. package/lib/debug.js +0 -0
  82. package/lib/debug.js.map +0 -0
  83. package/lib/folders.js +0 -0
  84. package/lib/folders.js.map +0 -0
  85. package/lib/footer/index.d.ts +0 -0
  86. package/lib/footer/index.d.ts.map +0 -0
  87. package/lib/footer/index.js +0 -0
  88. package/lib/footer/index.js.map +0 -0
  89. package/lib/header/empty-profile.d.ts +0 -0
  90. package/lib/header/empty-profile.d.ts.map +0 -0
  91. package/lib/header/empty-profile.js +0 -0
  92. package/lib/header/empty-profile.js.map +0 -0
  93. package/lib/header/index.d.ts +0 -0
  94. package/lib/header/index.d.ts.map +0 -0
  95. package/lib/header/index.js +0 -0
  96. package/lib/header/index.js.map +0 -0
  97. package/lib/iconBase.d.ts +0 -0
  98. package/lib/iconBase.d.ts.map +0 -0
  99. package/lib/iconBase.js +0 -0
  100. package/lib/iconBase.js.map +0 -0
  101. package/lib/icons/solid_logo.d.ts +0 -0
  102. package/lib/icons/solid_logo.d.ts.map +0 -0
  103. package/lib/icons/solid_logo.js +0 -0
  104. package/lib/icons/solid_logo.js.map +0 -0
  105. package/lib/index.d.ts +0 -0
  106. package/lib/index.d.ts.map +0 -0
  107. package/lib/index.js +0 -0
  108. package/lib/index.js.map +0 -0
  109. package/lib/log.d.ts +0 -0
  110. package/lib/log.d.ts.map +0 -0
  111. package/lib/log.js +0 -0
  112. package/lib/log.js.map +0 -0
  113. package/lib/login/login.d.ts +0 -0
  114. package/lib/login/login.d.ts.map +1 -1
  115. package/lib/login/login.js +37 -42
  116. package/lib/login/login.js.map +1 -1
  117. package/lib/matrix/index.d.ts +0 -0
  118. package/lib/matrix/index.d.ts.map +0 -0
  119. package/lib/matrix/index.js +0 -0
  120. package/lib/matrix/index.js.map +0 -0
  121. package/lib/matrix/matrix.d.ts +0 -0
  122. package/lib/matrix/matrix.d.ts.map +0 -0
  123. package/lib/matrix/matrix.js +0 -2
  124. package/lib/matrix/matrix.js.map +1 -1
  125. package/lib/matrix/types.d.ts +0 -0
  126. package/lib/matrix/types.d.ts.map +0 -0
  127. package/lib/matrix/types.js +0 -0
  128. package/lib/matrix/types.js.map +0 -0
  129. package/lib/media/index.d.ts +0 -0
  130. package/lib/media/index.d.ts.map +0 -0
  131. package/lib/media/index.js +0 -0
  132. package/lib/media/index.js.map +0 -0
  133. package/lib/media/media-capture.d.ts +2 -2
  134. package/lib/media/media-capture.d.ts.map +1 -1
  135. package/lib/media/media-capture.js +11 -18
  136. package/lib/media/media-capture.js.map +1 -1
  137. package/lib/messageArea.js +0 -4
  138. package/lib/messageArea.js.map +1 -1
  139. package/lib/noun_Camera_1618446_000000.js +0 -0
  140. package/lib/noun_Camera_1618446_000000.js.map +0 -0
  141. package/lib/ns.js +0 -0
  142. package/lib/ns.js.map +0 -0
  143. package/lib/pad.d.ts +2 -2
  144. package/lib/pad.d.ts.map +1 -1
  145. package/lib/pad.js +18 -45
  146. package/lib/pad.js.map +1 -1
  147. package/lib/participation.d.ts +7 -7
  148. package/lib/participation.d.ts.map +1 -1
  149. package/lib/participation.js +27 -28
  150. package/lib/participation.js.map +1 -1
  151. package/lib/preferences.js +0 -0
  152. package/lib/preferences.js.map +0 -0
  153. package/lib/signup/config-default.js +0 -0
  154. package/lib/signup/config-default.js.map +0 -0
  155. package/lib/signup/signup.js +0 -0
  156. package/lib/signup/signup.js.map +0 -0
  157. package/lib/stories/decorators.js +0 -0
  158. package/lib/stories/decorators.js.map +0 -0
  159. package/lib/style.js +93 -85
  160. package/lib/style.js.map +1 -1
  161. package/lib/styleConstants.js +35 -0
  162. package/lib/styleConstants.js.map +1 -0
  163. package/lib/style_multiSelect.js +0 -0
  164. package/lib/style_multiSelect.js.map +0 -0
  165. package/lib/table.js +0 -4
  166. package/lib/table.js.map +1 -1
  167. package/lib/tabs.d.ts +0 -125
  168. package/lib/tabs.d.ts.map +1 -1
  169. package/lib/tabs.js +15 -10
  170. package/lib/tabs.js.map +1 -1
  171. package/lib/typings.d.js +0 -0
  172. package/lib/typings.d.js.map +0 -0
  173. package/lib/utils/headerFooterHelpers.d.ts +0 -0
  174. package/lib/utils/headerFooterHelpers.d.ts.map +0 -0
  175. package/lib/utils/headerFooterHelpers.js +0 -0
  176. package/lib/utils/headerFooterHelpers.js.map +0 -0
  177. package/lib/utils/index.js +0 -7
  178. package/lib/utils/index.js.map +1 -1
  179. package/lib/utils/keyHelpers/accessData.d.ts +0 -0
  180. package/lib/utils/keyHelpers/accessData.d.ts.map +0 -0
  181. package/lib/utils/keyHelpers/accessData.js +0 -0
  182. package/lib/utils/keyHelpers/accessData.js.map +0 -0
  183. package/lib/utils/keyHelpers/acl.d.ts +0 -0
  184. package/lib/utils/keyHelpers/acl.d.ts.map +0 -0
  185. package/lib/utils/keyHelpers/acl.js +0 -0
  186. package/lib/utils/keyHelpers/acl.js.map +0 -0
  187. package/lib/utils/label.d.ts +0 -0
  188. package/lib/utils/label.d.ts.map +0 -0
  189. package/lib/utils/label.js +0 -0
  190. package/lib/utils/label.js.map +0 -0
  191. package/lib/versionInfo.d.ts +0 -0
  192. package/lib/versionInfo.d.ts.map +0 -0
  193. package/lib/versionInfo.js +14 -14
  194. package/lib/versionInfo.js.map +1 -1
  195. package/lib/widgets/buttons/iconLinks.d.ts +0 -0
  196. package/lib/widgets/buttons/iconLinks.d.ts.map +0 -0
  197. package/lib/widgets/buttons/iconLinks.js +0 -0
  198. package/lib/widgets/buttons/iconLinks.js.map +0 -0
  199. package/lib/widgets/buttons.d.ts +0 -0
  200. package/lib/widgets/buttons.d.ts.map +0 -0
  201. package/lib/widgets/buttons.js +2 -10
  202. package/lib/widgets/buttons.js.map +1 -1
  203. package/lib/widgets/dragAndDrop.js +11 -20
  204. package/lib/widgets/dragAndDrop.js.map +1 -1
  205. package/lib/widgets/error.d.ts +0 -0
  206. package/lib/widgets/error.d.ts.map +1 -1
  207. package/lib/widgets/error.js +9 -2
  208. package/lib/widgets/error.js.map +1 -1
  209. package/lib/widgets/forms/autocomplete/autocompleteBar.d.ts +0 -0
  210. package/lib/widgets/forms/autocomplete/autocompleteBar.d.ts.map +0 -0
  211. package/lib/widgets/forms/autocomplete/autocompleteBar.js +5 -5
  212. package/lib/widgets/forms/autocomplete/autocompleteBar.js.map +0 -0
  213. package/lib/widgets/forms/autocomplete/autocompleteField.d.ts +0 -0
  214. package/lib/widgets/forms/autocomplete/autocompleteField.d.ts.map +0 -0
  215. package/lib/widgets/forms/autocomplete/autocompleteField.js +0 -1
  216. package/lib/widgets/forms/autocomplete/autocompleteField.js.map +1 -1
  217. package/lib/widgets/forms/autocomplete/autocompletePicker.d.ts +0 -0
  218. package/lib/widgets/forms/autocomplete/autocompletePicker.d.ts.map +1 -1
  219. package/lib/widgets/forms/autocomplete/autocompletePicker.js +6 -8
  220. package/lib/widgets/forms/autocomplete/autocompletePicker.js.map +1 -1
  221. package/lib/widgets/forms/autocomplete/language.d.ts +0 -0
  222. package/lib/widgets/forms/autocomplete/language.d.ts.map +0 -0
  223. package/lib/widgets/forms/autocomplete/language.js +0 -0
  224. package/lib/widgets/forms/autocomplete/language.js.map +0 -0
  225. package/lib/widgets/forms/autocomplete/publicData.d.ts +0 -0
  226. package/lib/widgets/forms/autocomplete/publicData.d.ts.map +0 -0
  227. package/lib/widgets/forms/autocomplete/publicData.js +0 -3
  228. package/lib/widgets/forms/autocomplete/publicData.js.map +1 -1
  229. package/lib/widgets/forms/basic.d.ts +0 -0
  230. package/lib/widgets/forms/basic.d.ts.map +1 -1
  231. package/lib/widgets/forms/basic.js +5 -5
  232. package/lib/widgets/forms/basic.js.map +1 -1
  233. package/lib/widgets/forms/comment.d.ts +0 -0
  234. package/lib/widgets/forms/comment.d.ts.map +0 -0
  235. package/lib/widgets/forms/comment.js +0 -0
  236. package/lib/widgets/forms/comment.js.map +0 -0
  237. package/lib/widgets/forms/fieldFunction.d.ts +0 -0
  238. package/lib/widgets/forms/fieldFunction.d.ts.map +0 -0
  239. package/lib/widgets/forms/fieldFunction.js +0 -0
  240. package/lib/widgets/forms/fieldFunction.js.map +0 -0
  241. package/lib/widgets/forms/fieldParams.d.ts +0 -0
  242. package/lib/widgets/forms/fieldParams.d.ts.map +0 -0
  243. package/lib/widgets/forms/fieldParams.js +16 -16
  244. package/lib/widgets/forms/fieldParams.js.map +1 -1
  245. package/lib/widgets/forms/formStyle.d.ts +0 -0
  246. package/lib/widgets/forms/formStyle.d.ts.map +0 -0
  247. package/lib/widgets/forms/formStyle.js +0 -0
  248. package/lib/widgets/forms/formStyle.js.map +0 -0
  249. package/lib/widgets/forms.js +12 -30
  250. package/lib/widgets/forms.js.map +1 -1
  251. package/lib/widgets/index.js +0 -0
  252. package/lib/widgets/index.js.map +0 -0
  253. package/lib/widgets/multiSelect.js +0 -0
  254. package/lib/widgets/multiSelect.js.map +0 -0
  255. package/lib/widgets/peoplePicker.js +0 -1
  256. package/lib/widgets/peoplePicker.js.map +1 -1
  257. package/lib/widgets/widgetHelpers.d.ts +0 -0
  258. package/lib/widgets/widgetHelpers.d.ts.map +0 -0
  259. package/lib/widgets/widgetHelpers.js +0 -0
  260. package/lib/widgets/widgetHelpers.js.map +0 -0
  261. package/package.json +18 -18
@@ -9,39 +9,34 @@ exports.makeDropTarget = makeDropTarget;
9
9
  exports.uploadFiles = uploadFiles;
10
10
  var debug = _interopRequireWildcard(require("../debug"));
11
11
  var mime = _interopRequireWildcard(require("mime-types"));
12
+ var style = _interopRequireWildcard(require("../style"));
12
13
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
13
14
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
14
15
  /* Drag and drop common functionality
15
16
  *
16
17
  * It is easy to make something draggable, or to make it a drag target!
17
- * Just call the functions below. In a solid world, any part of the UI which
18
- * represent one thing which has a UR, should be made draggable using makeDraggable
18
+ * Just call the functions below. In a Solid world, any part of the UI which
19
+ * represents one thing which has a URI, should be made draggable using makeDraggable.
19
20
  * Any list of things should typically allow you to drag new members of the list
20
21
  * onto it.
21
- * The file upload function uploadFiles is provided as often of someone drags a file from the computer
22
- * desktop, you may want to upload it into the pod.
22
+ * The file upload function, uploadFiles, is provided as often as someone drags a file from the computer
23
+ * desktop. You may want to upload it into the pod.
23
24
  */
24
25
 
25
26
  /* global FileReader alert */
26
27
 
27
28
  function makeDropTarget(ele, droppedURIHandler, droppedFileHandler) {
28
29
  var dragoverListener = function dragoverListener(e) {
29
- e.preventDefault(); // Neeed else drop does not work [sic]
30
+ e.preventDefault(); // Need this; otherwise, drop does not work.
30
31
  e.dataTransfer.dropEffect = 'copy';
31
32
  };
32
33
  var dragenterListener = function dragenterListener(e) {
33
34
  debug.log('dragenter event dropEffect: ' + e.dataTransfer.dropEffect);
34
- if (this.style) {
35
+ if (this.localStyle) {
35
36
  // necessary not sure when
36
37
  if (!this.savedStyle) {
37
- this.savedStyle = {};
38
- this.savedStyle.border = this.style.border;
39
- this.savedStyle.backgroundColor = this.style.backgroundColor;
40
- this.savedStyle.borderRadius = this.style.borderRadius;
38
+ this.savedStyle = style.dragEvent;
41
39
  }
42
- this.style.backgroundColor = '#ccc';
43
- this.style.border = '0.25em dashed black';
44
- this.style.borderRadius = '0.3em';
45
40
  }
46
41
  e.dataTransfer.dropEffect = 'link';
47
42
  debug.log('dragenter event dropEffect 2: ' + e.dataTransfer.dropEffect);
@@ -49,12 +44,9 @@ function makeDropTarget(ele, droppedURIHandler, droppedFileHandler) {
49
44
  var dragleaveListener = function dragleaveListener(e) {
50
45
  debug.log('dragleave event dropEffect: ' + e.dataTransfer.dropEffect);
51
46
  if (this.savedStyle) {
52
- this.style.border = this.savedStyle.border;
53
- this.style.backgroundColor = this.savedStyle.backgroundColor;
54
- this.style.borderRadius = this.savedStyle.borderRadius;
47
+ this.localStyle = this.savedStyle;
55
48
  } else {
56
- this.style.backgroundColor = 'white';
57
- this.style.border = '0em solid black';
49
+ this.localStyle = style.dropEvent;
58
50
  }
59
51
  };
60
52
  var dropListener = function dropListener(e) {
@@ -93,7 +85,7 @@ function makeDropTarget(ele, droppedURIHandler, droppedFileHandler) {
93
85
  if (uris) {
94
86
  droppedURIHandler(uris);
95
87
  }
96
- this.style.backgroundColor = 'white'; // restore style
88
+ this.localStyle = style.restoreStyle; // restore style
97
89
  return false;
98
90
  }; // dropListener
99
91
 
@@ -181,7 +173,6 @@ function uploadFiles(fetcher, files, fileBase, imageBase, successHandler) {
181
173
  // console.log('MIME TYPE MISMATCH: ' + mime.lookup(theFile.name) + ': adding extension: ' + suffix)
182
174
  }
183
175
  }
184
-
185
176
  var folderName = theFile.type.startsWith('image/') ? imageBase || fileBase : fileBase;
186
177
  var destURI = folderName + (folderName.endsWith('/') ? '' : '/') + encodeURIComponent(theFile.name) + suffix;
187
178
  fetcher.webOperation('PUT', destURI, {
@@ -1 +1 @@
1
- {"version":3,"file":"dragAndDrop.js","names":["debug","_interopRequireWildcard","require","mime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","makeDropTarget","ele","droppedURIHandler","droppedFileHandler","dragoverListener","preventDefault","dataTransfer","dropEffect","dragenterListener","log","style","savedStyle","border","backgroundColor","borderRadius","dragleaveListener","dropListener","types","join","uris","text","length","type","getData","split","files","f","name","size","lastModifiedDate","toLocaleDateString","slice","addTargetListeners","addEventListener","makeDraggable","tr","obj","setAttribute","fontWeight","setData","uri","outerHTML","stopPropagation","uploadFiles","fetcher","fileBase","imageBase","successHandler","reader","FileReader","onload","theFile","data","target","result","suffix","byteLength","contentType","lookup","msg","alert","Error","extension","endsWith","folderName","startsWith","destURI","encodeURIComponent","webOperation","then","_response","error","readAsArrayBuffer"],"sources":["../../src/widgets/dragAndDrop.js"],"sourcesContent":["/* Drag and drop common functionality\n *\n * It is easy to make something draggable, or to make it a drag target!\n * Just call the functions below. In a solid world, any part of the UI which\n * represent one thing which has a UR, should be made draggable using makeDraggable\n * Any list of things should typically allow you to drag new members of the list\n * onto it.\n * The file upload function uploadFiles is provided as often of someone drags a file from the computer\n * desktop, you may want to upload it into the pod.\n */\nimport * as debug from '../debug'\nimport * as mime from 'mime-types'\n\n/* global FileReader alert */\n\nexport function makeDropTarget (ele, droppedURIHandler, droppedFileHandler) {\n const dragoverListener = function (e) {\n e.preventDefault() // Neeed else drop does not work [sic]\n e.dataTransfer.dropEffect = 'copy'\n }\n\n const dragenterListener = function (e) {\n debug.log('dragenter event dropEffect: ' + e.dataTransfer.dropEffect)\n if (this.style) {\n // necessary not sure when\n if (!this.savedStyle) {\n this.savedStyle = {}\n this.savedStyle.border = this.style.border\n this.savedStyle.backgroundColor = this.style.backgroundColor\n this.savedStyle.borderRadius = this.style.borderRadius\n }\n this.style.backgroundColor = '#ccc'\n this.style.border = '0.25em dashed black'\n this.style.borderRadius = '0.3em'\n }\n\n e.dataTransfer.dropEffect = 'link'\n debug.log('dragenter event dropEffect 2: ' + e.dataTransfer.dropEffect)\n }\n const dragleaveListener = function (e) {\n debug.log('dragleave event dropEffect: ' + e.dataTransfer.dropEffect)\n if (this.savedStyle) {\n this.style.border = this.savedStyle.border\n this.style.backgroundColor = this.savedStyle.backgroundColor\n this.style.borderRadius = this.savedStyle.borderRadius\n } else {\n this.style.backgroundColor = 'white'\n this.style.border = '0em solid black'\n }\n }\n\n const dropListener = function (e) {\n if (e.preventDefault) e.preventDefault() // stops the browser from redirecting off to the text.\n debug.log('Drop event. dropEffect: ' + e.dataTransfer.dropEffect)\n debug.log(\n 'Drop event. types: ' +\n (e.dataTransfer.types ? e.dataTransfer.types.join(', ') : 'NOPE')\n )\n\n let uris = null\n let text\n if (e.dataTransfer.types) {\n for (let t = 0; t < e.dataTransfer.types.length; t++) {\n const type = e.dataTransfer.types[t]\n if (type === 'text/uri-list') {\n uris = e.dataTransfer.getData(type).split('\\n') // @ ignore those starting with #\n debug.log('Dropped text/uri-list: ' + uris)\n } else if (type === 'text/plain') {\n text = e.dataTransfer.getData(type)\n } else if (type === 'Files' && droppedFileHandler) {\n const files = e.dataTransfer.files // FileList object.\n for (let i = 0; files[i]; i++) {\n const f = files[i]\n debug.log(\n 'Filename: ' +\n f.name +\n ', type: ' +\n (f.type || 'n/a') +\n ' size: ' +\n f.size +\n ' bytes, last modified: ' +\n (f.lastModifiedDate\n ? f.lastModifiedDate.toLocaleDateString()\n : 'n/a')\n )\n }\n droppedFileHandler(files)\n }\n }\n if (uris === null && text && text.slice(0, 4) === 'http') {\n uris = text\n debug.log(\"Waring: Poor man's drop: using text for URI\") // chrome disables text/uri-list??\n }\n } else {\n // ... however, if we're IE, we don't have the .types property, so we'll just get the Text value\n uris = [e.dataTransfer.getData('Text')]\n debug.log('WARNING non-standard drop event: ' + uris[0])\n }\n debug.log('Dropped URI list (2): ' + uris)\n if (uris) {\n droppedURIHandler(uris)\n }\n this.style.backgroundColor = 'white' // restore style\n return false\n } // dropListener\n\n const addTargetListeners = function (ele) {\n if (!ele) {\n debug.log('@@@ addTargetListeners: ele ' + ele)\n }\n ele.addEventListener('dragover', dragoverListener)\n ele.addEventListener('dragenter', dragenterListener)\n ele.addEventListener('dragleave', dragleaveListener)\n ele.addEventListener('drop', dropListener)\n }\n addTargetListeners(ele, droppedURIHandler)\n} // listen for dropped URIs\n\n// Make an HTML element draggable as a URI-identified thing\n//\n// Possibly later set the drag image too?\n//\nexport function makeDraggable (tr, obj) {\n tr.setAttribute('draggable', 'true') // Stop the image being dragged instead - just the TR\n\n tr.addEventListener(\n 'dragstart',\n function (e) {\n tr.style.fontWeight = 'bold'\n e.dataTransfer.setData('text/uri-list', obj.uri)\n e.dataTransfer.setData('text/plain', obj.uri)\n e.dataTransfer.setData('text/html', tr.outerHTML)\n debug.log(\n 'Dragstart: ' + tr + ' -> ' + obj + 'de: ' + e.dataTransfer.dropEffect\n )\n },\n false\n )\n\n tr.addEventListener(\n 'drag',\n function (e) {\n e.preventDefault()\n e.stopPropagation()\n // debug.log('Drag: dropEffect: ' + e.dataTransfer.dropEffect)\n },\n false\n )\n\n tr.addEventListener(\n 'dragend',\n function (e) {\n tr.style.fontWeight = 'normal'\n debug.log('Dragend dropeffect: ' + e.dataTransfer.dropEffect)\n debug.log('Dragend: ' + tr + ' -> ' + obj)\n },\n false\n )\n}\n\n/** uploadFiles\n**\n** Generic uploader of local files to the web\n** typically called from dropped file handler\n**\n** @param {Fetcher} fetcher instance of class Fetcher as in kb.fetcher\n** @param {Array<File>} files Array of file objects\n** @param {String} fileBase URI of folder in which to put files (except images) (no trailing slash)\n** @param {String } imageBase URI of folder in which to put images\n** @param successHandler function(file, uploadedURI) Called after EACH success upload\n** With file object an final URI as params\n*/\n\nexport function uploadFiles (fetcher, files, fileBase, imageBase, successHandler) {\n for (let i = 0; files[i]; i++) {\n const f = files[i]\n debug.log(\n ' dropped: Filename: ' +\n f.name +\n ', type: ' +\n (f.type || 'n/a') +\n ' size: ' +\n f.size +\n ' bytes, last modified: ' +\n (f.lastModifiedDate ? f.lastModifiedDate.toLocaleDateString() : 'n/a')\n ) // See e.g. https://www.html5rocks.com/en/tutorials/file/dndfiles/\n\n // @@ Add: progress bar(s)\n const reader = new FileReader()\n reader.onload = (function (theFile) {\n return function (e) {\n const data = e.target.result\n let suffix = ''\n debug.log(' File read byteLength : ' + data.byteLength)\n let contentType = theFile.type\n if (!theFile.type || theFile.type === '') {\n // Not known by browser\n contentType = mime.lookup(theFile.name)\n if (!contentType) {\n const msg =\n 'Filename needs to have an extension which gives a type we know: ' +\n theFile.name\n debug.log(msg)\n alert(msg)\n throw new Error(msg)\n }\n } else {\n const extension = mime.extension(theFile.type)\n // Note not simple: eg .mp3 => audio/mpeg; .mpga => audio/mpeg; audio/mp3 => .mp3\n if (extension && extension !== 'false' && !theFile.name.endsWith('.' + extension) && // Not already has preferred extension? and ...\n theFile.type !== mime.lookup(theFile.name)) { // the mime type of this ext is not the right one?\n suffix = '_.' + extension\n // console.log('MIME TYPE MISMATCH: ' + mime.lookup(theFile.name) + ': adding extension: ' + suffix)\n }\n }\n const folderName = theFile.type.startsWith('image/')\n ? imageBase || fileBase\n : fileBase\n const destURI =\n folderName +\n (folderName.endsWith('/') ? '' : '/') +\n encodeURIComponent(theFile.name) +\n suffix\n\n fetcher\n .webOperation('PUT', destURI, {\n data,\n contentType\n })\n .then(\n _response => {\n debug.log(' Upload: put OK: ' + destURI)\n successHandler(theFile, destURI)\n },\n error => {\n const msg = ' Upload: FAIL ' + destURI + ', Error: ' + error\n debug.log(msg)\n alert(msg)\n throw new Error(msg)\n }\n )\n }\n })(f)\n reader.readAsArrayBuffer(f)\n }\n}\n"],"mappings":";;;;;;;;;AAUA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAF,uBAAA,CAAAC,OAAA;AAAkC,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,gBAAAK,OAAA,CAAAL,CAAA,0BAAAA,CAAA,sBAAAA,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,U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CAACkC,GAAG,CAACkD,GAAG,CAAC;UACdC,KAAK,CAACD,GAAG,CAAC;UACV,MAAM,IAAIE,KAAK,CAACF,GAAG,CAAC;QACtB,CACF,CAAC;MACL,CAAC;IACH,CAAC,CAAEjC,CAAC,CAAC;IACLsB,MAAM,CAACwB,iBAAiB,CAAC9C,CAAC,CAAC;EAC7B;AACF"}
1
+ {"version":3,"file":"dragAndDrop.js","names":["debug","_interopRequireWildcard","require","mime","style","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","makeDropTarget","ele","droppedURIHandler","droppedFileHandler","dragoverListener","preventDefault","dataTransfer","dropEffect","dragenterListener","log","localStyle","savedStyle","dragEvent","dragleaveListener","dropEvent","dropListener","types","join","uris","text","length","type","getData","split","files","f","name","size","lastModifiedDate","toLocaleDateString","slice","restoreStyle","addTargetListeners","addEventListener","makeDraggable","tr","obj","setAttribute","fontWeight","setData","uri","outerHTML","stopPropagation","uploadFiles","fetcher","fileBase","imageBase","successHandler","reader","FileReader","onload","theFile","data","target","result","suffix","byteLength","contentType","lookup","msg","alert","Error","extension","endsWith","folderName","startsWith","destURI","encodeURIComponent","webOperation","then","_response","error","readAsArrayBuffer"],"sources":["../../src/widgets/dragAndDrop.js"],"sourcesContent":["/* Drag and drop common functionality\n *\n * It is easy to make something draggable, or to make it a drag target!\n * Just call the functions below. In a Solid world, any part of the UI which\n * represents one thing which has a URI, should be made draggable using makeDraggable.\n * Any list of things should typically allow you to drag new members of the list\n * onto it.\n * The file upload function, uploadFiles, is provided as often as someone drags a file from the computer\n * desktop. You may want to upload it into the pod.\n */\nimport * as debug from '../debug'\nimport * as mime from 'mime-types'\nimport * as style from '../style'\n\n/* global FileReader alert */\n\nexport function makeDropTarget (ele, droppedURIHandler, droppedFileHandler) {\n const dragoverListener = function (e) {\n e.preventDefault() // Need this; otherwise, drop does not work.\n e.dataTransfer.dropEffect = 'copy'\n }\n\n const dragenterListener = function (e) {\n debug.log('dragenter event dropEffect: ' + e.dataTransfer.dropEffect)\n if (this.localStyle) {\n // necessary not sure when\n if (!this.savedStyle) {\n this.savedStyle = style.dragEvent\n }\n }\n\n e.dataTransfer.dropEffect = 'link'\n debug.log('dragenter event dropEffect 2: ' + e.dataTransfer.dropEffect)\n }\n const dragleaveListener = function (e) {\n debug.log('dragleave event dropEffect: ' + e.dataTransfer.dropEffect)\n if (this.savedStyle) {\n this.localStyle = this.savedStyle\n } else {\n this.localStyle = style.dropEvent\n }\n }\n\n const dropListener = function (e) {\n if (e.preventDefault) e.preventDefault() // stops the browser from redirecting off to the text.\n debug.log('Drop event. dropEffect: ' + e.dataTransfer.dropEffect)\n debug.log(\n 'Drop event. types: ' +\n (e.dataTransfer.types ? e.dataTransfer.types.join(', ') : 'NOPE')\n )\n\n let uris = null\n let text\n if (e.dataTransfer.types) {\n for (let t = 0; t < e.dataTransfer.types.length; t++) {\n const type = e.dataTransfer.types[t]\n if (type === 'text/uri-list') {\n uris = e.dataTransfer.getData(type).split('\\n') // @ ignore those starting with #\n debug.log('Dropped text/uri-list: ' + uris)\n } else if (type === 'text/plain') {\n text = e.dataTransfer.getData(type)\n } else if (type === 'Files' && droppedFileHandler) {\n const files = e.dataTransfer.files // FileList object.\n for (let i = 0; files[i]; i++) {\n const f = files[i]\n debug.log(\n 'Filename: ' +\n f.name +\n ', type: ' +\n (f.type || 'n/a') +\n ' size: ' +\n f.size +\n ' bytes, last modified: ' +\n (f.lastModifiedDate\n ? f.lastModifiedDate.toLocaleDateString()\n : 'n/a')\n )\n }\n droppedFileHandler(files)\n }\n }\n if (uris === null && text && text.slice(0, 4) === 'http') {\n uris = text\n debug.log(\"Waring: Poor man's drop: using text for URI\") // chrome disables text/uri-list??\n }\n } else {\n // ... however, if we're IE, we don't have the .types property, so we'll just get the Text value\n uris = [e.dataTransfer.getData('Text')]\n debug.log('WARNING non-standard drop event: ' + uris[0])\n }\n debug.log('Dropped URI list (2): ' + uris)\n if (uris) {\n droppedURIHandler(uris)\n }\n this.localStyle = style.restoreStyle // restore style\n return false\n } // dropListener\n\n const addTargetListeners = function (ele) {\n if (!ele) {\n debug.log('@@@ addTargetListeners: ele ' + ele)\n }\n ele.addEventListener('dragover', dragoverListener)\n ele.addEventListener('dragenter', dragenterListener)\n ele.addEventListener('dragleave', dragleaveListener)\n ele.addEventListener('drop', dropListener)\n }\n addTargetListeners(ele, droppedURIHandler)\n} // listen for dropped URIs\n\n// Make an HTML element draggable as a URI-identified thing\n//\n// Possibly later set the drag image too?\n//\nexport function makeDraggable (tr, obj) {\n tr.setAttribute('draggable', 'true') // Stop the image being dragged instead - just the TR\n\n tr.addEventListener(\n 'dragstart',\n function (e) {\n tr.style.fontWeight = 'bold'\n e.dataTransfer.setData('text/uri-list', obj.uri)\n e.dataTransfer.setData('text/plain', obj.uri)\n e.dataTransfer.setData('text/html', tr.outerHTML)\n debug.log(\n 'Dragstart: ' + tr + ' -> ' + obj + 'de: ' + e.dataTransfer.dropEffect\n )\n },\n false\n )\n\n tr.addEventListener(\n 'drag',\n function (e) {\n e.preventDefault()\n e.stopPropagation()\n // debug.log('Drag: dropEffect: ' + e.dataTransfer.dropEffect)\n },\n false\n )\n\n tr.addEventListener(\n 'dragend',\n function (e) {\n tr.style.fontWeight = 'normal'\n debug.log('Dragend dropeffect: ' + e.dataTransfer.dropEffect)\n debug.log('Dragend: ' + tr + ' -> ' + obj)\n },\n false\n )\n}\n\n/** uploadFiles\n**\n** Generic uploader of local files to the web\n** typically called from dropped file handler\n**\n** @param {Fetcher} fetcher instance of class Fetcher as in kb.fetcher\n** @param {Array<File>} files Array of file objects\n** @param {String} fileBase URI of folder in which to put files (except images) (no trailing slash)\n** @param {String } imageBase URI of folder in which to put images\n** @param successHandler function(file, uploadedURI) Called after EACH success upload\n** With file object an final URI as params\n*/\n\nexport function uploadFiles (fetcher, files, fileBase, imageBase, successHandler) {\n for (let i = 0; files[i]; i++) {\n const f = files[i]\n debug.log(\n ' dropped: Filename: ' +\n f.name +\n ', type: ' +\n (f.type || 'n/a') +\n ' size: ' +\n f.size +\n ' bytes, last modified: ' +\n (f.lastModifiedDate ? f.lastModifiedDate.toLocaleDateString() : 'n/a')\n ) // See e.g. https://www.html5rocks.com/en/tutorials/file/dndfiles/\n\n // @@ Add: progress bar(s)\n const reader = new FileReader()\n reader.onload = (function (theFile) {\n return function (e) {\n const data = e.target.result\n let suffix = ''\n debug.log(' File read byteLength : ' + data.byteLength)\n let contentType = theFile.type\n if (!theFile.type || theFile.type === '') {\n // Not known by browser\n contentType = mime.lookup(theFile.name)\n if (!contentType) {\n const msg =\n 'Filename needs to have an extension which gives a type we know: ' +\n theFile.name\n debug.log(msg)\n alert(msg)\n throw new Error(msg)\n }\n } else {\n const extension = mime.extension(theFile.type)\n // Note not simple: eg .mp3 => audio/mpeg; .mpga => audio/mpeg; audio/mp3 => .mp3\n if (extension && extension !== 'false' && !theFile.name.endsWith('.' + extension) && // Not already has preferred extension? and ...\n theFile.type !== mime.lookup(theFile.name)) { // the mime type of this ext is not the right one?\n suffix = '_.' + extension\n // console.log('MIME TYPE MISMATCH: ' + mime.lookup(theFile.name) + ': adding extension: ' + suffix)\n }\n }\n const folderName = theFile.type.startsWith('image/')\n ? imageBase || fileBase\n : fileBase\n const destURI =\n folderName +\n (folderName.endsWith('/') ? '' : '/') +\n encodeURIComponent(theFile.name) +\n suffix\n\n fetcher\n .webOperation('PUT', destURI, {\n data,\n contentType\n })\n .then(\n _response => {\n debug.log(' Upload: put OK: ' + destURI)\n successHandler(theFile, destURI)\n },\n error => {\n const msg = ' Upload: FAIL ' + destURI + ', Error: ' + error\n debug.log(msg)\n alert(msg)\n throw new Error(msg)\n }\n )\n }\n })(f)\n reader.readAsArrayBuffer(f)\n }\n}\n"],"mappings":";;;;;;;;;AAUA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAF,uBAAA,CAAAC,OAAA;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,MAAM,IAAIE,KAAK,CAACF,GAAG,CAAC;QACtB,CACF,CAAC;MACL,CAAC;IACH,CAAC,CAAElC,CAAC,CAAC;IACLuB,MAAM,CAACwB,iBAAiB,CAAC/C,CAAC,CAAC;EAC7B;AACF"}
File without changes
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/widgets/error.ts"],"names":[],"mappings":"AAeA,wBAAgB,iBAAiB,CAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,GAAG,KAAK,EAAE,eAAe,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,KAAK,GAAG,cAAc,CAwBjI"}
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/widgets/error.ts"],"names":[],"mappings":"AAiBA,wBAAgB,iBAAiB,CAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,GAAG,KAAK,EAAE,eAAe,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,KAAK,GAAG,cAAc,CAoBjI"}
@@ -1,10 +1,16 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.errorMessageBlock = errorMessageBlock;
7
9
  var _widgets = require("../widgets");
10
+ var style = _interopRequireWildcard(require("../style"));
11
+ var _styleConstants = _interopRequireDefault(require("../styleConstants"));
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
8
14
  /**
9
15
  * Create an error message block
10
16
  * @param dom The DOM on which dom.createElement will be called
@@ -33,8 +39,9 @@ function errorMessageBlock(dom, err, backgroundColor, err2) {
33
39
  }
34
40
  div.appendChild((0, _widgets.cancelButton)(dom, function () {
35
41
  if (div.parentNode) div.parentNode.removeChild(div);
36
- })).style = 'width: 2em; height: 2em; align: right;';
37
- div.setAttribute('style', 'margin: 0.1em; padding: 0.5em; border: 0.05em solid gray; background-color: ' + (backgroundColor || '#fee') + '; color:black;');
42
+ })).style = style.errorCancelButton;
43
+ div.setAttribute('style', style.errorMessageBlockStyle);
44
+ div.style.backgroundColor = backgroundColor || _styleConstants["default"].defaultErrorBackgroundColor;
38
45
  return div;
39
46
  }
40
47
  //# sourceMappingURL=error.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","names":["_widgets","require","errorMessageBlock","dom","err","backgroundColor","err2","div","createElement","errorObject","Error","console","error","concat","stack","textContent","message","appendChild","cancelButton","parentNode","removeChild","style","setAttribute"],"sources":["../../src/widgets/error.ts"],"sourcesContent":["/**\n * Create an error message block\n * @param dom The DOM on which dom.createElement will be called\n * @param err The error message string to display (or an error object)\n * @param backgroundColor Background color. Default: '#fee'\n * @param err2 Is the second param is a string, you can put the original Error in here\n * @returns A div element with the err string\n *\n * This will return a DOM element you can put in the UI as a notice for the user\n * Meanwhile the stack is dumped to the console for the developer, so you actually know\n * where it happened!\n */\n/* eslint-disable no-console */\nimport { cancelButton } from '../widgets'\n\nexport function errorMessageBlock (dom: HTMLDocument, err: string | Error, backgroundColor?: string, err2?: Error): HTMLDivElement {\n const div = dom.createElement('div')\n\n /* tslint:disable-next-line */ // Too complex for TS?\n // @ts-ignore\n const errorObject:Error = err2 || err instanceof Error ? err : null\n\n if (errorObject) {\n console.error(`errorMessageBlock: ${errorObject} at: ${errorObject.stack || '??'}`, errorObject) // @@ pick one\n div.textContent = errorObject.message\n } else {\n div.textContent = err as string\n }\n\n div.appendChild(cancelButton(dom, () => { if (div.parentNode) div.parentNode.removeChild(div) }))\n .style = 'width: 2em; height: 2em; align: right;'\n\n div.setAttribute(\n 'style',\n 'margin: 0.1em; padding: 0.5em; border: 0.05em solid gray; background-color: ' +\n (backgroundColor || '#fee') +\n '; color:black;'\n )\n return div\n}\n"],"mappings":";;;;;;AAaA,IAAAA,QAAA,GAAAC,OAAA;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGO,SAASC,iBAAiBA,CAAEC,GAAiB,EAAEC,GAAmB,EAAEC,eAAwB,EAAEC,IAAY,EAAkB;EACjI,IAAMC,GAAG,GAAGJ,GAAG,CAACK,aAAa,CAAC,KAAK,CAAC;;EAEpC,+BAA+B;EAC/B;EACA,IAAMC,WAAiB,GAAGH,IAAI,IAAIF,GAAG,YAAYM,KAAK,GAAGN,GAAG,GAAG,IAAI;EAEnE,IAAIK,WAAW,EAAE;IACfE,OAAO,CAACC,KAAK,uBAAAC,MAAA,CAAuBJ,WAAW,WAAAI,MAAA,CAAQJ,WAAW,CAACK,KAAK,IAAI,IAAI,GAAIL,WAAW,CAAC,EAAC;IACjGF,GAAG,CAACQ,WAAW,GAAGN,WAAW,CAACO,OAAO;EACvC,CAAC,MAAM;IACLT,GAAG,CAACQ,WAAW,GAAGX,GAAa;EACjC;EAEAG,GAAG,CAACU,WAAW,CAAC,IAAAC,qBAAY,EAACf,GAAG,EAAE,YAAM;IAAE,IAAII,GAAG,CAACY,UAAU,EAAEZ,GAAG,CAACY,UAAU,CAACC,WAAW,CAACb,GAAG,CAAC;EAAC,CAAC,CAAC,CAAC,CAC9Fc,KAAK,GAAG,wCAAwC;EAEnDd,GAAG,CAACe,YAAY,CACd,OAAO,EACP,8EAA8E,IAC3EjB,eAAe,IAAI,MAAM,CAAC,GAC3B,gBACJ,CAAC;EACD,OAAOE,GAAG;AACZ"}
1
+ {"version":3,"file":"error.js","names":["_widgets","require","style","_interopRequireWildcard","_styleConstants","_interopRequireDefault","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","errorMessageBlock","dom","err","backgroundColor","err2","div","createElement","errorObject","Error","console","error","concat","stack","textContent","message","appendChild","cancelButton","parentNode","removeChild","errorCancelButton","setAttribute","errorMessageBlockStyle","styleConstants","defaultErrorBackgroundColor"],"sources":["../../src/widgets/error.ts"],"sourcesContent":["/**\n * Create an error message block\n * @param dom The DOM on which dom.createElement will be called\n * @param err The error message string to display (or an error object)\n * @param backgroundColor Background color. Default: '#fee'\n * @param err2 Is the second param is a string, you can put the original Error in here\n * @returns A div element with the err string\n *\n * This will return a DOM element you can put in the UI as a notice for the user\n * Meanwhile the stack is dumped to the console for the developer, so you actually know\n * where it happened!\n */\n/* eslint-disable no-console */\nimport { cancelButton } from '../widgets'\nimport * as style from '../style'\nimport styleConstants from '../styleConstants'\n\nexport function errorMessageBlock (dom: HTMLDocument, err: string | Error, backgroundColor?: string, err2?: Error): HTMLDivElement {\n const div = dom.createElement('div')\n\n /* tslint:disable-next-line */ // Too complex for TS?\n // @ts-ignore\n const errorObject:Error = err2 || err instanceof Error ? err : null\n\n if (errorObject) {\n console.error(`errorMessageBlock: ${errorObject} at: ${errorObject.stack || '??'}`, errorObject) // @@ pick one\n div.textContent = errorObject.message\n } else {\n div.textContent = err as string\n }\n\n div.appendChild(cancelButton(dom, () => { if (div.parentNode) div.parentNode.removeChild(div) }))\n .style = style.errorCancelButton\n\n div.setAttribute('style', style.errorMessageBlockStyle)\n div.style.backgroundColor = (backgroundColor || styleConstants.defaultErrorBackgroundColor)\n return div\n}\n"],"mappings":";;;;;;;;AAaA,IAAAA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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKO,SAASY,iBAAiBA,CAAEC,GAAiB,EAAEC,GAAmB,EAAEC,eAAwB,EAAEC,IAAY,EAAkB;EACjI,IAAMC,GAAG,GAAGJ,GAAG,CAACK,aAAa,CAAC,KAAK,CAAC;;EAEpC,+BAA+B;EAC/B;EACA,IAAMC,WAAiB,GAAGH,IAAI,IAAIF,GAAG,YAAYM,KAAK,GAAGN,GAAG,GAAG,IAAI;EAEnE,IAAIK,WAAW,EAAE;IACfE,OAAO,CAACC,KAAK,uBAAAC,MAAA,CAAuBJ,WAAW,WAAAI,MAAA,CAAQJ,WAAW,CAACK,KAAK,IAAI,IAAI,GAAIL,WAAW,CAAC,EAAC;IACjGF,GAAG,CAACQ,WAAW,GAAGN,WAAW,CAACO,OAAO;EACvC,CAAC,MAAM;IACLT,GAAG,CAACQ,WAAW,GAAGX,GAAa;EACjC;EAEAG,GAAG,CAACU,WAAW,CAAC,IAAAC,qBAAY,EAACf,GAAG,EAAE,YAAM;IAAE,IAAII,GAAG,CAACY,UAAU,EAAEZ,GAAG,CAACY,UAAU,CAACC,WAAW,CAACb,GAAG,CAAC;EAAC,CAAC,CAAC,CAAC,CAC9F9B,KAAK,GAAGA,KAAK,CAAC4C,iBAAiB;EAElCd,GAAG,CAACe,YAAY,CAAC,OAAO,EAAE7C,KAAK,CAAC8C,sBAAsB,CAAC;EACvDhB,GAAG,CAAC9B,KAAK,CAAC4B,eAAe,GAAIA,eAAe,IAAImB,0BAAc,CAACC,2BAA4B;EAC3F,OAAOlB,GAAG;AACZ"}
@@ -19,11 +19,11 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
19
19
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
20
20
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
21
21
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /* The Autocomplete Control with decorations
22
-
23
- This control has the buttons which control the state between editing, viewing, searching, accepting
24
- and so on. See the state diagram in the documentation. The AUtocomplete Picker does the main work.
25
-
26
- */
22
+
23
+ This control has the buttons which control the state between editing, viewing, searching, accepting
24
+ and so on. See the state diagram in the documentation. The AUtocomplete Picker does the main work.
25
+
26
+ */
27
27
  // dbpediaParameters
28
28
 
29
29
  var WEBID_NOUN = 'Solid ID';
@@ -252,7 +252,6 @@ function autocompleteField(dom, container, already, subject, form, doc, callback
252
252
  }, function (err) {
253
253
  rhs.appendChild(widgets.errorMessageBlock(dom, "Error rendering autocomplete ".concat(form, ": ").concat(err), '#fee', err)); //
254
254
  });
255
-
256
255
  return box;
257
256
  }
258
257
 
@@ -1 +1 @@
1
- {"version":3,"file":"autocompleteField.js","names":["ns","_interopRequireWildcard","require","_solidLogic","widgets","style","_autocompleteBar","_rdflib","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","autocompleteField","dom","container","already","subject","form","doc","callbackFunction","_kb$updater","addOneIdAndRefresh","_x","_x2","_addOneIdAndRefresh","apply","arguments","_asyncToGenerator2","_regenerator","mark","_callee","result","name","oldValue","oldName","deletables","insertables","_kb$updater2","wrap","_callee$","_context","prev","next","Error","kb","the","property","any","labelProperty","equals","sameTerm","abrupt","statementsMatching","concat","st","updater","updateMany","t0","box","appendChild","errorMessageBlock","stop","deleteOne","_x3","_x4","_deleteOne","_callee2","_result","_name","_kb$updater3","e2","_callee2$","_context2","termType","store","formDoc","createElement","lhs","setAttribute","formFieldNameBoxStyle","rhs","ui","schema","dataSource","queryParams","label","anyJS","logo","targetClass","objectURIBase","undefined","endpoint","searchByNameQuery","insitituteDetailsQuery","searchByNameURI","suppressEmptyUneditable","editable","uri","autocompleteOptions","permanent","size","obj","currentObject","currentName","display","fieldLabel","barOptions","dbLookup","renderAutocompleteControl","then","control","err"],"sources":["../../../../src/widgets/forms/autocomplete/autocompleteField.ts"],"sourcesContent":["/* Form field for doing autocompleete\n */\nimport * as ns from '../../../ns'\nimport { store } from 'solid-logic'\nimport * as widgets from '../../../widgets'\nimport * as style from '../../../style'\nimport { renderAutocompleteControl } from './autocompleteBar'\nimport { QueryParameters } from './publicData'\nimport { NamedNode, BlankNode, Literal, Variable, st } from 'rdflib'\nimport { AutocompleteOptions } from './autocompletePicker'\n/**\n * Render a autocomplete form field\n *\n * The autocomplete form searches for an object in a definitive public database,\n * and allows the user to search for it by name, displaying a list of objects whose names match\n * the input to date, and letting the user either click on one of the list,\n * or just go on untill there is only one. The process then returns two values,\n * the URiI of the object and its name.\n *\n * @param dom The HTML Document object aka Document Object Model\n * @param container If present, the created widget will be appended to this\n * @param already A hash table of (form, subject) kept to prevent recursive forms looping\n * @param subject The thing about which the form displays/edits data\n * @param form The form or field to be rendered\n * @param doc The web document in which the data is\n * @param callbackFunction Called when data is changed so other parts can be refreshed.\n *\n * Form properties:\n * @param ui:property The property to store the object itself\n * @param ui:labelProperty The property used to store the name of the object\n * @param ui:category The class of objects to be searched, if fixed (else dep on class of subject)\n *\n * @returns The HTML widget created\n */\n// eslint-disable-next-line complexity\nexport function autocompleteField (\n dom: HTMLDocument,\n container: HTMLElement | undefined,\n already,\n subject: NamedNode | BlankNode | Variable,\n form: NamedNode,\n doc: NamedNode | undefined,\n callbackFunction: (_ok: boolean, _errorMessage: string) => void\n): HTMLElement {\n async function addOneIdAndRefresh (result:NamedNode | Literal, name: Literal) {\n if (!name) {\n throw new Error('autocompleteField: No name set.')\n }\n const oldValue = kb.the(subject, property as any, null, doc)\n if (oldValue) {\n const oldName = kb.any(oldValue as any, labelProperty as any, null, doc)\n if (oldValue.equals(result) && oldName && oldName.sameTerm(name)) {\n // console.log('No change: same values.')\n return\n }\n }\n const deletables = oldValue\n ? kb.statementsMatching(subject, property as any, oldValue, doc)\n .concat(kb.statementsMatching(oldValue as any, labelProperty as any, null, doc))\n : []\n // console.log('autocompleteField Deletables ' + deletables.map(st => st.toNT()))\n const insertables = [st(subject, property as any, result, doc),\n st(result as any, labelProperty as any, name, doc)] // @@ track the language of the name too!\n // console.log(`AC form: ${deletables.length} to delete and ${insertables.length} to insert`)\n try {\n // console.log('@@@ AC updating ', deletables, insertables)\n await kb.updater?.updateMany(deletables, insertables)\n } catch (err) {\n callbackFunction(false, err)\n box.appendChild(widgets.errorMessageBlock(dom, 'Autocomplete form data update error:' + err, null, err))\n return\n }\n callbackFunction(true, '')\n }\n\n async function deleteOne (_result:NamedNode | Literal, _name: Literal) {\n const oldValue = kb.the(subject, property as any, null, doc)\n if (!oldValue) {\n callbackFunction(false, 'NO data to elete')\n box.appendChild(widgets.errorMessageBlock(dom, 'Autocomplete delete: no old data!'))\n return\n }\n // const oldName = kb.any(oldValue as any, labelProperty as any, null, doc)\n const deletables = kb.statementsMatching(subject, property as any, oldValue, doc)\n .concat(kb.statementsMatching(oldValue as any, labelProperty as any, null, doc))\n // console.log('autocompleteField Deletables ' + deletables.map(st => st.toNT()))\n const insertables = []\n // console.log(`AC form delete: ${deletables.length} to delete and ${insertables.length} to insert`)\n try {\n // console.log('@@@ AC updating ', deletables, insertables)\n await kb.updater?.updateMany(deletables, insertables)\n } catch (err) {\n const e2 = new Error('Autocomplete form data delete error:' + err)\n callbackFunction(false, err)\n box.appendChild(widgets.errorMessageBlock(dom, e2, null, err))\n return\n }\n callbackFunction(true, '') // changed\n }\n\n if (subject.termType !== 'NamedNode') {\n throw new Error('Sorry this field only works on NamedNode subjects (for editable)')\n }\n const kb = store\n const formDoc = form.doc ? form.doc() : null // @@ if blank no way to know\n\n const box = dom.createElement('div')\n if (container) container.appendChild(box)\n const lhs = dom.createElement('div')\n lhs.setAttribute('class', 'formFieldName')\n lhs.setAttribute('style', style.formFieldNameBoxStyle)\n box.appendChild(lhs)\n const rhs = dom.createElement('div')\n rhs.setAttribute('class', 'formFieldValue')\n box.appendChild(rhs)\n\n const property = kb.any(form, ns.ui('property'))\n if (!property) {\n return box.appendChild(\n widgets.errorMessageBlock(dom, 'Error: No property given for autocomplete field: ' + form)\n )\n }\n const labelProperty = kb.any(form, ns.ui('labelProperty')) || ns.schema('name')\n\n // Parse the data source into query options\n\n const dataSource = kb.any(form, ns.ui('dataSource')) as NamedNode | undefined\n if (!dataSource) {\n // console.log('@@ connectedStatements ACF ', kb.connectedStatements(form).map(x => x.toNT()).join('\\n'))\n return box.appendChild(\n widgets.errorMessageBlock(dom, 'Error: No data source given for autocomplete field: ' + form)\n )\n }\n const queryParams:QueryParameters = {\n // targetClass: kb.any(dataSource, ns.ui('targetClass'), null, dataSource.doc()) as NamedNode | undefined,\n label: kb.anyJS(dataSource, ns.schema('name'), null, dataSource.doc()),\n logo: (kb.any(dataSource, ns.schema('logo'), null, dataSource.doc())) as NamedNode | undefined\n }\n\n // @@ Should we pass the target class in from the data source definition or use a current type of the subject\n const targetClass = (kb.any(form, ns.ui('targetClass'), null, form.doc()) || // class in form takes pecedence\n kb.any(dataSource, ns.ui('targetClass'), null, dataSource.doc())) as NamedNode | undefined\n if (targetClass) {\n queryParams.targetClass = targetClass\n }\n\n queryParams.objectURIBase = (kb.any(dataSource, ns.ui('objectURIBase'), null, dataSource.doc()) || undefined) as NamedNode | undefined\n\n /*\n if (!queryParams.targetClass) {\n const klass = kb.any(subject, ns.rdf('type')) as NamedNode | undefined\n // @@ be more selective of which class if many\n // @@ todo: Take ALL classes, and compare them with those the data source knows about\n // with translation where necessary. Find most specific of the classes for the search.\n if (!klass) throw new Error('Autocomplete: No class specified or is current type of' + subject)\n queryParams.targetClass = klass\n }\n */\n const endpoint = kb.anyJS(dataSource, ns.ui('endpoint'), null, dataSource.doc()) as string | undefined\n if (endpoint) { // SPARQL\n queryParams.endpoint = endpoint\n\n queryParams.searchByNameQuery = kb.anyJS(dataSource, ns.ui('searchByNameQuery'), null, dataSource.doc())\n if (!queryParams.searchByNameQuery) {\n return box.appendChild(\n widgets.errorMessageBlock(dom, 'Error: No searchByNameQuery given for endpoint data Source: ' + form))\n }\n queryParams.insitituteDetailsQuery = kb.anyJS(dataSource, ns.ui('insitituteDetailsQuery'), null, dataSource.doc())\n } else {\n // return box.appendChild(\n // widgets.errorMessageBlock(dom, 'Error: No SPARQL endpoint given for autocomplete field: ' + form))\n const searchByNameURI = kb.anyJS(dataSource, ns.ui('searchByNameURI'))\n if (!searchByNameURI) {\n return box.appendChild(\n widgets.errorMessageBlock(dom, 'Error: No searchByNameURI OR sparql endpoint given for dataSource: ' + dataSource)\n )\n }\n queryParams.searchByNameURI = searchByNameURI\n }\n // It can be cleaner to just remove empty fields if you can't edit them anyway\n const suppressEmptyUneditable = kb.anyJS(form, ns.ui('suppressEmptyUneditable'), null, formDoc)\n const editable = kb.updater?.editable((doc as NamedNode).uri)\n\n const autocompleteOptions:AutocompleteOptions = { // cancelButton?: HTMLElement,\n permanent: true,\n targetClass: queryParams.targetClass, // @@ simplify?\n queryParams\n }\n\n autocompleteOptions.size = kb.anyJS(form, ns.ui('size'), null, formDoc) || undefined\n\n let obj = kb.any(subject, property as any, undefined, doc)\n if (!obj) {\n obj = kb.any(form, ns.ui('default'))\n if (obj) {\n autocompleteOptions.currentObject = obj as NamedNode\n autocompleteOptions.currentName = kb.any(autocompleteOptions.currentObject, labelProperty, null, doc) as Literal\n } else { // No data or default. Should we suprress the whole field?\n if (suppressEmptyUneditable && !editable) {\n box.style.display = 'none' // clutter removal\n return box\n }\n }\n } else { // get object and name from target data:\n autocompleteOptions.currentObject = obj as NamedNode\n autocompleteOptions.currentName = kb.any(autocompleteOptions.currentObject, labelProperty, null, doc) as Literal\n }\n\n lhs.appendChild(widgets.fieldLabel(dom, property as any, form))\n\n const barOptions = {\n editable,\n dbLookup: true\n }\n\n renderAutocompleteControl(dom, subject as NamedNode, barOptions, autocompleteOptions, addOneIdAndRefresh, deleteOne).then((control) => {\n rhs.appendChild(control)\n }, (err) => {\n rhs.appendChild(widgets.errorMessageBlock(dom, `Error rendering autocomplete ${form}: ${err}`, '#fee', err)) //\n })\n return box\n}\n\n// ends\n"],"mappings":";;;;;;;;;;AAEA,IAAAA,EAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAH,uBAAA,CAAAC,OAAA;AACA,IAAAG,KAAA,GAAAJ,uBAAA,CAAAC,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAEA,IAAAK,OAAA,GAAAL,OAAA;AAAoE,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAA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ACF,CAAC,MAAM;IAAE;IACPwC,mBAAmB,CAACI,aAAa,GAAGD,GAAgB;IACpDH,mBAAmB,CAACK,WAAW,GAAG3D,EAAE,CAACG,GAAG,CAACmD,mBAAmB,CAACI,aAAa,EAAEtD,aAAa,EAAE,IAAI,EAAE9B,GAAG,CAAY;EAClH;EAEA2D,GAAG,CAAClB,WAAW,CAACxE,OAAO,CAACsH,UAAU,CAAC5F,GAAG,EAAEiC,QAAQ,EAAS7B,IAAI,CAAC,CAAC;EAE/D,IAAMyF,UAAU,GAAG;IACjBV,QAAQ,EAARA,QAAQ;IACRW,QAAQ,EAAE;EACZ,CAAC;EAED,IAAAC,0CAAyB,EAAC/F,GAAG,EAAEG,OAAO,EAAe0F,UAAU,EAAER,mBAAmB,EAAE7E,kBAAkB,EAAEyC,SAAS,CAAC,CAAC+C,IAAI,CAAC,UAACC,OAAO,EAAK;IACrI9B,GAAG,CAACrB,WAAW,CAACmD,OAAO,CAAC;EAC1B,CAAC,EAAE,UAACC,GAAG,EAAK;IACV/B,GAAG,CAACrB,WAAW,CAACxE,OAAO,CAACyE,iBAAiB,CAAC/C,GAAG,kCAAAwC,MAAA,CAAkCpC,IAAI,QAAAoC,MAAA,CAAK0D,GAAG,GAAI,MAAM,EAAEA,GAAG,CAAC,CAAC,EAAC;EAC/G,CAAC,CAAC;;EACF,OAAOrD,GAAG;AACZ;;AAEA"}
1
+ {"version":3,"file":"autocompleteField.js","names":["ns","_interopRequireWildcard","require","_solidLogic","widgets","style","_autocompleteBar","_rdflib","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","autocompleteField","dom","container","already","subject","form","doc","callbackFunction","_kb$updater","addOneIdAndRefresh","_x","_x2","_addOneIdAndRefresh","apply","arguments","_asyncToGenerator2","_regenerator","mark","_callee","result","name","oldValue","oldName","deletables","insertables","_kb$updater2","wrap","_callee$","_context","prev","next","Error","kb","the","property","any","labelProperty","equals","sameTerm","abrupt","statementsMatching","concat","st","updater","updateMany","t0","box","appendChild","errorMessageBlock","stop","deleteOne","_x3","_x4","_deleteOne","_callee2","_result","_name","_kb$updater3","e2","_callee2$","_context2","termType","store","formDoc","createElement","lhs","setAttribute","formFieldNameBoxStyle","rhs","ui","schema","dataSource","queryParams","label","anyJS","logo","targetClass","objectURIBase","undefined","endpoint","searchByNameQuery","insitituteDetailsQuery","searchByNameURI","suppressEmptyUneditable","editable","uri","autocompleteOptions","permanent","size","obj","currentObject","currentName","display","fieldLabel","barOptions","dbLookup","renderAutocompleteControl","then","control","err"],"sources":["../../../../src/widgets/forms/autocomplete/autocompleteField.ts"],"sourcesContent":["/* Form field for doing autocompleete\n */\nimport * as ns from '../../../ns'\nimport { store } from 'solid-logic'\nimport * as widgets from '../../../widgets'\nimport * as style from '../../../style'\nimport { renderAutocompleteControl } from './autocompleteBar'\nimport { QueryParameters } from './publicData'\nimport { NamedNode, BlankNode, Literal, Variable, st } from 'rdflib'\nimport { AutocompleteOptions } from './autocompletePicker'\n/**\n * Render a autocomplete form field\n *\n * The autocomplete form searches for an object in a definitive public database,\n * and allows the user to search for it by name, displaying a list of objects whose names match\n * the input to date, and letting the user either click on one of the list,\n * or just go on untill there is only one. The process then returns two values,\n * the URiI of the object and its name.\n *\n * @param dom The HTML Document object aka Document Object Model\n * @param container If present, the created widget will be appended to this\n * @param already A hash table of (form, subject) kept to prevent recursive forms looping\n * @param subject The thing about which the form displays/edits data\n * @param form The form or field to be rendered\n * @param doc The web document in which the data is\n * @param callbackFunction Called when data is changed so other parts can be refreshed.\n *\n * Form properties:\n * @param ui:property The property to store the object itself\n * @param ui:labelProperty The property used to store the name of the object\n * @param ui:category The class of objects to be searched, if fixed (else dep on class of subject)\n *\n * @returns The HTML widget created\n */\n// eslint-disable-next-line complexity\nexport function autocompleteField (\n dom: HTMLDocument,\n container: HTMLElement | undefined,\n already,\n subject: NamedNode | BlankNode | Variable,\n form: NamedNode,\n doc: NamedNode | undefined,\n callbackFunction: (_ok: boolean, _errorMessage: string) => void\n): HTMLElement {\n async function addOneIdAndRefresh (result:NamedNode | Literal, name: Literal) {\n if (!name) {\n throw new Error('autocompleteField: No name set.')\n }\n const oldValue = kb.the(subject, property as any, null, doc)\n if (oldValue) {\n const oldName = kb.any(oldValue as any, labelProperty as any, null, doc)\n if (oldValue.equals(result) && oldName && oldName.sameTerm(name)) {\n // console.log('No change: same values.')\n return\n }\n }\n const deletables = oldValue\n ? kb.statementsMatching(subject, property as any, oldValue, doc)\n .concat(kb.statementsMatching(oldValue as any, labelProperty as any, null, doc))\n : []\n // console.log('autocompleteField Deletables ' + deletables.map(st => st.toNT()))\n const insertables = [st(subject, property as any, result, doc),\n st(result as any, labelProperty as any, name, doc)] // @@ track the language of the name too!\n // console.log(`AC form: ${deletables.length} to delete and ${insertables.length} to insert`)\n try {\n // console.log('@@@ AC updating ', deletables, insertables)\n await kb.updater?.updateMany(deletables, insertables)\n } catch (err) {\n callbackFunction(false, err)\n box.appendChild(widgets.errorMessageBlock(dom, 'Autocomplete form data update error:' + err, null, err))\n return\n }\n callbackFunction(true, '')\n }\n\n async function deleteOne (_result:NamedNode | Literal, _name: Literal) {\n const oldValue = kb.the(subject, property as any, null, doc)\n if (!oldValue) {\n callbackFunction(false, 'NO data to elete')\n box.appendChild(widgets.errorMessageBlock(dom, 'Autocomplete delete: no old data!'))\n return\n }\n // const oldName = kb.any(oldValue as any, labelProperty as any, null, doc)\n const deletables = kb.statementsMatching(subject, property as any, oldValue, doc)\n .concat(kb.statementsMatching(oldValue as any, labelProperty as any, null, doc))\n // console.log('autocompleteField Deletables ' + deletables.map(st => st.toNT()))\n const insertables = []\n // console.log(`AC form delete: ${deletables.length} to delete and ${insertables.length} to insert`)\n try {\n // console.log('@@@ AC updating ', deletables, insertables)\n await kb.updater?.updateMany(deletables, insertables)\n } catch (err) {\n const e2 = new Error('Autocomplete form data delete error:' + err)\n callbackFunction(false, err)\n box.appendChild(widgets.errorMessageBlock(dom, e2, null, err))\n return\n }\n callbackFunction(true, '') // changed\n }\n\n if (subject.termType !== 'NamedNode') {\n throw new Error('Sorry this field only works on NamedNode subjects (for editable)')\n }\n const kb = store\n const formDoc = form.doc ? form.doc() : null // @@ if blank no way to know\n\n const box = dom.createElement('div')\n if (container) container.appendChild(box)\n const lhs = dom.createElement('div')\n lhs.setAttribute('class', 'formFieldName')\n lhs.setAttribute('style', style.formFieldNameBoxStyle)\n box.appendChild(lhs)\n const rhs = dom.createElement('div')\n rhs.setAttribute('class', 'formFieldValue')\n box.appendChild(rhs)\n\n const property = kb.any(form, ns.ui('property'))\n if (!property) {\n return box.appendChild(\n widgets.errorMessageBlock(dom, 'Error: No property given for autocomplete field: ' + form)\n )\n }\n const labelProperty = kb.any(form, ns.ui('labelProperty')) || ns.schema('name')\n\n // Parse the data source into query options\n\n const dataSource = kb.any(form, ns.ui('dataSource')) as NamedNode | undefined\n if (!dataSource) {\n // console.log('@@ connectedStatements ACF ', kb.connectedStatements(form).map(x => x.toNT()).join('\\n'))\n return box.appendChild(\n widgets.errorMessageBlock(dom, 'Error: No data source given for autocomplete field: ' + form)\n )\n }\n const queryParams:QueryParameters = {\n // targetClass: kb.any(dataSource, ns.ui('targetClass'), null, dataSource.doc()) as NamedNode | undefined,\n label: kb.anyJS(dataSource, ns.schema('name'), null, dataSource.doc()),\n logo: (kb.any(dataSource, ns.schema('logo'), null, dataSource.doc())) as NamedNode | undefined\n }\n\n // @@ Should we pass the target class in from the data source definition or use a current type of the subject\n const targetClass = (kb.any(form, ns.ui('targetClass'), null, form.doc()) || // class in form takes pecedence\n kb.any(dataSource, ns.ui('targetClass'), null, dataSource.doc())) as NamedNode | undefined\n if (targetClass) {\n queryParams.targetClass = targetClass\n }\n\n queryParams.objectURIBase = (kb.any(dataSource, ns.ui('objectURIBase'), null, dataSource.doc()) || undefined) as NamedNode | undefined\n\n /*\n if (!queryParams.targetClass) {\n const klass = kb.any(subject, ns.rdf('type')) as NamedNode | undefined\n // @@ be more selective of which class if many\n // @@ todo: Take ALL classes, and compare them with those the data source knows about\n // with translation where necessary. Find most specific of the classes for the search.\n if (!klass) throw new Error('Autocomplete: No class specified or is current type of' + subject)\n queryParams.targetClass = klass\n }\n */\n const endpoint = kb.anyJS(dataSource, ns.ui('endpoint'), null, dataSource.doc()) as string | undefined\n if (endpoint) { // SPARQL\n queryParams.endpoint = endpoint\n\n queryParams.searchByNameQuery = kb.anyJS(dataSource, ns.ui('searchByNameQuery'), null, dataSource.doc())\n if (!queryParams.searchByNameQuery) {\n return box.appendChild(\n widgets.errorMessageBlock(dom, 'Error: No searchByNameQuery given for endpoint data Source: ' + form))\n }\n queryParams.insitituteDetailsQuery = kb.anyJS(dataSource, ns.ui('insitituteDetailsQuery'), null, dataSource.doc())\n } else {\n // return box.appendChild(\n // widgets.errorMessageBlock(dom, 'Error: No SPARQL endpoint given for autocomplete field: ' + form))\n const searchByNameURI = kb.anyJS(dataSource, ns.ui('searchByNameURI'))\n if (!searchByNameURI) {\n return box.appendChild(\n widgets.errorMessageBlock(dom, 'Error: No searchByNameURI OR sparql endpoint given for dataSource: ' + dataSource)\n )\n }\n queryParams.searchByNameURI = searchByNameURI\n }\n // It can be cleaner to just remove empty fields if you can't edit them anyway\n const suppressEmptyUneditable = kb.anyJS(form, ns.ui('suppressEmptyUneditable'), null, formDoc)\n const editable = kb.updater?.editable((doc as NamedNode).uri)\n\n const autocompleteOptions:AutocompleteOptions = { // cancelButton?: HTMLElement,\n permanent: true,\n targetClass: queryParams.targetClass, // @@ simplify?\n queryParams\n }\n\n autocompleteOptions.size = kb.anyJS(form, ns.ui('size'), null, formDoc) || undefined\n\n let obj = kb.any(subject, property as any, undefined, doc)\n if (!obj) {\n obj = kb.any(form, ns.ui('default'))\n if (obj) {\n autocompleteOptions.currentObject = obj as NamedNode\n autocompleteOptions.currentName = kb.any(autocompleteOptions.currentObject, labelProperty, null, doc) as Literal\n } else { // No data or default. Should we suprress the whole field?\n if (suppressEmptyUneditable && !editable) {\n box.style.display = 'none' // clutter removal\n return box\n }\n }\n } else { // get object and name from target data:\n autocompleteOptions.currentObject = obj as NamedNode\n autocompleteOptions.currentName = kb.any(autocompleteOptions.currentObject, labelProperty, null, doc) as Literal\n }\n\n lhs.appendChild(widgets.fieldLabel(dom, property as any, form))\n\n const barOptions = {\n editable,\n dbLookup: true\n }\n\n renderAutocompleteControl(dom, subject as NamedNode, barOptions, autocompleteOptions, addOneIdAndRefresh, deleteOne).then((control) => {\n rhs.appendChild(control)\n }, (err) => {\n rhs.appendChild(widgets.errorMessageBlock(dom, `Error rendering autocomplete ${form}: ${err}`, '#fee', err)) //\n })\n return box\n}\n\n// ends\n"],"mappings":";;;;;;;;;;AAEA,IAAAA,EAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAH,uBAAA,CAAAC,OAAA;AACA,IAAAG,KAAA,GAAAJ,uBAAA,CAAAC,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAEA,IAAAK,OAAA,GAAAL,OAAA;AAAoE,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,gBAAAK,OAAA,CAAAL,CAAA,0BAAAA,CAAA,sBAAAA,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,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,EAAS7B,IAAI,CAAC,CAAC;EAE/D,IAAMyF,UAAU,GAAG;IACjBV,QAAQ,EAARA,QAAQ;IACRW,QAAQ,EAAE;EACZ,CAAC;EAED,IAAAC,0CAAyB,EAAC/F,GAAG,EAAEG,OAAO,EAAe0F,UAAU,EAAER,mBAAmB,EAAE7E,kBAAkB,EAAEyC,SAAS,CAAC,CAAC+C,IAAI,CAAC,UAACC,OAAO,EAAK;IACrI9B,GAAG,CAACrB,WAAW,CAACmD,OAAO,CAAC;EAC1B,CAAC,EAAE,UAACC,GAAG,EAAK;IACV/B,GAAG,CAACrB,WAAW,CAACxE,OAAO,CAACyE,iBAAiB,CAAC/C,GAAG,kCAAAwC,MAAA,CAAkCpC,IAAI,QAAAoC,MAAA,CAAK0D,GAAG,GAAI,MAAM,EAAEA,GAAG,CAAC,CAAC,EAAC;EAC/G,CAAC,CAAC;EACF,OAAOrD,GAAG;AACZ;;AAEA"}
@@ -1 +1 @@
1
- {"version":3,"file":"autocompletePicker.d.ts","sourceRoot":"","sources":["../../../../src/widgets/forms/autocomplete/autocompletePicker.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,EAA4D,eAAe,EAAE,MAAM,cAAc,CAAA;AAoBxG,MAAM,MAAM,sBAAsB,GAAG;IACnC,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,YAAY,EAAE,WAAW,CAAC;IAC1B,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,YAAY,CAAC,EAAE,WAAW,CAAA;CAC3B,CAAA;AACD,MAAM,MAAM,mBAAmB,GAAG;IAC7B,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,eAAe,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAA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,UAAU,EAAE,sBAAsB,EAClC,QAAQ,EAAE,SAAS,2BAyPpB"}
@@ -11,6 +11,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
11
11
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
12
  var debug = _interopRequireWildcard(require("../../../debug"));
13
13
  var style = _interopRequireWildcard(require("../../../style"));
14
+ var _styleConstants = _interopRequireDefault(require("../../../styleConstants"));
14
15
  var widgets = _interopRequireWildcard(require("../../../widgets"));
15
16
  var _solidLogic = require("solid-logic");
16
17
  var _publicData = require("./publicData");
@@ -20,10 +21,10 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
20
21
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
21
22
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
22
23
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /* Autocomplete Picker: Create and edit data using public data
23
- **
24
- ** As the data source is passed as a parameter, all kinds of APIa and query services can be used
25
- **
26
- */
24
+ **
25
+ ** As the data source is passed as a parameter, all kinds of APIa and query services can be used
26
+ **
27
+ */
27
28
  var AUTOCOMPLETE_THRESHOLD = 4; // don't check until this many characters typed
28
29
  var AUTOCOMPLETE_ROWS = 20; // 20?
29
30
  var AUTOCOMPLETE_ROWS_STRETCH = 40;
@@ -74,14 +75,12 @@ function _renderAutoComplete() {
74
75
  if (decoration.acceptButton) {
75
76
  setVisible(decoration.acceptButton, false); // hide until input complete
76
77
  }
77
-
78
78
  if (decoration.editButton) {
79
79
  setVisible(decoration.editButton, true);
80
80
  }
81
81
  if (decoration.cancelButton) {
82
82
  setVisible(decoration.cancelButton, false); // only allow cancel when there is something to cancel
83
83
  }
84
-
85
84
  inputEventHandlerLock = false;
86
85
  clearList();
87
86
  };
@@ -165,7 +164,6 @@ function _renderAutoComplete() {
165
164
  if (loadedEnough && slimmed.length <= AUTOCOMPLETE_ROWS_STRETCH) {
166
165
  numberOfRows = slimmed.length; // stretch if it means we get all items
167
166
  }
168
-
169
167
  allDisplayed = loadedEnough && slimmed.length <= numberOfRows;
170
168
  debug.log(" Filter:\"".concat(filter, "\" lastBindings: ").concat(lastBindings.length, ", slimmed to ").concat(slimmed.length, "; rows: ").concat(numberOfRows, ", Enough? ").concat(loadedEnough, ", All displayed? ").concat(allDisplayed));
171
169
  displayable = slimmed.slice(0, numberOfRows);
@@ -413,7 +411,7 @@ function _renderAutoComplete() {
413
411
  searchInput = cell.appendChild(dom.createElement('input'));
414
412
  searchInput.setAttribute('type', 'text');
415
413
  initialize();
416
- size = acOptions.size || style.textInputSize || 20;
414
+ size = acOptions.size || _styleConstants["default"].textInputSize || 20;
417
415
  searchInput.setAttribute('size', size);
418
416
  searchInput.setAttribute('data-testid', 'autocomplete-input');
419
417
  searchInputStyle = style.textInputStyle ||