@mapsindoors/map-template 1.12.0-rc.3 → 1.12.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 (73) hide show
  1. package/package.json +1 -1
  2. package/dist/combo-box-item.entry-04f0e546.mjs +0 -12
  3. package/dist/combo-box-item.entry-f1f36e49.mjs +0 -14
  4. package/dist/mi-card_2.entry-112d6cec.mjs +0 -25
  5. package/dist/mi-card_2.entry-138c7653.mjs +0 -23
  6. package/dist/mi-chip.entry-3a9b51dd.mjs +0 -16
  7. package/dist/mi-chip.entry-b0cb0da5.mjs +0 -18
  8. package/dist/mi-column.entry-e8b74502.mjs +0 -20
  9. package/dist/mi-column.entry-fe197b13.mjs +0 -18
  10. package/dist/mi-combo-box.entry-5776c4cc.mjs +0 -260
  11. package/dist/mi-combo-box.entry-b23feef3.mjs +0 -262
  12. package/dist/mi-data-table.entry-0d04f901.mjs +0 -215
  13. package/dist/mi-data-table.entry-ff82dd01.mjs +0 -213
  14. package/dist/mi-distance_2.entry-80019828.mjs +0 -56
  15. package/dist/mi-distance_2.entry-c18ff16b.mjs +0 -54
  16. package/dist/mi-dropdown-item.entry-63c41efc.mjs +0 -14
  17. package/dist/mi-dropdown-item.entry-bb3d99f0.mjs +0 -12
  18. package/dist/mi-dropdown.entry-870fa8de.mjs +0 -296
  19. package/dist/mi-dropdown.entry-adcf21a7.mjs +0 -298
  20. package/dist/mi-floor-selector.entry-6b91f5fc.mjs +0 -110
  21. package/dist/mi-floor-selector.entry-9a4296ba.mjs +0 -112
  22. package/dist/mi-keyboard.entry-668f536d.mjs +0 -2960
  23. package/dist/mi-keyboard.entry-b0c17b79.mjs +0 -2962
  24. package/dist/mi-list-item-category.entry-b2884dba.mjs +0 -38
  25. package/dist/mi-list-item-category.entry-b9536a7c.mjs +0 -36
  26. package/dist/mi-list-item-location.entry-ab46e53a.mjs +0 -134
  27. package/dist/mi-list-item-location.entry-d34a5690.mjs +0 -136
  28. package/dist/mi-list.entry-40b86f7f.mjs +0 -39
  29. package/dist/mi-list.entry-f9fdb0da.mjs +0 -41
  30. package/dist/mi-location-booking.entry-0f7f2812.mjs +0 -4863
  31. package/dist/mi-location-booking.entry-32cb574a.mjs +0 -4865
  32. package/dist/mi-location-info.entry-5cc2e91c.mjs +0 -31
  33. package/dist/mi-location-info.entry-c0cc0b69.mjs +0 -29
  34. package/dist/mi-map-googlemaps.entry-46829aaa.mjs +0 -398
  35. package/dist/mi-map-googlemaps.entry-e559c0dc.mjs +0 -396
  36. package/dist/mi-map-mapbox.entry-2c18333b.mjs +0 -300
  37. package/dist/mi-map-mapbox.entry-68c783cf.mjs +0 -298
  38. package/dist/mi-metric-card.entry-2f6981e7.mjs +0 -26
  39. package/dist/mi-metric-card.entry-7e16c8f8.mjs +0 -28
  40. package/dist/mi-my-position.entry-23e243aa.mjs +0 -1395
  41. package/dist/mi-my-position.entry-5a94c83d.mjs +0 -1393
  42. package/dist/mi-notification.entry-401c9cb9.mjs +0 -81
  43. package/dist/mi-notification.entry-4d06c318.mjs +0 -83
  44. package/dist/mi-route-instructions-heading.entry-8f5eaa1d.mjs +0 -74
  45. package/dist/mi-route-instructions-heading.entry-f3b4f871.mjs +0 -72
  46. package/dist/mi-route-instructions-maneuver-legacy.entry-66dad3ef.mjs +0 -75
  47. package/dist/mi-route-instructions-maneuver-legacy.entry-8ffeb735.mjs +0 -73
  48. package/dist/mi-route-instructions-maneuver.entry-24bcf67d.mjs +0 -75
  49. package/dist/mi-route-instructions-maneuver.entry-703bbcd9.mjs +0 -73
  50. package/dist/mi-route-instructions-step-legacy.entry-27a5fe00.mjs +0 -199
  51. package/dist/mi-route-instructions-step-legacy.entry-cf34cec4.mjs +0 -201
  52. package/dist/mi-route-instructions-step.entry-c3beb0c0.mjs +0 -234
  53. package/dist/mi-route-instructions-step.entry-e8a13502.mjs +0 -236
  54. package/dist/mi-route-instructions.entry-d9cabf3f.mjs +0 -142
  55. package/dist/mi-route-instructions.entry-fd85a9a4.mjs +0 -140
  56. package/dist/mi-scroll-buttons.entry-7666d055.mjs +0 -48
  57. package/dist/mi-scroll-buttons.entry-c069579b.mjs +0 -46
  58. package/dist/mi-search.entry-5e428c8e.mjs +0 -209
  59. package/dist/mi-search.entry-7ad753cf.mjs +0 -207
  60. package/dist/mi-share-sms.entry-25262279.mjs +0 -53
  61. package/dist/mi-share-sms.entry-33766d61.mjs +0 -55
  62. package/dist/mi-step-switcher.entry-81d295f8.mjs +0 -24
  63. package/dist/mi-step-switcher.entry-95ade6f3.mjs +0 -26
  64. package/dist/mi-tab-panel.entry-8c9b016e.mjs +0 -19
  65. package/dist/mi-tab-panel.entry-d77c094f.mjs +0 -21
  66. package/dist/mi-tab.entry-458faa22.mjs +0 -11
  67. package/dist/mi-tab.entry-d45194c0.mjs +0 -13
  68. package/dist/mi-tabs.entry-94ef09f5.mjs +0 -34
  69. package/dist/mi-tabs.entry-a78c550d.mjs +0 -36
  70. package/dist/mi-time.entry-c35e476f.mjs +0 -43
  71. package/dist/mi-time.entry-cae11551.mjs +0 -45
  72. package/dist/reactcomponent-0e140537.mjs +0 -31717
  73. package/dist/webcomponent-592597b2.mjs +0 -36391
