@leavittsoftware/web 1.0.0

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 (294) hide show
  1. package/leavitt/api-service/HttpError.d.ts +10 -0
  2. package/leavitt/api-service/HttpError.js +2 -0
  3. package/leavitt/api-service/HttpError.js.map +1 -0
  4. package/leavitt/api-service/api-service.d.ts +27 -0
  5. package/leavitt/api-service/api-service.js +332 -0
  6. package/leavitt/api-service/api-service.js.map +1 -0
  7. package/leavitt/api-service/api2-service.d.ts +338 -0
  8. package/leavitt/api-service/api2-service.js +17 -0
  9. package/leavitt/api-service/api2-service.js.map +1 -0
  10. package/leavitt/api-service/authenticated-token-provider.d.ts +5 -0
  11. package/leavitt/api-service/authenticated-token-provider.js +7 -0
  12. package/leavitt/api-service/authenticated-token-provider.js.map +1 -0
  13. package/leavitt/api-service/bearer-token-provider.d.ts +4 -0
  14. package/leavitt/api-service/bearer-token-provider.js +2 -0
  15. package/leavitt/api-service/bearer-token-provider.js.map +1 -0
  16. package/leavitt/api-service/mapi-service.d.ts +338 -0
  17. package/leavitt/api-service/mapi-service.js +17 -0
  18. package/leavitt/api-service/mapi-service.js.map +1 -0
  19. package/leavitt/api-service/no-authentication-token-provider.d.ts +5 -0
  20. package/leavitt/api-service/no-authentication-token-provider.js +6 -0
  21. package/leavitt/api-service/no-authentication-token-provider.js.map +1 -0
  22. package/leavitt/api-service/odata-dto.d.ts +6 -0
  23. package/leavitt/api-service/odata-dto.js +7 -0
  24. package/leavitt/api-service/odata-dto.js.map +1 -0
  25. package/leavitt/api-service/odata-model-info.d.ts +5 -0
  26. package/leavitt/api-service/odata-model-info.js +7 -0
  27. package/leavitt/api-service/odata-model-info.js.map +1 -0
  28. package/leavitt/api-service/odata-response.d.ts +15 -0
  29. package/leavitt/api-service/odata-response.js +50 -0
  30. package/leavitt/api-service/odata-response.js.map +1 -0
  31. package/leavitt/api-service/status-codes.d.ts +2 -0
  32. package/leavitt/api-service/status-codes.js +44 -0
  33. package/leavitt/api-service/status-codes.js.map +1 -0
  34. package/leavitt/company-select/company-select.d.ts +50 -0
  35. package/leavitt/company-select/company-select.js +157 -0
  36. package/leavitt/company-select/company-select.js.map +1 -0
  37. package/leavitt/person-company-select/person-company-select.d.ts +41 -0
  38. package/leavitt/person-company-select/person-company-select.js +180 -0
  39. package/leavitt/person-company-select/person-company-select.js.map +1 -0
  40. package/leavitt/person-group-select/people-group-icons.d.ts +5 -0
  41. package/leavitt/person-group-select/people-group-icons.js +66 -0
  42. package/leavitt/person-group-select/people-group-icons.js.map +1 -0
  43. package/leavitt/person-group-select/person-group-select.d.ts +41 -0
  44. package/leavitt/person-group-select/person-group-select.js +186 -0
  45. package/leavitt/person-group-select/person-group-select.js.map +1 -0
  46. package/leavitt/person-select/person-select.d.ts +33 -0
  47. package/leavitt/person-select/person-select.js +128 -0
  48. package/leavitt/person-select/person-select.js.map +1 -0
  49. package/leavitt/profile-picture/profile-picture-menu.d.ts +44 -0
  50. package/leavitt/profile-picture/profile-picture-menu.js +197 -0
  51. package/leavitt/profile-picture/profile-picture-menu.js.map +1 -0
  52. package/leavitt/profile-picture/profile-picture.d.ts +39 -0
  53. package/leavitt/profile-picture/profile-picture.js +151 -0
  54. package/leavitt/profile-picture/profile-picture.js.map +1 -0
  55. package/leavitt/user-feedback/user-feedback.d.ts +357 -0
  56. package/leavitt/user-feedback/user-feedback.js +207 -0
  57. package/leavitt/user-feedback/user-feedback.js.map +1 -0
  58. package/leavitt/user-manager/LssJwtToken.d.ts +21 -0
  59. package/leavitt/user-manager/LssJwtToken.js +2 -0
  60. package/leavitt/user-manager/LssJwtToken.js.map +1 -0
  61. package/leavitt/user-manager/user-manager-events.d.ts +5 -0
  62. package/leavitt/user-manager/user-manager-events.js +7 -0
  63. package/leavitt/user-manager/user-manager-events.js.map +1 -0
  64. package/leavitt/user-manager/user-manager.d.ts +37 -0
  65. package/leavitt/user-manager/user-manager.js +364 -0
  66. package/leavitt/user-manager/user-manager.js.map +1 -0
  67. package/package.json +36 -0
  68. package/titanium/access-denied-page/access-denied-page.d.ts +16 -0
  69. package/titanium/access-denied-page/access-denied-page.js +360 -0
  70. package/titanium/access-denied-page/access-denied-page.js.map +1 -0
  71. package/titanium/address-input/Address.js.map +1 -0
  72. package/titanium/address-input/address-input.d.ts +29 -0
  73. package/titanium/address-input/address-input.js +77 -0
  74. package/titanium/address-input/address-input.js.map +1 -0
  75. package/titanium/address-input/google-address-input.d.ts +30 -0
  76. package/titanium/address-input/google-address-input.js +202 -0
  77. package/titanium/address-input/google-address-input.js.map +1 -0
  78. package/titanium/address-input/manual-address-dialog.d.ts +30 -0
  79. package/titanium/address-input/manual-address-dialog.js +250 -0
  80. package/titanium/address-input/manual-address-dialog.js.map +1 -0
  81. package/titanium/address-input/types/address-input-address.d.ts +17 -0
  82. package/titanium/address-input/types/address-input-address.js +2 -0
  83. package/titanium/address-input/types/address-input-address.js.map +1 -0
  84. package/titanium/address-input/types/address.js.map +1 -0
  85. package/titanium/address-input/types/autocomplete-prediction-suggestion.js.map +1 -0
  86. package/titanium/address-input/utils/address-to-string.d.ts +3 -0
  87. package/titanium/address-input/utils/address-to-string.js +13 -0
  88. package/titanium/address-input/utils/address-to-string.js.map +1 -0
  89. package/titanium/address-input/utils/place-result-to-address.d.ts +4 -0
  90. package/titanium/address-input/utils/place-result-to-address.js +33 -0
  91. package/titanium/address-input/utils/place-result-to-address.js.map +1 -0
  92. package/titanium/address-input/utils/validate-street.d.ts +2 -0
  93. package/titanium/address-input/utils/validate-street.js +8 -0
  94. package/titanium/address-input/utils/validate-street.js.map +1 -0
  95. package/titanium/card/card.d.ts +23 -0
  96. package/titanium/card/card.js +160 -0
  97. package/titanium/card/card.js.map +1 -0
  98. package/titanium/chip-multi-select/chip-multi-select.d.ts +55 -0
  99. package/titanium/chip-multi-select/chip-multi-select.js +119 -0
  100. package/titanium/chip-multi-select/chip-multi-select.js.map +1 -0
  101. package/titanium/data-table/data-table-header.d.ts +67 -0
  102. package/titanium/data-table/data-table-header.js +207 -0
  103. package/titanium/data-table/data-table-header.js.map +1 -0
  104. package/titanium/data-table/data-table-item.d.ts +100 -0
  105. package/titanium/data-table/data-table-item.js +511 -0
  106. package/titanium/data-table/data-table-item.js.map +1 -0
  107. package/titanium/data-table/data-table.d.ts +146 -0
  108. package/titanium/data-table/data-table.js +605 -0
  109. package/titanium/data-table/data-table.js.map +1 -0
  110. package/titanium/data-table/filter-controller.d.ts +23 -0
  111. package/titanium/data-table/filter-controller.js +119 -0
  112. package/titanium/data-table/filter-controller.js.map +1 -0
  113. package/titanium/data-table/filter.d.ts +8 -0
  114. package/titanium/data-table/filter.js +11 -0
  115. package/titanium/data-table/filter.js.map +1 -0
  116. package/titanium/data-table/page-control.d.ts +54 -0
  117. package/titanium/data-table/page-control.js +196 -0
  118. package/titanium/data-table/page-control.js.map +1 -0
  119. package/titanium/date-range-selector/date-range-change-event.d.ts +8 -0
  120. package/titanium/date-range-selector/date-range-change-event.js +10 -0
  121. package/titanium/date-range-selector/date-range-change-event.js.map +1 -0
  122. package/titanium/date-range-selector/date-range-selector.d.ts +65 -0
  123. package/titanium/date-range-selector/date-range-selector.js +423 -0
  124. package/titanium/date-range-selector/date-range-selector.js.map +1 -0
  125. package/titanium/date-range-selector/range-label.d.ts +4 -0
  126. package/titanium/date-range-selector/range-label.js +25 -0
  127. package/titanium/date-range-selector/range-label.js.map +1 -0
  128. package/titanium/drawer/drawer.d.ts +39 -0
  129. package/titanium/drawer/drawer.js +233 -0
  130. package/titanium/drawer/drawer.js.map +1 -0
  131. package/titanium/duration-input/duration-input.d.ts +26 -0
  132. package/titanium/duration-input/duration-input.js +86 -0
  133. package/titanium/duration-input/duration-input.js.map +1 -0
  134. package/titanium/duration-input/human-interval.d.ts +19 -0
  135. package/titanium/duration-input/human-interval.js +74 -0
  136. package/titanium/duration-input/human-interval.js.map +1 -0
  137. package/titanium/error-page/error-page.d.ts +16 -0
  138. package/titanium/error-page/error-page.js +96 -0
  139. package/titanium/error-page/error-page.js.map +1 -0
  140. package/titanium/event-bus/event-bus.d.ts +10 -0
  141. package/titanium/event-bus/event-bus.js +52 -0
  142. package/titanium/event-bus/event-bus.js.map +1 -0
  143. package/titanium/extendable-outlined-text-field/extendable-outlined-text-field.d.ts +160 -0
  144. package/titanium/extendable-outlined-text-field/extendable-outlined-text-field.js +295 -0
  145. package/titanium/extendable-outlined-text-field/extendable-outlined-text-field.js.map +1 -0
  146. package/titanium/extendable-outlined-text-field/extensible-outlined-text-field.d.ts +45 -0
  147. package/titanium/extendable-outlined-text-field/extensible-outlined-text-field.js.map +1 -0
  148. package/titanium/full-page-loading-indicator/full-page-loading-indicator.d.ts +19 -0
  149. package/titanium/full-page-loading-indicator/full-page-loading-indicator.js +170 -0
  150. package/titanium/full-page-loading-indicator/full-page-loading-indicator.js.map +1 -0
  151. package/titanium/hacks/dialog-overflow-hacks.d.ts +4 -0
  152. package/titanium/hacks/dialog-overflow-hacks.js +21 -0
  153. package/titanium/hacks/dialog-overflow-hacks.js.map +1 -0
  154. package/titanium/header/header.d.ts +39 -0
  155. package/titanium/header/header.js +148 -0
  156. package/titanium/header/header.js.map +1 -0
  157. package/titanium/helpers/csv-download.d.ts +3 -0
  158. package/titanium/helpers/csv-download.js +78 -0
  159. package/titanium/helpers/csv-download.js.map +1 -0
  160. package/titanium/helpers/debouncer.d.ts +13 -0
  161. package/titanium/helpers/debouncer.js +33 -0
  162. package/titanium/helpers/debouncer.js.map +1 -0
  163. package/titanium/helpers/delay.d.ts +2 -0
  164. package/titanium/helpers/delay.js +6 -0
  165. package/titanium/helpers/delay.js.map +1 -0
  166. package/titanium/helpers/dev-detection.d.ts +3 -0
  167. package/titanium/helpers/dev-detection.js +12 -0
  168. package/titanium/helpers/dev-detection.js.map +1 -0
  169. package/titanium/helpers/helpers.d.ts +14 -0
  170. package/titanium/helpers/helpers.js +14 -0
  171. package/titanium/helpers/helpers.js.map +1 -0
  172. package/titanium/helpers/join.d.ts +2 -0
  173. package/titanium/helpers/join.js +5 -0
  174. package/titanium/helpers/join.js.map +1 -0
  175. package/titanium/helpers/leavitt-cdn.d.ts +5 -0
  176. package/titanium/helpers/leavitt-cdn.js +38 -0
  177. package/titanium/helpers/leavitt-cdn.js.map +1 -0
  178. package/titanium/helpers/load-while.d.ts +343 -0
  179. package/titanium/helpers/load-while.js +27 -0
  180. package/titanium/helpers/load-while.js.map +1 -0
  181. package/titanium/helpers/media-query.d.ts +2 -0
  182. package/titanium/helpers/media-query.js +6 -0
  183. package/titanium/helpers/media-query.js.map +1 -0
  184. package/titanium/helpers/middle-ellipsis.d.ts +2 -0
  185. package/titanium/helpers/middle-ellipsis.js +7 -0
  186. package/titanium/helpers/middle-ellipsis.js.map +1 -0
  187. package/titanium/helpers/not-null-or-undefined.d.ts +2 -0
  188. package/titanium/helpers/not-null-or-undefined.js +4 -0
  189. package/titanium/helpers/not-null-or-undefined.js.map +1 -0
  190. package/titanium/helpers/not-null.d.ts +2 -0
  191. package/titanium/helpers/not-null.js +4 -0
  192. package/titanium/helpers/not-null.js.map +1 -0
  193. package/titanium/helpers/not-undefined.d.ts +2 -0
  194. package/titanium/helpers/not-undefined.js +4 -0
  195. package/titanium/helpers/not-undefined.js.map +1 -0
  196. package/titanium/helpers/odata-helpers.d.ts +2 -0
  197. package/titanium/helpers/odata-helpers.js +2 -0
  198. package/titanium/helpers/odata-helpers.js.map +1 -0
  199. package/titanium/helpers/search-token.d.ts +2 -0
  200. package/titanium/helpers/search-token.js +17 -0
  201. package/titanium/helpers/search-token.js.map +1 -0
  202. package/titanium/icon-picker/icon-picker.d.ts +23 -0
  203. package/titanium/icon-picker/icon-picker.js +75 -0
  204. package/titanium/icon-picker/icon-picker.js.map +1 -0
  205. package/titanium/icon-picker/material-symbols.d.ts +3 -0
  206. package/titanium/icon-picker/material-symbols.js +3297 -0
  207. package/titanium/icon-picker/material-symbols.js.map +1 -0
  208. package/titanium/input-validator/input-validator.d.ts +20 -0
  209. package/titanium/input-validator/input-validator.js +45 -0
  210. package/titanium/input-validator/input-validator.js.map +1 -0
  211. package/titanium/search-input/search-input.d.ts +47 -0
  212. package/titanium/search-input/search-input.js +237 -0
  213. package/titanium/search-input/search-input.js.map +1 -0
  214. package/titanium/service-worker-notifier/service-worker-notifier.d.ts +9 -0
  215. package/titanium/service-worker-notifier/service-worker-notifier.js +57 -0
  216. package/titanium/service-worker-notifier/service-worker-notifier.js.map +1 -0
  217. package/titanium/show-hide/show-hide.d.ts +36 -0
  218. package/titanium/show-hide/show-hide.js +144 -0
  219. package/titanium/show-hide/show-hide.js.map +1 -0
  220. package/titanium/single-select-base/single-select-base.d.ts +449 -0
  221. package/titanium/single-select-base/single-select-base.js +411 -0
  222. package/titanium/single-select-base/single-select-base.js.map +1 -0
  223. package/titanium/smart-attachment-input/crop-and-save-image-dialog.d.ts +370 -0
  224. package/titanium/smart-attachment-input/crop-and-save-image-dialog.js +270 -0
  225. package/titanium/smart-attachment-input/crop-and-save-image-dialog.js.map +1 -0
  226. package/titanium/smart-attachment-input/cropper-styles.d.ts +3 -0
  227. package/titanium/smart-attachment-input/cropper-styles.js +311 -0
  228. package/titanium/smart-attachment-input/cropper-styles.js.map +1 -0
  229. package/titanium/smart-attachment-input/image-formats.d.ts +5 -0
  230. package/titanium/smart-attachment-input/image-formats.js +37 -0
  231. package/titanium/smart-attachment-input/image-formats.js.map +1 -0
  232. package/titanium/smart-attachment-input/image-preview-dialog.d.ts +21 -0
  233. package/titanium/smart-attachment-input/image-preview-dialog.js +83 -0
  234. package/titanium/smart-attachment-input/image-preview-dialog.js.map +1 -0
  235. package/titanium/smart-attachment-input/smart-attachment-input.d.ts +126 -0
  236. package/titanium/smart-attachment-input/smart-attachment-input.js +422 -0
  237. package/titanium/smart-attachment-input/smart-attachment-input.js.map +1 -0
  238. package/titanium/smart-attachment-input/type/smart-attachment.d.ts +7 -0
  239. package/titanium/smart-attachment-input/type/smart-attachment.js +2 -0
  240. package/titanium/smart-attachment-input/type/smart-attachment.js.map +1 -0
  241. package/titanium/snackbar/snackbar.d.ts +79 -0
  242. package/titanium/snackbar/snackbar.js +302 -0
  243. package/titanium/snackbar/snackbar.js.map +1 -0
  244. package/titanium/styles/a.d.ts +2 -0
  245. package/titanium/styles/a.js +18 -0
  246. package/titanium/styles/a.js.map +1 -0
  247. package/titanium/styles/data-row.d.ts +2 -0
  248. package/titanium/styles/data-row.js +52 -0
  249. package/titanium/styles/data-row.js.map +1 -0
  250. package/titanium/styles/ellipsis.d.ts +2 -0
  251. package/titanium/styles/ellipsis.js +9 -0
  252. package/titanium/styles/ellipsis.js.map +1 -0
  253. package/titanium/styles/h1.d.ts +2 -0
  254. package/titanium/styles/h1.js +17 -0
  255. package/titanium/styles/h1.js.map +1 -0
  256. package/titanium/styles/h2.d.ts +2 -0
  257. package/titanium/styles/h2.js +17 -0
  258. package/titanium/styles/h2.js.map +1 -0
  259. package/titanium/styles/h3.d.ts +2 -0
  260. package/titanium/styles/h3.js +17 -0
  261. package/titanium/styles/h3.js.map +1 -0
  262. package/titanium/styles/h4.d.ts +2 -0
  263. package/titanium/styles/h4.js +17 -0
  264. package/titanium/styles/h4.js.map +1 -0
  265. package/titanium/styles/h5.d.ts +2 -0
  266. package/titanium/styles/h5.js +19 -0
  267. package/titanium/styles/h5.js.map +1 -0
  268. package/titanium/styles/p.d.ts +2 -0
  269. package/titanium/styles/p.js +17 -0
  270. package/titanium/styles/p.js.map +1 -0
  271. package/titanium/styles/styles.d.ts +17 -0
  272. package/titanium/styles/styles.js +17 -0
  273. package/titanium/styles/styles.js.map +1 -0
  274. package/titanium/toolbar/toolbar.d.ts +34 -0
  275. package/titanium/toolbar/toolbar.js +104 -0
  276. package/titanium/toolbar/toolbar.js.map +1 -0
  277. package/titanium/types/any-function.d.ts +5 -0
  278. package/titanium/types/any-function.js +2 -0
  279. package/titanium/types/any-function.js.map +1 -0
  280. package/titanium/types/dom-event.d.ts +4 -0
  281. package/titanium/types/dom-event.js +2 -0
  282. package/titanium/types/dom-event.js.map +1 -0
  283. package/titanium/types/identifier-interface.d.ts +4 -0
  284. package/titanium/types/identifier-interface.js +2 -0
  285. package/titanium/types/identifier-interface.js.map +1 -0
  286. package/titanium/types/pending-state-event.d.ts +7 -0
  287. package/titanium/types/pending-state-event.js +7 -0
  288. package/titanium/types/pending-state-event.js.map +1 -0
  289. package/titanium/types/string-map.d.ts +7 -0
  290. package/titanium/types/string-map.js +5 -0
  291. package/titanium/types/string-map.js.map +1 -0
  292. package/titanium/youtube-input/youtube-input.d.ts +17 -0
  293. package/titanium/youtube-input/youtube-input.js +52 -0
  294. package/titanium/youtube-input/youtube-input.js.map +1 -0
