@mapsindoors/map-template 1.95.0 → 1.95.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{GoogleMapsMap-BIUan6Mh.mjs → GoogleMapsMap-Dkn60-_e.mjs} +2 -2
- package/dist/{MapboxMap-BwTFmd5b.mjs → MapboxMap-B1oo7IUm.mjs} +3 -3
- package/dist/_commonjsHelpers-B85MJLTf.js +5 -0
- package/dist/app-globals-DQuL1Twl.js +3 -0
- package/dist/combo-box-item.entry.js +8 -10
- package/dist/icon-DT_sDkmK.js +11 -0
- package/dist/index-BZQHyS7V.js +1701 -0
- package/dist/loader.js +7 -14
- package/dist/mapsindoors-react.es.js +1 -1
- package/dist/mapsindoors-react.umd.js +175 -175
- package/dist/mapsindoors-webcomponent.es.js +2919 -2907
- package/dist/mi-card_2.entry.js +23 -18
- package/dist/mi-chip.entry.js +25 -16
- package/dist/mi-column.entry.js +47 -23
- package/dist/mi-combo-box.entry.js +412 -379
- package/dist/mi-components.js +15 -12
- package/dist/mi-data-table.entry.js +298 -278
- package/dist/mi-distance_2.entry.js +58 -56
- package/dist/mi-dropdown-item.entry.js +8 -10
- package/dist/mi-dropdown.entry.js +525 -481
- package/dist/mi-floor-selector.entry.js +183 -180
- package/dist/mi-keyboard.entry.js +207 -186
- package/dist/mi-list-item-category.entry.js +44 -41
- package/dist/mi-list-item-location.entry.js +168 -162
- package/dist/mi-list.entry.js +56 -48
- package/dist/mi-location-booking.entry.js +320 -295
- package/dist/mi-location-info.entry.js +61 -53
- package/dist/mi-map-googlemaps.entry.js +369 -324
- package/dist/mi-map-mapbox.entry.js +502 -439
- package/dist/mi-metric-card.entry.js +50 -37
- package/dist/mi-my-position.entry.js +2341 -874
- package/dist/mi-notification.entry.js +112 -102
- package/dist/mi-route-instructions-heading.entry.js +70 -65
- package/dist/mi-route-instructions-maneuver-legacy.entry.js +80 -76
- package/dist/mi-route-instructions-maneuver.entry.js +80 -76
- package/dist/mi-route-instructions-step-legacy.entry.js +296 -282
- package/dist/mi-route-instructions-step.entry.js +313 -292
- package/dist/mi-route-instructions.entry.js +167 -150
- package/dist/mi-scroll-buttons.entry.js +104 -98
- package/dist/mi-search.entry.js +366 -325
- package/dist/mi-share-sms.entry.js +82 -70
- package/dist/mi-step-switcher.entry.js +34 -25
- package/dist/mi-tab-panel.entry.js +18 -18
- package/dist/mi-tab.entry.js +5 -7
- package/dist/mi-tabs.entry.js +42 -40
- package/dist/mi-time.entry.js +49 -49
- package/dist/mi-variables-CDNvnTkH.js +5 -0
- package/dist/{reactcomponent-D3K1zzGs.mjs → reactcomponent-2Oa1vSiK.mjs} +8996 -8660
- package/dist/route-travel-mode.enum-BvqP1fpw.js +9 -0
- package/dist/sort-order.enum-jsLAbYWg.js +566 -0
- package/dist/{unit-system.enum-eaefb53e.js → unit-system.enum-BwPgAWqL.js} +2 -2
- package/dist/utils-DNHzysQ6.js +61 -0
- package/package.json +1 -1
- package/dist/_commonjsHelpers-ba3f0406.js +0 -21
- package/dist/icon-b8d01d6f.js +0 -24
- package/dist/index-7e9696f3.js +0 -1678
- package/dist/mi-variables-9a6c8d4d.js +0 -6
- package/dist/polyfills/core-js.js +0 -11
- package/dist/polyfills/css-shim.js +0 -1
- package/dist/polyfills/dom.js +0 -79
- package/dist/polyfills/es5-html-element.js +0 -1
- package/dist/polyfills/index.js +0 -34
- package/dist/polyfills/system.js +0 -6
- package/dist/route-travel-mode.enum-7f4ce9c7.js +0 -9
- package/dist/sort-order.enum-64ce8998.js +0 -552
- package/dist/utils-ae714467.js +0 -61
|
@@ -1,302 +1,322 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-
|
|
2
|
-
import { i as isNullOrUndefined, a as isNumber } from './utils-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-BZQHyS7V.js';
|
|
2
|
+
import { i as isNullOrUndefined, a as isNumber } from './utils-DNHzysQ6.js';
|
|
3
3
|
|
|
4
|
-
const dataTableCss = "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}";
|
|
4
|
+
const dataTableCss = () => `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}`;
|
|
5
5
|
|
|
6
6
|
const DataTable = class {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
onPageChangedHandler() {
|
|
38
|
-
this.currentPage = this.page;
|
|
39
|
-
this.renderTableContent();
|
|
40
|
-
}
|
|
41
|
-
connectedCallback() {
|
|
42
|
-
const miColumns = this.el.querySelectorAll('mi-column');
|
|
43
|
-
this.columns = Array.from(miColumns).map((miColumn) => {
|
|
44
|
-
const column = {
|
|
45
|
-
alignContent: miColumn.alignContent,
|
|
46
|
-
monospace: miColumn.monospace,
|
|
47
|
-
label: !isNullOrUndefined(miColumn.label) ? miColumn.label : miColumn.binding,
|
|
48
|
-
binding: miColumn.binding || null,
|
|
49
|
-
sortable: miColumn.sortable,
|
|
50
|
-
fitContent: !!miColumn.fitContent,
|
|
51
|
-
/* All HTML comments are removed from the template to avoid the issues with the table not displaying any data in IE11 */
|
|
52
|
-
template: miColumn.innerHTML.replace(/<!--[\s\S]*?-->/g, ''),
|
|
53
|
-
columnElement: miColumn,
|
|
54
|
-
width: miColumn.width
|
|
55
|
-
};
|
|
56
|
-
/* If the mi-column has the sort attribute, then the initial sort state is set. */
|
|
57
|
-
if (miColumn.sort && !this.sortByColumn) {
|
|
58
|
-
this.sortByColumn = { column: column, sortOrder: miColumn.sort === 'asc' ? 'asc' : 'desc' };
|
|
59
|
-
}
|
|
60
|
-
return column;
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Column header click handler.
|
|
65
|
-
* If the column is sortable the sort order is reversed.
|
|
66
|
-
*
|
|
67
|
-
* @private
|
|
68
|
-
* @param {MouseEvent} event
|
|
69
|
-
* @param {any} column
|
|
70
|
-
*/
|
|
71
|
-
columnHeaderClickHandler(event, column) {
|
|
72
|
-
var _a, _b;
|
|
73
|
-
if (!isNullOrUndefined(column.sortable)) {
|
|
74
|
-
let sortOrder = 'asc';
|
|
75
|
-
if (column === ((_a = this.sortByColumn) === null || _a === void 0 ? void 0 : _a.column)) {
|
|
76
|
-
// TODO: Use SortOrder enum in MICMS-1353
|
|
77
|
-
sortOrder = ((_b = this.sortByColumn) === null || _b === void 0 ? void 0 : _b.sortOrder) === 'asc' ? 'desc' : 'asc';
|
|
78
|
-
}
|
|
79
|
-
/* When a column that is sortable is clicked then the sort state is updated. */
|
|
80
|
-
this.sortByColumn = { column: column, sortOrder: sortOrder };
|
|
7
|
+
constructor(hostRef) {
|
|
8
|
+
registerInstance(this, hostRef);
|
|
9
|
+
this.selectionChanged = createEvent(this, "selectionChanged", 7);
|
|
10
|
+
/**
|
|
11
|
+
* Array of objects for each row in the table.
|
|
12
|
+
*/
|
|
13
|
+
this.rows = [];
|
|
14
|
+
/**
|
|
15
|
+
* The selectable attribute specifies whether the first column in the table should be checkboxes. The header will be a select all or none checkbox.
|
|
16
|
+
*/
|
|
17
|
+
this.selectable = false;
|
|
18
|
+
/**
|
|
19
|
+
* The selected property contains a Set of all selected rows. This property is only relevant if the selectable attribute is present.
|
|
20
|
+
*/
|
|
21
|
+
this.selected = new Set();
|
|
22
|
+
/**
|
|
23
|
+
* Guiding message when presented with a table that has no rows.
|
|
24
|
+
*/
|
|
25
|
+
this.emptyPageHeader = 'No results found';
|
|
26
|
+
/**
|
|
27
|
+
* Whether or not the table header should be sticky.
|
|
28
|
+
*/
|
|
29
|
+
this.isHeaderSticky = true;
|
|
30
|
+
this.tableRows = [];
|
|
31
|
+
this.currentPage = 1;
|
|
32
|
+
/**
|
|
33
|
+
* State to keep track of the table sorting.
|
|
34
|
+
*/
|
|
35
|
+
this.sortByColumn = null;
|
|
36
|
+
this.columns = [];
|
|
81
37
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
38
|
+
onSelectionChangedHandler() {
|
|
39
|
+
this.selectionChanged.emit(this.selected);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 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.
|
|
43
|
+
*/
|
|
44
|
+
onRowsChangedHandler() {
|
|
45
|
+
this.tableRows = Array.from(this.rows);
|
|
46
|
+
this.setHeaderCheckboxState();
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* When the page is set from outside of the components the table needs to show the newly specified page of rows.
|
|
50
|
+
*/
|
|
51
|
+
onPageChangedHandler() {
|
|
52
|
+
this.currentPage = this.page;
|
|
53
|
+
this.renderTableContent();
|
|
54
|
+
}
|
|
55
|
+
connectedCallback() {
|
|
56
|
+
const miColumns = this.el.querySelectorAll('mi-column');
|
|
57
|
+
this.columns = Array.from(miColumns).map((miColumn) => {
|
|
58
|
+
const column = {
|
|
59
|
+
alignContent: miColumn.alignContent,
|
|
60
|
+
monospace: miColumn.monospace,
|
|
61
|
+
label: !isNullOrUndefined(miColumn.label) ? miColumn.label : miColumn.binding,
|
|
62
|
+
binding: miColumn.binding || null,
|
|
63
|
+
sortable: miColumn.sortable,
|
|
64
|
+
fitContent: !!miColumn.fitContent,
|
|
65
|
+
/* All HTML comments are removed from the template to avoid the issues with the table not displaying any data in IE11 */
|
|
66
|
+
template: miColumn.innerHTML.replace(/<!--[\s\S]*?-->/g, ''),
|
|
67
|
+
columnElement: miColumn,
|
|
68
|
+
width: miColumn.width
|
|
69
|
+
};
|
|
70
|
+
/* If the mi-column has the sort attribute, then the initial sort state is set. */
|
|
71
|
+
if (miColumn.sort && !this.sortByColumn) {
|
|
72
|
+
this.sortByColumn = { column: column, sortOrder: miColumn.sort === 'asc' ? 'asc' : 'desc' };
|
|
73
|
+
}
|
|
74
|
+
return column;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Column header click handler.
|
|
79
|
+
* If the column is sortable the sort order is reversed.
|
|
80
|
+
*
|
|
81
|
+
* @private
|
|
82
|
+
* @param {MouseEvent} event
|
|
83
|
+
* @param {any} column
|
|
84
|
+
*/
|
|
85
|
+
columnHeaderClickHandler(event, column) {
|
|
86
|
+
var _a, _b;
|
|
87
|
+
if (!isNullOrUndefined(column.sortable)) {
|
|
88
|
+
let sortOrder = 'asc';
|
|
89
|
+
if (column === ((_a = this.sortByColumn) === null || _a === void 0 ? void 0 : _a.column)) {
|
|
90
|
+
// TODO: Use SortOrder enum in MICMS-1353
|
|
91
|
+
sortOrder = ((_b = this.sortByColumn) === null || _b === void 0 ? void 0 : _b.sortOrder) === 'asc' ? 'desc' : 'asc';
|
|
92
|
+
}
|
|
93
|
+
/* When a column that is sortable is clicked then the sort state is updated. */
|
|
94
|
+
this.sortByColumn = { column: column, sortOrder: sortOrder };
|
|
99
95
|
}
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Sorts table rows.
|
|
99
|
+
*
|
|
100
|
+
* @private
|
|
101
|
+
* @return {Array<any>}
|
|
102
|
+
*/
|
|
103
|
+
sortTableRows() {
|
|
104
|
+
var _a, _b, _c;
|
|
105
|
+
//Check if the table has any rows.
|
|
106
|
+
if (this.tableRows.length > 0 && this.sortByColumn) {
|
|
107
|
+
let sortMethod;
|
|
108
|
+
const sortByColumn = (_a = this.sortByColumn) === null || _a === void 0 ? void 0 : _a.column;
|
|
109
|
+
const sortOrder = (_b = this.sortByColumn) === null || _b === void 0 ? void 0 : _b.sortOrder;
|
|
110
|
+
if (sortByColumn && sortOrder) {
|
|
111
|
+
if (((_c = sortByColumn.sortable) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'date') {
|
|
112
|
+
sortMethod = sortOrder === 'desc' ? dateDesc(sortByColumn.binding) : dateAsc(sortByColumn.binding);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
sortMethod = sortOrder === 'desc' ? desc(sortByColumn.binding) : asc(sortByColumn.binding);
|
|
116
|
+
}
|
|
117
|
+
return [...this.tableRows.sort(sortMethod)];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return this.tableRows;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Replace template variables (eg. "{id}") with the corresponding value from the data.
|
|
124
|
+
*
|
|
125
|
+
* @private
|
|
126
|
+
* @param {string} template
|
|
127
|
+
* @param {object} data
|
|
128
|
+
* @returns {string}
|
|
129
|
+
*/
|
|
130
|
+
replaceVars(template, data) {
|
|
131
|
+
return template.replace(/\{(.*?)\}/g, (match, capture) => {
|
|
132
|
+
const path = capture.split('.');
|
|
133
|
+
// Traverse the input object until a given key is found.
|
|
134
|
+
return path.reduce((object, key) => {
|
|
135
|
+
return object ? object[key] : null;
|
|
136
|
+
}, data);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Remove boolean HTML attributes (eg. checked) that will have a false value based on data. This is necessary since
|
|
141
|
+
* the very presence of the attribute will give it a truthy value.
|
|
142
|
+
*
|
|
143
|
+
* @private
|
|
144
|
+
* @param {string} template
|
|
145
|
+
* @param {array} data
|
|
146
|
+
* @returns {string}
|
|
147
|
+
*/
|
|
148
|
+
removeFalseBooleanAttributes(template, data) {
|
|
149
|
+
return template.replace(/ (checked|disabled|hidden|selected)="\{(.*?)\}"/, (match, attributeName, binding) => {
|
|
150
|
+
return data[binding] === false ? '' : attributeName;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* React to clicks on table rows and emits the internal cellContentClicked event to
|
|
155
|
+
* the column component if clicked on content within a cell.
|
|
156
|
+
*
|
|
157
|
+
* @private
|
|
158
|
+
* @param {MouseEvent} event
|
|
159
|
+
* @param {any} tableRow
|
|
160
|
+
*/
|
|
161
|
+
tableRowClicked(event, tableRow) {
|
|
162
|
+
var _a;
|
|
163
|
+
const element = event.target;
|
|
164
|
+
const cellIndex = element.closest('td').cellIndex;
|
|
165
|
+
const columnClickedIndex = this.selectable ? cellIndex - 1 : cellIndex;
|
|
166
|
+
if (element.tagName.toLowerCase() !== 'td' && this.columns[columnClickedIndex]) {
|
|
167
|
+
const eventPayload = { detail: tableRow };
|
|
168
|
+
(_a = this.columns[columnClickedIndex]) === null || _a === void 0 ? void 0 : _a.columnElement.dispatchEvent(new CustomEvent('cellContentClicked', eventPayload));
|
|
102
169
|
}
|
|
103
|
-
return [...this.tableRows.sort(sortMethod)];
|
|
104
|
-
}
|
|
105
170
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const path = capture.split('.');
|
|
119
|
-
// Traverse the input object until a given key is found.
|
|
120
|
-
return path.reduce((object, key) => {
|
|
121
|
-
return object ? object[key] : null;
|
|
122
|
-
}, data);
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Remove boolean HTML attributes (eg. checked) that will have a false value based on data. This is necessary since
|
|
127
|
-
* the very presence of the attribute will give it a truthy value.
|
|
128
|
-
*
|
|
129
|
-
* @private
|
|
130
|
-
* @param {string} template
|
|
131
|
-
* @param {array} data
|
|
132
|
-
* @returns {string}
|
|
133
|
-
*/
|
|
134
|
-
removeFalseBooleanAttributes(template, data) {
|
|
135
|
-
return template.replace(/ (checked|disabled|hidden|selected)="\{(.*?)\}"/, (match, attributeName, binding) => {
|
|
136
|
-
return data[binding] === false ? '' : attributeName;
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* React to clicks on table rows and emits the internal cellContentClicked event to
|
|
141
|
-
* the column component if clicked on content within a cell.
|
|
142
|
-
*
|
|
143
|
-
* @private
|
|
144
|
-
* @param {MouseEvent} event
|
|
145
|
-
* @param {any} tableRow
|
|
146
|
-
*/
|
|
147
|
-
tableRowClicked(event, tableRow) {
|
|
148
|
-
var _a;
|
|
149
|
-
const element = event.target;
|
|
150
|
-
const cellIndex = element.closest('td').cellIndex;
|
|
151
|
-
const columnClickedIndex = this.selectable ? cellIndex - 1 : cellIndex;
|
|
152
|
-
if (element.tagName.toLowerCase() !== 'td' && this.columns[columnClickedIndex]) {
|
|
153
|
-
const eventPayload = { detail: tableRow };
|
|
154
|
-
(_a = this.columns[columnClickedIndex]) === null || _a === void 0 ? void 0 : _a.columnElement.dispatchEvent(new CustomEvent('cellContentClicked', eventPayload));
|
|
171
|
+
async componentWillLoad() {
|
|
172
|
+
if (this.rows.length > 0) {
|
|
173
|
+
this.tableRows = Array.from(this.rows);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
render() {
|
|
177
|
+
return (h(Host, { key: '5f33c379fd4a1726cad525f3674e6a4e8c5e90e0' }, h("table", { key: '852a27330cd0208c9f8d2bcab8589c44e809c713', class: "table" }, h("thead", { key: 'a111f00a7d2e84678b21bea62ad3b999b5dbabf0' }, h("tr", { key: '0550d95de2276ecd673389c0b7eac6421a80a2b7' }, this.renderSelectHeader(), this.columns.map(column => {
|
|
178
|
+
var _a;
|
|
179
|
+
const width = !column.fitContent ? column.width || 'auto' : '';
|
|
180
|
+
const sortOrder = ((_a = this.sortByColumn) === null || _a === void 0 ? void 0 : _a.column) === column ? this.sortByColumn.sortOrder : null;
|
|
181
|
+
return h("th", { "data-binding": column.binding, style: { 'width': width, 'max-width': width, 'min-width': width }, onClick: (event) => this.columnHeaderClickHandler(event, column), class: `table__header-cell ${this.isHeaderSticky ? 'table__header-cell--sticky' : ''} ${isNullOrUndefined(column.sortable) ? 'table__header-cell--no-sort' : ''} ${isNullOrUndefined(sortOrder) ? '' : sortOrder} ${column.fitContent ? 'table__header-cell--fit-content' : ''}` }, column.label);
|
|
182
|
+
}))), h("tbody", { key: '230d8604fd9f43ea6264bf3ecebc3acb09d230ed' }, this.renderTableContent())), this.tableRows.length === 0 ? this.renderEmptyPage() : null));
|
|
155
183
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
184
|
+
/**
|
|
185
|
+
* If the table is selectable then renderSelectHeader will render the th element with the checkbox to check or uncheck all items in the table.
|
|
186
|
+
*
|
|
187
|
+
* @private
|
|
188
|
+
* @returns {JSX.Element}
|
|
189
|
+
*/
|
|
190
|
+
renderSelectHeader() {
|
|
191
|
+
if (this.selectable) {
|
|
192
|
+
return (h("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` }, h("input", { type: "checkbox", class: "mi-input", ref: (el) => this.selectAllCheckbox = el, onChange: () => this.selectHeaderOnChangeHandler() })));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* If the table is selectable then this method will render the td for each row in the item to select or unselect the row.
|
|
197
|
+
*
|
|
198
|
+
* @private
|
|
199
|
+
* @param {object} row
|
|
200
|
+
* @returns {JSX.Element}
|
|
201
|
+
*/
|
|
202
|
+
renderSelectRow(row) {
|
|
203
|
+
if (this.selectable) {
|
|
204
|
+
return (h("td", { class: "table__data table__data--align-center" }, h("input", { class: "mi-input", type: "checkbox", checked: this.selected.has(row), onChange: event => this.selectOnChangeHandler(event, row) })));
|
|
205
|
+
}
|
|
160
206
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
* @private
|
|
174
|
-
* @returns {JSX.Element}
|
|
175
|
-
*/
|
|
176
|
-
renderSelectHeader() {
|
|
177
|
-
if (this.selectable) {
|
|
178
|
-
return (h("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` }, h("input", { type: "checkbox", class: "mi-input", ref: (el) => this.selectAllCheckbox = el, onChange: () => this.selectHeaderOnChangeHandler() })));
|
|
207
|
+
/**
|
|
208
|
+
* Helper method to render the tables content.
|
|
209
|
+
*
|
|
210
|
+
* @private
|
|
211
|
+
* @returns {[JSX.Element]}
|
|
212
|
+
*/
|
|
213
|
+
renderTableContent() {
|
|
214
|
+
let tableRows = this.sortTableRows();
|
|
215
|
+
tableRows = isNumber(this.maxRows) && this.maxRows > 0 ?
|
|
216
|
+
tableRows.slice(this.maxRows * (this.currentPage - 1), this.maxRows * this.currentPage)
|
|
217
|
+
: tableRows;
|
|
218
|
+
return tableRows.map(row => this.renderTableRow(row));
|
|
179
219
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
220
|
+
/**
|
|
221
|
+
* Helper method to render a table row.
|
|
222
|
+
*
|
|
223
|
+
* @private
|
|
224
|
+
* @param {*} tableRow
|
|
225
|
+
* @returns {JSX.Element}
|
|
226
|
+
*/
|
|
227
|
+
renderTableRow(tableRow) {
|
|
228
|
+
const rowData = [];
|
|
229
|
+
for (const column of this.columns) {
|
|
230
|
+
let template = column.template;
|
|
231
|
+
if (template > '') {
|
|
232
|
+
template = this.removeFalseBooleanAttributes(template, tableRow);
|
|
233
|
+
template = this.replaceVars(template, tableRow);
|
|
234
|
+
rowData.push(template);
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
rowData.push(tableRow[column.binding]);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return h("tr", { class: "table__row", onClick: e => this.tableRowClicked(e, tableRow) }, this.renderSelectRow(tableRow), rowData.map((cellContent, cellIndex) => h("td", { class: `table__data ${this.columns[cellIndex].fitContent ? 'table__data--fit-content' : ''} table__data--align-${this.columns[cellIndex].alignContent || 'left'} ${this.columns[cellIndex].monospace ? 'table__data--monospace-font' : ''}`, innerHTML: cellContent })));
|
|
191
241
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
tableRows = isNumber(this.maxRows) && this.maxRows > 0 ?
|
|
202
|
-
tableRows.slice(this.maxRows * (this.currentPage - 1), this.maxRows * this.currentPage)
|
|
203
|
-
: tableRows;
|
|
204
|
-
return tableRows.map(row => this.renderTableRow(row));
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Helper method to render a table row.
|
|
208
|
-
*
|
|
209
|
-
* @private
|
|
210
|
-
* @param {*} tableRow
|
|
211
|
-
* @returns {JSX.Element}
|
|
212
|
-
*/
|
|
213
|
-
renderTableRow(tableRow) {
|
|
214
|
-
const rowData = [];
|
|
215
|
-
for (const column of this.columns) {
|
|
216
|
-
let template = column.template;
|
|
217
|
-
if (template > '') {
|
|
218
|
-
template = this.removeFalseBooleanAttributes(template, tableRow);
|
|
219
|
-
template = this.replaceVars(template, tableRow);
|
|
220
|
-
rowData.push(template);
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
rowData.push(tableRow[column.binding]);
|
|
224
|
-
}
|
|
242
|
+
/**
|
|
243
|
+
* Renders en empty page with error message when no table rows are available.
|
|
244
|
+
*
|
|
245
|
+
* @private
|
|
246
|
+
* @returns {JSX.Element}
|
|
247
|
+
*/
|
|
248
|
+
renderEmptyPage() {
|
|
249
|
+
const emptyPage = (h("div", { class: "empty-page" }, h("p", { class: "empty-page__header" }, this.emptyPageHeader), h("p", { class: "empty-page__subheader" }, this.emptyPageSubheader)));
|
|
250
|
+
return emptyPage;
|
|
225
251
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
* The event handler for the onchange event for the checkboxes in the selectable column.
|
|
240
|
-
*
|
|
241
|
-
* @private
|
|
242
|
-
* @param {EventData} event
|
|
243
|
-
* @param {object} row
|
|
244
|
-
*/
|
|
245
|
-
selectOnChangeHandler(event, row) {
|
|
246
|
-
event.target.checked ? this.selected.add(row) : this.selected.delete(row);
|
|
247
|
-
this.setHeaderCheckboxState();
|
|
248
|
-
//The selectedRows is updated to force a rerendering of the table with the correct state.
|
|
249
|
-
this.numberOfSelectedRows = this.selected.size;
|
|
250
|
-
event.stopPropagation();
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Set the state of the checkbox in the table header.
|
|
254
|
-
* The state can be either checked, unchecked or indeterminate.
|
|
255
|
-
*/
|
|
256
|
-
setHeaderCheckboxState() {
|
|
257
|
-
if (this.selectAllCheckbox && this.selectable) {
|
|
258
|
-
this.selectAllCheckbox.checked = this.selected.size === this.rows.length;
|
|
259
|
-
this.selectAllCheckbox.indeterminate = this.selected.size > 0 && this.selected.size < this.rows.length;
|
|
252
|
+
/**
|
|
253
|
+
* The event handler for the onchange event for the checkboxes in the selectable column.
|
|
254
|
+
*
|
|
255
|
+
* @private
|
|
256
|
+
* @param {EventData} event
|
|
257
|
+
* @param {object} row
|
|
258
|
+
*/
|
|
259
|
+
selectOnChangeHandler(event, row) {
|
|
260
|
+
event.target.checked ? this.selected.add(row) : this.selected.delete(row);
|
|
261
|
+
this.setHeaderCheckboxState();
|
|
262
|
+
//The selectedRows is updated to force a rerendering of the table with the correct state.
|
|
263
|
+
this.numberOfSelectedRows = this.selected.size;
|
|
264
|
+
event.stopPropagation();
|
|
260
265
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
this.selected.clear();
|
|
271
|
-
this.selectAllCheckbox.checked = false;
|
|
266
|
+
/**
|
|
267
|
+
* Set the state of the checkbox in the table header.
|
|
268
|
+
* The state can be either checked, unchecked or indeterminate.
|
|
269
|
+
*/
|
|
270
|
+
setHeaderCheckboxState() {
|
|
271
|
+
if (this.selectAllCheckbox && this.selectable) {
|
|
272
|
+
this.selectAllCheckbox.checked = this.selected.size === this.rows.length;
|
|
273
|
+
this.selectAllCheckbox.indeterminate = this.selected.size > 0 && this.selected.size < this.rows.length;
|
|
274
|
+
}
|
|
272
275
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
+
/**
|
|
277
|
+
* The event handler for the onchange event for the checkbox in the selectable column header.
|
|
278
|
+
*
|
|
279
|
+
* @private
|
|
280
|
+
* @param {EventData} event
|
|
281
|
+
*/
|
|
282
|
+
selectHeaderOnChangeHandler() {
|
|
283
|
+
if (this.selected.size > 0 && this.selected.size <= this.rows.length) {
|
|
284
|
+
this.selected.clear();
|
|
285
|
+
this.selectAllCheckbox.checked = false;
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
this.rows.forEach(row => this.selected.add(row));
|
|
289
|
+
this.selectAllCheckbox.checked = true;
|
|
290
|
+
}
|
|
291
|
+
this.numberOfSelectedRows = this.selected.size;
|
|
276
292
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
293
|
+
get el() { return getElement(this); }
|
|
294
|
+
static get watchers() { return {
|
|
295
|
+
"numberOfSelectedRows": [{
|
|
296
|
+
"onSelectionChangedHandler": 0
|
|
297
|
+
}],
|
|
298
|
+
"rows": [{
|
|
299
|
+
"onRowsChangedHandler": 0
|
|
300
|
+
}],
|
|
301
|
+
"page": [{
|
|
302
|
+
"onPageChangedHandler": 0
|
|
303
|
+
}]
|
|
304
|
+
}; }
|
|
285
305
|
};
|
|
286
306
|
const asc = (value) => (a, b) => `${a[value] || ''}`
|
|
287
|
-
|
|
307
|
+
.localeCompare(`${(b[value] || '')}`.trimStart().toLowerCase(), undefined, { numeric: true });
|
|
288
308
|
const desc = (value) => (a, b) => `${b[value] || ''}`
|
|
289
|
-
|
|
309
|
+
.localeCompare(`${(a[value] || '')}`.trimStart().toLowerCase(), undefined, { numeric: true });
|
|
290
310
|
const dateAsc = (value) => (a, b) => {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
311
|
+
const aAsDate = Date.parse(a[value]);
|
|
312
|
+
const bAsDate = Date.parse(b[value]);
|
|
313
|
+
return aAsDate > bAsDate ? 1 : aAsDate < bAsDate ? -1 : 0;
|
|
294
314
|
};
|
|
295
315
|
const dateDesc = (value) => (b, a) => {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
316
|
+
const aAsDate = Date.parse(a[value]);
|
|
317
|
+
const bAsDate = Date.parse(b[value]);
|
|
318
|
+
return aAsDate > bAsDate ? 1 : aAsDate < bAsDate ? -1 : 0;
|
|
299
319
|
};
|
|
300
|
-
DataTable.style = dataTableCss;
|
|
320
|
+
DataTable.style = dataTableCss();
|
|
301
321
|
|
|
302
322
|
export { DataTable as mi_data_table };
|