@@ -1,213 +0,0 @@
1
- import { r as s, c as h, h as o, H as c, g } from "./webcomponent-592597b2.mjs";
2
- import { i as l, a as b } from "./utils-ae714467-b07fc3be.mjs";
3
- const p = `a.mi-button{cursor:default}.mi-button{border-radius:4px;border-width:1px;border-style:solid;font-family:Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";font-size:1rem;font-weight:500;padding-left:16px;padding-right:16px;padding-top:12px;padding-bottom:12px;display:inline-flex;align-items:center}.mi-button:disabled{opacity:0.48;cursor:not-allowed}.mi-button object{filter:invert(9%) sepia(13%) saturate(692%) hue-rotate(185deg) brightness(98%) contrast(91%);width:16px;height:16px}.mi-button--small{padding-left:12px;padding-right:12px;padding-top:8px;padding-bottom:8px;font-size:0.875rem;height:32px}.mi-button--small object{width:16px;height:16px}.mi-button--large{padding-left:16px;padding-right:16px;font-size:1.25rem}.mi-button--large object{width:20px;height:20px}.mi-button--full-width{width:100%;justify-content:center}.mi-button--icon-left{padding-left:12px}.mi-button--icon-left object{margin-right:8px}.mi-button--icon-right{padding-right:12px}.mi-button--icon-right object{margin-left:8px}.mi-button--icon-both{padding-top:12px;padding-bottom:12px}.mi-button--icon-both object:first-of-type{margin-right:8px}.mi-button--icon-both object:last-of-type{margin-left:8px}.mi-button--base{background:linear-gradient(#f5f7fa, #ebeff5);color:#1e2025;border-color:#c8d0e0}.mi-button--base:not(:disabled):hover{background:linear-gradient(#ebeff5, #dee3ed);border-color:#aeb9cb}.mi-button--base:not(:disabled):active{background:linear-gradient(#dee3ed, #ebeff5)}.mi-button--primary{color:#ffffff;border-color:#20693e;background:linear-gradient(#3ba064, #2a844e)}.mi-button--primary object{filter:invert(100%) sepia(93%) saturate(0%) hue-rotate(201deg) brightness(106%) contrast(106%)}.mi-button--primary:not(:disabled):hover{background:linear-gradient(#2a844e, #20693e)}.mi-button--primary:not(:disabled):active{background:linear-gradient(#20693e, #2a844e)}.mi-button--delete{background:linear-gradient(#f55151, #de1b1b);color:#ffffff;border-color:#ba0d0d}.mi-button--delete object{filter:invert(100%) sepia(93%) saturate(0%) hue-rotate(201deg) brightness(106%) contrast(106%)}.mi-button--delete:not(:disabled):hover{background:linear-gradient(#de1b1b, #ba0d0d)}.mi-button--delete:not(:disabled):active{background:linear-gradient(#ba0d0d, #de1b1b)}.mi-button--outline{color:#3071d9;border-color:#3071d9;background-color:transparent}.mi-button--outline object{filter:invert(38%) sepia(97%) saturate(742%) hue-rotate(188deg) brightness(86%) contrast(97%)}.mi-button--outline:not(:disabled):hover{color:#1d5bbf;border-color:#1d5bbf;background-color:#eef4fc}.mi-button--outline:not(:disabled):active{color:#1d5bbf;border-color:#1d5bbf;background-color:#cfe0fc}.mi-button--link{color:#3071d9;border-style:none;background-color:transparent;cursor:pointer}.mi-button--link object{filter:invert(38%) sepia(97%) saturate(742%) hue-rotate(188deg) brightness(86%) contrast(97%)}.mi-button--link:not(:disabled):hover{color:#1d5bbf;border-color:#1d5bbf;background-color:#eef4fc}.mi-button--link:disabled:hover{cursor:not-allowed}.mi-button--link:not(:disabled):active{color:#1d5bbf;border-color:#1d5bbf;background-color:#cfe0fc}.mi-input[type=text],.mi-input[type=search],.mi-input[type=number],.mi-input[type=password],.mi-input[type=tel]{font-size:1rem;padding:8px;border-style:solid;border-width:1px;border-color:#8d98aa;border-radius:4px}.mi-input[type=text],.mi-input[type=search],.mi-input[type=number],.mi-input[type=password],.mi-input[type=range],.mi-input[type=tel]{display:block}.mi-input[type=radio],.mi-input[type=checkbox]{margin:0px;transform:scale(1.2, 1.2)}.mi-input[type=search]{padding-left:32px;background:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 24 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.6267 8.43836C14.6267 11.8561 11.8561 14.6267 8.43836 14.6267C5.02062 14.6267 2.25 11.8561 2.25 8.43836C2.25 5.02062 5.02062 2.25 8.43836 2.25C11.8561 2.25 14.6267 5.02062 14.6267 8.43836Z' stroke='%23aeb9cb' stroke-width='2.5'/%3E%3Crect x='15.0979' y='14.1614' width='7.34678' height='1.32449' rx='0.662244' transform='rotate(45 15.0979 14.1614)' fill='%23aeb9cb' stroke='%23aeb9cb'/%3E%3Crect x='13.7847' y='13.2916' width='1.05276' height='0.697347' transform='rotate(45 13.7847 13.2916)' stroke='%23aeb9cb' stroke-width='0.697346'/%3E%3C/svg%3E%0A") no-repeat scroll 8px center, white}.mi-input:disabled{opacity:0.48;cursor:not-allowed}.mi-select{display:block;padding-top:8px;padding-bottom:8px;padding-left:8px;padding-right:32px;border-radius:4px;border-width:1px;border-style:solid;border-color:#c8d0e0;color:#1e2025;font-size:1rem;font-weight:500;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:url("data:image/svg+xml;base64,PHN2ZyBmaWxsPScjNDQ0QjU1JyBoZWlnaHQ9JzI0JyB2aWV3Qm94PScwIDAgMjQgMjQnIHdpZHRoPScyNCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJz4KPHBhdGggZD0nTTcgMTBsNSA1IDUtNXonLz4KPHBhdGggZD0nTTAgMGgyNHYyNEgweicgZmlsbD0nbm9uZScvPgo8L3N2Zz4=") 96%/24px no-repeat, linear-gradient(#f5f7fa, #ebeff5)}.mi-select:disabled{opacity:0.48;cursor:not-allowed}.mi-select:not(:disabled):hover{background:url("data:image/svg+xml;base64,PHN2ZyBmaWxsPScjNDQ0QjU1JyBoZWlnaHQ9JzI0JyB2aWV3Qm94PScwIDAgMjQgMjQnIHdpZHRoPScyNCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJz4KPHBhdGggZD0nTTcgMTBsNSA1IDUtNXonLz4KPHBhdGggZD0nTTAgMGgyNHYyNEgweicgZmlsbD0nbm9uZScvPgo8L3N2Zz4=") 96%/24px no-repeat, linear-gradient(#ebeff5, #dee3ed);border-color:#aeb9cb}.mi-select:not(:disabled):active{background:url("data:image/svg+xml;base64,PHN2ZyBmaWxsPScjNDQ0QjU1JyBoZWlnaHQ9JzI0JyB2aWV3Qm94PScwIDAgMjQgMjQnIHdpZHRoPScyNCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJz4KPHBhdGggZD0nTTcgMTBsNSA1IDUtNXonLz4KPHBhdGggZD0nTTAgMGgyNHYyNEgweicgZmlsbD0nbm9uZScvPgo8L3N2Zz4=") 96%/24px no-repeat, linear-gradient(#dee3ed, #ebeff5)}.mi-toggle{margin:0}.mi-toggle:disabled{cursor:not-allowed}.mi-toggle+.mi-label{margin-left:8px}@supports (appearance: none) or (-moz-appearance: none) or (-webkit-appearance: none){.mi-toggle{padding:2px;box-sizing:border-box;appearance:none;-moz-appearance:none;-webkit-appearance:none;width:48px;height:24px;border-radius:9999px;background-color:#8d98aa;transition:background-color 300ms ease}.mi-toggle:disabled{opacity:0.48}.mi-toggle:checked{background-color:#2a844e}.mi-toggle::after{content:"";display:inline-block;width:20px;height:20px;transform:translateX(0px);border-radius:50%;background-color:#fcfcfc;box-shadow:0 1px 1px rgba(0, 0, 0, 0.125), 0 2px 2px rgba(0, 0, 0, 0.125);transition:300ms ease}.mi-toggle:checked::after{transform:translateX(24px)}}.width-none{width:0}.width-xxx-small{width:2px}.width-xx-small{width:4px}.width-x-small{width:8px}.width-small{width:12px}.width-medium{width:16px}.width-large{width:24px}.width-x-large{width:32px}.width-xx-large{width:40px}.width-xxx-large{width:48px}.width-xxxx-large{width:64px}.min-width-none{min-width:0}.min-width-xxx-small{min-width:2px}.min-width-xx-small{min-width:4px}.min-width-x-small{min-width:8px}.min-width-small{min-width:12px}.min-width-medium{min-width:16px}.min-width-large{min-width:24px}.min-width-x-large{min-width:32px}.min-width-xx-large{min-width:40px}.min-width-xxx-large{min-width:48px}.min-width-xxxx-large{min-width:64px}.max-width-none{max-width:0}.max-width-xxx-small{max-width:2px}.max-width-xx-small{max-width:4px}.max-width-x-small{max-width:8px}.max-width-small{max-width:12px}.max-width-medium{max-width:16px}.max-width-large{max-width:24px}.max-width-x-large{max-width:32px}.max-width-xx-large{max-width:40px}.max-width-xxx-large{max-width:48px}.max-width-xxxx-large{max-width:64px}.height-none{height:0}.height-xxx-small{height:2px}.height-xx-small{height:4px}.height-x-small{height:8px}.height-small{height:12px}.height-medium{height:16px}.height-large{height:24px}.height-x-large{height:32px}.height-xx-large{height:40px}.height-xxx-large{height:48px}.height-xxxx-large{height:64px}.min-height-none{min-height:0}.min-height-xxx-small{min-height:2px}.min-height-xx-small{min-height:4px}.min-height-x-small{min-height:8px}.min-height-small{min-height:12px}.min-height-medium{min-height:16px}.min-height-large{min-height:24px}.min-height-x-large{min-height:32px}.min-height-xx-large{min-height:40px}.min-height-xxx-large{min-height:48px}.min-height-xxxx-large{min-height:64px}.max-height-none{max-height:0}.max-height-xxx-small{max-height:2px}.max-height-xx-small{max-height:4px}.max-height-x-small{max-height:8px}.max-height-small{max-height:12px}.max-height-medium{max-height:16px}.max-height-large{max-height:24px}.max-height-x-large{max-height:32px}.max-height-xx-large{max-height:40px}.max-height-xxx-large{max-height:48px}.max-height-xxxx-large{max-height:64px}.debug *{outline:1px solid gold}.flex{display:flex;flex:1}.inline-flex{display:inline-flex}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.display-block{display:block}.display-inline-block{display:inline-block}.display-inline{display:inline}.display-none{display:none}.text-decoration-none{text-decoration:none}.text-right{text-align:right}.text-left{text-align:left}.text-center{text-align:center}.margin-auto{margin-left:auto;margin-right:auto}*{box-sizing:border-box}.table{width:100%;border-collapse:collapse;font-family:Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";background-color:#ffffff;border-style:solid;border-width:1px;border-color:#d1d5db;border-top:none}.table__header-cell{position:relative;text-align:left;-webkit-user-select:none;-moz-user-select:none;user-select:none;min-width:48px;font-weight:500;font-size:1rem;line-height:1.25rem;color:#ffffff;background-color:#374151;padding-top:16px;padding-bottom:16px;padding-left:8px;padding-right:8px}.table__header-cell::before,.table__header-cell::after{content:"";display:block;position:absolute;right:16px;top:50%;border:7px solid transparent}.table__header-cell::before{border-bottom-color:#6b7280;margin-top:-15px}.table__header-cell::after{border-top-color:#6b7280;margin-top:3px}.table__header-cell.desc::after{border-top-color:#f9fafb}.table__header-cell.asc::before{border-bottom-color:#f9fafb}.table__header-cell--no-sort::before,.table__header-cell--no-sort::after{border:none}.table__header-cell:not(.table__header-cell--no-sort){padding-right:46px;cursor:pointer}.table__header-cell--fit-content{white-space:nowrap;width:1px}.table__header-cell--align-left{text-align:left}.table__header-cell--align-center{text-align:center}.table__header-cell--align-right{text-align:right}.table__header-cell--sticky{position:sticky;top:0;z-index:1}.table__row:nth-child(even):hover{background-color:#f3f4f6}.table__row:nth-child(odd){background-color:#f9fafb}.table__row:nth-child(odd):hover{background-color:#f3f4f6}.table__data{font-size:1rem;padding-left:8px;padding-right:8px;height:56px;border-right:1px solid #d1d5db}.table__data:last-child{border-right:none}.table__data--fit-content{white-space:nowrap;width:1px}.table__data--align-left{text-align:left}.table__data--align-center{text-align:center}.table__data--align-right{text-align:right}.table__data--monospace-font{font-family:Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace}.empty-page{display:flex;align-items:center;flex-direction:column;margin-top:72px;height:345px}.empty-page>*{margin:0}.empty-page__header{font-size:2.25rem}.empty-page__subheader{margin-top:32px;font-size:1.5rem}`, m = class {
4
- constructor(e) {
5
- s(this, e), this.selectionChanged = h(this, "selectionChanged", 7), this.columns = [], this.numberOfSelectedRows = void 0, this.rows = [], this.maxRows = void 0, this.selectable = !1, this.selected = /* @__PURE__ */ new Set(), this.emptyPageHeader = "No results found", this.emptyPageSubheader = void 0, this.isHeaderSticky = !0, this.tableRows = [], this.sortByColumn = null;
6
- }
7
- onSelectionChangedHandler() {
8
- this.selectionChanged.emit(this.selected);
9
- }
10
- /**
11
- * When the rows is set from outside of the components the table sorting is reset and the rows are assigned to the internal tabelRows property.
12
- */
13
- onRowsChangedHandler() {
14
- this.tableRows = Array.from(this.rows), this.setHeaderCheckboxState();
15
- }
16
- connectedCallback() {
17
- const e = this.el.querySelectorAll("mi-column");
18
- this.columns = Array.from(e).map((t) => {
19
- const i = {
20
- alignContent: t.alignContent,
21
- monospace: t.monospace,
22
- label: l(t.label) ? t.binding : t.label,
23
- binding: t.binding || null,
24
- sortable: t.sortable,
25
- fitContent: !!t.fitContent,
26
- /* All HTML comments are removed from the template to avoid the issues with the table not displaying any data in IE11 */
27
- template: t.innerHTML.replace(/<!--[\s\S]*?-->/g, ""),
28
- columnElement: t,
29
- width: t.width
30
- };
31
- return t.sort && !this.sortByColumn && (this.sortByColumn = { column: i, sortOrder: t.sort === "asc" ? "asc" : "desc" }), i;
32
- });
33
- }
34
- /**
35
- * Column header click handler.
36
- * If the column is sortable the sort order is reversed.
37
- *
38
- * @private
39
- * @param {MouseEvent} event
40
- * @param {any} column
41
- */
42
- columnHeaderClickHandler(e, t) {
43
- var i, a;
44
- if (!l(t.sortable)) {
45
- let n = "asc";
46
- t === ((i = this.sortByColumn) === null || i === void 0 ? void 0 : i.column) && (n = ((a = this.sortByColumn) === null || a === void 0 ? void 0 : a.sortOrder) === "asc" ? "desc" : "asc"), this.sortByColumn = { column: t, sortOrder: n };
47
- }
48
- }
49
- /**
50
- * Sorts table rows.
51
- *
52
- * @private
53
- * @return {Array<any>}
54
- */
55
- sortTableRows() {
56
- var e, t, i;
57
- if (this.tableRows.length > 0 && this.sortByColumn) {
58
- let a;
59
- const n = (e = this.sortByColumn) === null || e === void 0 ? void 0 : e.column, r = (t = this.sortByColumn) === null || t === void 0 ? void 0 : t.sortOrder;
60
- if (n && r)
61
- return ((i = n.sortable) === null || i === void 0 ? void 0 : i.toLowerCase()) === "date" ? a = r === "desc" ? w(n.binding) : f(n.binding) : a = r === "desc" ? u(n.binding) : x(n.binding), [...this.tableRows.sort(a)];
62
- }
63
- return this.tableRows;
64
- }
65
- /**
66
- * Replace template variables (eg. "{id}") with the corresponding value from the data.
67
- *
68
- * @private
69
- * @param {string} template
70
- * @param {object} data
71
- * @returns {string}
72
- */
73
- replaceVars(e, t) {
74
- return e.replace(/\{(.*?)\}/g, (i, a) => a.split(".").reduce((r, d) => r ? r[d] : null, t));
75
- }
76
- /**
77
- * Remove boolean HTML attributes (eg. checked) that will have a false value based on data. This is necessary since
78
- * the very presence of the attribute will give it a truthy value.
79
- *
80
- * @private
81
- * @param {string} template
82
- * @param {array} data
83
- * @returns {string}
84
- */
85
- removeFalseBooleanAttributes(e, t) {
86
- return e.replace(/ (checked|disabled|hidden|selected)="\{(.*?)\}"/, (i, a, n) => t[n] === !1 ? "" : a);
87
- }
88
- /**
89
- * React to clicks on table rows and emits the internal cellContentClicked event to
90
- * the column component if clicked on content within a cell.
91
- *
92
- * @private
93
- * @param {MouseEvent} event
94
- * @param {any} tableRow
95
- */
96
- tableRowClicked(e, t) {
97
- var i;
98
- const a = e.target, n = a.closest("td").cellIndex, r = this.selectable ? n - 1 : n;
99
- if (a.tagName.toLowerCase() !== "td" && this.columns[r]) {
100
- const d = { detail: t };
101
- (i = this.columns[r]) === null || i === void 0 || i.columnElement.dispatchEvent(new CustomEvent("cellContentClicked", d));
102
- }
103
- }
104
- async componentWillLoad() {
105
- this.rows.length > 0 && (this.tableRows = Array.from(this.rows));
106
- }
107
- render() {
108
- return o(c, null, o("table", { class: "table" }, o("thead", null, o("tr", null, this.renderSelectHeader(), this.columns.map((e) => {
109
- var t;
110
- const i = e.fitContent ? "" : e.width || "auto", a = ((t = this.sortByColumn) === null || t === void 0 ? void 0 : t.column) === e ? this.sortByColumn.sortOrder : null;
111
- return o("th", { "data-binding": e.binding, style: { width: i, "max-width": i, "min-width": i }, onClick: (n) => this.columnHeaderClickHandler(n, e), class: `table__header-cell ${this.isHeaderSticky ? "table__header-cell--sticky" : ""} ${l(e.sortable) ? "table__header-cell--no-sort" : ""} ${l(a) ? "" : a} ${e.fitContent ? "table__header-cell--fit-content" : ""}` }, e.label);
112
- }))), o("tbody", null, this.renderTableContent())), this.tableRows.length === 0 ? this.renderEmptyPage() : null);
113
- }
114
- /**
115
- * If the table is selectable then renderSelectHeader will render the th element with the checkbox to check or uncheck all items in the table.
116
- *
117
- * @private
118
- * @returns {JSX.Element}
119
- */
120
- renderSelectHeader() {
121
- if (this.selectable)
122
- return o("th", { class: `table__header-cell ${this.isHeaderSticky ? "table__header-cell--sticky" : ""} table__header-cell--fit-content table__header-cell--no-sort table__header-cell--align-center` }, o("input", { type: "checkbox", class: "mi-input", ref: (e) => this.selectAllCheckbox = e, onChange: () => this.selectHeaderOnChangeHandler() }));
123
- }
124
- /**
125
- * If the table is selectable then this method will render the td for each row in the item to select or unselect the row.
126
- *
127
- * @private
128
- * @param {object} row
129
- */
130
- renderSelectRow(e) {
131
- if (this.selectable)
132
- return o("td", { class: "table__data table__data--align-center" }, o("input", { class: "mi-input", type: "checkbox", checked: this.selected.has(e), onChange: (t) => this.selectOnChangeHandler(t, e) }));
133
- }
134
- /**
135
- * Helper method to render the tables content.
136
- *
137
- * @private
138
- * @return {[JSX.Element]}
139
- */
140
- renderTableContent() {
141
- let e = this.sortTableRows();
142
- return e = b(this.maxRows) && this.maxRows > 0 ? e.slice(0, this.maxRows) : e, e.map((t) => this.renderTableRow(t));
143
- }
144
- /**
145
- * Helper method to render a table row.
146
- *
147
- * @private
148
- * @param {*} tableRow
149
- * @return {JSX.Element}
150
- */
151
- renderTableRow(e) {
152
- const t = [];
153
- for (const i of this.columns) {
154
- let a = i.template;
155
- a > "" ? (a = this.removeFalseBooleanAttributes(a, e), a = this.replaceVars(a, e), t.push(a)) : t.push(e[i.binding]);
156
- }
157
- return o("tr", { class: "table__row", onClick: (i) => this.tableRowClicked(i, e) }, this.renderSelectRow(e), t.map((i, a) => o("td", { class: `table__data ${this.columns[a].fitContent ? "table__data--fit-content" : ""} table__data--align-${this.columns[a].alignContent || "left"} ${this.columns[a].monospace ? "table__data--monospace-font" : ""}`, innerHTML: i })));
158
- }
159
- /**
160
- * Renders en empty page with error message when no table rows are available.
161
- *
162
- * @private
163
- * @returns {JSX.Element}
164
- */
165
- renderEmptyPage() {
166
- return o("div", { class: "empty-page" }, o("p", { class: "empty-page__header" }, this.emptyPageHeader), o("p", { class: "empty-page__subheader" }, this.emptyPageSubheader));
167
- }
168
- /**
169
- * The event handler for the onchange event for the checkboxes in the selectable column.
170
- *
171
- * @private
172
- * @param {EventData} event
173
- * @param {object} row
174
- */
175
- selectOnChangeHandler(e, t) {
176
- e.target.checked ? this.selected.add(t) : this.selected.delete(t), this.setHeaderCheckboxState(), this.numberOfSelectedRows = this.selected.size, e.stopPropagation();
177
- }
178
- /**
179
- * Set the state of the checkbox in the table header.
180
- * The state can be either checked, unchecked or indeterminate.
181
- */
182
- setHeaderCheckboxState() {
183
- this.selectAllCheckbox && this.selectable && (this.selectAllCheckbox.checked = this.selected.size === this.rows.length, this.selectAllCheckbox.indeterminate = this.selected.size > 0 && this.selected.size < this.rows.length);
184
- }
185
- /**
186
- * The event handler for the onchange event for the checkbox in the selectable column header.
187
- *
188
- * @private
189
- * @param {EventData} event
190
- */
191
- selectHeaderOnChangeHandler() {
192
- this.selected.size > 0 && this.selected.size <= this.rows.length ? (this.selected.clear(), this.selectAllCheckbox.checked = !1) : (this.rows.forEach((e) => this.selected.add(e)), this.selectAllCheckbox.checked = !0), this.numberOfSelectedRows = this.selected.size;
193
- }
194
- get el() {
195
- return g(this);
196
- }
197
- static get watchers() {
198
- return {
199
- numberOfSelectedRows: ["onSelectionChangedHandler"],
200
- rows: ["onRowsChangedHandler"]
201
- };
202
- }
203
- }, x = (e) => (t, i) => `${t[e] || ""}`.localeCompare(`${i[e] || ""}`.trimStart().toLowerCase(), void 0, { numeric: !0 }), u = (e) => (t, i) => `${i[e] || ""}`.localeCompare(`${t[e] || ""}`.trimStart().toLowerCase(), void 0, { numeric: !0 }), f = (e) => (t, i) => {
204
- const a = Date.parse(t[e]), n = Date.parse(i[e]);
205
- return a > n ? 1 : a < n ? -1 : 0;
206
- }, w = (e) => (t, i) => {
207
- const a = Date.parse(i[e]), n = Date.parse(t[e]);
208
- return a > n ? 1 : a < n ? -1 : 0;
209
- };
210
- m.style = p;
211
- export {
212
- m as mi_data_table
213
- };