@@ -0,0 +1,422 @@
1
+ import { __decorate } from "tslib";
2
+ import '../chip-multi-select/chip-multi-select';
3
+ import './crop-and-save-image-dialog';
4
+ import './image-preview-dialog';
5
+ import '@material/web/dialog/dialog';
6
+ import '@material/web/icon/icon';
7
+ import '@material/web/button/text-button';
8
+ import '@material/web/button/outlined-button';
9
+ import '@material/web/chips/input-chip';
10
+ import { css, html, LitElement } from 'lit';
11
+ import { property, customElement, query } from 'lit/decorators.js';
12
+ import { repeat } from 'lit/directives/repeat.js';
13
+ import { getExtension, getFileIcon, imageFormats } from './image-formats';
14
+ import { delay, middleEllipsis } from '../../titanium/helpers/helpers';
15
+ import { getCdnDownloadUrl, getCdnInlineUrl } from '../../titanium/helpers/leavitt-cdn';
16
+ /**
17
+ * Material outline image input with cropper
18
+ *
19
+ * @element titanium-smart-attachment-input
20
+ *
21
+ * @fires change - Fired when image is attached or removed from input.
22
+ *
23
+ *
24
+ */
25
+ let TitaniumSmartAttachmentInput = class TitaniumSmartAttachmentInput extends LitElement {
26
+ constructor() {
27
+ super(...arguments);
28
+ this.files = [];
29
+ this.isOver = false;
30
+ this.previewSrc = undefined;
31
+ this.#originalFiles = [];
32
+ /**
33
+ * File types to accept ex. "image/*,.pdf"
34
+ */
35
+ this.accept = 'image/*,.pdf';
36
+ /**
37
+ * Allow multiple attachments
38
+ */
39
+ this.multiple = false;
40
+ /**
41
+ * Requires at least one attachment on validate
42
+ */
43
+ this.required = false;
44
+ /**
45
+ * Whether or not the input should be disabled
46
+ */
47
+ this.disabled = false;
48
+ /**
49
+ * Requires user to confirm when delete of an attachment is requested
50
+ */
51
+ this.confirmDelete = false;
52
+ /**
53
+ * Delete confirmation header text
54
+ */
55
+ this.confirmDeleteHeader = 'Confirm delete';
56
+ /**
57
+ * Delete confirmation paragraph text
58
+ */
59
+ this.confirmDeleteText = 'Are you sure you would like to delete this attachment?';
60
+ /**
61
+ * Add button label text
62
+ */
63
+ this.addButtonLabel = 'Add attachment';
64
+ /**
65
+ * Label of input
66
+ */
67
+ this.label = 'Attachments';
68
+ /**
69
+ * Text to show when there are no attachments
70
+ */
71
+ this.noItemsText = 'No attachments';
72
+ /**
73
+ * Configurable CropperJs options.
74
+ */
75
+ this.options = {};
76
+ /**
77
+ * Image formats here are sent to the cropper
78
+ */
79
+ this.croppableImageFormats = [
80
+ 'tiff',
81
+ 'pjp',
82
+ 'jfif',
83
+ 'bmp',
84
+ 'gif',
85
+ 'svg',
86
+ 'png',
87
+ 'xbm',
88
+ 'dib',
89
+ 'jxl',
90
+ 'jpeg',
91
+ 'svgz',
92
+ 'jpg',
93
+ 'webp',
94
+ 'ico',
95
+ 'tif',
96
+ 'pjpeg',
97
+ 'avif',
98
+ ];
99
+ this.#fileToDelete = null;
100
+ }
101
+ #originalFiles;
102
+ /**
103
+ * File object of cropped image.
104
+ */
105
+ getFiles() {
106
+ return this.files;
107
+ }
108
+ /**
109
+ * Use to preset input to existing image.
110
+ */
111
+ setFiles(...files) {
112
+ this.files = [...files].map((o) => ({ file: new File([''], o.fileName), previewSrc: o.previewSrc, downloadSrc: o.downloadSrc, id: o.id }));
113
+ this.#originalFiles = structuredClone(this.files);
114
+ }
115
+ /**
116
+ * Use to preset input to existing image.
117
+ */
118
+ setFilesFromDatabaseAttachments(...attachments) {
119
+ this.files = [...attachments]
120
+ .filter((o) => o.Name && o.Extension)
121
+ .map((o) => ({
122
+ id: o.Id,
123
+ file: new File([''], `${o?.Name}.${o?.Extension}`),
124
+ previewSrc: getCdnInlineUrl(o, 512),
125
+ downloadSrc: getCdnDownloadUrl(o),
126
+ }));
127
+ this.#originalFiles = structuredClone(this.files);
128
+ }
129
+ /**
130
+ * Returns true if the input passes validity checks.
131
+ */
132
+ checkValidity() {
133
+ return this.chipMultiSelect.checkValidity();
134
+ }
135
+ /**
136
+ * Runs checkValidity() method, and if it returns false, then it reports to the user that the input is invalid.
137
+ */
138
+ reportValidity() {
139
+ return this.chipMultiSelect.reportValidity();
140
+ }
141
+ /**
142
+ * Returns true if the images have been added, removed or edited.
143
+ */
144
+ hasChanges() {
145
+ return JSON.stringify(this.#originalFiles) !== JSON.stringify(this.files);
146
+ }
147
+ /**
148
+ * Resets the inputs state.
149
+ */
150
+ async reset() {
151
+ this.#originalFiles = [];
152
+ this.previewSrc = undefined;
153
+ this.files = [];
154
+ this.isOver = false;
155
+ await this.updateComplete;
156
+ this.chipMultiSelect.reset();
157
+ }
158
+ async handleNewFile(files) {
159
+ let shouldNotify = false;
160
+ for (let i = 0; i < (files?.length ?? 0); i++) {
161
+ const file = files?.item(i);
162
+ if (file) {
163
+ const shouldCrop = this.croppableImageFormats.some((o) => file.name.endsWith(o));
164
+ if (shouldCrop) {
165
+ const cropResult = await this.cropperDialog.open(URL.createObjectURL(file), file.name, async (croppedImage, previewDataUrl) => {
166
+ const croppedFile = { file: croppedImage, previewSrc: previewDataUrl ?? undefined };
167
+ if (this.multiple) {
168
+ this.files = [...this.files, croppedFile];
169
+ }
170
+ else {
171
+ this.files = [croppedFile];
172
+ }
173
+ });
174
+ if (cropResult === 'cropped') {
175
+ this.reportValidity();
176
+ shouldNotify = true;
177
+ }
178
+ await delay(500);
179
+ }
180
+ else {
181
+ const _file = { file: file };
182
+ const isImage = imageFormats.some((o) => file.name.endsWith(o));
183
+ if (isImage) {
184
+ try {
185
+ const fileAsBase64 = await this.toBase64(file);
186
+ if (typeof fileAsBase64 === 'string') {
187
+ _file.previewSrc = fileAsBase64 ?? undefined;
188
+ }
189
+ }
190
+ catch (error) { }
191
+ }
192
+ if (this.multiple) {
193
+ this.files = [...this.files, _file];
194
+ }
195
+ else {
196
+ this.files = [_file];
197
+ }
198
+ this.reportValidity();
199
+ shouldNotify = true;
200
+ }
201
+ }
202
+ }
203
+ if (shouldNotify) {
204
+ this.#notifyChange();
205
+ }
206
+ }
207
+ #fileToDelete;
208
+ #deleteFile(file) {
209
+ const i = this.files.findIndex((o) => o === file);
210
+ this.files.splice(i, 1);
211
+ this.requestUpdate('files');
212
+ this.reportValidity();
213
+ this.#notifyChange();
214
+ }
215
+ toBase64(file) {
216
+ return new Promise((resolve, reject) => {
217
+ const reader = new FileReader();
218
+ reader.readAsDataURL(file);
219
+ reader.onload = () => resolve(reader.result);
220
+ reader.onerror = (error) => reject(error);
221
+ });
222
+ }
223
+ #notifyChange() {
224
+ this.dispatchEvent(new Event('change'));
225
+ }
226
+ static { this.styles = [
227
+ css `
228
+ :host {
229
+ display: block;
230
+ }
231
+
232
+ :host([is-over]:not([disabled])) drop-scrim {
233
+ background-color: var(--md-sys-color-outline-variant);
234
+ opacity: 0.08;
235
+ }
236
+
237
+ titanium-chip-multi-select {
238
+ position: relative;
239
+ }
240
+
241
+ drop-scrim {
242
+ position: absolute;
243
+ pointer-events: none;
244
+ top: 0;
245
+ right: 0;
246
+ left: 0;
247
+ bottom: 0;
248
+ }
249
+
250
+ [hidden] {
251
+ display: none !important;
252
+ }
253
+ `,
254
+ ]; }
255
+ render() {
256
+ return html `
257
+ <titanium-chip-multi-select
258
+ .supportingText=${this.supportingText}
259
+ .required=${this.required}
260
+ ?disabled=${this.disabled}
261
+ @drop=${(e) => {
262
+ if (this.disabled) {
263
+ return;
264
+ }
265
+ const files = e.dataTransfer?.files ?? new FileList();
266
+ this.handleNewFile(files);
267
+ e.preventDefault();
268
+ this.isOver = false;
269
+ }}
270
+ @dragover=${(e) => {
271
+ e.preventDefault();
272
+ }}
273
+ @dragenter=${(e) => {
274
+ this.isOver = e.dataTransfer?.types?.[0] === 'Files';
275
+ e.preventDefault();
276
+ }}
277
+ @dragleave=${() => {
278
+ this.isOver = false;
279
+ }}
280
+ label="${this.label} ${this.files.length ? ` (${this.files.length})` : ''}"
281
+ noItemsText=${this.noItemsText}
282
+ .hasItems=${!!this.files.length}
283
+ >
284
+ <drop-scrim></drop-scrim>
285
+ <md-outlined-button
286
+ ?hidden=${!this.multiple && !!this.files.length}
287
+ .disabled=${this.disabled}
288
+ @click=${() => {
289
+ if (!this.disabled) {
290
+ this.input.value = '';
291
+ this.input.click();
292
+ }
293
+ }}
294
+ >${this.addButtonLabel} <md-icon slot="icon">add</md-icon></md-outlined-button
295
+ >
296
+ ${repeat(this.files, (o) => o.file.name, (o) => html `<md-input-chip
297
+ label=${middleEllipsis(o.file.name)}
298
+ ?closeable=${!this.disabled}
299
+ @remove=${async (e) => {
300
+ e.preventDefault();
301
+ if (this.confirmDelete) {
302
+ this.#fileToDelete = o;
303
+ this.confirmDeleteDialog?.show();
304
+ }
305
+ else {
306
+ this.#deleteFile(o);
307
+ }
308
+ }}
309
+ @click=${() => {
310
+ if (o.previewSrc || o.downloadSrc) {
311
+ this.imagePreviewDialog.open(o.previewSrc || getFileIcon(getExtension(o.file.name)), o.downloadSrc, o.file.name);
312
+ }
313
+ }}
314
+ >
315
+ <img draggable="false" slot="icon" src="${o.previewSrc || getFileIcon(getExtension(o.file.name))}" />
316
+ </md-input-chip>`)}
317
+ </titanium-chip-multi-select>
318
+
319
+ <label hidden for="upload">
320
+ <input
321
+ hidden
322
+ type="file"
323
+ id="input"
324
+ name="image"
325
+ ?multiple=${this.multiple}
326
+ accept="${this.accept}"
327
+ @change=${(e) => {
328
+ const files = e.target.files;
329
+ this.handleNewFile(files);
330
+ }}
331
+ />
332
+ </label>
333
+ <crop-and-save-image-dialog .options=${this.options}></crop-and-save-image-dialog>
334
+ <image-preview-dialog></image-preview-dialog>
335
+
336
+ <md-dialog confirm-delete>
337
+ <div slot="headline">${this.confirmDeleteHeader}</div>
338
+ <div slot="content"><p>${this.confirmDeleteText}</p></div>
339
+ <div slot="actions">
340
+ <md-text-button @click=${() => this.confirmDeleteDialog.close()}>Cancel</md-text-button>
341
+ <md-text-button
342
+ @click=${() => {
343
+ if (this.#fileToDelete) {
344
+ this.#deleteFile(this.#fileToDelete);
345
+ }
346
+ this.confirmDeleteDialog.close();
347
+ }}
348
+ >Confirm</md-text-button
349
+ >
350
+ </div>
351
+ </md-dialog>
352
+ `;
353
+ }
354
+ };
355
+ __decorate([
356
+ property({ type: Array })
357
+ ], TitaniumSmartAttachmentInput.prototype, "files", void 0);
358
+ __decorate([
359
+ property({ type: Boolean, reflect: true, attribute: 'is-over' })
360
+ ], TitaniumSmartAttachmentInput.prototype, "isOver", void 0);
361
+ __decorate([
362
+ property({ type: String })
363
+ ], TitaniumSmartAttachmentInput.prototype, "previewSrc", void 0);
364
+ __decorate([
365
+ query('input')
366
+ ], TitaniumSmartAttachmentInput.prototype, "input", void 0);
367
+ __decorate([
368
+ query('image-preview-dialog')
369
+ ], TitaniumSmartAttachmentInput.prototype, "imagePreviewDialog", void 0);
370
+ __decorate([
371
+ query('crop-and-save-image-dialog')
372
+ ], TitaniumSmartAttachmentInput.prototype, "cropperDialog", void 0);
373
+ __decorate([
374
+ query('md-dialog[confirm-delete]')
375
+ ], TitaniumSmartAttachmentInput.prototype, "confirmDeleteDialog", void 0);
376
+ __decorate([
377
+ query('titanium-chip-multi-select')
378
+ ], TitaniumSmartAttachmentInput.prototype, "chipMultiSelect", void 0);
379
+ __decorate([
380
+ property({ type: String })
381
+ ], TitaniumSmartAttachmentInput.prototype, "accept", void 0);
382
+ __decorate([
383
+ property({ type: Boolean })
384
+ ], TitaniumSmartAttachmentInput.prototype, "multiple", void 0);
385
+ __decorate([
386
+ property({ type: Boolean })
387
+ ], TitaniumSmartAttachmentInput.prototype, "required", void 0);
388
+ __decorate([
389
+ property({ type: Boolean, reflect: true })
390
+ ], TitaniumSmartAttachmentInput.prototype, "disabled", void 0);
391
+ __decorate([
392
+ property({ type: Boolean })
393
+ ], TitaniumSmartAttachmentInput.prototype, "confirmDelete", void 0);
394
+ __decorate([
395
+ property({ type: String })
396
+ ], TitaniumSmartAttachmentInput.prototype, "confirmDeleteHeader", void 0);
397
+ __decorate([
398
+ property({ type: String })
399
+ ], TitaniumSmartAttachmentInput.prototype, "confirmDeleteText", void 0);
400
+ __decorate([
401
+ property({ type: String })
402
+ ], TitaniumSmartAttachmentInput.prototype, "addButtonLabel", void 0);
403
+ __decorate([
404
+ property({ type: String })
405
+ ], TitaniumSmartAttachmentInput.prototype, "label", void 0);
406
+ __decorate([
407
+ property({ type: String })
408
+ ], TitaniumSmartAttachmentInput.prototype, "supportingText", void 0);
409
+ __decorate([
410
+ property({ type: String })
411
+ ], TitaniumSmartAttachmentInput.prototype, "noItemsText", void 0);
412
+ __decorate([
413
+ property({ type: Object })
414
+ ], TitaniumSmartAttachmentInput.prototype, "options", void 0);
415
+ __decorate([
416
+ property({ type: Array })
417
+ ], TitaniumSmartAttachmentInput.prototype, "croppableImageFormats", void 0);
418
+ TitaniumSmartAttachmentInput = __decorate([
419
+ customElement('titanium-smart-attachment-input')
420
+ ], TitaniumSmartAttachmentInput);
421
+ export { TitaniumSmartAttachmentInput };
422
+ //# sourceMappingURL=smart-attachment-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smart-attachment-input.js","sourceRoot":"","sources":["smart-attachment-input.ts"],"names":[],"mappings":";AAAA,OAAO,wCAAwC,CAAC;AAChD,OAAO,8BAA8B,CAAC;AACtC,OAAO,wBAAwB,CAAC;AAEhC,OAAO,6BAA6B,CAAC;AACrC,OAAO,yBAAyB,CAAC;AACjC,OAAO,kCAAkC,CAAC;AAC1C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,gCAAgC,CAAC;AAExC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,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EAAgD;AAK/C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uEAAsF;AAKrF;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oEAA2C;AAK1C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAA+B;AAK9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oEAAwB;AAKvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iEAAwC;AAKvC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DAA8B;AAK9B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;2EAmBxB;AA/FS,4BAA4B;IADxC,aAAa,CAAC,iCAAiC,CAAC;GACpC,4BAA4B,CA2WxC"}
@@ -0,0 +1,7 @@
1
+ export type SmartAttachment = {
2
+ id?: number;
3
+ file: File;
4
+ previewSrc?: string;
5
+ downloadSrc?: string;
6
+ };
7
+ //# sourceMappingURL=smart-attachment.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=smart-attachment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smart-attachment.js","sourceRoot":"","sources":["smart-attachment.ts"],"names":[],"mappings":""}
@@ -0,0 +1,79 @@
1
+ import { HttpError } from '../../leavitt/api-service/HttpError';
2
+ import { LitElement, TemplateResult } from 'lit';
3
+ import '@material/web/button/text-button';
4
+ export declare class BasicSnackBar {
5
+ _isComponent: boolean;
6
+ open(message: string | TemplateResult, options?: SnackbarOptions): void;
7
+ close(): void;
8
+ }
9
+ export declare let TitaniumSnackbarSingleton: BasicSnackBar;
10
+ export type SnackbarOptions = {
11
+ actionText?: string | null;
12
+ autoHide?: boolean;
13
+ noAction?: boolean;
14
+ };
15
+ /**
16
+ * Material design snackbar.
17
+ *
18
+ * @element titanium-snackbar
19
+ *
20
+ * Only one snackbar is intended to be used per site.
21
+ * Use TitaniumSnackbarSingleton export to fetch the instance of the snackbar when you need to use it.
22
+ * ex.
23
+ * import { TitaniumSnackbarSingleton } from '@leavittsoftware/web/snackbar/snackbar';
24
+ * TitaniumSnackbarSingleton.open('Hello world');
25
+ *
26
+ * @cssprop {Color} [--titanium-snackbar-background-color=#323232] - Snackbar background color
27
+ * @cssprop {Color} [--titanium-snackbar-text-color=#f1f1f1] - Color of the text in the snackbar
28
+ * @cssprop {Color} [--app-light-text-color=#707175] - Color used on http error and status
29
+ *
30
+ */
31
+ export declare class TitaniumSnackbar extends LitElement implements BasicSnackBar {
32
+ #private;
33
+ /**
34
+ * True when opened
35
+ */
36
+ protected opened: boolean;
37
+ /**
38
+ * True when closing
39
+ */
40
+ protected closing: boolean;
41
+ /**
42
+ * True when opening
43
+ */
44
+ protected opening: boolean;
45
+ /**
46
+ * Hides the action button
47
+ */
48
+ protected noaction: boolean;
49
+ /**
50
+ * Text used on the button
51
+ */
52
+ protected actionText: string;
53
+ /**
54
+ * Message used in the snackbar.
55
+ */
56
+ protected message: string | TemplateResult;
57
+ /**
58
+ * @ignore
59
+ */
60
+ _isComponent: boolean;
61
+ constructor();
62
+ /**
63
+ * Opens the snackbar with the supplied message.
64
+ *
65
+ * optional options object:
66
+ * actionText?: string | null;
67
+ * autoHide?: boolean;
68
+ * noAction?: boolean;
69
+ *
70
+ */
71
+ open(message: string | TemplateResult | HttpError, options?: SnackbarOptions): Promise<unknown>;
72
+ /**
73
+ * Closes the snackbar
74
+ */
75
+ close(): void;
76
+ static styles: import("lit").CSSResult;
77
+ render(): TemplateResult<1>;
78
+ }
79
+ //# sourceMappingURL=snackbar.d.ts.map