@sebgroup/green-core 2.35.1 → 2.36.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.
- package/components/button/button.trans.styles.scss.js +1 -1
- package/components/calendar/calendar.trans.styles.scss.js +1 -1
- package/components/context-menu/context-menu.trans.styles.scss.js +1 -1
- package/components/datepicker/datepicker.trans.styles.scss.js +1 -1
- package/components/dialog/dialog.component.d.ts +22 -2
- package/components/dialog/dialog.component.js +104 -23
- package/components/formatted-text/date/date-time-formatter.js +1 -3
- package/components/grouped-list/grouped-list.trans.styles.scss.js +1 -1
- package/components/pagination/pagination.component.js +11 -8
- package/components/popover/popover.trans.styles.scss.js +1 -1
- package/components/segmented-control/segment/segment.trans.styles.scss.js +1 -1
- package/components/segmented-control/segmented-control.trans.styles.css.js +1 -1
- package/components/table/table.component.d.ts +16 -1
- package/components/table/table.component.js +116 -190
- package/components/table/table.stories.data.d.ts +25 -47
- package/components/table/table.stories.data.js +261 -288
- package/components/table/table.styles.js +15 -2
- package/components/table/table.types.d.ts +16 -81
- package/components/table/table.types.js +40 -10
- package/components/theme/chlorophyll-tokens.scss.js +1 -1
- package/custom-elements.json +20809 -20571
- package/gds-element.js +1 -1
- package/generated/mcp/components.json +1 -1
- package/generated/mcp/dialog/api.md +8 -4
- package/generated/mcp/icons.json +1 -1
- package/generated/mcp/index.json +1 -1
- package/generated/mcp/table/api.md +2 -1
- package/generated/react/dialog/index.d.ts +2 -1
- package/generated/react/index.d.ts +1 -1
- package/generated/react/index.js +1 -1
- package/generated/react/table/index.d.ts +2 -1
- package/package.json +1 -1
- package/primitives/field-base/field-base.trans.styles.scss.js +1 -1
- package/primitives/listbox/listbox.trans.styles.scss.js +1 -1
- package/primitives/listbox/option.trans.styles.scss.js +1 -1
- package/primitives/menu/menu-heading.trans.styles.scss.js +1 -1
- package/utils/helpers/custom-element-scoping.js +1 -1
- package/utils/helpers/id.d.ts +0 -3
- package/utils/helpers/id.js +6 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const styles = "/* stylelint-disable max-nesting-depth */\n/* stylelint-enable max-nesting-depth */\n/**\n * Calculate the luminance for a color.\n *
|
|
1
|
+
const styles = "/* stylelint-disable max-nesting-depth */\n/**\n * Assert that a map is in ascending order\n * @mixin assert-ascending\n * @param {Map} $map - The map to check\n * @param {String} $map-name - The name of the map\n */\n/**\n * Assert that the first breakpoint in a map starts at zero\n * @mixin assert-starts-at-zero\n * @param {Map} $map - The map to check\n * @param {String} $map-name - The name of the map\n */\n/**\n * Check if a value is important\n * @function is-important\n * @param {Boolean} $important - Whether the value is important\n * @return {String} - \"!important\" if true, otherwise an empty string\n */\n/**\n * Replace a substring in a string\n * @function str-replace\n * @param {String} $string - The original string\n * @param {String} $search - The substring to replace\n * @param {String} $replace - The replacement string\n * @return {String} - The updated string\n */\n/**\n * Convert a map to its negative variant\n * @function negativify-map\n * @param {Map} $map - The map to convert\n * @return {Map} - The negative variant of the map\n */\n/**\n * Generate utility classes\n * @mixin generate-utility\n * @param {Map} $utility - Utility map\n * @param {String} $infix - Infix for class names\n * @param {Boolean} $is-rfs-media-query - Whether to use RFS media query\n */\n/* stylelint-enable max-nesting-depth */\n/**\n * Calculate the luminance for a color.\n * @function luminance\n * @param {Color} $color - The color to calculate luminance for\n * @return {Number} - The luminance value\n */\n/**\n * Calculate the contrast ratio between two colors.\n * @function color-contrast\n * @param {Color} $fg - Foreground color\n * @param {Color} $bg - Background color\n * @return {Number} - The contrast ratio\n */\n/**\n * Remove the unit of a length\n * @function strip-unit\n * @param {Number} $number - Number to remove unit from\n * @return {Number} - Unitless number\n */\n/**\n * Validate font size\n * @function validate-font-size\n * @param {Number} $size - Font size to validate\n * @return {Number} - Validated font size in pixels\n */\n/**\n * Get ratio for WCAG level\n * @function get-ratio\n * @param {String} $level - WCAG level\n * @param {Number} $size - Font size\n * @param {Boolean} $bold - Is bold\n * @param {Boolean} $graphic - Is graphic\n * @return {Number} - Ratio value\n */\n/**\n * Determine if a color is light or dark\n * @function light-or-dark\n * @param {Color} $color - The color to check\n * @return {String} - \"light\" or \"dark\"\n */\n/**\n * Get the most legible color (black or white) for a given background color\n * @function most-legible-color\n * @param {Color} $color - The background color\n * @return {Color} - The most legible color\n */\n/**\n * Get the desired color combination for foreground and background colors\n * @function desired-color-combination\n * @param {Color} $fg - Foreground color\n * @param {Color} $bg - Background color\n * @param {Number} $offsetThreshold - Offset threshold\n * @param {Number} $ratio - Contrast ratio\n * @return {List} - List containing background and foreground colors\n */\n/**\n * @mixin desired-color-combination\n * @param {Color} $fg - Foreground color\n * @param {Color} $bg - Background color\n * @param {Number} $offsetThreshold - Offset threshold\n * @param {Number} $ratio - Contrast ratio\n */\n/**\n * Get an accessible color for a given foreground and background color\n * @function a11y-color\n * @param {Color} $fg - Foreground color\n * @param {Color} $bg - Background color\n * @param {String} $level - WCAG level\n * @param {Number} $size - Font size\n * @param {Boolean} $bold - Is bold\n * @param {Boolean} $graphic - Is graphic\n * @param {Number} $maxOffset - Maximum offset\n * @param {Boolean} $darkMode - Is dark mode\n * @param {Number} $ratio - Contrast ratio\n * @return {Color} - Accessible color\n */\n/**\n * Get the maximum contrast color\n * @function max-contrast\n * @param {Color} $fg - Foreground color\n * @param {Color} $bg - Background color\n * @param {Color} $max - Maximum contrast color\n * @return {Color} - Maximum contrast color\n */\n/**\n * Get the RGB values of a color as a string\n * @function stripped-rgb\n * @param {Color} $color - The color\n * @return {String} - RGB values as a string\n */\n/**\n * Get the HSL values of a color as a string\n * @function stripped-hsl\n * @param {Color} $color - The color\n * @return {String} - HSL values as a string\n */\n/**\n * Convert a map of colors to a map of HSL values\n * @function hsl-map\n * @param {Map} $colors - Map of colors\n * @return {Map} - Map of HSL values\n */\n/**\n* @deprecated\n* Use `add-focus` instead\n*/\n/** add background color, color and border-color to element when it has focus-visible i.e. tab focus */\n/**\n * Breakpoint viewport sizes and media queries.\n *\n * Breakpoints are defined as a map of (name: minimum width), order from small to large:\n *\n * (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px)\n *\n * The map defined in the `$grid-breakpoints` global variable is used as the `$breakpoints` argument by default.\n */\n/**\n * Name of the next breakpoint, or null for the last breakpoint.\n *\n * >> breakpoint-next(sm)\n * md\n * >> breakpoint-next(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))\n * md\n * >> breakpoint-next(sm, $breakpoint-names: (xs sm md lg xl))\n * md\n */\n/**\n * Minimum breakpoint width. Null for the smallest (first) breakpoint.\n *\n * >> breakpoint-min(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))\n * 576px\n */\n/**\n * Maximum breakpoint width.\n * The maximum value is reduced by 0.02px to work around the limitations of\n * `min-` and `max-` prefixes and viewports with fractional widths.\n * See https://www.w3.org/TR/mediaqueries-4/#mq-min-max\n * Uses 0.02px rather than 0.01px to work around a current rounding bug in Safari.\n * See https://bugs.webkit.org/show_bug.cgi?id=178261\n *\n * >> breakpoint-max(md, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))\n * 767.98px\n */\n/**\n * Returns a blank string if smallest breakpoint, otherwise returns the name with a dash in front.\n * Useful for making responsive utilities.\n *\n * >> breakpoint-infix(xs, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))\n * \"\" (Returns a blank string)\n * >> breakpoint-infix(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))\n * \"-sm\"\n */\n/**\n * Media of at least the minimum breakpoint width. No query for the smallest breakpoint.\n * Makes the @content apply to the given breakpoint and wider.\n */\n/**\n * Media of at most the maximum breakpoint width. No query for the largest breakpoint.\n * Makes the @content apply to the given breakpoint and narrower.\n */\n/**\n * Media that spans multiple breakpoint widths.\n * Makes the @content apply between the min and max breakpoints\n */\n/**\n * Media between the breakpoint's minimum and maximum widths.\n * No minimum for the smallest breakpoint, and no maximum for the largest one.\n * Makes the @content apply only to the given breakpoint, not viewports any wider or narrower.\n */\n@layer base, reset, transitional-styles;\n@layer transitional-styles {\n :host {\n display: contents;\n }\n :host([open]) dialog {\n box-sizing: border-box;\n opacity: 1;\n transform: translate3d(0, 0, 0);\n visibility: visible;\n }\n :host > div:not([hidden]) {\n display: contents;\n }\n header {\n display: flex;\n }\n header .close::part(_button) {\n border-radius: 100%;\n color: var(--gds-sys-color-text-primary);\n border: 1px solid transparent;\n }\n header .close::part(_button):hover {\n background-color: var(--gds-sys-color-base-300);\n }\n header h2 {\n flex-grow: 1;\n font-weight: 400;\n line-height: 1.5;\n margin: 0.25rem 0 0 0.75rem;\n }\n dialog {\n background-color: var(--gds-sys-color-background-primary);\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n opacity: 0;\n visibility: hidden;\n position: fixed;\n inset: auto;\n z-index: 1060;\n box-shadow: 0 0.125rem 0.375rem rgba(0, 0, 0, 0.15);\n color: var(--gds-sys-color-text-primary);\n overflow: hidden;\n padding: 0;\n padding-bottom: 0;\n border: solid 1px var(--gds-sys-color-base-600);\n --border-color: var(--gds-sys-color-text-primary);\n border-radius: 0.25rem;\n }\n @media (max-width: 35.98em) {\n dialog.use-modal-in-mobile {\n border-top: solid 1px var(--gds-sys-color-base-600);\n --border-color: var(--gds-sys-color-base-600);\n padding-bottom: 0.5rem;\n border-radius: 1rem 1rem 0 0;\n bottom: 0;\n left: 0;\n transition: all 300ms ease-in-out;\n width: 100%;\n border: 1px solid var(--border-color);\n border-radius: 0.25rem;\n max-height: 80svh;\n padding-bottom: 0;\n inset: 0;\n }\n dialog.use-modal-in-mobile.v-kb-visible {\n inset-block-end: auto;\n max-height: 50svh;\n top: 1rem;\n }\n }\n @media (min-width: 36em) {\n dialog.use-modal-in-mobile header {\n display: none;\n }\n }\n @media (min-width: 36em) {\n dialog.use-modal-in-mobile:not(.has-backdrop)::backdrop {\n opacity: 0;\n }\n }\n dialog::backdrop {\n background-color: rgba(0, 0, 0, 0.2);\n display: block;\n position: fixed;\n }\n dialog:not(.use-modal-in-mobile) header {\n display: none;\n }\n dialog:not(.use-modal-in-mobile)::backdrop {\n opacity: 0;\n }\n}";
|
|
2
2
|
export default styles;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const styles = "/* stylelint-disable max-nesting-depth */\n/* stylelint-enable max-nesting-depth */\n/**\n * Calculate the luminance for a color.\n *
|
|
1
|
+
const styles = "/* stylelint-disable max-nesting-depth */\n/**\n * Assert that a map is in ascending order\n * @mixin assert-ascending\n * @param {Map} $map - The map to check\n * @param {String} $map-name - The name of the map\n */\n/**\n * Assert that the first breakpoint in a map starts at zero\n * @mixin assert-starts-at-zero\n * @param {Map} $map - The map to check\n * @param {String} $map-name - The name of the map\n */\n/**\n * Check if a value is important\n * @function is-important\n * @param {Boolean} $important - Whether the value is important\n * @return {String} - \"!important\" if true, otherwise an empty string\n */\n/**\n * Replace a substring in a string\n * @function str-replace\n * @param {String} $string - The original string\n * @param {String} $search - The substring to replace\n * @param {String} $replace - The replacement string\n * @return {String} - The updated string\n */\n/**\n * Convert a map to its negative variant\n * @function negativify-map\n * @param {Map} $map - The map to convert\n * @return {Map} - The negative variant of the map\n */\n/**\n * Generate utility classes\n * @mixin generate-utility\n * @param {Map} $utility - Utility map\n * @param {String} $infix - Infix for class names\n * @param {Boolean} $is-rfs-media-query - Whether to use RFS media query\n */\n/* stylelint-enable max-nesting-depth */\n/**\n * Calculate the luminance for a color.\n * @function luminance\n * @param {Color} $color - The color to calculate luminance for\n * @return {Number} - The luminance value\n */\n/**\n * Calculate the contrast ratio between two colors.\n * @function color-contrast\n * @param {Color} $fg - Foreground color\n * @param {Color} $bg - Background color\n * @return {Number} - The contrast ratio\n */\n/**\n * Remove the unit of a length\n * @function strip-unit\n * @param {Number} $number - Number to remove unit from\n * @return {Number} - Unitless number\n */\n/**\n * Validate font size\n * @function validate-font-size\n * @param {Number} $size - Font size to validate\n * @return {Number} - Validated font size in pixels\n */\n/**\n * Get ratio for WCAG level\n * @function get-ratio\n * @param {String} $level - WCAG level\n * @param {Number} $size - Font size\n * @param {Boolean} $bold - Is bold\n * @param {Boolean} $graphic - Is graphic\n * @return {Number} - Ratio value\n */\n/**\n * Determine if a color is light or dark\n * @function light-or-dark\n * @param {Color} $color - The color to check\n * @return {String} - \"light\" or \"dark\"\n */\n/**\n * Get the most legible color (black or white) for a given background color\n * @function most-legible-color\n * @param {Color} $color - The background color\n * @return {Color} - The most legible color\n */\n/**\n * Get the desired color combination for foreground and background colors\n * @function desired-color-combination\n * @param {Color} $fg - Foreground color\n * @param {Color} $bg - Background color\n * @param {Number} $offsetThreshold - Offset threshold\n * @param {Number} $ratio - Contrast ratio\n * @return {List} - List containing background and foreground colors\n */\n/**\n * @mixin desired-color-combination\n * @param {Color} $fg - Foreground color\n * @param {Color} $bg - Background color\n * @param {Number} $offsetThreshold - Offset threshold\n * @param {Number} $ratio - Contrast ratio\n */\n/**\n * Get an accessible color for a given foreground and background color\n * @function a11y-color\n * @param {Color} $fg - Foreground color\n * @param {Color} $bg - Background color\n * @param {String} $level - WCAG level\n * @param {Number} $size - Font size\n * @param {Boolean} $bold - Is bold\n * @param {Boolean} $graphic - Is graphic\n * @param {Number} $maxOffset - Maximum offset\n * @param {Boolean} $darkMode - Is dark mode\n * @param {Number} $ratio - Contrast ratio\n * @return {Color} - Accessible color\n */\n/**\n * Get the maximum contrast color\n * @function max-contrast\n * @param {Color} $fg - Foreground color\n * @param {Color} $bg - Background color\n * @param {Color} $max - Maximum contrast color\n * @return {Color} - Maximum contrast color\n */\n/**\n * Get the RGB values of a color as a string\n * @function stripped-rgb\n * @param {Color} $color - The color\n * @return {String} - RGB values as a string\n */\n/**\n * Get the HSL values of a color as a string\n * @function stripped-hsl\n * @param {Color} $color - The color\n * @return {String} - HSL values as a string\n */\n/**\n * Convert a map of colors to a map of HSL values\n * @function hsl-map\n * @param {Map} $colors - Map of colors\n * @return {Map} - Map of HSL values\n */\n/**\n* @deprecated\n* Use `add-focus` instead\n*/\n/** add background color, color and border-color to element when it has focus-visible i.e. tab focus */\n/**\n * Breakpoint viewport sizes and media queries.\n *\n * Breakpoints are defined as a map of (name: minimum width), order from small to large:\n *\n * (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px)\n *\n * The map defined in the `$grid-breakpoints` global variable is used as the `$breakpoints` argument by default.\n */\n/**\n * Name of the next breakpoint, or null for the last breakpoint.\n *\n * >> breakpoint-next(sm)\n * md\n * >> breakpoint-next(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))\n * md\n * >> breakpoint-next(sm, $breakpoint-names: (xs sm md lg xl))\n * md\n */\n/**\n * Minimum breakpoint width. Null for the smallest (first) breakpoint.\n *\n * >> breakpoint-min(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))\n * 576px\n */\n/**\n * Maximum breakpoint width.\n * The maximum value is reduced by 0.02px to work around the limitations of\n * `min-` and `max-` prefixes and viewports with fractional widths.\n * See https://www.w3.org/TR/mediaqueries-4/#mq-min-max\n * Uses 0.02px rather than 0.01px to work around a current rounding bug in Safari.\n * See https://bugs.webkit.org/show_bug.cgi?id=178261\n *\n * >> breakpoint-max(md, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))\n * 767.98px\n */\n/**\n * Returns a blank string if smallest breakpoint, otherwise returns the name with a dash in front.\n * Useful for making responsive utilities.\n *\n * >> breakpoint-infix(xs, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))\n * \"\" (Returns a blank string)\n * >> breakpoint-infix(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))\n * \"-sm\"\n */\n/**\n * Media of at least the minimum breakpoint width. No query for the smallest breakpoint.\n * Makes the @content apply to the given breakpoint and wider.\n */\n/**\n * Media of at most the maximum breakpoint width. No query for the largest breakpoint.\n * Makes the @content apply to the given breakpoint and narrower.\n */\n/**\n * Media that spans multiple breakpoint widths.\n * Makes the @content apply between the min and max breakpoints\n */\n/**\n * Media between the breakpoint's minimum and maximum widths.\n * No minimum for the smallest breakpoint, and no maximum for the largest one.\n * Makes the @content apply only to the given breakpoint, not viewports any wider or narrower.\n */\n@layer base, reset, transitional-styles;\n@layer transitional-styles {\n @layer _base;\n @layer _base {\n :host {\n border-right: 1px solid #333;\n box-sizing: border-box;\n display: flex;\n transition: 0.2s;\n z-index: 1;\n }\n :host(:last-child) {\n border-right: 0;\n }\n button {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n background: transparent;\n border-width: 0;\n color: var(--text-primary-color);\n cursor: pointer;\n flex-grow: 1;\n flex-shrink: 0;\n font-family: inherit;\n font-size: inherit;\n font-weight: 500;\n min-width: 6.625rem;\n overflow: hidden;\n padding: 0 1rem;\n text-align: center;\n text-overflow: ellipsis;\n white-space: nowrap;\n width: 100%;\n border-radius: 0;\n }\n @media (pointer: fine) {\n button:hover {\n background-color: var(--gds-sys-color-base-200);\n }\n }\n button[aria-current=true] {\n background-color: #333;\n color: #fff;\n }\n button:focus-visible {\n outline: 2px solid #000;\n outline-offset: -2px;\n }\n button:disabled,\n button[aria-disabled=true],\n button.disabled {\n color: var(--gds-sys-color-text-disabled) !important;\n border-color: var(--gds-sys-color-text-disabled) !important;\n cursor: not-allowed;\n }\n button:disabled::-moz-placeholder, button[aria-disabled=true]::-moz-placeholder, button.disabled::-moz-placeholder {\n color: var(--gds-sys-color-text-disabled);\n }\n button:disabled::placeholder,\n button[aria-disabled=true]::placeholder,\n button.disabled::placeholder {\n color: var(--gds-sys-color-text-disabled);\n }\n }\n}";
|
|
2
2
|
export default styles;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const styles = "@layer base, reset, transitional-styles;\n\n@layer transitional-styles {\n @layer _base, _overrides;\n\n @layer _base {\n :host {\n background-color: #fff;\n border: 1px solid #333;\n border-radius: 4px;\n box-sizing: border-box;\n contain: layout;\n display: inline-flex;\n height: 3rem;\n max-width: 100%;\n overflow: hidden;\n }\n\n :host([size='small']) {\n height: 2.5rem;\n }\n\n #track {\n box-sizing: border-box;\n display: flex;\n flex-grow: 0;\n flex-shrink: 1;\n scroll-snap-type: inline mandatory;\n overscroll-behavior-x: contain;\n scroll-behavior: smooth;\n overflow-x: scroll;\n position: relative;\n width: 100%;\n scrollbar-width: none;\n }\n\n #track::-webkit-scrollbar {\n display: none;\n }\n\n #btn-prev,\n #btn-next {\n align-items: center;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n aspect-ratio: 1;\n background-color: #fff;\n border-width: 0;\n color: #333;\n cursor: pointer;\n display: flex;\n font-size: 1rem;\n height: 100%;\n justify-content: center;\n width: 2.5rem;\n z-index: 2;\n position: absolute;\n transition: 0.2s;\n\n @media (pointer: fine) {\n &:hover {\n background-color: var(--
|
|
1
|
+
const styles = "@layer base, reset, transitional-styles;\n\n@layer transitional-styles {\n @layer _base, _overrides;\n\n @layer _base {\n :host {\n background-color: #fff;\n border: 1px solid #333;\n border-radius: 4px;\n box-sizing: border-box;\n contain: layout;\n display: inline-flex;\n height: 3rem;\n max-width: 100%;\n overflow: hidden;\n }\n\n :host([size='small']) {\n height: 2.5rem;\n }\n\n #track {\n box-sizing: border-box;\n display: flex;\n flex-grow: 0;\n flex-shrink: 1;\n scroll-snap-type: inline mandatory;\n overscroll-behavior-x: contain;\n scroll-behavior: smooth;\n overflow-x: scroll;\n position: relative;\n width: 100%;\n scrollbar-width: none;\n }\n\n #track::-webkit-scrollbar {\n display: none;\n }\n\n #btn-prev,\n #btn-next {\n align-items: center;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n aspect-ratio: 1;\n background-color: #fff;\n border-width: 0;\n color: #333;\n cursor: pointer;\n display: flex;\n font-size: 1rem;\n height: 100%;\n justify-content: center;\n width: 2.5rem;\n z-index: 2;\n position: absolute;\n transition: 0.2s;\n\n @media (pointer: fine) {\n &:hover {\n background-color: var(--gds-sys-color-base-200);\n }\n }\n }\n\n #btn-prev {\n border-right: 1px solid #333;\n }\n #btn-next {\n border-left: 1px solid #333;\n right: 0;\n }\n\n #btn-prev[aria-hidden='true'],\n #btn-next[aria-hidden='true'] {\n opacity: 0;\n width: 0;\n margin: 0;\n padding: 0;\n }\n\n :host([size='small']) #btn-prev,\n :host([size='small']) #btn-next {\n width: 2rem;\n }\n\n ::slotted(*) {\n flex-grow: 1;\n flex-shrink: 0;\n z-index: 1;\n scroll-margin: 0 2.5rem;\n scroll-snap-align: start;\n }\n\n #indicator {\n display: none;\n }\n }\n\n /* @layer _overrides {\n } */\n}\n";
|
|
2
2
|
export default styles;
|
|
@@ -15,7 +15,7 @@ import * as Types from './table.types';
|
|
|
15
15
|
* @event gds-page-change - Fired when the active page changes. Detail: `{ page: number }`
|
|
16
16
|
* @event gds-rows-change - Fired when the rows per page value changes. Detail: `{ rows: number }`
|
|
17
17
|
* @event gds-sort-change - Fired when sorting changes. Detail: `{ sortColumn: string, sortDirection: 'asc' | 'desc' }`
|
|
18
|
-
* @event gds-table-data-loaded - Fired when data is successfully loaded.
|
|
18
|
+
* @event gds-table-data-loaded - Fired when data is successfully loaded. Detail: `{ rows: T[], total: number, page: number, rowsPerPage: number, searchQuery: string, sortColumn?: string, sortDirection?: 'asc' | 'desc' }`
|
|
19
19
|
* @event gds-table-data-error - Fired when data loading fails.
|
|
20
20
|
* @event gds-table-selection - Fired when row selection changes.
|
|
21
21
|
*/
|
|
@@ -70,6 +70,10 @@ export declare class GdsTable<T extends Types.Row = Types.Row> extends GdsElemen
|
|
|
70
70
|
* Enables row selection functionality.
|
|
71
71
|
*/
|
|
72
72
|
selectable: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Disables select all checkbox in header.
|
|
75
|
+
*/
|
|
76
|
+
disableSelectAll: boolean;
|
|
73
77
|
/**
|
|
74
78
|
* Transforms table layout for mobile screens.
|
|
75
79
|
*/
|
|
@@ -132,6 +136,17 @@ export declare class GdsTable<T extends Types.Row = Types.Row> extends GdsElemen
|
|
|
132
136
|
private _selected;
|
|
133
137
|
private _error;
|
|
134
138
|
private _onDataChange;
|
|
139
|
+
/**
|
|
140
|
+
* Syncs the external `page` property to internal view state and reloads data.
|
|
141
|
+
* Without this, setting `.page` from outside (e.g. via attribute or binding)
|
|
142
|
+
* would update the Lit property but not trigger a data fetch.
|
|
143
|
+
*/
|
|
144
|
+
private _onPageChange;
|
|
145
|
+
/**
|
|
146
|
+
* Syncs the external `rows` property to internal view state and reloads data.
|
|
147
|
+
* Resets to page 1 since changing page size invalidates the current position.
|
|
148
|
+
*/
|
|
149
|
+
private _onRowsChange;
|
|
135
150
|
private _onColumnsChange;
|
|
136
151
|
connectedCallback(): void;
|
|
137
152
|
render(): any;
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
__privateMethod,
|
|
6
6
|
__privateSet
|
|
7
7
|
} from "../../chunks/chunk.QU3DSPNU.js";
|
|
8
|
-
var _cache, _cacheDuration,
|
|
8
|
+
var _cache, _cacheDuration, _GdsTable_instances, Density_get, hasSelection_get, isAllSelected_get, isPartialSelection_get, getCacheKey_fn, isCacheValid_fn, loadData_fn, getRowKey_fn, renderCellWrapped_fn, renderMobileLabel_fn, renderSlotElement_fn, renderCellContent_fn, renderSortIcon_fn, hasHeaderContent_fn, renderHeaderControls_fn, renderColumnHeader_fn, renderActionsHeader_fn, renderSelectableHeader_fn, renderColumnHeaders_fn, renderTableHeader_fn, renderTableCell_fn, renderSelectableCell_fn, renderRowCells_fn, renderActionsCell_fn, renderTableRow_fn, renderCheckbox_fn, renderSkeletonCell_fn, renderSkeletonRow_fn, renderTableBody_fn, renderTable_fn, renderErrorState_fn, renderEmptyState_fn, renderFooter_fn, renderHeadline_fn, handleSearch_fn, handleSearchClear_fn, handleSort_fn, handlePageChange_fn, handlePageSizeChange_fn, handleColumnVisibility_fn, handleSelectAll_fn, handleRowSelect_fn, selectAllInternal_fn, clearSelectionInternal_fn, emitSelectionChange_fn, initializeScrollTracking_fn, updateVerticalScrollState_fn, updateHorizontalScrollState_fn;
|
|
9
9
|
import { localized, msg } from "@lit/localize";
|
|
10
10
|
import { property, state } from "lit/decorators.js";
|
|
11
11
|
import { classMap } from "lit/directives/class-map.js";
|
|
@@ -29,7 +29,6 @@ let GdsTable = class extends GdsElement {
|
|
|
29
29
|
__privateAdd(this, _GdsTable_instances);
|
|
30
30
|
__privateAdd(this, _cache, {});
|
|
31
31
|
__privateAdd(this, _cacheDuration, 5 * 60 * 1e3);
|
|
32
|
-
__privateAdd(this, _templateCache, /* @__PURE__ */ new Map());
|
|
33
32
|
this.headlineTag = "h2";
|
|
34
33
|
this.options = [5, 10, 20, 50, 100];
|
|
35
34
|
this.page = 1;
|
|
@@ -37,6 +36,7 @@ let GdsTable = class extends GdsElement {
|
|
|
37
36
|
this.columns = [];
|
|
38
37
|
this.density = "comfortable";
|
|
39
38
|
this.selectable = false;
|
|
39
|
+
this.disableSelectAll = false;
|
|
40
40
|
this.responsive = false;
|
|
41
41
|
this.plain = false;
|
|
42
42
|
this.searchable = false;
|
|
@@ -65,6 +65,14 @@ let GdsTable = class extends GdsElement {
|
|
|
65
65
|
__privateSet(this, _cache, {});
|
|
66
66
|
__privateMethod(this, _GdsTable_instances, loadData_fn).call(this);
|
|
67
67
|
}
|
|
68
|
+
_onPageChange() {
|
|
69
|
+
this._view = { ...this._view, page: Number(this.page ?? 1) };
|
|
70
|
+
__privateMethod(this, _GdsTable_instances, loadData_fn).call(this);
|
|
71
|
+
}
|
|
72
|
+
_onRowsChange() {
|
|
73
|
+
this._view = { ...this._view, rows: Number(this.rows ?? 10), page: 1 };
|
|
74
|
+
__privateMethod(this, _GdsTable_instances, loadData_fn).call(this);
|
|
75
|
+
}
|
|
68
76
|
_onColumnsChange() {
|
|
69
77
|
__privateSet(this, _cache, {});
|
|
70
78
|
this._view = {
|
|
@@ -147,7 +155,6 @@ let GdsTable = class extends GdsElement {
|
|
|
147
155
|
};
|
|
148
156
|
_cache = new WeakMap();
|
|
149
157
|
_cacheDuration = new WeakMap();
|
|
150
|
-
_templateCache = new WeakMap();
|
|
151
158
|
_GdsTable_instances = new WeakSet();
|
|
152
159
|
Density_get = function() {
|
|
153
160
|
return Types.DENSITY_CONFIG[this.density];
|
|
@@ -182,6 +189,18 @@ loadData_fn = async function() {
|
|
|
182
189
|
this._rowsState = cachedData.rows;
|
|
183
190
|
this._total = cachedData.total;
|
|
184
191
|
this._loaded = false;
|
|
192
|
+
this.dispatchCustomEvent("gds-table-data-loaded", {
|
|
193
|
+
detail: {
|
|
194
|
+
rows: cachedData.rows,
|
|
195
|
+
total: cachedData.total,
|
|
196
|
+
page: this._view.page,
|
|
197
|
+
rowsPerPage: this._view.rows,
|
|
198
|
+
searchQuery: this._view.searchQuery,
|
|
199
|
+
sortColumn: this._view.sortColumn,
|
|
200
|
+
sortDirection: this._view.sortDirection
|
|
201
|
+
},
|
|
202
|
+
bubbles: true
|
|
203
|
+
});
|
|
185
204
|
return;
|
|
186
205
|
}
|
|
187
206
|
}
|
|
@@ -208,7 +227,14 @@ loadData_fn = async function() {
|
|
|
208
227
|
this._selected.clear();
|
|
209
228
|
this._loaded = false;
|
|
210
229
|
this.dispatchCustomEvent("gds-table-data-loaded", {
|
|
211
|
-
detail:
|
|
230
|
+
detail: {
|
|
231
|
+
...response,
|
|
232
|
+
page: this._view.page,
|
|
233
|
+
rowsPerPage: this._view.rows,
|
|
234
|
+
searchQuery: this._view.searchQuery,
|
|
235
|
+
sortColumn: this._view.sortColumn,
|
|
236
|
+
sortDirection: this._view.sortDirection
|
|
237
|
+
},
|
|
212
238
|
bubbles: true
|
|
213
239
|
});
|
|
214
240
|
} catch (error) {
|
|
@@ -222,190 +248,64 @@ loadData_fn = async function() {
|
|
|
222
248
|
}
|
|
223
249
|
};
|
|
224
250
|
/**
|
|
225
|
-
*
|
|
226
|
-
* Uses caching to prevent repeated DOM queries for better performance in large tables.
|
|
251
|
+
* Gets the unique key for slot naming (prioritizes: custom key > row.id > index)
|
|
227
252
|
*/
|
|
228
|
-
|
|
229
|
-
if (
|
|
230
|
-
|
|
231
|
-
const template = this.querySelector(
|
|
232
|
-
`template[name="${slot}"]`
|
|
233
|
-
);
|
|
234
|
-
__privateGet(this, _templateCache).set(slot, template);
|
|
253
|
+
getRowKey_fn = function(row, index, slotKey) {
|
|
254
|
+
if (typeof slotKey === "string" || typeof slotKey === "number") {
|
|
255
|
+
return slotKey;
|
|
235
256
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
if (!config) return null;
|
|
240
|
-
if (Array.isArray(config)) {
|
|
241
|
-
return config.map((c) => __privateMethod(this, _GdsTable_instances, renderCell_fn).call(this, c, row));
|
|
242
|
-
}
|
|
243
|
-
const resolve = (value) => typeof value === "function" ? value(row) : value;
|
|
244
|
-
switch (config.type) {
|
|
245
|
-
case "badge": {
|
|
246
|
-
const variant = resolve(config.variant) || "information";
|
|
247
|
-
const size = resolve(config.size) || __privateGet(this, _GdsTable_instances, Density_get).badge;
|
|
248
|
-
return html`
|
|
249
|
-
<gds-badge size="${size}" variant="${variant}">
|
|
250
|
-
${resolve(config.value)}
|
|
251
|
-
</gds-badge>
|
|
252
|
-
`;
|
|
253
|
-
}
|
|
254
|
-
case "image": {
|
|
255
|
-
const src = resolve(config.src);
|
|
256
|
-
if (!src) return null;
|
|
257
|
-
const width = resolve(config.width) || "24px";
|
|
258
|
-
const height = resolve(config.height) || "24px";
|
|
259
|
-
const borderRadius = resolve(config["border-radius"]) || "max";
|
|
260
|
-
const objectFit = resolve(config["object-fit"]) || "cover";
|
|
261
|
-
const alt = resolve(config.alt) || "";
|
|
262
|
-
return html`
|
|
263
|
-
<gds-img
|
|
264
|
-
src="${src}"
|
|
265
|
-
alt="${alt}"
|
|
266
|
-
width="${width}"
|
|
267
|
-
height="${height}"
|
|
268
|
-
border-radius="${borderRadius}"
|
|
269
|
-
object-fit="${objectFit}"
|
|
270
|
-
object-position="center"
|
|
271
|
-
></gds-img>
|
|
272
|
-
`;
|
|
273
|
-
}
|
|
274
|
-
case "icon": {
|
|
275
|
-
const template = resolve(config.template);
|
|
276
|
-
const size = resolve(config.size);
|
|
277
|
-
const color = resolve(config.color);
|
|
278
|
-
const clonedSlot = __privateMethod(this, _GdsTable_instances, getSlotContent_fn).call(this, template);
|
|
279
|
-
if (!clonedSlot) return null;
|
|
280
|
-
if (clonedSlot instanceof DocumentFragment) {
|
|
281
|
-
const iconElement = clonedSlot.firstElementChild;
|
|
282
|
-
if (iconElement) {
|
|
283
|
-
if (size) iconElement.setAttribute("size", size);
|
|
284
|
-
if (color) iconElement.setAttribute("color", color);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
return clonedSlot;
|
|
288
|
-
}
|
|
289
|
-
case "button": {
|
|
290
|
-
const size = resolve(config.size) || __privateGet(this, _GdsTable_instances, Density_get).button;
|
|
291
|
-
const variant = resolve(config.variant);
|
|
292
|
-
const rank = resolve(config.rank);
|
|
293
|
-
const label = resolve(config.label);
|
|
294
|
-
const template = resolve(config.template);
|
|
295
|
-
const clonedSlot = __privateMethod(this, _GdsTable_instances, getSlotContent_fn).call(this, template);
|
|
296
|
-
const content = [label, clonedSlot];
|
|
297
|
-
return html`
|
|
298
|
-
<gds-button
|
|
299
|
-
size="${size}"
|
|
300
|
-
variant="${variant || "neutral"}"
|
|
301
|
-
rank="${rank || "secondary"}"
|
|
302
|
-
@click="${(e) => {
|
|
303
|
-
e.stopPropagation();
|
|
304
|
-
config.onClick(row);
|
|
305
|
-
}}"
|
|
306
|
-
>
|
|
307
|
-
${content}
|
|
308
|
-
</gds-button>
|
|
309
|
-
`;
|
|
310
|
-
}
|
|
311
|
-
case "link": {
|
|
312
|
-
const href = resolve(config.href);
|
|
313
|
-
if (!href) return null;
|
|
314
|
-
const label = resolve(config.label);
|
|
315
|
-
const target = resolve(config.target);
|
|
316
|
-
const download = resolve(config.download);
|
|
317
|
-
const template = resolve(config.template);
|
|
318
|
-
const clonedSlot = __privateMethod(this, _GdsTable_instances, getSlotContent_fn).call(this, template);
|
|
319
|
-
const content = [label, clonedSlot];
|
|
320
|
-
return html`
|
|
321
|
-
<gds-link
|
|
322
|
-
href=${ifDefined(href)}
|
|
323
|
-
target=${ifDefined(target)}
|
|
324
|
-
.download=${download}
|
|
325
|
-
text-decoration="underline"
|
|
326
|
-
>
|
|
327
|
-
${content}
|
|
328
|
-
</gds-link>
|
|
329
|
-
`;
|
|
330
|
-
}
|
|
331
|
-
case "context-menu": {
|
|
332
|
-
const items = config.items;
|
|
333
|
-
const size = __privateGet(this, _GdsTable_instances, Density_get).button;
|
|
334
|
-
return html`
|
|
335
|
-
<gds-context-menu>
|
|
336
|
-
<gds-button
|
|
337
|
-
slot="trigger"
|
|
338
|
-
size="${size}"
|
|
339
|
-
rank="tertiary"
|
|
340
|
-
label="${msg("Actions")}"
|
|
341
|
-
>
|
|
342
|
-
<gds-icon-dot-grid-one-horizontal></gds-icon-dot-grid-one-horizontal>
|
|
343
|
-
</gds-button>
|
|
344
|
-
${items.map((item) => {
|
|
345
|
-
const label = resolve(item.label);
|
|
346
|
-
return html`
|
|
347
|
-
<gds-menu-item @click="${() => item.onClick(row)}">
|
|
348
|
-
${label}
|
|
349
|
-
</gds-menu-item>
|
|
350
|
-
`;
|
|
351
|
-
})}
|
|
352
|
-
</gds-context-menu>
|
|
353
|
-
`;
|
|
354
|
-
}
|
|
355
|
-
case "formatted-number": {
|
|
356
|
-
const value = resolve(config.value);
|
|
357
|
-
const formatter = Table.FormatNumber[config.format || "decimalsAndThousands"];
|
|
358
|
-
return formatter(value, config.locale, config.currency, config.decimals);
|
|
359
|
-
}
|
|
360
|
-
case "formatted-account": {
|
|
361
|
-
const value = resolve(config.value);
|
|
362
|
-
const formatter = Table.FormatAccount[config.format || "seb-account"];
|
|
363
|
-
return formatter(value);
|
|
364
|
-
}
|
|
365
|
-
case "formatted-date": {
|
|
366
|
-
const value = resolve(config.value);
|
|
367
|
-
const formatter = Table.FormatDate[config.format || "dateLong"];
|
|
368
|
-
return formatter(value, config.locale);
|
|
369
|
-
}
|
|
370
|
-
default:
|
|
371
|
-
return null;
|
|
257
|
+
const rowId = row?.id;
|
|
258
|
+
if (typeof rowId === "string" || typeof rowId === "number") {
|
|
259
|
+
return rowId;
|
|
372
260
|
}
|
|
261
|
+
return index + 1;
|
|
262
|
+
};
|
|
263
|
+
renderCellWrapped_fn = function(content) {
|
|
264
|
+
return html`<span class="cell-wrapped-content">${content}</span>`;
|
|
265
|
+
};
|
|
266
|
+
renderMobileLabel_fn = function(column) {
|
|
267
|
+
return html`<span class="column-label" aria-hidden="true">
|
|
268
|
+
${column.label}:
|
|
269
|
+
</span>`;
|
|
270
|
+
};
|
|
271
|
+
renderSlotElement_fn = function(columnKey, rowKey, slotId) {
|
|
272
|
+
const slotName = `${columnKey}:${rowKey}:${slotId}`;
|
|
273
|
+
return html`<slot name="${slotName}"></slot>`;
|
|
373
274
|
};
|
|
374
275
|
/**
|
|
375
|
-
* Renders
|
|
376
|
-
*
|
|
276
|
+
* Renders cell content with proper ordering and wrapping.
|
|
277
|
+
*
|
|
278
|
+
* **Slot-based content:**
|
|
279
|
+
* - Renders in exact order: ['lead', 'value', 'button'] → icon, text, button
|
|
280
|
+
* - Wraps value when column.justify is set (for flexbox)
|
|
281
|
+
* - Slots stay unwrapped
|
|
377
282
|
*
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
* 2. cell.value - Cell type configuration (badge, button, etc.)
|
|
381
|
-
* 3. row[column.key] - Raw data value
|
|
283
|
+
* **Plain content:**
|
|
284
|
+
* - Wraps when column.justify is set, otherwise renders directly
|
|
382
285
|
*/
|
|
383
|
-
renderCellContent_fn = function(row, column) {
|
|
384
|
-
const
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
286
|
+
renderCellContent_fn = function(row, column, index) {
|
|
287
|
+
const rawValue = column.value ? column.value(row) : row[column.key];
|
|
288
|
+
const isMobile = this._isMobile && this.responsive;
|
|
289
|
+
const shouldWrap = !!column.justify;
|
|
290
|
+
let content;
|
|
291
|
+
if (Types.isSlotValue(rawValue)) {
|
|
292
|
+
const rowKey = __privateMethod(this, _GdsTable_instances, getRowKey_fn).call(this, row, index, rawValue.key);
|
|
293
|
+
content = rawValue.slots.map((slotItem) => {
|
|
294
|
+
if (slotItem === "value") {
|
|
295
|
+
if (rawValue.value === void 0) return null;
|
|
296
|
+
return shouldWrap ? __privateMethod(this, _GdsTable_instances, renderCellWrapped_fn).call(this, rawValue.value) : rawValue.value;
|
|
297
|
+
}
|
|
298
|
+
return __privateMethod(this, _GdsTable_instances, renderSlotElement_fn).call(this, column.key, rowKey, slotItem);
|
|
299
|
+
});
|
|
390
300
|
} else {
|
|
391
|
-
|
|
301
|
+
content = shouldWrap ? __privateMethod(this, _GdsTable_instances, renderCellWrapped_fn).call(this, rawValue) : rawValue;
|
|
392
302
|
}
|
|
393
|
-
const processedValue = column.justify ? html`<span>${value}</span>` : value;
|
|
394
|
-
const isResponsive = this._isMobile && this.responsive;
|
|
395
|
-
const mobileLabel = isResponsive ? html`
|
|
396
|
-
<span class="column-label" aria-hidden="true">
|
|
397
|
-
${column.label}:
|
|
398
|
-
</span>
|
|
399
|
-
` : null;
|
|
400
|
-
const ariaLabel = isResponsive ? `${column.label}: ` : "";
|
|
401
303
|
return html`
|
|
402
|
-
<div
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
__privateMethod(this, _GdsTable_instances, renderCell_fn).call(this, cell?.trail, row)
|
|
408
|
-
]}
|
|
304
|
+
<div
|
|
305
|
+
class="cell-content"
|
|
306
|
+
aria-label=${ifDefined(isMobile ? column.label : void 0)}
|
|
307
|
+
>
|
|
308
|
+
${isMobile ? __privateMethod(this, _GdsTable_instances, renderMobileLabel_fn).call(this, column) : null} ${content}
|
|
409
309
|
</div>
|
|
410
310
|
`;
|
|
411
311
|
};
|
|
@@ -530,11 +430,15 @@ renderActionsHeader_fn = function() {
|
|
|
530
430
|
const label = this.actions.label || msg("Actions");
|
|
531
431
|
const classes = classMap({
|
|
532
432
|
actions: true,
|
|
433
|
+
wrap: Boolean(this.actions.width),
|
|
533
434
|
[`align-${this.actions.align}`]: !!this.actions.align,
|
|
534
435
|
[`justify-${this.actions.justify}`]: !!this.actions.justify
|
|
535
436
|
});
|
|
437
|
+
const style = styleMap({
|
|
438
|
+
"--cell-width": this.actions.width
|
|
439
|
+
});
|
|
536
440
|
return html`
|
|
537
|
-
<th class="${classes}">
|
|
441
|
+
<th class="${classes}" style=${style}>
|
|
538
442
|
<div class="column-header">
|
|
539
443
|
<div class="column-label">${label}</div>
|
|
540
444
|
</div>
|
|
@@ -549,7 +453,8 @@ renderSelectableHeader_fn = function() {
|
|
|
549
453
|
checked: __privateGet(this, _GdsTable_instances, isAllSelected_get),
|
|
550
454
|
indeterminate: __privateGet(this, _GdsTable_instances, isPartialSelection_get),
|
|
551
455
|
ariaLabel: msg("Select all rows"),
|
|
552
|
-
onToggle: () => __privateMethod(this, _GdsTable_instances, handleSelectAll_fn).call(this, {})
|
|
456
|
+
onToggle: () => __privateMethod(this, _GdsTable_instances, handleSelectAll_fn).call(this, {}),
|
|
457
|
+
skip: this.disableSelectAll
|
|
553
458
|
})}
|
|
554
459
|
</th>
|
|
555
460
|
`;
|
|
@@ -570,7 +475,7 @@ renderTableHeader_fn = function() {
|
|
|
570
475
|
</thead>
|
|
571
476
|
`;
|
|
572
477
|
};
|
|
573
|
-
renderTableCell_fn = function(row, column) {
|
|
478
|
+
renderTableCell_fn = function(row, column, index) {
|
|
574
479
|
const classes = classMap({
|
|
575
480
|
[`align-${column.align}`]: !!column.align,
|
|
576
481
|
[`justify-${column.justify}`]: !!column.justify,
|
|
@@ -581,7 +486,7 @@ renderTableCell_fn = function(row, column) {
|
|
|
581
486
|
});
|
|
582
487
|
return html`
|
|
583
488
|
<td style=${style} class=${classes}>
|
|
584
|
-
${__privateMethod(this, _GdsTable_instances, renderCellContent_fn).call(this, row, column)}
|
|
489
|
+
${__privateMethod(this, _GdsTable_instances, renderCellContent_fn).call(this, row, column, index)}
|
|
585
490
|
</td>
|
|
586
491
|
`;
|
|
587
492
|
};
|
|
@@ -601,8 +506,8 @@ renderSelectableCell_fn = function(index) {
|
|
|
601
506
|
</td>
|
|
602
507
|
`;
|
|
603
508
|
};
|
|
604
|
-
renderRowCells_fn = function(row) {
|
|
605
|
-
return this.columns.filter((column) => this._view.visibleColumns.has(column.key)).map((column) => __privateMethod(this, _GdsTable_instances, renderTableCell_fn).call(this, row, column));
|
|
509
|
+
renderRowCells_fn = function(row, index) {
|
|
510
|
+
return this.columns.filter((column) => this._view.visibleColumns.has(column.key)).map((column) => __privateMethod(this, _GdsTable_instances, renderTableCell_fn).call(this, row, column, index));
|
|
606
511
|
};
|
|
607
512
|
renderActionsCell_fn = function(row, index) {
|
|
608
513
|
if (!this.actions) return null;
|
|
@@ -613,15 +518,21 @@ renderActionsCell_fn = function(row, index) {
|
|
|
613
518
|
</td>
|
|
614
519
|
`;
|
|
615
520
|
}
|
|
616
|
-
const
|
|
521
|
+
const rowKey = __privateMethod(this, _GdsTable_instances, getRowKey_fn).call(this, row, index);
|
|
617
522
|
const classes = classMap({
|
|
618
523
|
"actions-cell": true,
|
|
524
|
+
wrap: Boolean(this.actions.width),
|
|
619
525
|
[`align-${this.actions.align}`]: !!this.actions.align,
|
|
620
526
|
[`justify-${this.actions.justify}`]: !!this.actions.justify
|
|
621
527
|
});
|
|
528
|
+
const style = styleMap({
|
|
529
|
+
"--cell-width": this.actions.width
|
|
530
|
+
});
|
|
622
531
|
return html`
|
|
623
|
-
<td class="${classes}">
|
|
624
|
-
<div class="cell-content"
|
|
532
|
+
<td class="${classes}" style=${style}>
|
|
533
|
+
<div class="cell-content">
|
|
534
|
+
${__privateMethod(this, _GdsTable_instances, renderSlotElement_fn).call(this, "actions", rowKey, "main")}
|
|
535
|
+
</div>
|
|
625
536
|
</td>
|
|
626
537
|
`;
|
|
627
538
|
};
|
|
@@ -635,7 +546,7 @@ renderTableRow_fn = function(row, index) {
|
|
|
635
546
|
>
|
|
636
547
|
${[
|
|
637
548
|
__privateMethod(this, _GdsTable_instances, renderSelectableCell_fn).call(this, index),
|
|
638
|
-
__privateMethod(this, _GdsTable_instances, renderRowCells_fn).call(this, row),
|
|
549
|
+
__privateMethod(this, _GdsTable_instances, renderRowCells_fn).call(this, row, index),
|
|
639
550
|
__privateMethod(this, _GdsTable_instances, renderActionsCell_fn).call(this, row, index)
|
|
640
551
|
]}
|
|
641
552
|
</tr>
|
|
@@ -646,8 +557,10 @@ renderCheckbox_fn = function({
|
|
|
646
557
|
indeterminate = false,
|
|
647
558
|
disabled = false,
|
|
648
559
|
ariaLabel,
|
|
649
|
-
onToggle
|
|
560
|
+
onToggle,
|
|
561
|
+
skip = false
|
|
650
562
|
}) {
|
|
563
|
+
if (skip) return null;
|
|
651
564
|
const toggle = (e) => {
|
|
652
565
|
e.stopPropagation();
|
|
653
566
|
if (disabled) return;
|
|
@@ -751,7 +664,7 @@ renderTable_fn = function() {
|
|
|
751
664
|
variant="${this.variant}"
|
|
752
665
|
padding="0"
|
|
753
666
|
border-radius="m"
|
|
754
|
-
border-width="0; s{5xs}"
|
|
667
|
+
border-width="${this.responsive ? "0; s{5xs}" : "5xs"}"
|
|
755
668
|
class="table-card"
|
|
756
669
|
>
|
|
757
670
|
<div class=${CLASSES} tabindex="0">
|
|
@@ -1072,6 +985,13 @@ __decorateClass([
|
|
|
1072
985
|
__decorateClass([
|
|
1073
986
|
property({ type: Boolean, reflect: false })
|
|
1074
987
|
], GdsTable.prototype, "selectable", 2);
|
|
988
|
+
__decorateClass([
|
|
989
|
+
property({
|
|
990
|
+
attribute: "disable-select-all",
|
|
991
|
+
type: Boolean,
|
|
992
|
+
reflect: false
|
|
993
|
+
})
|
|
994
|
+
], GdsTable.prototype, "disableSelectAll", 2);
|
|
1075
995
|
__decorateClass([
|
|
1076
996
|
property({ type: Boolean, reflect: false })
|
|
1077
997
|
], GdsTable.prototype, "responsive", 2);
|
|
@@ -1137,6 +1057,12 @@ __decorateClass([
|
|
|
1137
1057
|
watch("dataLoadKey"),
|
|
1138
1058
|
watch("data")
|
|
1139
1059
|
], GdsTable.prototype, "_onDataChange", 1);
|
|
1060
|
+
__decorateClass([
|
|
1061
|
+
watch("page", { waitUntilFirstUpdate: true })
|
|
1062
|
+
], GdsTable.prototype, "_onPageChange", 1);
|
|
1063
|
+
__decorateClass([
|
|
1064
|
+
watch("rows", { waitUntilFirstUpdate: true })
|
|
1065
|
+
], GdsTable.prototype, "_onRowsChange", 1);
|
|
1140
1066
|
__decorateClass([
|
|
1141
1067
|
watch("columns")
|
|
1142
1068
|
], GdsTable.prototype, "_onColumnsChange", 1);
|
|
@@ -1,53 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
id: number;
|
|
4
|
-
name: string;
|
|
5
|
-
email: string;
|
|
6
|
-
role: 'Admin' | 'User' | 'Editor';
|
|
7
|
-
status: 'Active' | 'Inactive';
|
|
8
|
-
amount: number;
|
|
9
|
-
account: string;
|
|
10
|
-
lastLogin: string;
|
|
11
|
-
avatarUrl?: string;
|
|
12
|
-
department?: string;
|
|
13
|
-
download?: string;
|
|
14
|
-
}
|
|
15
|
-
interface FeedbackData {
|
|
16
|
-
id: number;
|
|
17
|
-
name: string;
|
|
18
|
-
email: string;
|
|
19
|
-
feedback: string;
|
|
20
|
-
notes: string;
|
|
21
|
-
status: 'Active' | 'Inactive';
|
|
22
|
-
department: string;
|
|
23
|
-
}
|
|
1
|
+
import { TemplateResult } from 'lit';
|
|
2
|
+
import type { TableActions, TableColumn, TableRequest, TableResponse } from './table.types';
|
|
24
3
|
export declare const Users: {
|
|
25
4
|
Columns: TableColumn[];
|
|
26
|
-
Actions:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
divider: boolean;
|
|
39
|
-
label: string;
|
|
40
|
-
})[];
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
Data: (request: TableRequest) => Promise<TableResponse<UserData>>;
|
|
5
|
+
Actions: TableActions;
|
|
6
|
+
Data: (request: TableRequest) => Promise<TableResponse<any>>;
|
|
7
|
+
/**
|
|
8
|
+
* Generates slot content for the given rows (current page).
|
|
9
|
+
* Creates per-row slot elements using `columnKey:rowKey:slotId` convention.
|
|
10
|
+
*
|
|
11
|
+
* Used with Lit's `render()` to update table light DOM on each data load:
|
|
12
|
+
* ```ts
|
|
13
|
+
* @gds-table-data-loaded=${(e) => render(Users.SlotContent(e.detail.rows), table)}
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
SlotContent: (rows: any[]) => TemplateResult;
|
|
44
17
|
};
|
|
45
18
|
export declare const Feedback: {
|
|
46
19
|
Columns: TableColumn[];
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
20
|
+
Data: (request: TableRequest) => Promise<TableResponse<any>>;
|
|
21
|
+
};
|
|
22
|
+
export declare const Actions: {
|
|
23
|
+
Columns: TableColumn[];
|
|
24
|
+
MultipleActions: TableActions;
|
|
25
|
+
MultipleActionsSlotContent: (rows: any[]) => TemplateResult;
|
|
26
|
+
ActionLink: TableActions;
|
|
27
|
+
ActionLinkSlotContent: (rows: any[]) => TemplateResult;
|
|
28
|
+
ActionContextMenu: TableActions;
|
|
29
|
+
ActionContextMenuSlotContent: (rows: any[]) => TemplateResult;
|
|
30
|
+
Data: (request: TableRequest) => Promise<TableResponse<any>>;
|
|
52
31
|
};
|
|
53
|
-
export {};
|