@sellmate/design-system 1.7.2 → 1.7.3
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/cjs/sd-select_3.cjs.entry.js +3 -3
- package/dist/collection/components/sd-select/sd-select-listbox/sd-select-listbox.js +3 -3
- package/dist/components/p-D7g33VZR.js +1 -0
- package/dist/components/{p-ZSGGRCNc.js → p-DKwnEkHE.js} +1 -1
- package/dist/components/sd-key-value-table.js +1 -1
- package/dist/components/sd-select-listbox.js +1 -1
- package/dist/components/sd-select.js +1 -1
- package/dist/components/sd-table.js +1 -1
- package/dist/design-system/design-system.esm.js +1 -1
- package/dist/design-system/p-25204798.entry.js +1 -0
- package/dist/esm/sd-select_3.entry.js +3 -3
- package/hydrate/index.js +3 -3
- package/hydrate/index.mjs +3 -3
- package/package.json +1 -1
- package/dist/components/p-CARYLqH9.js +0 -1
- package/dist/design-system/p-97b405aa.entry.js +0 -1
|
@@ -318,7 +318,7 @@ const SdSelectListbox = class {
|
|
|
318
318
|
label: '전체',
|
|
319
319
|
};
|
|
320
320
|
get showSelectAll() {
|
|
321
|
-
return this.useSelectAll && this.isMulti;
|
|
321
|
+
return this.useSelectAll && this.isMulti && this.getAllNonDisabledLeaves().length > 0;
|
|
322
322
|
}
|
|
323
323
|
getAllNonDisabledLeaves() {
|
|
324
324
|
const collect = (opts) => opts.flatMap(o => {
|
|
@@ -637,9 +637,9 @@ const SdSelectListbox = class {
|
|
|
637
637
|
'--listbox-max-height': this.maxHeight ?? '260px',
|
|
638
638
|
'--listbox-radius': `${sdSelect_config.LIST_BOX_LAYOUT.radius}px`,
|
|
639
639
|
};
|
|
640
|
-
return (index.h("div", { key: '
|
|
640
|
+
return (index.h("div", { key: '49f10bc8511fedcc0224729593498273088e16a3', class: "sd-select-listbox", style: cssVars }, this.showSearch && (index.h("sd-select-list-item-search", { key: '2eab7f77c0e900f90a79b2b2e9a7e60da2349409', isScrolled: this.isScrolled, onSdSearchFilter: this.handleSearchFilter })), index.h("div", { key: '46407c47a1d24ee8d997060c2b54f2443c163700', class: "sd-select-listbox__list", onScroll: this.handleScroll, ref: el => {
|
|
641
641
|
this.listEl = el;
|
|
642
|
-
} }, this.showSelectAll && (index.h("sd-select-list-item", { key: '
|
|
642
|
+
} }, this.showSelectAll && (index.h("sd-select-list-item", { key: '9c4a35e6515fb9bc9cd4feafc69a44c432b75139', option: SdSelectListbox.SELECT_ALL_OPTION, depth: 1, isSelected: this.selectAllState, isFocused: this.isOptionFocused(SdSelectListbox.SELECT_ALL_OPTION), useCheckbox: true, onSdListItemClick: this.handleSelectAllClick, onMouseEnter: () => this.handleOptionHover(SdSelectListbox.SELECT_ALL_OPTION) })), this.isEmpty ? (index.h("div", { class: "sd-select-listbox__empty" }, sdSelect_config.EMPTY_MESSAGE)) : this.isDepth ? (this.renderOptions(this.filteredOptions)) : (this.filteredOptions.map(option => (index.h("sd-select-list-item", { option: option, depth: 1, isSelected: this.isOptionSelected(option), isFocused: this.isOptionFocused(option), useCheckbox: this.isMulti, onSdListItemClick: this.handleOptionClick, onMouseEnter: () => this.handleOptionHover(option) })))))));
|
|
643
643
|
}
|
|
644
644
|
static get watchers() { return {
|
|
645
645
|
"searchKeyword": [{
|
|
@@ -29,7 +29,7 @@ export class SdSelectListbox {
|
|
|
29
29
|
label: '전체',
|
|
30
30
|
};
|
|
31
31
|
get showSelectAll() {
|
|
32
|
-
return this.useSelectAll && this.isMulti;
|
|
32
|
+
return this.useSelectAll && this.isMulti && this.getAllNonDisabledLeaves().length > 0;
|
|
33
33
|
}
|
|
34
34
|
getAllNonDisabledLeaves() {
|
|
35
35
|
const collect = (opts) => opts.flatMap(o => {
|
|
@@ -348,9 +348,9 @@ export class SdSelectListbox {
|
|
|
348
348
|
'--listbox-max-height': this.maxHeight ?? '260px',
|
|
349
349
|
'--listbox-radius': `${LIST_BOX_LAYOUT.radius}px`,
|
|
350
350
|
};
|
|
351
|
-
return (h("div", { key: '
|
|
351
|
+
return (h("div", { key: '49f10bc8511fedcc0224729593498273088e16a3', class: "sd-select-listbox", style: cssVars }, this.showSearch && (h("sd-select-list-item-search", { key: '2eab7f77c0e900f90a79b2b2e9a7e60da2349409', isScrolled: this.isScrolled, onSdSearchFilter: this.handleSearchFilter })), h("div", { key: '46407c47a1d24ee8d997060c2b54f2443c163700', class: "sd-select-listbox__list", onScroll: this.handleScroll, ref: el => {
|
|
352
352
|
this.listEl = el;
|
|
353
|
-
} }, this.showSelectAll && (h("sd-select-list-item", { key: '
|
|
353
|
+
} }, this.showSelectAll && (h("sd-select-list-item", { key: '9c4a35e6515fb9bc9cd4feafc69a44c432b75139', option: SdSelectListbox.SELECT_ALL_OPTION, depth: 1, isSelected: this.selectAllState, isFocused: this.isOptionFocused(SdSelectListbox.SELECT_ALL_OPTION), useCheckbox: true, onSdListItemClick: this.handleSelectAllClick, onMouseEnter: () => this.handleOptionHover(SdSelectListbox.SELECT_ALL_OPTION) })), this.isEmpty ? (h("div", { class: "sd-select-listbox__empty" }, EMPTY_MESSAGE)) : this.isDepth ? (this.renderOptions(this.filteredOptions)) : (this.filteredOptions.map(option => (h("sd-select-list-item", { option: option, depth: 1, isSelected: this.isOptionSelected(option), isFocused: this.isOptionFocused(option), useCheckbox: this.isMulti, onSdListItemClick: this.handleOptionClick, onMouseEnter: () => this.handleOptionHover(option) })))))));
|
|
354
354
|
}
|
|
355
355
|
static get is() { return "sd-select-listbox"; }
|
|
356
356
|
static get encapsulation() { return "shadow"; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as t,H as e,c as s,h as i,t as h}from"./p-pwNG5WaX.js";import{c as o,d as r,f as l,E as n,e as c}from"./p-C4uWhzoG.js";import{d}from"./p-Cye8r1MG.js";import{d as a}from"./p-DQj-S8AC.js";import{d as u}from"./p-DP0Dp12H.js";import{d as m}from"./p-EcuI_UmK.js";const p=t(class t extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.optionSelect=s(this,"sdOptionSelect",7)}type="default";options=[];value=null;emitValue=!1;useSearch=!1;useSelectAll=!1;triggerWidth="200px";maxWidth="640px";maxHeight="260px";searchKeyword="";isScrolled=!1;focusedIndex=-1;optionSelect;listEl;lastScrolledIndex=-1;keydownAttached=!1;suppressHover=!1;get isDepth(){return"default_depth"===this.type||"multi_depth"===this.type}get isMulti(){return"multi"===this.type||"multi_depth"===this.type}static SELECT_ALL_OPTION={value:"__select_all__",label:"전체"};get showSelectAll(){return this.useSelectAll&&this.isMulti&&this.getAllNonDisabledLeaves().length>0}getAllNonDisabledLeaves(){const t=e=>e.flatMap((e=>e.disabled?[]:e.children?t(e.children):[e]));return t(this.options)}get selectAllState(){if(!this.showSelectAll)return!1;const t=this.getAllNonDisabledLeaves();if(0===t.length)return!1;const e=this.getSelectedValues(),s=t.filter((t=>e.has(t.value))).length;return 0!==s&&(s===t.length||null)}get showSearch(){return!!this.useSearch&&(this.isDepth?o(this.options):this.options.length)>=r}get filteredOptions(){if(""===this.searchKeyword)return this.options;if(this.isDepth)return l(this.options,this.searchKeyword);const t=this.searchKeyword.toLowerCase();return this.options.filter((e=>e.label.toLowerCase().includes(t)))}get isEmpty(){return this.isDepth?0===o(this.filteredOptions)&&0===this.filteredOptions.length:0===this.filteredOptions.length}getSelectedValues(){return null!=this.value&&Array.isArray(this.value)?this.emitValue?new Set(this.value):new Set(this.value.map((t=>t.value))):new Set}isOptionSelected(t){return this.isMulti?this.getSelectedValues().has(t.value):this.emitValue||null==this.value||"object"!=typeof this.value||Array.isArray(this.value)?this.value===t.value:this.value.value===t.value}getGroupSelectionState(t){if(!this.isMulti||!t.children)return!1;const e=this.getSelectedValues();if(0===e.size)return!1;const s=this.collectVisibleLeaves(t);if(0===s.length)return!1;const i=s.filter((t=>e.has(t.value))).length;return 0!==i&&(i===s.length||null)}getCountInfo(t){if(!this.isMulti||!t.children)return;const e=this.getSelectedValues(),s=this.collectVisibleLeaves(t);return{selected:s.filter((t=>e.has(t.value))).length,total:s.length}}findOriginalOption(t,e){for(const s of e){if(s.value===t)return s;if(s.children){const e=this.findOriginalOption(t,s.children);if(e)return e}}}collectLeaves(t){return t.children?t.children.flatMap((t=>this.collectLeaves(t))):[t]}collectVisibleLeaves(t){if(t.disabled)return[];if(!t.children)return[t];if(0===t.children.length){const e=this.findOriginalOption(t.value,this.options);return e?this.collectLeaves(e).filter((t=>!t.disabled)):[]}return t.children.flatMap((t=>this.collectVisibleLeaves(t)))}get navigableOptions(){const e=[];this.showSelectAll&&e.push(t.SELECT_ALL_OPTION);const s=t=>{for(const i of t){const t=!!i.children;(!t||this.isMulti)&&!i.disabled&&e.push(i),t&&i.children&&i.children.length>0&&s(i.children)}};return s(this.filteredOptions),e}isSelectAllOption(e){return this.showSelectAll&&e.value===t.SELECT_ALL_OPTION.value}emitSelectAll(){if(!this.showSelectAll)return;const e=this.getAllNonDisabledLeaves();this.optionSelect.emit({option:{...t.SELECT_ALL_OPTION,children:e},leaves:e})}handleSelectAllClick=t=>{t.stopPropagation(),this.emitSelectAll()};isOptionFocused(t){if(this.focusedIndex<0)return!1;const e=this.navigableOptions[this.focusedIndex];return null!=e&&e.value===t.value}resetFocusOnFilter(){this.focusedIndex=this.navigableOptions.length>0?0:-1,this.suppressHover&&(document.removeEventListener("mousemove",this.releaseHoverSuppress,!0),this.suppressHover=!1)}handleSearchFilter=t=>{this.searchKeyword=t.detail};handleScroll=t=>{this.isScrolled=t.target.scrollTop>0};emitOptionSelect(t){this.optionSelect.emit({option:t,leaves:this.collectVisibleLeaves(t)})}handleOptionClick=t=>{t.stopPropagation(),this.emitOptionSelect(t.detail)};handleOptionHover=t=>{if(this.suppressHover)return;const e=this.navigableOptions.findIndex((e=>e.value===t.value));e>=0&&(this.focusedIndex=e)};releaseHoverSuppress=()=>{this.suppressHover=!1,document.removeEventListener("mousemove",this.releaseHoverSuppress,!0)};handleKeyDown=t=>{const e=this.navigableOptions;if("ArrowDown"===t.key){if(0===e.length)return;t.preventDefault(),t.stopPropagation(),this.focusedIndex=this.focusedIndex<0?0:(this.focusedIndex+1)%e.length,this.beginHoverSuppression()}else if("ArrowUp"===t.key){if(0===e.length)return;t.preventDefault(),t.stopPropagation(),this.focusedIndex=this.focusedIndex<=0?e.length-1:this.focusedIndex-1,this.beginHoverSuppression()}else if("Enter"===t.key){if(this.focusedIndex<0||this.focusedIndex>=e.length)return;t.preventDefault(),t.stopPropagation();const s=e[this.focusedIndex];this.isSelectAllOption(s)?this.emitSelectAll():this.emitOptionSelect(s)}};beginHoverSuppression(){this.suppressHover||(this.suppressHover=!0,document.addEventListener("mousemove",this.releaseHoverSuppress,!0))}scrollFocusedIntoView(){const t=this.listEl,e=t?.querySelector(".sd-select-list-item--focused");if(!t||!e)return;const s=t.getBoundingClientRect(),i=e.getBoundingClientRect();i.top<s.top?t.scrollTop+=i.top-s.top:i.bottom>s.bottom&&(t.scrollTop+=i.bottom-s.bottom)}connectedCallback(){this.keydownAttached||(document.addEventListener("keydown",this.handleKeyDown,!0),this.keydownAttached=!0)}disconnectedCallback(){this.keydownAttached&&(document.removeEventListener("keydown",this.handleKeyDown,!0),this.keydownAttached=!1),this.suppressHover&&(document.removeEventListener("mousemove",this.releaseHoverSuppress,!0),this.suppressHover=!1)}componentDidRender(){this.focusedIndex!==this.lastScrolledIndex&&(this.lastScrolledIndex=this.focusedIndex,this.focusedIndex>=0&&this.scrollFocusedIntoView())}renderOptions(t,e=1){return t.map((t=>{const s=!!t.children;return[i("sd-select-list-item",{option:t,depth:e,isSelected:s?this.getGroupSelectionState(t):this.isOptionSelected(t),isFocused:this.isOptionFocused(t),useCheckbox:this.isMulti,countInfo:this.getCountInfo(t),onSdListItemClick:this.handleOptionClick,onMouseEnter:()=>this.handleOptionHover(t)}),s&&t.children?this.renderOptions(t.children,e+1):null]}))}render(){return i("div",{key:"49f10bc8511fedcc0224729593498273088e16a3",class:"sd-select-listbox",style:{"--listbox-trigger-width":this.triggerWidth??"200px","--listbox-max-width":this.maxWidth??"640px","--listbox-max-height":this.maxHeight??"260px","--listbox-radius":`${c.radius}px`}},this.showSearch&&i("sd-select-list-item-search",{key:"2eab7f77c0e900f90a79b2b2e9a7e60da2349409",isScrolled:this.isScrolled,onSdSearchFilter:this.handleSearchFilter}),i("div",{key:"46407c47a1d24ee8d997060c2b54f2443c163700",class:"sd-select-listbox__list",onScroll:this.handleScroll,ref:t=>{this.listEl=t}},this.showSelectAll&&i("sd-select-list-item",{key:"9c4a35e6515fb9bc9cd4feafc69a44c432b75139",option:t.SELECT_ALL_OPTION,depth:1,isSelected:this.selectAllState,isFocused:this.isOptionFocused(t.SELECT_ALL_OPTION),useCheckbox:!0,onSdListItemClick:this.handleSelectAllClick,onMouseEnter:()=>this.handleOptionHover(t.SELECT_ALL_OPTION)}),this.isEmpty?i("div",{class:"sd-select-listbox__empty"},n):this.isDepth?this.renderOptions(this.filteredOptions):this.filteredOptions.map((t=>i("sd-select-list-item",{option:t,depth:1,isSelected:this.isOptionSelected(t),isFocused:this.isOptionFocused(t),useCheckbox:this.isMulti,onSdListItemClick:this.handleOptionClick,onMouseEnter:()=>this.handleOptionHover(t)})))))}static get watchers(){return{searchKeyword:[{resetFocusOnFilter:0}]}}static get style(){return":host{display:block}:host .sd-select-listbox{display:flex;flex-direction:column;width:var(--listbox-trigger-width);max-width:var(--listbox-max-width);max-height:var(--listbox-max-height);border-radius:var(--listbox-radius);background:white;box-shadow:2px 2px 12px 2px rgba(0, 0, 0, 0.1);overflow:hidden;outline:none}:host .sd-select-listbox__list{flex:1;min-height:0;overflow-y:auto;padding-bottom:0}:host .sd-select-listbox__empty{padding:12px;text-align:center;font-size:12px;line-height:20px;color:#888888}"}},[513,"sd-select-listbox",{type:[1],options:[16],value:[8],emitValue:[4,"emit-value"],useSearch:[4,"use-search"],useSelectAll:[4,"use-select-all"],triggerWidth:[1,"trigger-width"],maxWidth:[1,"max-width"],maxHeight:[1,"max-height"],searchKeyword:[32],isScrolled:[32],focusedIndex:[32]},void 0,{searchKeyword:[{resetFocusOnFilter:0}]}]);function f(){"undefined"!=typeof customElements&&["sd-select-listbox","sd-checkbox","sd-icon","sd-select-list-item","sd-select-list-item-search"].forEach((t=>{switch(t){case"sd-select-listbox":customElements.get(h(t))||customElements.define(h(t),p);break;case"sd-checkbox":customElements.get(h(t))||d();break;case"sd-icon":customElements.get(h(t))||a();break;case"sd-select-list-item":customElements.get(h(t))||u();break;case"sd-select-list-item-search":customElements.get(h(t))||m()}}))}export{p as S,f as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as e,c as s,h as i,t as o}from"./p-pwNG5WaX.js";import{n as r}from"./p-CCwNgVmC.js";import{d as l}from"./p-B6L3bPm2.js";import{d as h}from"./p-Cye8r1MG.js";import{d as a}from"./p-DmDGMDzt.js";import{d}from"./p-CwQTEZWO.js";import{d as n}from"./p-DQj-S8AC.js";import{d as c}from"./p-DCFqtVBm.js";import{d as p}from"./p-DP0Dp12H.js";import{d as u}from"./p-EcuI_UmK.js";import{d as m}from"./p-
|
|
1
|
+
import{p as t,H as e,c as s,h as i,t as o}from"./p-pwNG5WaX.js";import{n as r}from"./p-CCwNgVmC.js";import{d as l}from"./p-B6L3bPm2.js";import{d as h}from"./p-Cye8r1MG.js";import{d as a}from"./p-DmDGMDzt.js";import{d}from"./p-CwQTEZWO.js";import{d as n}from"./p-DQj-S8AC.js";import{d as c}from"./p-DCFqtVBm.js";import{d as p}from"./p-DP0Dp12H.js";import{d as u}from"./p-EcuI_UmK.js";import{d as m}from"./p-D7g33VZR.js";import{d as f}from"./p-DoREs-rv.js";import{d as g}from"./p-D6cUtm8p.js";const b=t(class t extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.update=s(this,"sdUpdate",7),this.dropDownShow=s(this,"sdDropDownShow",7)}static VIEWPORT_PADDING=20;static PORTAL_OFFSET_Y=4;static CLOSE_ANIMATION_DURATION=150;get el(){return this}type="default";value=null;options=[];placeholder="선택";maxDropdownWidth="640px";dropdownHeight="260px";disabled=!1;label="";labelWidth="";addonLabel="";addonAlign="start";error=!1;hint="";errorMessage="";rules=[];icon=void 0;labelTooltip="";labelTooltipProps=null;emitValue=!1;width="";useSearch=!1;allSelectedLabel="전체";useSelectAll=!1;isOpen=!1;isAnimatingOut=!1;triggerWidth="200px";resolvedDropdownHeight="260px";resolvedMaxDropdownWidth="640px";focused=!1;hovered=!1;update;dropDownShow;async sdFocus(){this.disabled||await(this.triggerComponentRef?.sdFocus())}async sdOpen(){await new Promise((t=>setTimeout(t,0))),this.disabled||this.isOpen||(this.prepareDropdownGeometry(),this.closeAnimationTimer&&clearTimeout(this.closeAnimationTimer),this.isAnimatingOut=!1,this.isOpen=!0)}triggerRef;triggerComponentRef;closeAnimationTimer;name=r();triggerHasFocus=!1;watchIsOpen(t){this.syncFocusedState(t),this.dropDownShow.emit({isOpen:t})}get isMulti(){return"multi"===this.type||"multi_depth"===this.type}get displayText(){if(this.isMulti){if(!Array.isArray(this.value)||0===this.value.length)return"";const t=this.getNonDisabledLeaves(this.options),e=this.getSelectedOptions();if(t.length>0&&t.every((t=>e.some((e=>e.value===t.value)))))return this.allSelectedLabel??"전체";const s=this.flattenOptions(this.options);return this.value.map((t=>{if(null!=t&&"object"==typeof t){const e=t;return e.label??s.find((t=>t.value===e.value))?.label??""}return s.find((e=>e.value===t))?.label??""})).filter(Boolean).join(", ")}if(null==this.value)return"";if(!this.emitValue&&"object"==typeof this.value&&!Array.isArray(this.value))return this.value.label??"";const t=this.flattenOptions(this.options).find((t=>t.value===this.value));return t?.label??""}flattenOptions(t){return t.flatMap((t=>t.children?this.flattenOptions(t.children):[t]))}getNonDisabledLeaves(t){return t.flatMap((t=>t.disabled?[]:t.children?this.getNonDisabledLeaves(t.children):[t]))}getSelectedOptions(){const t=this.value;return null!=t&&Array.isArray(t)?this.emitValue?t.map((t=>this.findOriginalOption(t,this.options))).filter((t=>!!t)):t:[]}toMultiValue(t){return this.emitValue?t.map((t=>t.value)):t}parsePixelValue(t,e){const s=Number.parseFloat(t);return Number.isFinite(s)?s:e}updateDropdownViewportConstraints(){if(!this.triggerRef)return;const e=this.triggerRef.getBoundingClientRect(),s=t.VIEWPORT_PADDING,i=t.PORTAL_OFFSET_Y,o=this.parsePixelValue(this.dropdownHeight,260),r=this.parsePixelValue(this.maxDropdownWidth,640),l=Math.max(window.innerHeight-e.bottom-s-i,0),h=Math.max(e.top-s-i,0),a=Math.max(l,h),d=Math.max(window.innerWidth-2*s,0);this.resolvedDropdownHeight=`${Math.min(o,a)}px`,this.resolvedMaxDropdownWidth=`${Math.min(r,d)}px`}handleViewportResize=()=>{this.isOpen&&this.updateDropdownViewportConstraints()};findOriginalOption(t,e){for(const s of e){if(s.value===t)return s;if(s.children){const e=this.findOriginalOption(t,s.children);if(e)return e}}}closeDropdown(){this.isOpen&&(this.isOpen=!1,this.isAnimatingOut=!0,this.closeAnimationTimer&&clearTimeout(this.closeAnimationTimer),this.closeAnimationTimer=setTimeout((()=>{this.isAnimatingOut=!1}),t.CLOSE_ANIMATION_DURATION))}prepareDropdownGeometry(){this.triggerRef&&(this.triggerWidth=`${this.triggerRef.offsetWidth}px`),this.updateDropdownViewportConstraints()}syncFocusedState(t=this.isOpen){this.focused=t||this.triggerHasFocus}handleTriggerFocus=()=>{this.triggerHasFocus=!0,this.syncFocusedState()};handleTriggerBlur=()=>{this.triggerHasFocus=!1,this.syncFocusedState()};handleTriggerClick=()=>{this.isOpen?this.closeDropdown():(this.prepareDropdownGeometry(),this.closeAnimationTimer&&clearTimeout(this.closeAnimationTimer),this.isAnimatingOut=!1,this.isOpen=!0)};emitUpdate(t){this.update.emit(t)}handleOptionSelect=t=>{const{option:e,leaves:s}=t;if(this.isMulti)this.handleMultiSelect(e,s);else{this.closeDropdown(),this.value=this.emitValue?e.value:e;const t=this.value;requestAnimationFrame((()=>{this.emitUpdate(t)}))}};handleMultiSelect(t,e){const s=this.getSelectedOptions();let i;if(t.children)if(e.every((t=>s.some((e=>e.value===t.value))))){const t=new Set(e.map((t=>t.value)));i=s.filter((e=>!t.has(e.value)))}else{const t=new Set(s.map((t=>t.value))),o=e.filter((e=>!t.has(e.value)));i=[...s,...o]}else i=s.some((e=>e.value===t.value))?s.filter((e=>e.value!==t.value)):[...s,t];this.value=this.toMultiValue(i),this.emitUpdate(this.value)}connectedCallback(){window.addEventListener("resize",this.handleViewportResize)}disconnectedCallback(){window.removeEventListener("resize",this.handleViewportResize),this.closeAnimationTimer&&clearTimeout(this.closeAnimationTimer)}render(){const e={open:this.isOpen,parentRef:this.triggerRef,viewportPadding:t.VIEWPORT_PADDING,onSdClose:()=>{this.closeDropdown()}};return i("sd-field",{key:"3c188cbdd8c612e78780d18c03acc382d32080c9",name:this.name,label:this.label,labelWidth:this.labelWidth,addonLabel:this.addonLabel,addonAlign:this.addonAlign,hint:this.hint,errorMessage:this.errorMessage,width:this.width,rules:this.rules,error:this.error,disabled:this.disabled,focused:this.focused,hovered:this.hovered,icon:this.icon,labelTooltip:this.labelTooltip,labelTooltipProps:this.labelTooltipProps,onMouseEnter:()=>{this.hovered=!0},onMouseLeave:()=>{this.hovered=!1}},i("div",{key:"be596d399856ed966408ba1525fea9dbdf8fcc7e",class:"sd-select",ref:t=>{this.triggerRef=t}},i("sd-select-trigger",{key:"f8a29b1ac2469c60af8c7101d05157674566f00f",ref:t=>{this.triggerComponentRef=t},displayText:this.displayText,placeholder:this.placeholder??"선택",disabled:this.disabled,isOpen:this.isOpen,onSdTriggerClick:this.handleTriggerClick,onSdTriggerFocus:this.handleTriggerFocus,onSdTriggerBlur:this.handleTriggerBlur})),(this.isOpen||this.isAnimatingOut)&&i("sd-portal",{key:"3cef3f95f69b09d0e4e8f6b01615df4cca031cff",...e},i("sd-select-listbox",{key:"e8833c547aa2e8084754c7a439d3860df5c97e5b",type:this.type,options:this.options,value:this.value,emitValue:this.emitValue,useSearch:this.useSearch,useSelectAll:this.useSelectAll,triggerWidth:this.triggerWidth,maxWidth:this.resolvedMaxDropdownWidth,maxHeight:this.resolvedDropdownHeight,onSdOptionSelect:t=>this.handleOptionSelect(t.detail)})))}static get watchers(){return{isOpen:[{watchIsOpen:0}]}}static get style(){return"sd-select{display:inline-flex}sd-select sd-portal{display:none}sd-select .sd-select{position:relative;width:100%;height:100%}"}},[512,"sd-select",{type:[1],value:[1032],options:[16],placeholder:[1],maxDropdownWidth:[1,"max-dropdown-width"],dropdownHeight:[1,"dropdown-height"],disabled:[4],label:[1],labelWidth:[8,"label-width"],addonLabel:[1,"addon-label"],addonAlign:[1,"addon-align"],error:[1028],hint:[1],errorMessage:[1,"error-message"],rules:[16],icon:[16],labelTooltip:[1,"label-tooltip"],labelTooltipProps:[16],emitValue:[4,"emit-value"],width:[8],useSearch:[4,"use-search"],allSelectedLabel:[1,"all-selected-label"],useSelectAll:[4,"use-select-all"],name:[1],isOpen:[32],isAnimatingOut:[32],triggerWidth:[32],resolvedDropdownHeight:[32],resolvedMaxDropdownWidth:[32],focused:[32],hovered:[32],sdFocus:[64],sdOpen:[64]},void 0,{isOpen:[{watchIsOpen:0}]}]);function w(){"undefined"!=typeof customElements&&["sd-select","sd-button","sd-checkbox","sd-field","sd-floating-portal","sd-icon","sd-portal","sd-select-list-item","sd-select-list-item-search","sd-select-listbox","sd-select-trigger","sd-tooltip"].forEach((t=>{switch(t){case"sd-select":customElements.get(o(t))||customElements.define(o(t),b);break;case"sd-button":customElements.get(o(t))||l();break;case"sd-checkbox":customElements.get(o(t))||h();break;case"sd-field":customElements.get(o(t))||a();break;case"sd-floating-portal":customElements.get(o(t))||d();break;case"sd-icon":customElements.get(o(t))||n();break;case"sd-portal":customElements.get(o(t))||c();break;case"sd-select-list-item":customElements.get(o(t))||p();break;case"sd-select-list-item-search":customElements.get(o(t))||u();break;case"sd-select-listbox":customElements.get(o(t))||m();break;case"sd-select-trigger":customElements.get(o(t))||f();break;case"sd-tooltip":customElements.get(o(t))||g()}}))}export{b as S,w as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,H as t,c as s,h as a,t as d}from"./p-pwNG5WaX.js";import{s as l}from"./p-j2khhcHY.js";import{t as r}from"./p-D6GUzecR.js";import{d as i}from"./p-B6L3bPm2.js";import{d as o}from"./p-B6JOxZKP.js";import{d as n}from"./p-Cye8r1MG.js";import{d as c}from"./p-DMrXwfmf.js";import{d as u}from"./p-f10Mw7qM.js";import{d as p}from"./p-DISZkQqT.js";import{d as b}from"./p-cX2DD74L.js";import{d as k}from"./p-B6G64i5a.js";import{d as v}from"./p-DmDGMDzt.js";import{d as m}from"./p-C8c6MuKQ.js";import{d as h}from"./p-CwQTEZWO.js";import{d as y}from"./p-DhtKHJ7-.js";import{d as f}from"./p-DQj-S8AC.js";import{d as g}from"./p-I9SoAcVO.js";import{d as _}from"./p-Bhh7ig9Q.js";import{d as w}from"./p-DCFqtVBm.js";import{d as x}from"./p-CTuKWVTh.js";import{d as j}from"./p-B45aOf4I.js";import{d as E}from"./p-ZSGGRCNc.js";import{d as S}from"./p-DP0Dp12H.js";import{d as D}from"./p-EcuI_UmK.js";import{d as N}from"./p-CARYLqH9.js";import{d as z}from"./p-DoREs-rv.js";import{d as C}from"./p-BWJtQGYo.js";import{d as U}from"./p-D6cUtm8p.js";const q=r.table,B=Number(q.keyValue.height),F=Number(q.radius),T=Number(q.body.paddingX),G=Number(q.keyValue.body.padding),H=Number(q.header.gap),M=Number(q.content.gap),A=Number(q.border.width),I=Number(q.keyValue.search.paddingX),L={border:q.border.color,thBg:q.header.bg,thLabel:l.color.fg.primary,required:l.color.fg.accent,helpIcon:l.color.fg.success,tdBg:l.color.bg.frame,tdText:l.color.fg.primary,searchBg:q.keyValue.search.bg},Q={labelFontFamily:q.header.typography.fontFamily,labelFontSize:Number(q.header.typography.fontSize),labelFontWeight:Number(q.header.typography.fontWeight),labelLineHeight:Number(q.header.typography.lineHeight),tdFontFamily:q.body.typography.fontFamily,tdFontSize:Number(q.body.typography.fontSize),tdFontWeight:Number(q.body.typography.fontWeight),tdLineHeight:Number(q.body.typography.lineHeight)},W=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.change=s(this,"sdChange",7),this.searchEvent=s(this,"sdSearch",7)}fields=[];search=!1;useTop=!1;change;searchEvent;emit=(e,t)=>{this.change.emit({name:e,value:t})};handleSearchClick=()=>{this.searchEvent.emit()};renderField(e){const t=t=>this.emit(e.name,t.detail);switch(e.type){case"input":return a("sd-input",{width:"100%",...e.options??{},onSdUpdate:t});case"textarea":return a("sd-textarea",{width:"100%",...e.options??{},onSdUpdate:t});case"number-input":return a("sd-number-input",{width:"100%",...e.options??{},onSdUpdate:t});case"select":return a("sd-select",{width:"100%",...e.options??{},onSdUpdate:t});case"radio":{const{value:s,direction:d,...l}=e.options??{};return a("sd-radio-group",{...l,value:s,direction:d??"horizontal",onSdUpdate:t})}case"checkbox":{const{value:s,...d}=e.options??{};return a("sd-checkbox",{...d,value:s,onSdUpdate:t})}case"date-picker":return a("sd-date-picker",{width:"100%",...e.options??{},onSdUpdate:t});case"date-range-picker":return a("sd-date-range-picker",{width:"100%",...e.options??{},onSdUpdate:t});case"file-picker":return a("sd-file-picker",{width:"100%",...e.options??{},onSdUpdate:t});default:return a("span",{class:"sd-key-value-table__text"},e.options?.value??"")}}renderHelpIcon(e){return a("span",{class:"sd-key-value-table__help"},a("sd-tooltip",{icon:"helpOutline",iconSize:16,color:L.helpIcon,trigger:"hover"},e))}computeAutoSkipTh(){const e=this.fields.map((e=>e.map((()=>!1))));return this.fields.forEach(((t,s)=>{t.forEach(((t,a)=>{const d=null!=t.thRowSpan&&t.thRowSpan>1?t.thRowSpan:1;if(!(d<=1))for(let t=1;t<d;t++){const d=e[s+t];d&&a<d.length&&(d[a]=!0)}}))})),e}computeMaxCols(e){let t=0;return this.fields.forEach(((s,a)=>{let d=0;s.forEach(((t,s)=>{let l;l=t.hideTh?0:e[a]?.[s]?1:null!=t.thColSpan&&t.thColSpan>1?t.thColSpan:1,d+=l+(null!=t.tdColSpan&&t.tdColSpan>1?t.tdColSpan:1)})),d>t&&(t=d)})),t}renderTh(e,t,s){const d=null!=e.thRowSpan&&e.thRowSpan>1?e.thRowSpan:void 0,l=null!=e.thColSpan&&e.thColSpan>1?e.thColSpan:void 0,r={"sd-key-value-table__th":!0};return"string"==typeof e.thClass?r[e.thClass]=!0:Array.isArray(e.thClass)&&e.thClass.forEach((e=>r[e]=!0)),a("th",{key:`th-${t}-${s}`,class:r,style:e.thStyle,scope:"row",rowSpan:d,colSpan:l},a("div",{class:"sd-key-value-table__th-inner"},a("span",{class:"sd-key-value-table__label"},e.label,e.required&&a("sd-icon",{class:"sd-key-value-table__required",name:"star",size:12,color:L.required,label:"required"})),e.helpText&&this.renderHelpIcon(e.helpText)))}renderTd(e,t,s){return a("td",{key:`td-${t}-${s}`,class:"sd-key-value-table__td",rowSpan:null!=e.tdRowSpan&&e.tdRowSpan>1?e.tdRowSpan:void 0,colSpan:null!=e.tdColSpan&&e.tdColSpan>1?e.tdColSpan:void 0},a("div",{class:"sd-key-value-table__td-inner"},a("slot",{name:"field-"+e.name},this.renderField(e))))}warnDuplicateNames(){const e=new Set,t=new Set;this.fields.forEach((s=>s.forEach((s=>{e.has(s.name)?t.add(s.name):e.add(s.name)})))),t.size>0&&console.warn(`[sd-key-value-table] Duplicate field name(s) detected: ${[...t].join(", ")}. Slot names ("field-{name}") and sdChange events rely on unique names.`)}render(){if(0===this.fields.length)return null;const e={"--sd-kvt-row-height":B+"px","--sd-kvt-th-width":"120px","--sd-kvt-radius":F+"px","--sd-kvt-padding-x":T+"px","--sd-kvt-padding-y":G+"px","--sd-kvt-gap":H+"px","--sd-kvt-label-gap":M+"px","--sd-kvt-border-width":A+"px","--sd-kvt-border-color":L.border,"--sd-kvt-th-bg":L.thBg,"--sd-kvt-th-color":L.thLabel,"--sd-kvt-required-color":L.required,"--sd-kvt-td-bg":L.tdBg,"--sd-kvt-td-color":L.tdText,"--sd-kvt-label-font-family":Q.labelFontFamily,"--sd-kvt-label-font-size":Q.labelFontSize+"px","--sd-kvt-label-font-weight":""+Q.labelFontWeight,"--sd-kvt-label-line-height":Q.labelLineHeight+"px","--sd-kvt-td-font-family":Q.tdFontFamily,"--sd-kvt-td-font-size":Q.tdFontSize+"px","--sd-kvt-td-font-weight":""+Q.tdFontWeight,"--sd-kvt-td-line-height":Q.tdLineHeight+"px","--sd-kvt-search-bg":L.searchBg,"--sd-kvt-search-padding-x":I+"px"};this.warnDuplicateNames();const t=this.computeAutoSkipTh(),s=this.computeMaxCols(t),d=a("table",{class:{"sd-key-value-table":!0,"sd-key-value-table--use-top":this.useTop},style:e},a("colgroup",null,Array.from({length:s},((e,t)=>a("col",{key:"col-"+t,style:t%2==0?{width:"120px"}:void 0})))),a("tbody",null,this.fields.map(((e,s)=>a("tr",{class:"sd-key-value-table__row",key:"row-"+s},e.map(((e,a)=>[e.hideTh||t[s][a]?null:this.renderTh(e,s,a),this.renderTd(e,s,a)])))))));return this.search?a("div",{class:{"sd-key-value-table__wrapper":!0,"sd-key-value-table__wrapper--use-top":this.useTop},style:e},d,a("div",{class:"sd-key-value-table__search-panel"},a("sd-button",{label:"검색",name:"neutral_outline_md",onSdClick:this.handleSearchClick}))):d}static get style(){return"sd-key-value-table{display:block}sd-key-value-table .sd-key-value-table__wrapper{display:flex;align-items:stretch;width:100%;border:var(--sd-kvt-border-width) solid var(--sd-kvt-border-color);border-radius:var(--sd-kvt-radius);overflow:hidden}sd-key-value-table .sd-key-value-table__wrapper .sd-key-value-table{flex:1 1 auto;border:0;border-radius:0}sd-key-value-table .sd-key-value-table__wrapper.sd-key-value-table__wrapper--use-top{border-top-left-radius:0;border-top-right-radius:0}sd-key-value-table .sd-key-value-table__search-panel{display:flex;align-items:center;justify-content:center;flex:0 0 auto;padding:var(--sd-kvt-padding-y) var(--sd-kvt-search-padding-x);background:var(--sd-kvt-search-bg);border-left:var(--sd-kvt-border-width) solid var(--sd-kvt-border-color)}sd-key-value-table .sd-key-value-table{width:100%;table-layout:fixed;border:var(--sd-kvt-border-width) solid var(--sd-kvt-border-color);border-radius:var(--sd-kvt-radius);border-collapse:separate;border-spacing:0;overflow:hidden}sd-key-value-table .sd-key-value-table.sd-key-value-table--use-top{border-top-left-radius:0;border-top-right-radius:0}sd-key-value-table .sd-key-value-table__th,sd-key-value-table .sd-key-value-table__td{height:var(--sd-kvt-row-height);padding:var(--sd-kvt-padding-y) var(--sd-kvt-padding-x);box-sizing:border-box;vertical-align:middle;text-align:left;font-weight:normal;border-top:var(--sd-kvt-border-width) solid var(--sd-kvt-border-color)}sd-key-value-table .sd-key-value-table tbody>tr:first-child>.sd-key-value-table__th,sd-key-value-table .sd-key-value-table tbody>tr:first-child>.sd-key-value-table__td{border-top:0}sd-key-value-table .sd-key-value-table__th{width:var(--sd-kvt-th-width);background:var(--sd-kvt-th-bg);color:var(--sd-kvt-th-color)}sd-key-value-table .sd-key-value-table__th-inner{display:flex;align-items:center;justify-content:space-between;gap:var(--sd-kvt-gap);width:100%;height:100%}sd-key-value-table .sd-key-value-table__label{display:inline-flex;align-items:center;gap:var(--sd-kvt-label-gap);font-family:var(--sd-kvt-label-font-family);font-size:var(--sd-kvt-label-font-size);font-weight:var(--sd-kvt-label-font-weight);line-height:var(--sd-kvt-label-line-height);color:var(--sd-kvt-th-color)}sd-key-value-table .sd-key-value-table__required{display:inline-flex;align-items:center;flex-shrink:0}sd-key-value-table .sd-key-value-table__help{display:inline-flex;align-items:center;flex-shrink:0}sd-key-value-table .sd-key-value-table__td{background:var(--sd-kvt-td-bg);color:var(--sd-kvt-td-color)}sd-key-value-table .sd-key-value-table__td-inner{display:flex;align-items:center;width:100%;height:100%}sd-key-value-table .sd-key-value-table__td-inner>slot{display:block;flex:1 1 auto;min-width:0}sd-key-value-table .sd-key-value-table__td-inner sd-input,sd-key-value-table .sd-key-value-table__td-inner sd-textarea,sd-key-value-table .sd-key-value-table__td-inner sd-number-input,sd-key-value-table .sd-key-value-table__td-inner sd-select,sd-key-value-table .sd-key-value-table__td-inner sd-date-picker,sd-key-value-table .sd-key-value-table__td-inner sd-date-range-picker,sd-key-value-table .sd-key-value-table__td-inner sd-file-picker{width:100%}sd-key-value-table .sd-key-value-table__text{font-family:var(--sd-kvt-td-font-family);font-size:var(--sd-kvt-td-font-size);font-weight:var(--sd-kvt-td-font-weight);line-height:var(--sd-kvt-td-line-height);color:var(--sd-kvt-td-color)}"}},[772,"sd-key-value-table",{fields:[16],search:[4],useTop:[4,"use-top"]}]),K=W,O=function(){"undefined"!=typeof customElements&&["sd-key-value-table","sd-button","sd-calendar","sd-checkbox","sd-chip","sd-date-picker","sd-date-picker-trigger","sd-date-range-picker","sd-date-range-picker-calendar","sd-field","sd-file-picker","sd-floating-portal","sd-ghost-button","sd-icon","sd-input","sd-number-input","sd-portal","sd-radio","sd-radio-group","sd-select","sd-select-list-item","sd-select-list-item-search","sd-select-listbox","sd-select-trigger","sd-textarea","sd-tooltip"].forEach((e=>{switch(e){case"sd-key-value-table":customElements.get(d(e))||customElements.define(d(e),W);break;case"sd-button":customElements.get(d(e))||i();break;case"sd-calendar":customElements.get(d(e))||o();break;case"sd-checkbox":customElements.get(d(e))||n();break;case"sd-chip":customElements.get(d(e))||c();break;case"sd-date-picker":customElements.get(d(e))||u();break;case"sd-date-picker-trigger":customElements.get(d(e))||p();break;case"sd-date-range-picker":customElements.get(d(e))||b();break;case"sd-date-range-picker-calendar":customElements.get(d(e))||k();break;case"sd-field":customElements.get(d(e))||v();break;case"sd-file-picker":customElements.get(d(e))||m();break;case"sd-floating-portal":customElements.get(d(e))||h();break;case"sd-ghost-button":customElements.get(d(e))||y();break;case"sd-icon":customElements.get(d(e))||f();break;case"sd-input":customElements.get(d(e))||g();break;case"sd-number-input":customElements.get(d(e))||_();break;case"sd-portal":customElements.get(d(e))||w();break;case"sd-radio":customElements.get(d(e))||x();break;case"sd-radio-group":customElements.get(d(e))||j();break;case"sd-select":customElements.get(d(e))||E();break;case"sd-select-list-item":customElements.get(d(e))||S();break;case"sd-select-list-item-search":customElements.get(d(e))||D();break;case"sd-select-listbox":customElements.get(d(e))||N();break;case"sd-select-trigger":customElements.get(d(e))||z();break;case"sd-textarea":customElements.get(d(e))||C();break;case"sd-tooltip":customElements.get(d(e))||U()}}))};export{K as SdKeyValueTable,O as defineCustomElement}
|
|
1
|
+
import{p as e,H as t,c as s,h as a,t as d}from"./p-pwNG5WaX.js";import{s as l}from"./p-j2khhcHY.js";import{t as r}from"./p-D6GUzecR.js";import{d as i}from"./p-B6L3bPm2.js";import{d as o}from"./p-B6JOxZKP.js";import{d as n}from"./p-Cye8r1MG.js";import{d as u}from"./p-DMrXwfmf.js";import{d as c}from"./p-f10Mw7qM.js";import{d as p}from"./p-DISZkQqT.js";import{d as k}from"./p-cX2DD74L.js";import{d as b}from"./p-B6G64i5a.js";import{d as v}from"./p-DmDGMDzt.js";import{d as m}from"./p-C8c6MuKQ.js";import{d as h}from"./p-CwQTEZWO.js";import{d as y}from"./p-DhtKHJ7-.js";import{d as f}from"./p-DQj-S8AC.js";import{d as g}from"./p-I9SoAcVO.js";import{d as _}from"./p-Bhh7ig9Q.js";import{d as w}from"./p-DCFqtVBm.js";import{d as x}from"./p-CTuKWVTh.js";import{d as E}from"./p-B45aOf4I.js";import{d as j}from"./p-DKwnEkHE.js";import{d as S}from"./p-DP0Dp12H.js";import{d as D}from"./p-EcuI_UmK.js";import{d as N}from"./p-D7g33VZR.js";import{d as z}from"./p-DoREs-rv.js";import{d as U}from"./p-BWJtQGYo.js";import{d as C}from"./p-D6cUtm8p.js";const B=r.table,F=Number(B.keyValue.height),T=Number(B.radius),q=Number(B.body.paddingX),H=Number(B.keyValue.body.padding),M=Number(B.header.gap),G=Number(B.content.gap),I=Number(B.border.width),K=Number(B.keyValue.search.paddingX),Q={border:B.border.color,thBg:B.header.bg,thLabel:l.color.fg.primary,required:l.color.fg.accent,helpIcon:l.color.fg.success,tdBg:l.color.bg.frame,tdText:l.color.fg.primary,searchBg:B.keyValue.search.bg},W={labelFontFamily:B.header.typography.fontFamily,labelFontSize:Number(B.header.typography.fontSize),labelFontWeight:Number(B.header.typography.fontWeight),labelLineHeight:Number(B.header.typography.lineHeight),tdFontFamily:B.body.typography.fontFamily,tdFontSize:Number(B.body.typography.fontSize),tdFontWeight:Number(B.body.typography.fontWeight),tdLineHeight:Number(B.body.typography.lineHeight)},A=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.change=s(this,"sdChange",7),this.searchEvent=s(this,"sdSearch",7)}fields=[];search=!1;useTop=!1;change;searchEvent;emit=(e,t)=>{this.change.emit({name:e,value:t})};handleSearchClick=()=>{this.searchEvent.emit()};renderField(e){const t=t=>this.emit(e.name,t.detail);switch(e.type){case"input":return a("sd-input",{width:"100%",...e.options??{},onSdUpdate:t});case"textarea":return a("sd-textarea",{width:"100%",...e.options??{},onSdUpdate:t});case"number-input":return a("sd-number-input",{width:"100%",...e.options??{},onSdUpdate:t});case"select":return a("sd-select",{width:"100%",...e.options??{},onSdUpdate:t});case"radio":{const{value:s,direction:d,...l}=e.options??{};return a("sd-radio-group",{...l,value:s,direction:d??"horizontal",onSdUpdate:t})}case"checkbox":{const{value:s,...d}=e.options??{};return a("sd-checkbox",{...d,value:s,onSdUpdate:t})}case"date-picker":return a("sd-date-picker",{width:"100%",...e.options??{},onSdUpdate:t});case"date-range-picker":return a("sd-date-range-picker",{width:"100%",...e.options??{},onSdUpdate:t});case"file-picker":return a("sd-file-picker",{width:"100%",...e.options??{},onSdUpdate:t});default:return a("span",{class:"sd-key-value-table__text"},e.options?.value??"")}}renderHelpIcon(e){return a("span",{class:"sd-key-value-table__help"},a("sd-tooltip",{icon:"helpOutline",iconSize:16,color:Q.helpIcon,trigger:"hover"},e))}computeAutoSkipTh(){const e=this.fields.map((e=>e.map((()=>!1))));return this.fields.forEach(((t,s)=>{t.forEach(((t,a)=>{const d=null!=t.thRowSpan&&t.thRowSpan>1?t.thRowSpan:1;if(!(d<=1))for(let t=1;t<d;t++){const d=e[s+t];d&&a<d.length&&(d[a]=!0)}}))})),e}computeMaxCols(e){let t=0;return this.fields.forEach(((s,a)=>{let d=0;s.forEach(((t,s)=>{let l;l=t.hideTh?0:e[a]?.[s]?1:null!=t.thColSpan&&t.thColSpan>1?t.thColSpan:1,d+=l+(null!=t.tdColSpan&&t.tdColSpan>1?t.tdColSpan:1)})),d>t&&(t=d)})),t}renderTh(e,t,s){const d=null!=e.thRowSpan&&e.thRowSpan>1?e.thRowSpan:void 0,l=null!=e.thColSpan&&e.thColSpan>1?e.thColSpan:void 0,r={"sd-key-value-table__th":!0};return"string"==typeof e.thClass?r[e.thClass]=!0:Array.isArray(e.thClass)&&e.thClass.forEach((e=>r[e]=!0)),a("th",{key:`th-${t}-${s}`,class:r,style:e.thStyle,scope:"row",rowSpan:d,colSpan:l},a("div",{class:"sd-key-value-table__th-inner"},a("span",{class:"sd-key-value-table__label"},e.label,e.required&&a("sd-icon",{class:"sd-key-value-table__required",name:"star",size:12,color:Q.required,label:"required"})),e.helpText&&this.renderHelpIcon(e.helpText)))}renderTd(e,t,s){return a("td",{key:`td-${t}-${s}`,class:"sd-key-value-table__td",rowSpan:null!=e.tdRowSpan&&e.tdRowSpan>1?e.tdRowSpan:void 0,colSpan:null!=e.tdColSpan&&e.tdColSpan>1?e.tdColSpan:void 0},a("div",{class:"sd-key-value-table__td-inner"},a("slot",{name:"field-"+e.name},this.renderField(e))))}warnDuplicateNames(){const e=new Set,t=new Set;this.fields.forEach((s=>s.forEach((s=>{e.has(s.name)?t.add(s.name):e.add(s.name)})))),t.size>0&&console.warn(`[sd-key-value-table] Duplicate field name(s) detected: ${[...t].join(", ")}. Slot names ("field-{name}") and sdChange events rely on unique names.`)}render(){if(0===this.fields.length)return null;const e={"--sd-kvt-row-height":F+"px","--sd-kvt-th-width":"120px","--sd-kvt-radius":T+"px","--sd-kvt-padding-x":q+"px","--sd-kvt-padding-y":H+"px","--sd-kvt-gap":M+"px","--sd-kvt-label-gap":G+"px","--sd-kvt-border-width":I+"px","--sd-kvt-border-color":Q.border,"--sd-kvt-th-bg":Q.thBg,"--sd-kvt-th-color":Q.thLabel,"--sd-kvt-required-color":Q.required,"--sd-kvt-td-bg":Q.tdBg,"--sd-kvt-td-color":Q.tdText,"--sd-kvt-label-font-family":W.labelFontFamily,"--sd-kvt-label-font-size":W.labelFontSize+"px","--sd-kvt-label-font-weight":""+W.labelFontWeight,"--sd-kvt-label-line-height":W.labelLineHeight+"px","--sd-kvt-td-font-family":W.tdFontFamily,"--sd-kvt-td-font-size":W.tdFontSize+"px","--sd-kvt-td-font-weight":""+W.tdFontWeight,"--sd-kvt-td-line-height":W.tdLineHeight+"px","--sd-kvt-search-bg":Q.searchBg,"--sd-kvt-search-padding-x":K+"px"};this.warnDuplicateNames();const t=this.computeAutoSkipTh(),s=this.computeMaxCols(t),d=a("table",{class:{"sd-key-value-table":!0,"sd-key-value-table--use-top":this.useTop},style:e},a("colgroup",null,Array.from({length:s},((e,t)=>a("col",{key:"col-"+t,style:t%2==0?{width:"120px"}:void 0})))),a("tbody",null,this.fields.map(((e,s)=>a("tr",{class:"sd-key-value-table__row",key:"row-"+s},e.map(((e,a)=>[e.hideTh||t[s][a]?null:this.renderTh(e,s,a),this.renderTd(e,s,a)])))))));return this.search?a("div",{class:{"sd-key-value-table__wrapper":!0,"sd-key-value-table__wrapper--use-top":this.useTop},style:e},d,a("div",{class:"sd-key-value-table__search-panel"},a("sd-button",{label:"검색",name:"neutral_outline_md",onSdClick:this.handleSearchClick}))):d}static get style(){return"sd-key-value-table{display:block}sd-key-value-table .sd-key-value-table__wrapper{display:flex;align-items:stretch;width:100%;border:var(--sd-kvt-border-width) solid var(--sd-kvt-border-color);border-radius:var(--sd-kvt-radius);overflow:hidden}sd-key-value-table .sd-key-value-table__wrapper .sd-key-value-table{flex:1 1 auto;border:0;border-radius:0}sd-key-value-table .sd-key-value-table__wrapper.sd-key-value-table__wrapper--use-top{border-top-left-radius:0;border-top-right-radius:0}sd-key-value-table .sd-key-value-table__search-panel{display:flex;align-items:center;justify-content:center;flex:0 0 auto;padding:var(--sd-kvt-padding-y) var(--sd-kvt-search-padding-x);background:var(--sd-kvt-search-bg);border-left:var(--sd-kvt-border-width) solid var(--sd-kvt-border-color)}sd-key-value-table .sd-key-value-table{width:100%;table-layout:fixed;border:var(--sd-kvt-border-width) solid var(--sd-kvt-border-color);border-radius:var(--sd-kvt-radius);border-collapse:separate;border-spacing:0;overflow:hidden}sd-key-value-table .sd-key-value-table.sd-key-value-table--use-top{border-top-left-radius:0;border-top-right-radius:0}sd-key-value-table .sd-key-value-table__th,sd-key-value-table .sd-key-value-table__td{height:var(--sd-kvt-row-height);padding:var(--sd-kvt-padding-y) var(--sd-kvt-padding-x);box-sizing:border-box;vertical-align:middle;text-align:left;font-weight:normal;border-top:var(--sd-kvt-border-width) solid var(--sd-kvt-border-color)}sd-key-value-table .sd-key-value-table tbody>tr:first-child>.sd-key-value-table__th,sd-key-value-table .sd-key-value-table tbody>tr:first-child>.sd-key-value-table__td{border-top:0}sd-key-value-table .sd-key-value-table__th{width:var(--sd-kvt-th-width);background:var(--sd-kvt-th-bg);color:var(--sd-kvt-th-color)}sd-key-value-table .sd-key-value-table__th-inner{display:flex;align-items:center;justify-content:space-between;gap:var(--sd-kvt-gap);width:100%;height:100%}sd-key-value-table .sd-key-value-table__label{display:inline-flex;align-items:center;gap:var(--sd-kvt-label-gap);font-family:var(--sd-kvt-label-font-family);font-size:var(--sd-kvt-label-font-size);font-weight:var(--sd-kvt-label-font-weight);line-height:var(--sd-kvt-label-line-height);color:var(--sd-kvt-th-color)}sd-key-value-table .sd-key-value-table__required{display:inline-flex;align-items:center;flex-shrink:0}sd-key-value-table .sd-key-value-table__help{display:inline-flex;align-items:center;flex-shrink:0}sd-key-value-table .sd-key-value-table__td{background:var(--sd-kvt-td-bg);color:var(--sd-kvt-td-color)}sd-key-value-table .sd-key-value-table__td-inner{display:flex;align-items:center;width:100%;height:100%}sd-key-value-table .sd-key-value-table__td-inner>slot{display:block;flex:1 1 auto;min-width:0}sd-key-value-table .sd-key-value-table__td-inner sd-input,sd-key-value-table .sd-key-value-table__td-inner sd-textarea,sd-key-value-table .sd-key-value-table__td-inner sd-number-input,sd-key-value-table .sd-key-value-table__td-inner sd-select,sd-key-value-table .sd-key-value-table__td-inner sd-date-picker,sd-key-value-table .sd-key-value-table__td-inner sd-date-range-picker,sd-key-value-table .sd-key-value-table__td-inner sd-file-picker{width:100%}sd-key-value-table .sd-key-value-table__text{font-family:var(--sd-kvt-td-font-family);font-size:var(--sd-kvt-td-font-size);font-weight:var(--sd-kvt-td-font-weight);line-height:var(--sd-kvt-td-line-height);color:var(--sd-kvt-td-color)}"}},[772,"sd-key-value-table",{fields:[16],search:[4],useTop:[4,"use-top"]}]),L=A,O=function(){"undefined"!=typeof customElements&&["sd-key-value-table","sd-button","sd-calendar","sd-checkbox","sd-chip","sd-date-picker","sd-date-picker-trigger","sd-date-range-picker","sd-date-range-picker-calendar","sd-field","sd-file-picker","sd-floating-portal","sd-ghost-button","sd-icon","sd-input","sd-number-input","sd-portal","sd-radio","sd-radio-group","sd-select","sd-select-list-item","sd-select-list-item-search","sd-select-listbox","sd-select-trigger","sd-textarea","sd-tooltip"].forEach((e=>{switch(e){case"sd-key-value-table":customElements.get(d(e))||customElements.define(d(e),A);break;case"sd-button":customElements.get(d(e))||i();break;case"sd-calendar":customElements.get(d(e))||o();break;case"sd-checkbox":customElements.get(d(e))||n();break;case"sd-chip":customElements.get(d(e))||u();break;case"sd-date-picker":customElements.get(d(e))||c();break;case"sd-date-picker-trigger":customElements.get(d(e))||p();break;case"sd-date-range-picker":customElements.get(d(e))||k();break;case"sd-date-range-picker-calendar":customElements.get(d(e))||b();break;case"sd-field":customElements.get(d(e))||v();break;case"sd-file-picker":customElements.get(d(e))||m();break;case"sd-floating-portal":customElements.get(d(e))||h();break;case"sd-ghost-button":customElements.get(d(e))||y();break;case"sd-icon":customElements.get(d(e))||f();break;case"sd-input":customElements.get(d(e))||g();break;case"sd-number-input":customElements.get(d(e))||_();break;case"sd-portal":customElements.get(d(e))||w();break;case"sd-radio":customElements.get(d(e))||x();break;case"sd-radio-group":customElements.get(d(e))||E();break;case"sd-select":customElements.get(d(e))||j();break;case"sd-select-list-item":customElements.get(d(e))||S();break;case"sd-select-list-item-search":customElements.get(d(e))||D();break;case"sd-select-listbox":customElements.get(d(e))||N();break;case"sd-select-trigger":customElements.get(d(e))||z();break;case"sd-textarea":customElements.get(d(e))||U();break;case"sd-tooltip":customElements.get(d(e))||C()}}))};export{L as SdKeyValueTable,O as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as o,d as s}from"./p-
|
|
1
|
+
import{S as o,d as s}from"./p-D7g33VZR.js";const p=o,r=s;export{p as SdSelectListbox,r as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as o,d as s}from"./p-
|
|
1
|
+
import{S as o,d as s}from"./p-DKwnEkHE.js";const p=o,r=s;export{p as SdSelect,r as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as e,c as s,e as i,f as a,h as n,d as h,t as o}from"./p-pwNG5WaX.js";import{T as l}from"./p-sZMi_32I.js";import{T as r,a as d,b as c,c as u,d as b}from"./p-DGyTYauz.js";import{d as g}from"./p-B6L3bPm2.js";import{d as f}from"./p-Cye8r1MG.js";import{d as p}from"./p-p4bNikji.js";import{d as m}from"./p-DmDGMDzt.js";import{d as y}from"./p-CwQTEZWO.js";import{d as w}from"./p-DQj-S8AC.js";import{d as C}from"./p-lOVBaLB7.js";import{d as S}from"./p-DCFqtVBm.js";import{d as v}from"./p-ZSGGRCNc.js";import{d as k}from"./p-DP0Dp12H.js";import{d as x}from"./p-EcuI_UmK.js";import{d as _}from"./p-CARYLqH9.js";import{d as R}from"./p-DoREs-rv.js";import{d as P}from"./p-uVZjhyvS.js";import{d as E}from"./p-y_6iWhDy.js";import{d as M}from"./p-D6cUtm8p.js";import{d as A}from"./p-_zllPZMm.js";let I=(t=21)=>{let e="",s=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&s[t]];return e};const D=t(class t extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.sdSelectChange=s(this,"sdSelectChange",7),this.sdPageChange=s(this,"sdPageChange",7),this.sdRowsPerPageChange=s(this,"sdRowsPerPageChange",7),this.sdVirtualUpdate=s(this,"sdVirtualUpdate",7),this.sdVirtualReachEnd=s(this,"sdVirtualReachEnd",7)}static DEFAULT_NO_DATA_LABEL="데이터가 없습니다.";get el(){return this}tableId=I(8);fallbackTableId=I(8);columns=[];rows;selected=[];rowKey="id";selectable=!1;resizable=!1;width;height;stickyHeader=!1;stickyColumn={left:0,right:0};useTop=!1;noDataLabel=t.DEFAULT_NO_DATA_LABEL;resolvedNoDataLabel=t.DEFAULT_NO_DATA_LABEL;isLoading=!1;pagination;useInternalPagination=!1;useRowsPerPageSelect=!1;dense=!1;useVirtualScroll=!1;rowHeight;get effectiveRowHeight(){return null!=this.rowHeight?this.rowHeight:Number(this.dense?r.dense.height:r.default.height)}virtualBuffer=5;virtualEndThreshold=10;rowsPerPageOption=[{label:"10개씩 보기",value:10},{label:"25개씩 보기",value:25},{label:"50개씩 보기",value:50},{label:"100개씩 보기",value:100}];sdSelectChange;sdPageChange;sdRowsPerPageChange;sdVirtualUpdate;sdVirtualReachEnd;currentPage=1;innerRowsPerPage=10;innerSelected=new Set;columnWidths=[];scrolledLeft=!1;scrolledRight=!1;rowCount=0;loadingScrollTop=0;noDataBodyHeight=60;autoThead=!1;autoTbody=!1;vsStart=0;vsEnd=0;lastReachEndNotifiedRowCount=-1;scrollContainer=null;noDataContentEl=null;noDataContentResizeObserver;onScroll;spanRegistry=new Map;useFrameRegistry=new Map;cellClassRegistry=new Map;rowIndexMap=new Map;rebuildRowIndexMap(){if(this.rowIndexMap.clear(),!Array.isArray(this.rows))return;const t=this.rowKey;this.rows.forEach(((e,s)=>{const i=e?.[t];null!=i&&this.rowIndexMap.set(i+"",s)}))}resolveRowIndex(t){const e=this.rowIndexMap.get(t);if(void 0!==e)return e;const s=Number(t);return Number.isFinite(s)?s:null}toFiniteNumber(t,e){const s="number"==typeof t?t:Number(t);return Number.isFinite(s)?s:e}isRowsPerPageValue(t){return null===t||"string"==typeof t||"number"==typeof t}isValidTableId(t){return"string"==typeof t&&t.trim().length>0&&"undefined"!==t&&"null"!==t}getResolvedTableId(){if(this.isValidTableId(this.tableId))return this.tableId;const t=this.el?.getAttribute(l);return this.isValidTableId(t)?t:this.fallbackTableId}syncTableIdAttribute(){const t=this.getResolvedTableId();this.el?.getAttribute(l)!==t&&this.el.setAttribute(l,t)}handleIsLoadingChange(t){t&&(this.loadingScrollTop=this.scrollContainer?.scrollTop??0),this.syncNoDataContentObserver()}handleUseVirtualScrollChange(t){t&&i((()=>this.propagateVirtualUpdate()))}handleColumnsChange(t){this.columnWidths=t.map((t=>t.autoWidth?0:parseInt(t.width||"120",10))),this.refreshChildrenConfig()}handleRowsChange(t){Array.isArray(t)&&(this.rowCount=t.length,this.rebuildRowIndexMap(),this.useVirtualScroll&&this.propagateVirtualUpdate(!0),this.pushRowsToChildren(t),this.syncNoDataContentObserver())}handleRowKeyChange(){this.rebuildRowIndexMap()}handleTableIdChange(){this.syncTableIdAttribute()}handleNoDataLabelChange(e){this.resolvedNoDataLabel="string"==typeof e&&e.trim().length>0&&"undefined"!==e&&"null"!==e?e:t.DEFAULT_NO_DATA_LABEL}handleConfigChange(){this.refreshChildrenConfig()}handleSelectedChange(t){this.innerSelected=new Set(t)}handlePaginationChange(t){null!=t?.page&&t.page!==this.currentPage&&(this.currentPage=t.page),null!=t?.rowsPerPage&&t.rowsPerPage!==this.innerRowsPerPage&&(this.innerRowsPerPage=t.rowsPerPage)}detectChildren(){const t=!!this.el.querySelector(":scope > sd-thead"),e=!!this.el.querySelector(":scope > sd-tbody");this.autoThead=!t,this.autoTbody=!e}componentWillLoad(){this.syncTableIdAttribute(),this.handleNoDataLabelChange(this.noDataLabel),this.detectChildren(),this.innerSelected=new Set(this.selected||[]),this.columnWidths=(this.columns||[]).map((t=>t.autoWidth?0:parseInt(t.width||"120",10))),this.rebuildRowIndexMap(),null!=this.pagination?.page&&(this.currentPage=this.pagination.page),null!=this.pagination?.rowsPerPage&&(this.innerRowsPerPage=this.pagination.rowsPerPage);const t=this.el;t.isRowSelectedSync=this.isRowSelectedSync.bind(this),t.updateRowSelectSync=this.updateRowSelectSync.bind(this),t.toggleSelectAllSync=this.toggleSelectAllSync.bind(this),t.getIsAllCheckedSync=this.getIsAllCheckedSync.bind(this),t.getStickyStyleSync=this.getStickyStyleSync.bind(this),t.setRowCountSync=this.setRowCountSync.bind(this),t.handleResize=this.handleResize.bind(this),t.getPaginationInfoSync=this.getPaginationInfoSync.bind(this),t.getVirtualScrollRangeSync=this.getVirtualScrollRangeSync.bind(this),t.getConfigSync=this.getConfigSync.bind(this),t.getTableIdSync=()=>this.getResolvedTableId(),t.getVirtualScrollConfigSync=this.getVirtualScrollConfigSync.bind(this),t.calculateVisibleRange=this.calculateVisibleRange.bind(this),t.registerSpanSync=this.registerSpanSync.bind(this),t.unregisterSpanSync=this.unregisterSpanSync.bind(this),t.getSpanSync=this.getSpanSync.bind(this),t.isCoveredSync=this.isCoveredSync.bind(this),t.hasRowspanSync=this.hasRowspanSync.bind(this),t.registerCellClassSync=this.registerCellClassSync.bind(this),t.unregisterCellClassSync=this.unregisterCellClassSync.bind(this),t.getCellClassSync=this.getCellClassSync.bind(this),t.registerUseFrameSync=this.registerUseFrameSync.bind(this),t.unregisterUseFrameSync=this.unregisterUseFrameSync.bind(this),t.hasUseFrameInRowSync=this.hasUseFrameInRowSync.bind(this),t.isCellUseFrameSync=this.isCellUseFrameSync.bind(this),Array.isArray(this.rows)&&(this.rowCount=this.rows.length,this.pushRowsToChildren(this.rows))}componentDidLoad(){Array.isArray(this.rows)&&this.pushRowsToChildren(this.rows),i((()=>{const t=this.el.shadowRoot?.querySelector(".sd-table__scroll-container");if(!t)return;let e=!1;this.onScroll=()=>{const s=t.scrollLeft,i=s>0,a=s+t.clientWidth<t.scrollWidth;this.scrolledLeft===i&&this.scrolledRight===a||(this.scrolledLeft=i,this.scrolledRight=a,this.refreshChildrenConfig()),this.useVirtualScroll&&!e&&(e=!0,requestAnimationFrame((()=>{e=!1,this.propagateVirtualUpdate()})))},this.scrollContainer=t,t.addEventListener("scroll",this.onScroll,{passive:!0}),this.onScroll(),this.useVirtualScroll&&this.propagateVirtualUpdate()})),this.syncNoDataContentObserver()}disconnectedCallback(){this.scrollContainer&&this.onScroll&&this.scrollContainer.removeEventListener("scroll",this.onScroll),this.noDataContentResizeObserver?.disconnect(),this.noDataContentResizeObserver=void 0}syncNoDataContentObserver(){if(0!==this.rowCount||this.isLoading)return this.noDataContentResizeObserver?.disconnect(),this.noDataContentResizeObserver=void 0,void(this.noDataBodyHeight=60);this.observeNoDataContentHeight()}observeNoDataContentHeight(){if("undefined"==typeof ResizeObserver)return;const t=this.noDataContentEl;t&&(this.noDataContentResizeObserver?.disconnect(),this.noDataContentResizeObserver=new ResizeObserver((()=>{const e=Math.max(60,Math.ceil(t.scrollHeight));e!==this.noDataBodyHeight&&(this.noDataBodyHeight=e)})),this.noDataContentResizeObserver.observe(t),i((()=>{if(!this.noDataContentEl)return;const t=Math.max(60,Math.ceil(this.noDataContentEl.scrollHeight));t!==this.noDataBodyHeight&&(this.noDataBodyHeight=t)})))}queryChildEl(t){return this.el.querySelector(t)??this.el.shadowRoot?.querySelector(t)??null}queryAllTr(){return[...Array.from(this.el.querySelectorAll("sd-tr")),...Array.from(this.el.shadowRoot?.querySelectorAll("sd-tr")??[])]}pushRowsToChildren(t){const e=this.queryChildEl("sd-tbody");e&&(e.rows=t);const s=this.queryChildEl("sd-thead");s&&(s.rows=t)}handleStructureSlotChange=()=>{Array.isArray(this.rows)&&this.pushRowsToChildren(this.rows),this.refreshChildrenConfig()};refreshChildrenSelection(){const t=this.queryChildEl("sd-thead");t?.refreshSelection?.(),this.queryAllTr().forEach((t=>t.refreshSelection?.()))}refreshChildrenConfig(){const t=this.queryChildEl("sd-thead");t?.refreshConfig?.(),this.queryAllTr().forEach((t=>t.refreshConfig?.()))}maybeEmitVirtualReachEnd(t,e){const s=Math.max(1,this.virtualEndThreshold);e>=Math.max(0,this.rowCount-s)&&this.lastReachEndNotifiedRowCount!==this.rowCount&&(this.lastReachEndNotifiedRowCount=this.rowCount,this.sdVirtualReachEnd.emit({from:t,to:e,rowCount:this.rowCount,threshold:s}))}propagateVirtualUpdate(t=!1){if(!this.scrollContainer||!this.useVirtualScroll)return;const e=this.toFiniteNumber(this.scrollContainer.scrollTop,0),s=this.toFiniteNumber(this.scrollContainer.clientHeight,0),{start:i,end:a}=this.calculateVisibleRange(e,s);if(!Number.isFinite(i)||!Number.isFinite(a))return;const n=this.vsStart!==i||this.vsEnd!==a;if(!n&&!t)return;this.vsStart=i,this.vsEnd=a;const h=i*this.effectiveRowHeight,o=Math.max(0,(this.rowCount-a)*this.effectiveRowHeight),l=this.queryChildEl("sd-tbody");l?.setSpacersSync?.(h,o),n&&this.sdVirtualUpdate.emit({from:i,to:a}),this.maybeEmitVirtualReachEnd(i,a)}getVirtualScrollConfigSync(){return{useVirtualScroll:this.useVirtualScroll,rowHeight:this.effectiveRowHeight,virtualBuffer:this.virtualBuffer,vsStart:this.vsStart,vsEnd:this.vsEnd,rowCount:this.rowCount}}getConfigSync(){return{columns:this.columns,selectable:this.selectable,resizable:this.resizable,stickyColumn:this.stickyColumn,stickyHeader:this.stickyHeader,scrolledLeft:this.scrolledLeft,scrolledRight:this.scrolledRight,columnWidths:this.columnWidths,dense:this.dense}}registerUseFrameSync(t,e){if(null==t||""===e)return;let s=this.useFrameRegistry.get(t);s||(s=new Set,this.useFrameRegistry.set(t,s)),s.add(e)}unregisterUseFrameSync(t,e){if(null==t||""===e)return;const s=this.useFrameRegistry.get(t);s&&(s.delete(e),0===s.size&&this.useFrameRegistry.delete(t))}hasUseFrameInRowSync(t){const e=this.useFrameRegistry.get(t);return null!=e&&e.size>0}isCellUseFrameSync(t,e){return this.useFrameRegistry.get(t)?.has(e)??!1}isRowSelectedSync(t){return Array.from(this.innerSelected).some((e=>e[this.rowKey??"id"]===t[this.rowKey??"id"]))}async isRowSelected(t){return this.isRowSelectedSync(t)}updateRowSelectSync(t){const e=Array.from(this.innerSelected),s=this.isRowSelectedSync(t)?e.filter((e=>e[this.rowKey??"id"]!==t[this.rowKey??"id"])):[...e,t];s.length!==e.length&&(this.innerSelected=new Set(s),this.selected=Array.from(this.innerSelected),this.sdSelectChange.emit(Array.from(this.innerSelected)),this.refreshChildrenSelection())}async updateRowSelect(t){this.updateRowSelectSync(t)}toggleSelectAllSync(t,e){if(t){const t=new Set([...e]);this.innerSelected=new Set([...this.innerSelected,...t])}else{const t=e.map((t=>t[this.rowKey??"id"]));this.innerSelected=new Set([...this.innerSelected].filter((e=>!t.includes(e[this.rowKey??"id"]))))}this.selected=Array.from(this.innerSelected),this.sdSelectChange.emit(Array.from(this.innerSelected)),this.refreshChildrenSelection()}async toggleSelectAll(t,e){this.toggleSelectAllSync(t,e)}getIsAllCheckedSync(t){const e=t.length,s=t.filter((t=>Array.from(this.innerSelected).some((e=>e[this.rowKey??"id"]===t[this.rowKey??"id"])))).length;return 0!==s&&(s===e||null)}async getIsAllChecked(t){return this.getIsAllCheckedSync(t)}changePage(t){this.useInternalPagination?(this.currentPage=t,this.sdPageChange.emit(this.currentPage),this.updateRowsVisibility()):this.sdPageChange.emit(t)}updateRowsVisibility(){this.queryAllTr().forEach((t=>t.updateVisibility?.()))}changeRowsPerPage(t){const e=null!=t&&""!==t?Number(t):0;if(!this.useInternalPagination)return void this.sdRowsPerPageChange.emit(e);this.innerRowsPerPage=e;const s=Math.max(1,Math.ceil(this.rowCount/e));this.currentPage>s&&(this.currentPage=s),this.sdRowsPerPageChange.emit(e),this.updateRowsVisibility()}get lastPageNumber(){if(this.useInternalPagination)return Math.max(1,Math.ceil(this.rowCount/this.innerRowsPerPage));const{lastPage:t,rowsPerPage:e=10}=this.pagination||{};return t??Math.max(1,Math.ceil(this.rowCount/e))}handleResize(t,e,s=!1){if("undefined"==typeof document)return;const i=e.clientX,a=this.columnWidths[t],n=e=>{const n=this.columns[t];if(null==n)return;const h=n.maxWidth||9999,o=e.clientX-i,l=Math.min(Math.max(a+(s?-o:o),n.minWidth||50),h);this.columnWidths=this.columnWidths.map(((e,s)=>s===t?l:e));const r=this.queryChildEl("sd-thead");r?.setColumnWidths?.(this.columnWidths),this.queryAllTr().forEach((t=>t.setColumnWidths?.(this.columnWidths)));const d=this.stickyColumn?.right||0,c=this.columns.filter((t=>!1!==t.visible)).length;d>0&&t===c-d&&requestAnimationFrame((()=>{this.onScroll?.()}))},h=()=>{document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",h)};document.addEventListener("mousemove",n),document.addEventListener("mouseup",h)}getStickyStyleSync(t){const e=this.columnWidths.slice(0,t).reduce(((t,e)=>t+e),this.selectable?d:0),s=this.columnWidths.filter(((e,s)=>s>=this.columns.filter((t=>!1!==t.visible)).length-(this.stickyColumn?.right||0)&&s>t)).reduce(((t,e)=>t+e),0),i=this.columns.filter((t=>!1!==t.visible))[t],a={"--sticky-left-offset":e+"px","--sticky-right-offset":s+"px"};return i?.autoWidth||(a.width=this.columnWidths[t]+"px",a.minWidth=this.columnWidths[t]+"px",a.maxWidth=this.columnWidths[t]+"px"),a}async getStickyStyle(t){return this.getStickyStyleSync(t)}spanKey(t,e){return`${t}::${e}`}requestAllTrUpdate(){this.queryAllTr().forEach((t=>{"function"==typeof t.bumpSpansVersion?t.bumpSpansVersion():a(t)}))}registerSpanSync(t,e,s,i){if(null==t||""===e)return;const a=Math.max(1,Math.floor(s||1)),n=Math.max(1,Math.floor(i||1)),h=this.spanKey(t,e),o=this.spanRegistry.get(h);if(1===a&&1===n){if(!o)return;return this.spanRegistry.delete(h),void this.requestAllTrUpdate()}o&&o.rowspan===a&&o.colspan===n||(this.spanRegistry.set(h,{rowspan:a,colspan:n}),this.requestAllTrUpdate())}unregisterSpanSync(t,e){if(null==t||""===e)return;const s=this.spanKey(t,e);this.spanRegistry.has(s)&&(this.spanRegistry.delete(s),this.requestAllTrUpdate())}getSpanSync(t,e){return this.spanRegistry.get(this.spanKey(t,e))}registerCellClassSync(t,e,s){if(null==t||""===e)return;const i=this.spanKey(t,e),a=(s??"").trim();""!==a?this.cellClassRegistry.set(i,a):this.cellClassRegistry.delete(i)}unregisterCellClassSync(t,e){null!=t&&""!==e&&this.cellClassRegistry.delete(this.spanKey(t,e))}getCellClassSync(t,e){return this.cellClassRegistry.get(this.spanKey(t,e))}hasRowspanSync(){for(const t of this.spanRegistry.values())if(t.rowspan>1)return!0;return!1}isCoveredSync(t,e,s){if(0===this.spanRegistry.size)return!1;const i=s.filter((t=>!1!==t.visible));for(let s=0;s<e;s++){const a=i[s];if(null==a)continue;const n=this.spanRegistry.get(this.spanKey(t,"string"==typeof a.field?a.field:a.name));if(n&&s+n.colspan>e)return!0}const a=this.resolveRowIndex(t);if(null==a)return!1;for(const[t,s]of this.spanRegistry){if(s.rowspan<=1)continue;const n=t.indexOf("::");if(n<0)continue;const h=t.slice(0,n),o=t.slice(n+2),l=this.resolveRowIndex(h);if(null==l)continue;if(l>=a)continue;if(l+s.rowspan<=a)continue;const r=i.findIndex((t=>("string"==typeof t.field?t.field:t.name)===o));if(!(r<0)&&r<=e&&r+s.colspan>e)return!0}return!1}setRowCountSync(t){const e=Math.max(0,Math.floor(this.toFiniteNumber(t,0)));e!==this.rowCount&&(this.lastReachEndNotifiedRowCount=-1),this.rowCount=e,this.useVirtualScroll&&this.propagateVirtualUpdate(!0)}async setRowCount(t){this.setRowCountSync(t)}calculateVisibleRange(t,e){const s=Math.max(1,this.toFiniteNumber(this.effectiveRowHeight,40)),i=Math.max(0,Math.floor(this.toFiniteNumber(this.virtualBuffer,5))),a=Math.max(0,this.toFiniteNumber(t,0)),n=Math.max(0,this.toFiniteNumber(e,0)),h=Math.max(0,Math.floor(this.toFiniteNumber(this.rowCount,0))),o=Math.floor(a/s),l=Math.ceil(n/s);return{start:Math.max(0,o-i),end:Math.min(h,o+l+i)}}getPaginationInfoSync(){if(!this.useInternalPagination||!this.pagination)return null;const t=(this.currentPage-1)*this.innerRowsPerPage;return{startIndex:t,endIndex:t+this.innerRowsPerPage,currentPage:this.currentPage,rowsPerPage:this.innerRowsPerPage}}async getPaginationInfo(){return this.getPaginationInfoSync()}getVirtualScrollRangeSync(){return this.useVirtualScroll&&this.vsEnd>0?{from:this.vsStart,to:this.vsEnd}:null}renderAutoRows(){if(this.useVirtualScroll)return null;const t=this.rows??[],e=this.getPaginationInfoSync(),s=e?.startIndex??0;return(e?t.slice(e.startIndex,e.endIndex):t).map(((t,e)=>{const i=s+e;return n("sd-tr",{key:i,"row-key":i+"",row:t})}))}get tableClasses(){return["sd-table",this.stickyHeader&&"sd-table--sticky-header",this.selectable&&"sd-table--selectable",this.resizable&&"sd-table--resizable",(this.selectable||(this.stickyColumn?.left??0)>0||(this.stickyColumn?.right??0)>0)&&"sd-table--sticky-column",this.scrolledLeft&&"sd-table--scrolled-left",this.scrolledRight&&"sd-table--scrolled-right",0===this.rowCount&&!this.isLoading&&"sd-table--no-data"].filter(Boolean).join(" ")}render(){const t=this.getResolvedTableId(),e=0===this.rowCount&&!this.isLoading,s=e?`max(${this.height||"96px"}, ${36+this.noDataBodyHeight}px)`:this.height||"100%";return n(h,{key:"4596e04bd57aca00fa6378fd26ce33a06a795eaf",style:{"--table-radius":b+"px","--table-border-color":u.color,"--table-border-width":u.width+"px","--table-body-font-family":c.fontFamily,"--table-body-font-weight":c.fontWeight,"--table-body-font-size":c.fontSize+"px","--table-body-line-height":c.lineHeight+"px","--table-body-text-decoration":c.textDecoration,"--table-selectable-width":d+"px"}},n("div",{key:"11a20d327410b0be659cede32917164e036e796c",class:"sd-table__container",style:{"--table-width":this.width,"--table-height":s,"--table-container-height":`calc(${s} - ${this.pagination&&this.rowCount>0&&!this.useVirtualScroll?48:0}px)`}},n("div",{key:"f4f3acf584dc4eacdae25b11aa2b62b73ffab949",class:{"sd-table__wrapper":!0,"sd-table__wrapper--use-top":this.useTop}},n("div",{key:"c8ab618b9c990a22b8e9466a5bfb5f02f4de8b12",class:{"sd-table__scroll-container":!0,"sd-table__scroll-container--loading":this.isLoading,"sd-table__scroll-container--no-data":e}},this.isLoading&&n("div",{key:"a696933a70799ba282fc743281d0af27fd691a2e",class:"sd-table__loading",style:{top:this.loadingScrollTop+"px"}},n("sd-circle-progress",{key:"cba6ac47367ef6499bf338b9b757ee74fdd7e6c1",indeterminate:!0})),e&&n(n.Fragment,null,n("div",{key:"6e22156bf5b0fb9814d9bf9cad57506758c6284b",class:"sd-table__no-data-header-overlay"}),n("div",{key:"b72f9fabcc8acb8e700ad55acc4d7aff08355a1c",class:"sd-table__no-data"},n("div",{key:"43f271a8803121362f16e8153748328658f073ec",class:"sd-table__no-data-content",ref:t=>{this.noDataContentEl=t,t&&this.syncNoDataContentObserver()}},n("slot",{key:"4b8533115bbc81962b80c9c2533fe4b44a87193c",name:"no-data"},n("span",{key:"d94c4f7cf9eca7901b99434f712480a7b20c869a"},this.resolvedNoDataLabel))))),n("table",{key:"a9a353aca09124ed8a82fcd2f8a0a7de09b234f5",class:this.tableClasses},this.autoThead?n("slot",{name:t+"-head",onSlotchange:this.handleStructureSlotChange},n("sd-thead",{rows:this.rows??[]})):n("slot",{name:t+"-head",onSlotchange:this.handleStructureSlotChange}),this.autoTbody?n("slot",{name:t+"-body",onSlotchange:this.handleStructureSlotChange},n("sd-tbody",{rows:this.rows??[]},this.renderAutoRows())):n("slot",{name:t+"-body",onSlotchange:this.handleStructureSlotChange})))),this.pagination&&this.pagination.rowsPerPage>0&&this.rowCount>0&&!this.useVirtualScroll&&n("div",{key:"8afeb9398c3d7540a54b9a3660fb9685ae1cddca",class:"sd-table__pagination"},n("sd-pagination",{key:"e2cbb3f7414f65b81ab2d33eaec5d9f28bed6cc8",currentPage:this.useInternalPagination?this.currentPage:this.pagination.page,lastPage:this.useInternalPagination?this.lastPageNumber:this.pagination.lastPage,onSdPageChange:t=>this.changePage(t.detail)}),this.useRowsPerPageSelect&&n("sd-select",{key:"ce723544dbc7e4cc0d77ced3b685b8575cf67e6f",value:this.useInternalPagination?this.innerRowsPerPage:this.pagination.rowsPerPage,options:this.rowsPerPageOption,width:"128px",emitValue:!0,onSdUpdate:t=>{this.isRowsPerPageValue(t.detail)&&this.changeRowsPerPage(t.detail)}}))))}static get watchers(){return{isLoading:[{handleIsLoadingChange:0}],useVirtualScroll:[{handleUseVirtualScrollChange:0}],columns:[{handleColumnsChange:0}],rows:[{handleRowsChange:0}],rowKey:[{handleRowKeyChange:0}],tableId:[{handleTableIdChange:0}],noDataLabel:[{handleNoDataLabelChange:0}],selectable:[{handleConfigChange:0}],resizable:[{handleConfigChange:0}],stickyColumn:[{handleConfigChange:0}],stickyHeader:[{handleConfigChange:0}],dense:[{handleConfigChange:0}],selected:[{handleSelectedChange:0}],pagination:[{handlePaginationChange:0}]}}static get style(){return"sd-table,:host{display:block;width:100%;max-width:100%;min-width:0}sd-table *,:host *{box-sizing:border-box}.sd-table__container{height:var(--table-height, 100%);width:var(--table-width, 100%);max-width:100%;min-width:0;color:#222222;display:flex;flex-direction:column}.sd-table__wrapper{width:100%;min-width:0;height:var(--table-container-height, 400px);border:var(--table-border-width, 1px) solid var(--table-border-color, #E1E1E1);border-radius:var(--table-radius, 8px);overflow:hidden}.sd-table__wrapper--use-top{border-radius:0 0 var(--table-radius, 8px) var(--table-radius, 8px)}.sd-table__scroll-container{width:100%;height:100%;display:flex;flex-direction:column;position:relative;font-family:var(--table-body-font-family, inherit);font-weight:var(--table-body-font-weight, 400);font-size:var(--table-body-font-size, 12px);line-height:var(--table-body-line-height, 20px);text-decoration:var(--table-body-text-decoration, none);overflow:auto;background:#FFFFFF}.sd-table__scroll-container--loading{overflow:hidden !important;pointer-events:none}.sd-table__scroll-container--no-data{overflow:hidden;pointer-events:none}.sd-table__no-data{position:absolute;top:36px;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center;font-size:var(--table-body-font-size, 12px);color:#888888;pointer-events:none;z-index:200;background:rgba(255, 255, 255, 0.6)}.sd-table__no-data-header-overlay{position:absolute;top:0;left:0;right:0;height:36px;background:rgba(255, 255, 255, 0.6);z-index:210;pointer-events:none}.sd-table__no-data-content{pointer-events:auto;min-height:60px;width:100%;display:flex;align-items:center;justify-content:center}.sd-table__loading{position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(255, 255, 255, 0.6);z-index:200;display:flex;align-items:center;justify-content:center;pointer-events:none}.sd-table{background-color:white;display:table;width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed}.sd-table--selectable sd-thead,.sd-table--selectable sd-tbody{--selectable:true}.sd-table--sticky-header sd-thead thead{position:sticky;top:0;z-index:120}.sd-table--sticky-column sd-thead,.sd-table--sticky-column sd-tbody{--sticky-column:true}.sd-table--scrolled-left sd-thead,.sd-table--scrolled-left sd-tbody{--scrolled-left:true}.sd-table--scrolled-right sd-thead,.sd-table--scrolled-right sd-tbody{--scrolled-right:true}.sd-table--resizable sd-thead{--resizable:true}.sd-table--no-data sd-thead{opacity:0.4}.sd-table__pagination{position:relative;background:#F9F9F9;height:48px;display:flex;align-items:center;justify-content:center;border:var(--table-border-width, 1px) solid var(--table-border-color, #E1E1E1);margin-top:-1px;border-radius:var(--table-radius, 8px)}.sd-table__pagination sd-select{position:absolute;right:10px;top:50%;transform:translateY(-50%)}"}},[769,"sd-table",{tableId:[513,"table-id"],columns:[16],rows:[16],selected:[1040],rowKey:[1,"row-key"],selectable:[4],resizable:[4],width:[1],height:[1],stickyHeader:[4,"sticky-header"],stickyColumn:[16],useTop:[4,"use-top"],noDataLabel:[1,"no-data-label"],isLoading:[4,"is-loading"],pagination:[16],useInternalPagination:[4,"use-internal-pagination"],useRowsPerPageSelect:[4,"use-rows-per-page-select"],dense:[4],useVirtualScroll:[4,"use-virtual-scroll"],rowHeight:[2,"row-height"],virtualBuffer:[2,"virtual-buffer"],virtualEndThreshold:[2,"virtual-end-threshold"],rowsPerPageOption:[16],resolvedNoDataLabel:[32],currentPage:[32],innerRowsPerPage:[32],innerSelected:[32],columnWidths:[32],scrolledLeft:[32],scrolledRight:[32],rowCount:[32],loadingScrollTop:[32],noDataBodyHeight:[32],autoThead:[32],autoTbody:[32],isRowSelected:[64],updateRowSelect:[64],toggleSelectAll:[64],getIsAllChecked:[64],getStickyStyle:[64],setRowCount:[64],getPaginationInfo:[64]},void 0,{isLoading:[{handleIsLoadingChange:0}],useVirtualScroll:[{handleUseVirtualScrollChange:0}],columns:[{handleColumnsChange:0}],rows:[{handleRowsChange:0}],rowKey:[{handleRowKeyChange:0}],tableId:[{handleTableIdChange:0}],noDataLabel:[{handleNoDataLabelChange:0}],selectable:[{handleConfigChange:0}],resizable:[{handleConfigChange:0}],stickyColumn:[{handleConfigChange:0}],stickyHeader:[{handleConfigChange:0}],dense:[{handleConfigChange:0}],selected:[{handleSelectedChange:0}],pagination:[{handlePaginationChange:0}]}]),j=D,L=function(){"undefined"!=typeof customElements&&["sd-table","sd-button","sd-checkbox","sd-circle-progress","sd-field","sd-floating-portal","sd-icon","sd-pagination","sd-portal","sd-select","sd-select-list-item","sd-select-list-item-search","sd-select-listbox","sd-select-trigger","sd-tbody","sd-thead","sd-tooltip","sd-tr"].forEach((t=>{switch(t){case"sd-table":customElements.get(o(t))||customElements.define(o(t),D);break;case"sd-button":customElements.get(o(t))||g();break;case"sd-checkbox":customElements.get(o(t))||f();break;case"sd-circle-progress":customElements.get(o(t))||p();break;case"sd-field":customElements.get(o(t))||m();break;case"sd-floating-portal":customElements.get(o(t))||y();break;case"sd-icon":customElements.get(o(t))||w();break;case"sd-pagination":customElements.get(o(t))||C();break;case"sd-portal":customElements.get(o(t))||S();break;case"sd-select":customElements.get(o(t))||v();break;case"sd-select-list-item":customElements.get(o(t))||k();break;case"sd-select-list-item-search":customElements.get(o(t))||x();break;case"sd-select-listbox":customElements.get(o(t))||_();break;case"sd-select-trigger":customElements.get(o(t))||R();break;case"sd-tbody":customElements.get(o(t))||P();break;case"sd-thead":customElements.get(o(t))||E();break;case"sd-tooltip":customElements.get(o(t))||M();break;case"sd-tr":customElements.get(o(t))||A()}}))};export{j as SdTable,L as defineCustomElement}
|
|
1
|
+
import{p as t,H as e,c as s,e as i,f as a,h as n,d as h,t as o}from"./p-pwNG5WaX.js";import{T as l}from"./p-sZMi_32I.js";import{T as r,a as d,b as c,c as u,d as b}from"./p-DGyTYauz.js";import{d as g}from"./p-B6L3bPm2.js";import{d as f}from"./p-Cye8r1MG.js";import{d as p}from"./p-p4bNikji.js";import{d as m}from"./p-DmDGMDzt.js";import{d as y}from"./p-CwQTEZWO.js";import{d as w}from"./p-DQj-S8AC.js";import{d as C}from"./p-lOVBaLB7.js";import{d as S}from"./p-DCFqtVBm.js";import{d as v}from"./p-DKwnEkHE.js";import{d as k}from"./p-DP0Dp12H.js";import{d as x}from"./p-EcuI_UmK.js";import{d as _}from"./p-D7g33VZR.js";import{d as R}from"./p-DoREs-rv.js";import{d as P}from"./p-uVZjhyvS.js";import{d as E}from"./p-y_6iWhDy.js";import{d as M}from"./p-D6cUtm8p.js";import{d as A}from"./p-_zllPZMm.js";let I=(t=21)=>{let e="",s=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&s[t]];return e};const D=t(class t extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.sdSelectChange=s(this,"sdSelectChange",7),this.sdPageChange=s(this,"sdPageChange",7),this.sdRowsPerPageChange=s(this,"sdRowsPerPageChange",7),this.sdVirtualUpdate=s(this,"sdVirtualUpdate",7),this.sdVirtualReachEnd=s(this,"sdVirtualReachEnd",7)}static DEFAULT_NO_DATA_LABEL="데이터가 없습니다.";get el(){return this}tableId=I(8);fallbackTableId=I(8);columns=[];rows;selected=[];rowKey="id";selectable=!1;resizable=!1;width;height;stickyHeader=!1;stickyColumn={left:0,right:0};useTop=!1;noDataLabel=t.DEFAULT_NO_DATA_LABEL;resolvedNoDataLabel=t.DEFAULT_NO_DATA_LABEL;isLoading=!1;pagination;useInternalPagination=!1;useRowsPerPageSelect=!1;dense=!1;useVirtualScroll=!1;rowHeight;get effectiveRowHeight(){return null!=this.rowHeight?this.rowHeight:Number(this.dense?r.dense.height:r.default.height)}virtualBuffer=5;virtualEndThreshold=10;rowsPerPageOption=[{label:"10개씩 보기",value:10},{label:"25개씩 보기",value:25},{label:"50개씩 보기",value:50},{label:"100개씩 보기",value:100}];sdSelectChange;sdPageChange;sdRowsPerPageChange;sdVirtualUpdate;sdVirtualReachEnd;currentPage=1;innerRowsPerPage=10;innerSelected=new Set;columnWidths=[];scrolledLeft=!1;scrolledRight=!1;rowCount=0;loadingScrollTop=0;noDataBodyHeight=60;autoThead=!1;autoTbody=!1;vsStart=0;vsEnd=0;lastReachEndNotifiedRowCount=-1;scrollContainer=null;noDataContentEl=null;noDataContentResizeObserver;onScroll;spanRegistry=new Map;useFrameRegistry=new Map;cellClassRegistry=new Map;rowIndexMap=new Map;rebuildRowIndexMap(){if(this.rowIndexMap.clear(),!Array.isArray(this.rows))return;const t=this.rowKey;this.rows.forEach(((e,s)=>{const i=e?.[t];null!=i&&this.rowIndexMap.set(i+"",s)}))}resolveRowIndex(t){const e=this.rowIndexMap.get(t);if(void 0!==e)return e;const s=Number(t);return Number.isFinite(s)?s:null}toFiniteNumber(t,e){const s="number"==typeof t?t:Number(t);return Number.isFinite(s)?s:e}isRowsPerPageValue(t){return null===t||"string"==typeof t||"number"==typeof t}isValidTableId(t){return"string"==typeof t&&t.trim().length>0&&"undefined"!==t&&"null"!==t}getResolvedTableId(){if(this.isValidTableId(this.tableId))return this.tableId;const t=this.el?.getAttribute(l);return this.isValidTableId(t)?t:this.fallbackTableId}syncTableIdAttribute(){const t=this.getResolvedTableId();this.el?.getAttribute(l)!==t&&this.el.setAttribute(l,t)}handleIsLoadingChange(t){t&&(this.loadingScrollTop=this.scrollContainer?.scrollTop??0),this.syncNoDataContentObserver()}handleUseVirtualScrollChange(t){t&&i((()=>this.propagateVirtualUpdate()))}handleColumnsChange(t){this.columnWidths=t.map((t=>t.autoWidth?0:parseInt(t.width||"120",10))),this.refreshChildrenConfig()}handleRowsChange(t){Array.isArray(t)&&(this.rowCount=t.length,this.rebuildRowIndexMap(),this.useVirtualScroll&&this.propagateVirtualUpdate(!0),this.pushRowsToChildren(t),this.syncNoDataContentObserver())}handleRowKeyChange(){this.rebuildRowIndexMap()}handleTableIdChange(){this.syncTableIdAttribute()}handleNoDataLabelChange(e){this.resolvedNoDataLabel="string"==typeof e&&e.trim().length>0&&"undefined"!==e&&"null"!==e?e:t.DEFAULT_NO_DATA_LABEL}handleConfigChange(){this.refreshChildrenConfig()}handleSelectedChange(t){this.innerSelected=new Set(t)}handlePaginationChange(t){null!=t?.page&&t.page!==this.currentPage&&(this.currentPage=t.page),null!=t?.rowsPerPage&&t.rowsPerPage!==this.innerRowsPerPage&&(this.innerRowsPerPage=t.rowsPerPage)}detectChildren(){const t=!!this.el.querySelector(":scope > sd-thead"),e=!!this.el.querySelector(":scope > sd-tbody");this.autoThead=!t,this.autoTbody=!e}componentWillLoad(){this.syncTableIdAttribute(),this.handleNoDataLabelChange(this.noDataLabel),this.detectChildren(),this.innerSelected=new Set(this.selected||[]),this.columnWidths=(this.columns||[]).map((t=>t.autoWidth?0:parseInt(t.width||"120",10))),this.rebuildRowIndexMap(),null!=this.pagination?.page&&(this.currentPage=this.pagination.page),null!=this.pagination?.rowsPerPage&&(this.innerRowsPerPage=this.pagination.rowsPerPage);const t=this.el;t.isRowSelectedSync=this.isRowSelectedSync.bind(this),t.updateRowSelectSync=this.updateRowSelectSync.bind(this),t.toggleSelectAllSync=this.toggleSelectAllSync.bind(this),t.getIsAllCheckedSync=this.getIsAllCheckedSync.bind(this),t.getStickyStyleSync=this.getStickyStyleSync.bind(this),t.setRowCountSync=this.setRowCountSync.bind(this),t.handleResize=this.handleResize.bind(this),t.getPaginationInfoSync=this.getPaginationInfoSync.bind(this),t.getVirtualScrollRangeSync=this.getVirtualScrollRangeSync.bind(this),t.getConfigSync=this.getConfigSync.bind(this),t.getTableIdSync=()=>this.getResolvedTableId(),t.getVirtualScrollConfigSync=this.getVirtualScrollConfigSync.bind(this),t.calculateVisibleRange=this.calculateVisibleRange.bind(this),t.registerSpanSync=this.registerSpanSync.bind(this),t.unregisterSpanSync=this.unregisterSpanSync.bind(this),t.getSpanSync=this.getSpanSync.bind(this),t.isCoveredSync=this.isCoveredSync.bind(this),t.hasRowspanSync=this.hasRowspanSync.bind(this),t.registerCellClassSync=this.registerCellClassSync.bind(this),t.unregisterCellClassSync=this.unregisterCellClassSync.bind(this),t.getCellClassSync=this.getCellClassSync.bind(this),t.registerUseFrameSync=this.registerUseFrameSync.bind(this),t.unregisterUseFrameSync=this.unregisterUseFrameSync.bind(this),t.hasUseFrameInRowSync=this.hasUseFrameInRowSync.bind(this),t.isCellUseFrameSync=this.isCellUseFrameSync.bind(this),Array.isArray(this.rows)&&(this.rowCount=this.rows.length,this.pushRowsToChildren(this.rows))}componentDidLoad(){Array.isArray(this.rows)&&this.pushRowsToChildren(this.rows),i((()=>{const t=this.el.shadowRoot?.querySelector(".sd-table__scroll-container");if(!t)return;let e=!1;this.onScroll=()=>{const s=t.scrollLeft,i=s>0,a=s+t.clientWidth<t.scrollWidth;this.scrolledLeft===i&&this.scrolledRight===a||(this.scrolledLeft=i,this.scrolledRight=a,this.refreshChildrenConfig()),this.useVirtualScroll&&!e&&(e=!0,requestAnimationFrame((()=>{e=!1,this.propagateVirtualUpdate()})))},this.scrollContainer=t,t.addEventListener("scroll",this.onScroll,{passive:!0}),this.onScroll(),this.useVirtualScroll&&this.propagateVirtualUpdate()})),this.syncNoDataContentObserver()}disconnectedCallback(){this.scrollContainer&&this.onScroll&&this.scrollContainer.removeEventListener("scroll",this.onScroll),this.noDataContentResizeObserver?.disconnect(),this.noDataContentResizeObserver=void 0}syncNoDataContentObserver(){if(0!==this.rowCount||this.isLoading)return this.noDataContentResizeObserver?.disconnect(),this.noDataContentResizeObserver=void 0,void(this.noDataBodyHeight=60);this.observeNoDataContentHeight()}observeNoDataContentHeight(){if("undefined"==typeof ResizeObserver)return;const t=this.noDataContentEl;t&&(this.noDataContentResizeObserver?.disconnect(),this.noDataContentResizeObserver=new ResizeObserver((()=>{const e=Math.max(60,Math.ceil(t.scrollHeight));e!==this.noDataBodyHeight&&(this.noDataBodyHeight=e)})),this.noDataContentResizeObserver.observe(t),i((()=>{if(!this.noDataContentEl)return;const t=Math.max(60,Math.ceil(this.noDataContentEl.scrollHeight));t!==this.noDataBodyHeight&&(this.noDataBodyHeight=t)})))}queryChildEl(t){return this.el.querySelector(t)??this.el.shadowRoot?.querySelector(t)??null}queryAllTr(){return[...Array.from(this.el.querySelectorAll("sd-tr")),...Array.from(this.el.shadowRoot?.querySelectorAll("sd-tr")??[])]}pushRowsToChildren(t){const e=this.queryChildEl("sd-tbody");e&&(e.rows=t);const s=this.queryChildEl("sd-thead");s&&(s.rows=t)}handleStructureSlotChange=()=>{Array.isArray(this.rows)&&this.pushRowsToChildren(this.rows),this.refreshChildrenConfig()};refreshChildrenSelection(){const t=this.queryChildEl("sd-thead");t?.refreshSelection?.(),this.queryAllTr().forEach((t=>t.refreshSelection?.()))}refreshChildrenConfig(){const t=this.queryChildEl("sd-thead");t?.refreshConfig?.(),this.queryAllTr().forEach((t=>t.refreshConfig?.()))}maybeEmitVirtualReachEnd(t,e){const s=Math.max(1,this.virtualEndThreshold);e>=Math.max(0,this.rowCount-s)&&this.lastReachEndNotifiedRowCount!==this.rowCount&&(this.lastReachEndNotifiedRowCount=this.rowCount,this.sdVirtualReachEnd.emit({from:t,to:e,rowCount:this.rowCount,threshold:s}))}propagateVirtualUpdate(t=!1){if(!this.scrollContainer||!this.useVirtualScroll)return;const e=this.toFiniteNumber(this.scrollContainer.scrollTop,0),s=this.toFiniteNumber(this.scrollContainer.clientHeight,0),{start:i,end:a}=this.calculateVisibleRange(e,s);if(!Number.isFinite(i)||!Number.isFinite(a))return;const n=this.vsStart!==i||this.vsEnd!==a;if(!n&&!t)return;this.vsStart=i,this.vsEnd=a;const h=i*this.effectiveRowHeight,o=Math.max(0,(this.rowCount-a)*this.effectiveRowHeight),l=this.queryChildEl("sd-tbody");l?.setSpacersSync?.(h,o),n&&this.sdVirtualUpdate.emit({from:i,to:a}),this.maybeEmitVirtualReachEnd(i,a)}getVirtualScrollConfigSync(){return{useVirtualScroll:this.useVirtualScroll,rowHeight:this.effectiveRowHeight,virtualBuffer:this.virtualBuffer,vsStart:this.vsStart,vsEnd:this.vsEnd,rowCount:this.rowCount}}getConfigSync(){return{columns:this.columns,selectable:this.selectable,resizable:this.resizable,stickyColumn:this.stickyColumn,stickyHeader:this.stickyHeader,scrolledLeft:this.scrolledLeft,scrolledRight:this.scrolledRight,columnWidths:this.columnWidths,dense:this.dense}}registerUseFrameSync(t,e){if(null==t||""===e)return;let s=this.useFrameRegistry.get(t);s||(s=new Set,this.useFrameRegistry.set(t,s)),s.add(e)}unregisterUseFrameSync(t,e){if(null==t||""===e)return;const s=this.useFrameRegistry.get(t);s&&(s.delete(e),0===s.size&&this.useFrameRegistry.delete(t))}hasUseFrameInRowSync(t){const e=this.useFrameRegistry.get(t);return null!=e&&e.size>0}isCellUseFrameSync(t,e){return this.useFrameRegistry.get(t)?.has(e)??!1}isRowSelectedSync(t){return Array.from(this.innerSelected).some((e=>e[this.rowKey??"id"]===t[this.rowKey??"id"]))}async isRowSelected(t){return this.isRowSelectedSync(t)}updateRowSelectSync(t){const e=Array.from(this.innerSelected),s=this.isRowSelectedSync(t)?e.filter((e=>e[this.rowKey??"id"]!==t[this.rowKey??"id"])):[...e,t];s.length!==e.length&&(this.innerSelected=new Set(s),this.selected=Array.from(this.innerSelected),this.sdSelectChange.emit(Array.from(this.innerSelected)),this.refreshChildrenSelection())}async updateRowSelect(t){this.updateRowSelectSync(t)}toggleSelectAllSync(t,e){if(t){const t=new Set([...e]);this.innerSelected=new Set([...this.innerSelected,...t])}else{const t=e.map((t=>t[this.rowKey??"id"]));this.innerSelected=new Set([...this.innerSelected].filter((e=>!t.includes(e[this.rowKey??"id"]))))}this.selected=Array.from(this.innerSelected),this.sdSelectChange.emit(Array.from(this.innerSelected)),this.refreshChildrenSelection()}async toggleSelectAll(t,e){this.toggleSelectAllSync(t,e)}getIsAllCheckedSync(t){const e=t.length,s=t.filter((t=>Array.from(this.innerSelected).some((e=>e[this.rowKey??"id"]===t[this.rowKey??"id"])))).length;return 0!==s&&(s===e||null)}async getIsAllChecked(t){return this.getIsAllCheckedSync(t)}changePage(t){this.useInternalPagination?(this.currentPage=t,this.sdPageChange.emit(this.currentPage),this.updateRowsVisibility()):this.sdPageChange.emit(t)}updateRowsVisibility(){this.queryAllTr().forEach((t=>t.updateVisibility?.()))}changeRowsPerPage(t){const e=null!=t&&""!==t?Number(t):0;if(!this.useInternalPagination)return void this.sdRowsPerPageChange.emit(e);this.innerRowsPerPage=e;const s=Math.max(1,Math.ceil(this.rowCount/e));this.currentPage>s&&(this.currentPage=s),this.sdRowsPerPageChange.emit(e),this.updateRowsVisibility()}get lastPageNumber(){if(this.useInternalPagination)return Math.max(1,Math.ceil(this.rowCount/this.innerRowsPerPage));const{lastPage:t,rowsPerPage:e=10}=this.pagination||{};return t??Math.max(1,Math.ceil(this.rowCount/e))}handleResize(t,e,s=!1){if("undefined"==typeof document)return;const i=e.clientX,a=this.columnWidths[t],n=e=>{const n=this.columns[t];if(null==n)return;const h=n.maxWidth||9999,o=e.clientX-i,l=Math.min(Math.max(a+(s?-o:o),n.minWidth||50),h);this.columnWidths=this.columnWidths.map(((e,s)=>s===t?l:e));const r=this.queryChildEl("sd-thead");r?.setColumnWidths?.(this.columnWidths),this.queryAllTr().forEach((t=>t.setColumnWidths?.(this.columnWidths)));const d=this.stickyColumn?.right||0,c=this.columns.filter((t=>!1!==t.visible)).length;d>0&&t===c-d&&requestAnimationFrame((()=>{this.onScroll?.()}))},h=()=>{document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",h)};document.addEventListener("mousemove",n),document.addEventListener("mouseup",h)}getStickyStyleSync(t){const e=this.columnWidths.slice(0,t).reduce(((t,e)=>t+e),this.selectable?d:0),s=this.columnWidths.filter(((e,s)=>s>=this.columns.filter((t=>!1!==t.visible)).length-(this.stickyColumn?.right||0)&&s>t)).reduce(((t,e)=>t+e),0),i=this.columns.filter((t=>!1!==t.visible))[t],a={"--sticky-left-offset":e+"px","--sticky-right-offset":s+"px"};return i?.autoWidth||(a.width=this.columnWidths[t]+"px",a.minWidth=this.columnWidths[t]+"px",a.maxWidth=this.columnWidths[t]+"px"),a}async getStickyStyle(t){return this.getStickyStyleSync(t)}spanKey(t,e){return`${t}::${e}`}requestAllTrUpdate(){this.queryAllTr().forEach((t=>{"function"==typeof t.bumpSpansVersion?t.bumpSpansVersion():a(t)}))}registerSpanSync(t,e,s,i){if(null==t||""===e)return;const a=Math.max(1,Math.floor(s||1)),n=Math.max(1,Math.floor(i||1)),h=this.spanKey(t,e),o=this.spanRegistry.get(h);if(1===a&&1===n){if(!o)return;return this.spanRegistry.delete(h),void this.requestAllTrUpdate()}o&&o.rowspan===a&&o.colspan===n||(this.spanRegistry.set(h,{rowspan:a,colspan:n}),this.requestAllTrUpdate())}unregisterSpanSync(t,e){if(null==t||""===e)return;const s=this.spanKey(t,e);this.spanRegistry.has(s)&&(this.spanRegistry.delete(s),this.requestAllTrUpdate())}getSpanSync(t,e){return this.spanRegistry.get(this.spanKey(t,e))}registerCellClassSync(t,e,s){if(null==t||""===e)return;const i=this.spanKey(t,e),a=(s??"").trim();""!==a?this.cellClassRegistry.set(i,a):this.cellClassRegistry.delete(i)}unregisterCellClassSync(t,e){null!=t&&""!==e&&this.cellClassRegistry.delete(this.spanKey(t,e))}getCellClassSync(t,e){return this.cellClassRegistry.get(this.spanKey(t,e))}hasRowspanSync(){for(const t of this.spanRegistry.values())if(t.rowspan>1)return!0;return!1}isCoveredSync(t,e,s){if(0===this.spanRegistry.size)return!1;const i=s.filter((t=>!1!==t.visible));for(let s=0;s<e;s++){const a=i[s];if(null==a)continue;const n=this.spanRegistry.get(this.spanKey(t,"string"==typeof a.field?a.field:a.name));if(n&&s+n.colspan>e)return!0}const a=this.resolveRowIndex(t);if(null==a)return!1;for(const[t,s]of this.spanRegistry){if(s.rowspan<=1)continue;const n=t.indexOf("::");if(n<0)continue;const h=t.slice(0,n),o=t.slice(n+2),l=this.resolveRowIndex(h);if(null==l)continue;if(l>=a)continue;if(l+s.rowspan<=a)continue;const r=i.findIndex((t=>("string"==typeof t.field?t.field:t.name)===o));if(!(r<0)&&r<=e&&r+s.colspan>e)return!0}return!1}setRowCountSync(t){const e=Math.max(0,Math.floor(this.toFiniteNumber(t,0)));e!==this.rowCount&&(this.lastReachEndNotifiedRowCount=-1),this.rowCount=e,this.useVirtualScroll&&this.propagateVirtualUpdate(!0)}async setRowCount(t){this.setRowCountSync(t)}calculateVisibleRange(t,e){const s=Math.max(1,this.toFiniteNumber(this.effectiveRowHeight,40)),i=Math.max(0,Math.floor(this.toFiniteNumber(this.virtualBuffer,5))),a=Math.max(0,this.toFiniteNumber(t,0)),n=Math.max(0,this.toFiniteNumber(e,0)),h=Math.max(0,Math.floor(this.toFiniteNumber(this.rowCount,0))),o=Math.floor(a/s),l=Math.ceil(n/s);return{start:Math.max(0,o-i),end:Math.min(h,o+l+i)}}getPaginationInfoSync(){if(!this.useInternalPagination||!this.pagination)return null;const t=(this.currentPage-1)*this.innerRowsPerPage;return{startIndex:t,endIndex:t+this.innerRowsPerPage,currentPage:this.currentPage,rowsPerPage:this.innerRowsPerPage}}async getPaginationInfo(){return this.getPaginationInfoSync()}getVirtualScrollRangeSync(){return this.useVirtualScroll&&this.vsEnd>0?{from:this.vsStart,to:this.vsEnd}:null}renderAutoRows(){if(this.useVirtualScroll)return null;const t=this.rows??[],e=this.getPaginationInfoSync(),s=e?.startIndex??0;return(e?t.slice(e.startIndex,e.endIndex):t).map(((t,e)=>{const i=s+e;return n("sd-tr",{key:i,"row-key":i+"",row:t})}))}get tableClasses(){return["sd-table",this.stickyHeader&&"sd-table--sticky-header",this.selectable&&"sd-table--selectable",this.resizable&&"sd-table--resizable",(this.selectable||(this.stickyColumn?.left??0)>0||(this.stickyColumn?.right??0)>0)&&"sd-table--sticky-column",this.scrolledLeft&&"sd-table--scrolled-left",this.scrolledRight&&"sd-table--scrolled-right",0===this.rowCount&&!this.isLoading&&"sd-table--no-data"].filter(Boolean).join(" ")}render(){const t=this.getResolvedTableId(),e=0===this.rowCount&&!this.isLoading,s=e?`max(${this.height||"96px"}, ${36+this.noDataBodyHeight}px)`:this.height||"100%";return n(h,{key:"4596e04bd57aca00fa6378fd26ce33a06a795eaf",style:{"--table-radius":b+"px","--table-border-color":u.color,"--table-border-width":u.width+"px","--table-body-font-family":c.fontFamily,"--table-body-font-weight":c.fontWeight,"--table-body-font-size":c.fontSize+"px","--table-body-line-height":c.lineHeight+"px","--table-body-text-decoration":c.textDecoration,"--table-selectable-width":d+"px"}},n("div",{key:"11a20d327410b0be659cede32917164e036e796c",class:"sd-table__container",style:{"--table-width":this.width,"--table-height":s,"--table-container-height":`calc(${s} - ${this.pagination&&this.rowCount>0&&!this.useVirtualScroll?48:0}px)`}},n("div",{key:"f4f3acf584dc4eacdae25b11aa2b62b73ffab949",class:{"sd-table__wrapper":!0,"sd-table__wrapper--use-top":this.useTop}},n("div",{key:"c8ab618b9c990a22b8e9466a5bfb5f02f4de8b12",class:{"sd-table__scroll-container":!0,"sd-table__scroll-container--loading":this.isLoading,"sd-table__scroll-container--no-data":e}},this.isLoading&&n("div",{key:"a696933a70799ba282fc743281d0af27fd691a2e",class:"sd-table__loading",style:{top:this.loadingScrollTop+"px"}},n("sd-circle-progress",{key:"cba6ac47367ef6499bf338b9b757ee74fdd7e6c1",indeterminate:!0})),e&&n(n.Fragment,null,n("div",{key:"6e22156bf5b0fb9814d9bf9cad57506758c6284b",class:"sd-table__no-data-header-overlay"}),n("div",{key:"b72f9fabcc8acb8e700ad55acc4d7aff08355a1c",class:"sd-table__no-data"},n("div",{key:"43f271a8803121362f16e8153748328658f073ec",class:"sd-table__no-data-content",ref:t=>{this.noDataContentEl=t,t&&this.syncNoDataContentObserver()}},n("slot",{key:"4b8533115bbc81962b80c9c2533fe4b44a87193c",name:"no-data"},n("span",{key:"d94c4f7cf9eca7901b99434f712480a7b20c869a"},this.resolvedNoDataLabel))))),n("table",{key:"a9a353aca09124ed8a82fcd2f8a0a7de09b234f5",class:this.tableClasses},this.autoThead?n("slot",{name:t+"-head",onSlotchange:this.handleStructureSlotChange},n("sd-thead",{rows:this.rows??[]})):n("slot",{name:t+"-head",onSlotchange:this.handleStructureSlotChange}),this.autoTbody?n("slot",{name:t+"-body",onSlotchange:this.handleStructureSlotChange},n("sd-tbody",{rows:this.rows??[]},this.renderAutoRows())):n("slot",{name:t+"-body",onSlotchange:this.handleStructureSlotChange})))),this.pagination&&this.pagination.rowsPerPage>0&&this.rowCount>0&&!this.useVirtualScroll&&n("div",{key:"8afeb9398c3d7540a54b9a3660fb9685ae1cddca",class:"sd-table__pagination"},n("sd-pagination",{key:"e2cbb3f7414f65b81ab2d33eaec5d9f28bed6cc8",currentPage:this.useInternalPagination?this.currentPage:this.pagination.page,lastPage:this.useInternalPagination?this.lastPageNumber:this.pagination.lastPage,onSdPageChange:t=>this.changePage(t.detail)}),this.useRowsPerPageSelect&&n("sd-select",{key:"ce723544dbc7e4cc0d77ced3b685b8575cf67e6f",value:this.useInternalPagination?this.innerRowsPerPage:this.pagination.rowsPerPage,options:this.rowsPerPageOption,width:"128px",emitValue:!0,onSdUpdate:t=>{this.isRowsPerPageValue(t.detail)&&this.changeRowsPerPage(t.detail)}}))))}static get watchers(){return{isLoading:[{handleIsLoadingChange:0}],useVirtualScroll:[{handleUseVirtualScrollChange:0}],columns:[{handleColumnsChange:0}],rows:[{handleRowsChange:0}],rowKey:[{handleRowKeyChange:0}],tableId:[{handleTableIdChange:0}],noDataLabel:[{handleNoDataLabelChange:0}],selectable:[{handleConfigChange:0}],resizable:[{handleConfigChange:0}],stickyColumn:[{handleConfigChange:0}],stickyHeader:[{handleConfigChange:0}],dense:[{handleConfigChange:0}],selected:[{handleSelectedChange:0}],pagination:[{handlePaginationChange:0}]}}static get style(){return"sd-table,:host{display:block;width:100%;max-width:100%;min-width:0}sd-table *,:host *{box-sizing:border-box}.sd-table__container{height:var(--table-height, 100%);width:var(--table-width, 100%);max-width:100%;min-width:0;color:#222222;display:flex;flex-direction:column}.sd-table__wrapper{width:100%;min-width:0;height:var(--table-container-height, 400px);border:var(--table-border-width, 1px) solid var(--table-border-color, #E1E1E1);border-radius:var(--table-radius, 8px);overflow:hidden}.sd-table__wrapper--use-top{border-radius:0 0 var(--table-radius, 8px) var(--table-radius, 8px)}.sd-table__scroll-container{width:100%;height:100%;display:flex;flex-direction:column;position:relative;font-family:var(--table-body-font-family, inherit);font-weight:var(--table-body-font-weight, 400);font-size:var(--table-body-font-size, 12px);line-height:var(--table-body-line-height, 20px);text-decoration:var(--table-body-text-decoration, none);overflow:auto;background:#FFFFFF}.sd-table__scroll-container--loading{overflow:hidden !important;pointer-events:none}.sd-table__scroll-container--no-data{overflow:hidden;pointer-events:none}.sd-table__no-data{position:absolute;top:36px;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center;font-size:var(--table-body-font-size, 12px);color:#888888;pointer-events:none;z-index:200;background:rgba(255, 255, 255, 0.6)}.sd-table__no-data-header-overlay{position:absolute;top:0;left:0;right:0;height:36px;background:rgba(255, 255, 255, 0.6);z-index:210;pointer-events:none}.sd-table__no-data-content{pointer-events:auto;min-height:60px;width:100%;display:flex;align-items:center;justify-content:center}.sd-table__loading{position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(255, 255, 255, 0.6);z-index:200;display:flex;align-items:center;justify-content:center;pointer-events:none}.sd-table{background-color:white;display:table;width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed}.sd-table--selectable sd-thead,.sd-table--selectable sd-tbody{--selectable:true}.sd-table--sticky-header sd-thead thead{position:sticky;top:0;z-index:120}.sd-table--sticky-column sd-thead,.sd-table--sticky-column sd-tbody{--sticky-column:true}.sd-table--scrolled-left sd-thead,.sd-table--scrolled-left sd-tbody{--scrolled-left:true}.sd-table--scrolled-right sd-thead,.sd-table--scrolled-right sd-tbody{--scrolled-right:true}.sd-table--resizable sd-thead{--resizable:true}.sd-table--no-data sd-thead{opacity:0.4}.sd-table__pagination{position:relative;background:#F9F9F9;height:48px;display:flex;align-items:center;justify-content:center;border:var(--table-border-width, 1px) solid var(--table-border-color, #E1E1E1);margin-top:-1px;border-radius:var(--table-radius, 8px)}.sd-table__pagination sd-select{position:absolute;right:10px;top:50%;transform:translateY(-50%)}"}},[769,"sd-table",{tableId:[513,"table-id"],columns:[16],rows:[16],selected:[1040],rowKey:[1,"row-key"],selectable:[4],resizable:[4],width:[1],height:[1],stickyHeader:[4,"sticky-header"],stickyColumn:[16],useTop:[4,"use-top"],noDataLabel:[1,"no-data-label"],isLoading:[4,"is-loading"],pagination:[16],useInternalPagination:[4,"use-internal-pagination"],useRowsPerPageSelect:[4,"use-rows-per-page-select"],dense:[4],useVirtualScroll:[4,"use-virtual-scroll"],rowHeight:[2,"row-height"],virtualBuffer:[2,"virtual-buffer"],virtualEndThreshold:[2,"virtual-end-threshold"],rowsPerPageOption:[16],resolvedNoDataLabel:[32],currentPage:[32],innerRowsPerPage:[32],innerSelected:[32],columnWidths:[32],scrolledLeft:[32],scrolledRight:[32],rowCount:[32],loadingScrollTop:[32],noDataBodyHeight:[32],autoThead:[32],autoTbody:[32],isRowSelected:[64],updateRowSelect:[64],toggleSelectAll:[64],getIsAllChecked:[64],getStickyStyle:[64],setRowCount:[64],getPaginationInfo:[64]},void 0,{isLoading:[{handleIsLoadingChange:0}],useVirtualScroll:[{handleUseVirtualScrollChange:0}],columns:[{handleColumnsChange:0}],rows:[{handleRowsChange:0}],rowKey:[{handleRowKeyChange:0}],tableId:[{handleTableIdChange:0}],noDataLabel:[{handleNoDataLabelChange:0}],selectable:[{handleConfigChange:0}],resizable:[{handleConfigChange:0}],stickyColumn:[{handleConfigChange:0}],stickyHeader:[{handleConfigChange:0}],dense:[{handleConfigChange:0}],selected:[{handleSelectedChange:0}],pagination:[{handlePaginationChange:0}]}]),j=D,L=function(){"undefined"!=typeof customElements&&["sd-table","sd-button","sd-checkbox","sd-circle-progress","sd-field","sd-floating-portal","sd-icon","sd-pagination","sd-portal","sd-select","sd-select-list-item","sd-select-list-item-search","sd-select-listbox","sd-select-trigger","sd-tbody","sd-thead","sd-tooltip","sd-tr"].forEach((t=>{switch(t){case"sd-table":customElements.get(o(t))||customElements.define(o(t),D);break;case"sd-button":customElements.get(o(t))||g();break;case"sd-checkbox":customElements.get(o(t))||f();break;case"sd-circle-progress":customElements.get(o(t))||p();break;case"sd-field":customElements.get(o(t))||m();break;case"sd-floating-portal":customElements.get(o(t))||y();break;case"sd-icon":customElements.get(o(t))||w();break;case"sd-pagination":customElements.get(o(t))||C();break;case"sd-portal":customElements.get(o(t))||S();break;case"sd-select":customElements.get(o(t))||v();break;case"sd-select-list-item":customElements.get(o(t))||k();break;case"sd-select-list-item-search":customElements.get(o(t))||x();break;case"sd-select-listbox":customElements.get(o(t))||_();break;case"sd-select-trigger":customElements.get(o(t))||R();break;case"sd-tbody":customElements.get(o(t))||P();break;case"sd-thead":customElements.get(o(t))||E();break;case"sd-tooltip":customElements.get(o(t))||M();break;case"sd-tr":customElements.get(o(t))||A()}}))};export{j as SdTable,L as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,g as l,b as a}from"./p-DNWwGHho.js";export{s as setNonce}from"./p-DNWwGHho.js";(()=>{const l=import.meta.url,a={};return""!==l&&(a.resourcesUrl=new URL(".",l).href),e(a)})().then((async e=>(await l(),a(JSON.parse('[["p-f3dff8b8",[[512,"sd-button",{"name":[1],"label":[1],"icon":[1],"rightIcon":[1,"right-icon"],"ariaLabel":[1,"aria-label"],"disabled":[4],"type":[1]}],[512,"sd-icon",{"name":[1],"size":[8],"color":[1],"rotate":[2],"label":[1],"iconStyle":[16]}]]],["p-8fc49d2d",[[772,"sd-key-value-table",{"fields":[16],"search":[4],"useTop":[4,"use-top"]}]]],["p-969665c0",[[769,"sd-table",{"tableId":[513,"table-id"],"columns":[16],"rows":[16],"selected":[1040],"rowKey":[1,"row-key"],"selectable":[4],"resizable":[4],"width":[1],"height":[1],"stickyHeader":[4,"sticky-header"],"stickyColumn":[16],"useTop":[4,"use-top"],"noDataLabel":[1,"no-data-label"],"isLoading":[4,"is-loading"],"pagination":[16],"useInternalPagination":[4,"use-internal-pagination"],"useRowsPerPageSelect":[4,"use-rows-per-page-select"],"dense":[4],"useVirtualScroll":[4,"use-virtual-scroll"],"rowHeight":[2,"row-height"],"virtualBuffer":[2,"virtual-buffer"],"virtualEndThreshold":[2,"virtual-end-threshold"],"rowsPerPageOption":[16],"resolvedNoDataLabel":[32],"currentPage":[32],"innerRowsPerPage":[32],"innerSelected":[32],"columnWidths":[32],"scrolledLeft":[32],"scrolledRight":[32],"rowCount":[32],"loadingScrollTop":[32],"noDataBodyHeight":[32],"autoThead":[32],"autoTbody":[32],"isRowSelected":[64],"updateRowSelect":[64],"toggleSelectAll":[64],"getIsAllChecked":[64],"getStickyStyle":[64],"setRowCount":[64],"getPaginationInfo":[64]},null,{"isLoading":[{"handleIsLoadingChange":0}],"useVirtualScroll":[{"handleUseVirtualScrollChange":0}],"columns":[{"handleColumnsChange":0}],"rows":[{"handleRowsChange":0}],"rowKey":[{"handleRowKeyChange":0}],"tableId":[{"handleTableIdChange":0}],"noDataLabel":[{"handleNoDataLabelChange":0}],"selectable":[{"handleConfigChange":0}],"resizable":[{"handleConfigChange":0}],"stickyColumn":[{"handleConfigChange":0}],"stickyHeader":[{"handleConfigChange":0}],"dense":[{"handleConfigChange":0}],"selected":[{"handleSelectedChange":0}],"pagination":[{"handlePaginationChange":0}]}]]],["p-9e75a5dc",[[512,"sd-modal-container",{"autoRemove":[4,"auto-remove"],"entries":[32],"open":[64],"openLoading":[64],"createCustom":[64],"dismissById":[64],"update":[64]}]]],["p-5d5d8220",[[772,"sd-barcode-input",{"value":[1032],"size":[1],"addonLabel":[1,"addon-label"],"addonAlign":[1,"addon-align"],"placeholder":[1],"disabled":[4],"clearable":[4],"width":[8],"rules":[16],"autoFocus":[4,"auto-focus"],"status":[1],"hint":[1],"errorMessage":[1,"error-message"],"inputClass":[1,"input-class"],"readonly":[4],"error":[1028],"focused":[1028],"hovered":[1028],"label":[1],"labelWidth":[8,"label-width"],"icon":[16],"labelTooltip":[1,"label-tooltip"],"labelTooltipProps":[16],"inputStyle":[16],"name":[1],"internalValue":[32],"sdGetNativeElement":[64],"sdValidate":[64],"sdReset":[64],"sdResetValidate":[64],"sdFocus":[64]},null,{"value":[{"valueChanged":0}],"internalValue":[{"internalValueChanged":0}]}]]],["p-60b80bf3",[[512,"sd-popover",{"show":[1028],"placement":[513],"color":[513],"icon":[513],"iconSize":[514,"icon-size"],"label":[1],"name":[1],"rightIcon":[1,"right-icon"],"ariaLabel":[1,"aria-label"],"disabled":[4],"type":[1],"menuTitle":[1,"menu-title"],"leftLink":[16],"button":[16],"menuClass":[1,"menu-class"],"slotContentHTML":[32]}]]],["p-78c2fd6d",[[512,"sd-guide",{"type":[513],"label":[513],"message":[1],"url":[1],"popupTitle":[1,"popup-title"],"popupWidth":[2,"popup-width"],"popupShow":[32]}]]],["p-1aafbc7b",[[512,"sd-toast-container",{"position":[1],"maxVisible":[2,"max-visible"],"defaultDuration":[2,"default-duration"],"zIndex":[2,"z-index"],"toasts":[32],"expanded":[32],"create":[64],"dismiss":[64],"dismissAll":[64]}]]],["p-cce38339",[[772,"sd-action-modal",{"modalTitle":[1,"modal-title"],"buttonProps":[16],"width":[8],"height":[8]}]]],["p-54086285",[[512,"sd-dropdown-button",{"name":[1],"label":[1],"items":[16],"disabled":[4],"split":[4],"isOpen":[32],"isAnimatingOut":[32],"itemIndex":[32],"sdOpen":[64],"sdClose":[64]},null,{"isOpen":[{"handleOpenChange":0}]}]]],["p-2c0a8333",[[772,"sd-popup",{"popupTitle":[1,"popup-title"],"type":[1],"useFooter":[4,"use-footer"],"submitButtonProps":[16]}]]],["p-95bbba4f",[[512,"sd-tabs",{"value":[1537],"tabs":[1040],"size":[513],"isSub":[516,"is-sub"]},null,{"value":[{"valueChanged":0}]}]]],["p-2d3d25bd",[[512,"sd-callout",{"type":[513],"message":[16]}]]],["p-a5930cbd",[[512,"sd-loading-container",{"visible":[32],"message":[32],"show":[64],"hide":[64]}]]],["p-78b0b759",[[512,"sd-badge",{"color":[1]}]]],["p-8674d868",[[772,"sd-card",{"bordered":[4],"sdClass":[1,"sd-class"]}]]],["p-25fad267",[[514,"sd-date-box",{"date":[8],"disabled":[4],"selected":[4],"isStartDate":[4,"is-start-date"],"isEndDate":[4,"is-end-date"],"isToday":[4,"is-today"],"inRange":[4,"in-range"],"type":[1]}]]],["p-18057222",[[512,"sd-divider",{"vertical":[516]}]]],["p-d8292621",[[772,"sd-form",{"formClass":[1,"form-class"],"sdRegisterField":[64],"sdUnregisterField":[64],"sdValidate":[64],"sdReset":[64],"sdResetValidation":[64]}]]],["p-ff33d019",[[512,"sd-linear-progress",{"indeterminate":[516],"value":[2],"type":[513],"label":[1]}]]],["p-f14962bd",[[512,"sd-radio-button",{"value":[1032],"options":[1040],"size":[1],"disabled":[4],"name":[1]}]]],["p-1219699a",[[512,"sd-switch",{"value":[1028],"label":[1],"disabled":[4]}]]],["p-07b0d118",[[772,"sd-td",{"field":[1],"rowKey":[1,"row-key"],"align":[1],"rowspan":[2],"colspan":[2],"sdClass":[1,"sd-class"],"dividerLeft":[4,"divider-left"],"dividerRight":[4,"divider-right"],"useFrame":[4,"use-frame"]},null,{"field":[{"handleFieldChange":0}],"rowKey":[{"handleRowKeyChange":0}],"rowspan":[{"handleSpanChange":0}],"colspan":[{"handleSpanChange":0}],"sdClass":[{"handleSdClassChange":0}],"dividerLeft":[{"handleDividerChange":0}],"dividerRight":[{"handleDividerChange":0}],"useFrame":[{"handleUseFrameChange":0}]}]]],["p-18d3ae55",[[512,"sd-toggle",{"value":[1540],"label":[1],"disabled":[4]}]]],["p-e6bd8ab1",[[512,"sd-toast",{"icon":[1],"message":[1],"link":[1],"linkLabel":[1,"link-label"],"buttonLabel":[1,"button-label"],"useClose":[4,"use-close"],"type":[1]}]]],["p-4c3ead1b",[[512,"sd-text-link",{"label":[1],"icon":[1],"iconColor":[1,"icon-color"],"labelClass":[1,"label-class"],"useArrow":[516,"use-arrow"],"underline":[516],"disabled":[516]}]]],["p-74b3e95b",[[512,"sd-tag",{"name":[1],"label":[1],"icon":[1],"isLeft":[4,"is-left"]}]]],["p-bd4e5141",[[772,"sd-confirm-modal",{"type":[1],"modalTitle":[1,"modal-title"],"titleClass":[1,"title-class"],"topMessage":[16],"bottomMessage":[16],"mainButtonName":[1,"main-button-name"],"mainButtonLabel":[1,"main-button-label"],"subButtonLabel":[1,"sub-button-label"],"tagPreset":[1,"tag-preset"],"tagLabel":[1,"tag-label"],"slotLabel":[1,"slot-label"],"tagContents":[16],"hasSlottedContent":[32]}],[512,"sd-loading-modal",{"state":[513],"message":[1],"useButton":[516,"use-button"],"buttonLabel":[1,"button-label"],"width":[8],"height":[8],"progress":[2]}]]],["p-9d34518e",[[512,"sd-chip",{"name":[1],"value":[1025],"error":[1028],"disabled":[4],"placeholder":[1],"rules":[16],"internalValue":[32],"isEditing":[32],"sdValidate":[64],"sdReset":[64],"sdResetValidate":[64],"sdResetValidation":[64],"sdFocus":[64],"sdGetNativeElement":[64]},null,{"value":[{"valueChanged":0}]}]]],["p-e81cb8c9",[[512,"sd-date-range-picker-calendar",{"value":[16],"selectable":[16],"maxRange":[2,"max-range"],"currentYear":[32],"currentMonth":[32],"pendingStart":[32],"hoverDate":[32],"displayValue":[32]},null,{"value":[{"handleValueChange":0}]}]]],["p-ea586c5e",[[512,"sd-radio",{"value":[1032],"val":[8],"disabled":[4],"label":[1]},null,{"value":[{"valueChanged":0}]}]]],["p-c73cadc7",[[512,"sd-thead",{"columns":[16],"selectable":[4],"resizable":[4],"stickyColumn":[16],"stickyHeader":[4,"sticky-header"],"scrolledLeft":[4,"scrolled-left"],"scrolledRight":[4,"scrolled-right"],"rows":[16],"columnWidths":[1040],"tableId":[32],"_columns":[32],"_selectable":[32],"_resizable":[32],"_stickyColumn":[32],"_stickyHeader":[32],"_scrolledLeft":[32],"_scrolledRight":[32],"refreshConfig":[64],"setColumnWidths":[64],"refreshSelection":[64]},null,{"columns":[{"handleColumnsChange":0}]}],[772,"sd-tr",{"columns":[16],"selectable":[4],"stickyColumn":[16],"rowKey":[1,"row-key"],"row":[16],"separator":[8],"tableId":[32],"columnWidths":[32],"isVisible":[32],"spansVersion":[32],"_columns":[32],"_selectable":[32],"_stickyColumn":[32],"_scrolledLeft":[32],"_scrolledRight":[32],"_dense":[32],"refreshConfig":[64],"bumpSpansVersion":[64],"updateVisibility":[64],"setColumnWidths":[64],"refreshSelection":[64]}],[512,"sd-pagination",{"currentPage":[1026,"current-page"],"lastPage":[2,"last-page"],"simple":[4]}],[769,"sd-tbody",{"rows":[16],"tableId":[32],"topSpacerHeight":[32],"bottomSpacerHeight":[32]},null,{"rows":[{"handleRowsChange":0}]}]]],["p-5c4fd9c1",[[512,"sd-circle-progress",{"indeterminate":[516],"value":[2],"type":[513],"label":[1]}]]],["p-46faa7ed",[[512,"sd-ghost-button",{"icon":[1],"size":[1],"intent":[1],"ariaLabel":[1,"aria-label"],"disabled":[4]}]]],["p-c1bac61e",[[512,"sd-calendar",{"value":[1025],"selectable":[16],"events":[16],"elevated":[4],"currentYear":[32],"currentMonth":[32]},null,{"value":[{"handleValueChange":0}]}],[512,"sd-date-picker-trigger",{"displayText":[1,"display-text"],"placeholder":[1],"disabled":[4],"size":[1]}]]],["p-cffa6da7",[[772,"sd-portal",{"to":[1],"parentRef":[16],"offset":[16],"viewportPadding":[2,"viewport-padding"],"zIndex":[2,"z-index"],"open":[4]},[[9,"scroll","updatePosition"],[9,"resize","updatePosition"],[9,"mousedown","handleMouseDown"],[8,"click","handleWindowClick"]],{"open":[{"handleOpenChange":0}]}]]],["p-3e2b5e01",[[512,"sd-date-picker",{"value":[1025],"size":[513],"placeholder":[513],"selectable":[16],"disabled":[516],"width":[8],"label":[1],"labelWidth":[8,"label-width"],"addonLabel":[1,"addon-label"],"addonAlign":[1,"addon-align"],"hint":[1],"errorMessage":[1,"error-message"],"rules":[16],"error":[1028],"icon":[16],"labelTooltip":[1,"label-tooltip"],"labelTooltipProps":[16],"name":[1],"isOpen":[32],"isAnimatingOut":[32],"focused":[32],"hovered":[32],"sdValidate":[64],"sdReset":[64],"sdResetValidate":[64]},null,{"isOpen":[{"watchIsOpen":0}]}],[512,"sd-date-range-picker",{"value":[1040],"size":[513],"placeholder":[513],"selectable":[16],"maxRange":[2,"max-range"],"disabled":[516],"width":[8],"label":[1],"labelWidth":[8,"label-width"],"addonLabel":[1,"addon-label"],"addonAlign":[1,"addon-align"],"hint":[1],"errorMessage":[1,"error-message"],"rules":[16],"error":[1028],"icon":[16],"labelTooltip":[1,"label-tooltip"],"labelTooltipProps":[16],"name":[1],"isOpen":[32],"isAnimatingOut":[32],"focused":[32],"hovered":[32],"sdValidate":[64],"sdReset":[64],"sdResetValidate":[64]},null,{"isOpen":[{"watchIsOpen":0}]}],[512,"sd-file-picker",{"value":[1040],"placeholder":[513],"disabled":[516],"inline":[516],"multiple":[516],"accept":[1],"maxFileSize":[8,"max-file-size"],"maxTotalSize":[8,"max-total-size"],"maxFiles":[8,"max-files"],"name":[1],"label":[1],"labelWidth":[8,"label-width"],"addonLabel":[1,"addon-label"],"addonAlign":[1,"addon-align"],"hint":[1],"errorMessage":[1,"error-message"],"width":[8],"rules":[16],"error":[1028],"status":[1],"icon":[16],"labelTooltip":[1,"label-tooltip"],"labelTooltipProps":[16],"focused":[1028],"hovered":[1028],"internalValue":[32],"showTooltip":[32],"sdValidate":[64],"sdReset":[64],"sdResetValidate":[64]},null,{"value":[{"valueChanged":0}]}],[772,"sd-input",{"value":[1032],"type":[1],"size":[1],"addonLabel":[1,"addon-label"],"addonAlign":[1,"addon-align"],"placeholder":[1],"disabled":[4],"clearable":[4],"width":[8],"rules":[16],"autoFocus":[4,"auto-focus"],"autocomplete":[1],"maxlength":[2],"minlength":[2],"inputmode":[1],"enterkeyhint":[1],"spellcheck":[4],"status":[1],"hint":[1],"errorMessage":[1,"error-message"],"inputClass":[1,"input-class"],"readonly":[4],"error":[1028],"focused":[1028],"hovered":[1028],"label":[1],"labelWidth":[8,"label-width"],"icon":[16],"labelTooltip":[1,"label-tooltip"],"labelTooltipProps":[16],"inputStyle":[16],"name":[1],"internalValue":[32],"passwordVisible":[32],"sdGetNativeElement":[64],"sdValidate":[64],"sdReset":[64],"sdResetValidate":[64],"sdFocus":[64]},null,{"value":[{"valueChanged":0}],"internalValue":[{"internalValueChanged":0}]}],[512,"sd-number-input",{"size":[1],"min":[2],"max":[2],"step":[2],"useButton":[4,"use-button"],"useDecimal":[4,"use-decimal"],"value":[1032],"label":[1],"labelWidth":[8,"label-width"],"icon":[16],"labelTooltip":[1,"label-tooltip"],"labelTooltipProps":[16],"addonLabel":[1,"addon-label"],"addonAlign":[1,"addon-align"],"placeholder":[1],"disabled":[4],"width":[8],"rules":[16],"autoFocus":[4,"auto-focus"],"status":[1],"hint":[1],"errorMessage":[1,"error-message"],"inputPrefix":[1,"input-prefix"],"inputSuffix":[1,"input-suffix"],"inputClass":[1,"input-class"],"readonly":[4],"inputStyle":[16],"error":[1028],"focused":[1028],"hovered":[1028],"name":[1],"internalValue":[32],"displayValue":[32],"sdValidate":[64],"sdReset":[64],"sdResetValidate":[64],"sdFocus":[64],"sdGetNativeElement":[64]},null,{"value":[{"valueChanged":0}],"internalValue":[{"internalValueChanged":0}]}],[512,"sd-textarea",{"value":[1025],"placeholder":[1],"disabled":[4],"readonly":[4],"autoFocus":[4,"auto-focus"],"textareaClass":[1,"textarea-class"],"textareaStyle":[16],"maxLength":[2,"max-length"],"rows":[2],"spellcheck":[4],"width":[8],"label":[1],"labelWidth":[8,"label-width"],"addonLabel":[1,"addon-label"],"addonAlign":[1,"addon-align"],"hint":[1],"errorMessage":[1,"error-message"],"icon":[16],"labelTooltip":[1,"label-tooltip"],"labelTooltipProps":[16],"rules":[16],"error":[1028],"status":[1],"focused":[1028],"hovered":[1028],"name":[1],"internalValue":[32],"sdGetNativeElement":[64],"sdValidate":[64],"sdReset":[64],"sdResetValidate":[64],"sdFocus":[64]},null,{"value":[{"valueChanged":0}],"internalValue":[{"internalValueChanged":0}]}],[512,"sd-radio-group",{"value":[1032],"options":[1040],"direction":[1],"disabled":[4],"groupName":[1,"group-name"]},null,{"value":[{"valueChanged":0}]}]]],["p-4b43648c",[[512,"sd-checkbox",{"value":[1028],"val":[8],"disabled":[516],"inverse":[516],"label":[1],"isChecked":[32]},null,{"value":[{"watchValueHandler":0}]}]]],["p-deec1ef0",[[512,"sd-select-list-item",{"option":[16],"depth":[2],"isSelected":[4,"is-selected"],"isFocused":[4,"is-focused"],"useCheckbox":[4,"use-checkbox"],"countInfo":[16]}],[512,"sd-select-list-item-search",{"isScrolled":[4,"is-scrolled"],"searchText":[32],"sdFocus":[64]}]]],["p-0de5a53b",[[772,"sd-field",{"name":[1],"rules":[16],"error":[1028],"disabled":[1028],"readonly":[1028],"hovered":[1028],"focused":[1028],"status":[1],"hint":[1],"errorMessage":[1,"error-message"],"width":[8],"size":[513],"label":[1],"labelWidth":[8,"label-width"],"addonLabel":[1,"addon-label"],"addonAlign":[1,"addon-align"],"icon":[16],"labelTooltip":[1,"label-tooltip"],"labelTooltipProps":[16],"errorMsg":[32],"sdValidate":[64],"sdReset":[64],"sdResetValidation":[64],"sdFocus":[64]}],[512,"sd-tooltip",{"trigger":[1],"placement":[1],"color":[1],"tooltipType":[1,"tooltip-type"],"icon":[1],"iconSize":[2,"icon-size"],"label":[1],"name":[1],"rightIcon":[1,"right-icon"],"ariaLabel":[1,"aria-label"],"disabled":[4],"type":[1],"sdClass":[1,"sd-class"],"showTooltip":[32],"slotContentHTML":[32]}],[772,"sd-floating-portal",{"to":[1],"parentRef":[16],"offset":[16],"zIndex":[2,"z-index"],"placement":[1],"open":[4]},[[9,"scroll","updatePosition"],[9,"resize","updatePosition"],[9,"mousedown","handleMouseDown"],[8,"click","handleWindowClick"],[8,"keydown","handleKeydown"]]]]],["p-97b405aa",[[512,"sd-select",{"type":[1],"value":[1032],"options":[16],"placeholder":[1],"maxDropdownWidth":[1,"max-dropdown-width"],"dropdownHeight":[1,"dropdown-height"],"disabled":[4],"label":[1],"labelWidth":[8,"label-width"],"addonLabel":[1,"addon-label"],"addonAlign":[1,"addon-align"],"error":[1028],"hint":[1],"errorMessage":[1,"error-message"],"rules":[16],"icon":[16],"labelTooltip":[1,"label-tooltip"],"labelTooltipProps":[16],"emitValue":[4,"emit-value"],"width":[8],"useSearch":[4,"use-search"],"allSelectedLabel":[1,"all-selected-label"],"useSelectAll":[4,"use-select-all"],"name":[1],"isOpen":[32],"isAnimatingOut":[32],"triggerWidth":[32],"resolvedDropdownHeight":[32],"resolvedMaxDropdownWidth":[32],"focused":[32],"hovered":[32],"sdFocus":[64],"sdOpen":[64]},null,{"isOpen":[{"watchIsOpen":0}]}],[513,"sd-select-listbox",{"type":[1],"options":[16],"value":[8],"emitValue":[4,"emit-value"],"useSearch":[4,"use-search"],"useSelectAll":[4,"use-select-all"],"triggerWidth":[1,"trigger-width"],"maxWidth":[1,"max-width"],"maxHeight":[1,"max-height"],"searchKeyword":[32],"isScrolled":[32],"focusedIndex":[32]},null,{"searchKeyword":[{"resetFocusOnFilter":0}]}],[512,"sd-select-trigger",{"displayText":[1,"display-text"],"placeholder":[1],"disabled":[4],"isOpen":[4,"is-open"],"sdFocus":[64]}]]]]'),e))));
|
|
1
|
+
import{p as e,g as l,b as a}from"./p-DNWwGHho.js";export{s as setNonce}from"./p-DNWwGHho.js";(()=>{const l=import.meta.url,a={};return""!==l&&(a.resourcesUrl=new URL(".",l).href),e(a)})().then((async e=>(await l(),a(JSON.parse('[["p-f3dff8b8",[[512,"sd-button",{"name":[1],"label":[1],"icon":[1],"rightIcon":[1,"right-icon"],"ariaLabel":[1,"aria-label"],"disabled":[4],"type":[1]}],[512,"sd-icon",{"name":[1],"size":[8],"color":[1],"rotate":[2],"label":[1],"iconStyle":[16]}]]],["p-8fc49d2d",[[772,"sd-key-value-table",{"fields":[16],"search":[4],"useTop":[4,"use-top"]}]]],["p-969665c0",[[769,"sd-table",{"tableId":[513,"table-id"],"columns":[16],"rows":[16],"selected":[1040],"rowKey":[1,"row-key"],"selectable":[4],"resizable":[4],"width":[1],"height":[1],"stickyHeader":[4,"sticky-header"],"stickyColumn":[16],"useTop":[4,"use-top"],"noDataLabel":[1,"no-data-label"],"isLoading":[4,"is-loading"],"pagination":[16],"useInternalPagination":[4,"use-internal-pagination"],"useRowsPerPageSelect":[4,"use-rows-per-page-select"],"dense":[4],"useVirtualScroll":[4,"use-virtual-scroll"],"rowHeight":[2,"row-height"],"virtualBuffer":[2,"virtual-buffer"],"virtualEndThreshold":[2,"virtual-end-threshold"],"rowsPerPageOption":[16],"resolvedNoDataLabel":[32],"currentPage":[32],"innerRowsPerPage":[32],"innerSelected":[32],"columnWidths":[32],"scrolledLeft":[32],"scrolledRight":[32],"rowCount":[32],"loadingScrollTop":[32],"noDataBodyHeight":[32],"autoThead":[32],"autoTbody":[32],"isRowSelected":[64],"updateRowSelect":[64],"toggleSelectAll":[64],"getIsAllChecked":[64],"getStickyStyle":[64],"setRowCount":[64],"getPaginationInfo":[64]},null,{"isLoading":[{"handleIsLoadingChange":0}],"useVirtualScroll":[{"handleUseVirtualScrollChange":0}],"columns":[{"handleColumnsChange":0}],"rows":[{"handleRowsChange":0}],"rowKey":[{"handleRowKeyChange":0}],"tableId":[{"handleTableIdChange":0}],"noDataLabel":[{"handleNoDataLabelChange":0}],"selectable":[{"handleConfigChange":0}],"resizable":[{"handleConfigChange":0}],"stickyColumn":[{"handleConfigChange":0}],"stickyHeader":[{"handleConfigChange":0}],"dense":[{"handleConfigChange":0}],"selected":[{"handleSelectedChange":0}],"pagination":[{"handlePaginationChange":0}]}]]],["p-9e75a5dc",[[512,"sd-modal-container",{"autoRemove":[4,"auto-remove"],"entries":[32],"open":[64],"openLoading":[64],"createCustom":[64],"dismissById":[64],"update":[64]}]]],["p-5d5d8220",[[772,"sd-barcode-input",{"value":[1032],"size":[1],"addonLabel":[1,"addon-label"],"addonAlign":[1,"addon-align"],"placeholder":[1],"disabled":[4],"clearable":[4],"width":[8],"rules":[16],"autoFocus":[4,"auto-focus"],"status":[1],"hint":[1],"errorMessage":[1,"error-message"],"inputClass":[1,"input-class"],"readonly":[4],"error":[1028],"focused":[1028],"hovered":[1028],"label":[1],"labelWidth":[8,"label-width"],"icon":[16],"labelTooltip":[1,"label-tooltip"],"labelTooltipProps":[16],"inputStyle":[16],"name":[1],"internalValue":[32],"sdGetNativeElement":[64],"sdValidate":[64],"sdReset":[64],"sdResetValidate":[64],"sdFocus":[64]},null,{"value":[{"valueChanged":0}],"internalValue":[{"internalValueChanged":0}]}]]],["p-60b80bf3",[[512,"sd-popover",{"show":[1028],"placement":[513],"color":[513],"icon":[513],"iconSize":[514,"icon-size"],"label":[1],"name":[1],"rightIcon":[1,"right-icon"],"ariaLabel":[1,"aria-label"],"disabled":[4],"type":[1],"menuTitle":[1,"menu-title"],"leftLink":[16],"button":[16],"menuClass":[1,"menu-class"],"slotContentHTML":[32]}]]],["p-78c2fd6d",[[512,"sd-guide",{"type":[513],"label":[513],"message":[1],"url":[1],"popupTitle":[1,"popup-title"],"popupWidth":[2,"popup-width"],"popupShow":[32]}]]],["p-1aafbc7b",[[512,"sd-toast-container",{"position":[1],"maxVisible":[2,"max-visible"],"defaultDuration":[2,"default-duration"],"zIndex":[2,"z-index"],"toasts":[32],"expanded":[32],"create":[64],"dismiss":[64],"dismissAll":[64]}]]],["p-cce38339",[[772,"sd-action-modal",{"modalTitle":[1,"modal-title"],"buttonProps":[16],"width":[8],"height":[8]}]]],["p-54086285",[[512,"sd-dropdown-button",{"name":[1],"label":[1],"items":[16],"disabled":[4],"split":[4],"isOpen":[32],"isAnimatingOut":[32],"itemIndex":[32],"sdOpen":[64],"sdClose":[64]},null,{"isOpen":[{"handleOpenChange":0}]}]]],["p-2c0a8333",[[772,"sd-popup",{"popupTitle":[1,"popup-title"],"type":[1],"useFooter":[4,"use-footer"],"submitButtonProps":[16]}]]],["p-95bbba4f",[[512,"sd-tabs",{"value":[1537],"tabs":[1040],"size":[513],"isSub":[516,"is-sub"]},null,{"value":[{"valueChanged":0}]}]]],["p-2d3d25bd",[[512,"sd-callout",{"type":[513],"message":[16]}]]],["p-a5930cbd",[[512,"sd-loading-container",{"visible":[32],"message":[32],"show":[64],"hide":[64]}]]],["p-78b0b759",[[512,"sd-badge",{"color":[1]}]]],["p-8674d868",[[772,"sd-card",{"bordered":[4],"sdClass":[1,"sd-class"]}]]],["p-25fad267",[[514,"sd-date-box",{"date":[8],"disabled":[4],"selected":[4],"isStartDate":[4,"is-start-date"],"isEndDate":[4,"is-end-date"],"isToday":[4,"is-today"],"inRange":[4,"in-range"],"type":[1]}]]],["p-18057222",[[512,"sd-divider",{"vertical":[516]}]]],["p-d8292621",[[772,"sd-form",{"formClass":[1,"form-class"],"sdRegisterField":[64],"sdUnregisterField":[64],"sdValidate":[64],"sdReset":[64],"sdResetValidation":[64]}]]],["p-ff33d019",[[512,"sd-linear-progress",{"indeterminate":[516],"value":[2],"type":[513],"label":[1]}]]],["p-f14962bd",[[512,"sd-radio-button",{"value":[1032],"options":[1040],"size":[1],"disabled":[4],"name":[1]}]]],["p-1219699a",[[512,"sd-switch",{"value":[1028],"label":[1],"disabled":[4]}]]],["p-07b0d118",[[772,"sd-td",{"field":[1],"rowKey":[1,"row-key"],"align":[1],"rowspan":[2],"colspan":[2],"sdClass":[1,"sd-class"],"dividerLeft":[4,"divider-left"],"dividerRight":[4,"divider-right"],"useFrame":[4,"use-frame"]},null,{"field":[{"handleFieldChange":0}],"rowKey":[{"handleRowKeyChange":0}],"rowspan":[{"handleSpanChange":0}],"colspan":[{"handleSpanChange":0}],"sdClass":[{"handleSdClassChange":0}],"dividerLeft":[{"handleDividerChange":0}],"dividerRight":[{"handleDividerChange":0}],"useFrame":[{"handleUseFrameChange":0}]}]]],["p-18d3ae55",[[512,"sd-toggle",{"value":[1540],"label":[1],"disabled":[4]}]]],["p-e6bd8ab1",[[512,"sd-toast",{"icon":[1],"message":[1],"link":[1],"linkLabel":[1,"link-label"],"buttonLabel":[1,"button-label"],"useClose":[4,"use-close"],"type":[1]}]]],["p-4c3ead1b",[[512,"sd-text-link",{"label":[1],"icon":[1],"iconColor":[1,"icon-color"],"labelClass":[1,"label-class"],"useArrow":[516,"use-arrow"],"underline":[516],"disabled":[516]}]]],["p-74b3e95b",[[512,"sd-tag",{"name":[1],"label":[1],"icon":[1],"isLeft":[4,"is-left"]}]]],["p-bd4e5141",[[772,"sd-confirm-modal",{"type":[1],"modalTitle":[1,"modal-title"],"titleClass":[1,"title-class"],"topMessage":[16],"bottomMessage":[16],"mainButtonName":[1,"main-button-name"],"mainButtonLabel":[1,"main-button-label"],"subButtonLabel":[1,"sub-button-label"],"tagPreset":[1,"tag-preset"],"tagLabel":[1,"tag-label"],"slotLabel":[1,"slot-label"],"tagContents":[16],"hasSlottedContent":[32]}],[512,"sd-loading-modal",{"state":[513],"message":[1],"useButton":[516,"use-button"],"buttonLabel":[1,"button-label"],"width":[8],"height":[8],"progress":[2]}]]],["p-9d34518e",[[512,"sd-chip",{"name":[1],"value":[1025],"error":[1028],"disabled":[4],"placeholder":[1],"rules":[16],"internalValue":[32],"isEditing":[32],"sdValidate":[64],"sdReset":[64],"sdResetValidate":[64],"sdResetValidation":[64],"sdFocus":[64],"sdGetNativeElement":[64]},null,{"value":[{"valueChanged":0}]}]]],["p-e81cb8c9",[[512,"sd-date-range-picker-calendar",{"value":[16],"selectable":[16],"maxRange":[2,"max-range"],"currentYear":[32],"currentMonth":[32],"pendingStart":[32],"hoverDate":[32],"displayValue":[32]},null,{"value":[{"handleValueChange":0}]}]]],["p-ea586c5e",[[512,"sd-radio",{"value":[1032],"val":[8],"disabled":[4],"label":[1]},null,{"value":[{"valueChanged":0}]}]]],["p-c73cadc7",[[512,"sd-thead",{"columns":[16],"selectable":[4],"resizable":[4],"stickyColumn":[16],"stickyHeader":[4,"sticky-header"],"scrolledLeft":[4,"scrolled-left"],"scrolledRight":[4,"scrolled-right"],"rows":[16],"columnWidths":[1040],"tableId":[32],"_columns":[32],"_selectable":[32],"_resizable":[32],"_stickyColumn":[32],"_stickyHeader":[32],"_scrolledLeft":[32],"_scrolledRight":[32],"refreshConfig":[64],"setColumnWidths":[64],"refreshSelection":[64]},null,{"columns":[{"handleColumnsChange":0}]}],[772,"sd-tr",{"columns":[16],"selectable":[4],"stickyColumn":[16],"rowKey":[1,"row-key"],"row":[16],"separator":[8],"tableId":[32],"columnWidths":[32],"isVisible":[32],"spansVersion":[32],"_columns":[32],"_selectable":[32],"_stickyColumn":[32],"_scrolledLeft":[32],"_scrolledRight":[32],"_dense":[32],"refreshConfig":[64],"bumpSpansVersion":[64],"updateVisibility":[64],"setColumnWidths":[64],"refreshSelection":[64]}],[512,"sd-pagination",{"currentPage":[1026,"current-page"],"lastPage":[2,"last-page"],"simple":[4]}],[769,"sd-tbody",{"rows":[16],"tableId":[32],"topSpacerHeight":[32],"bottomSpacerHeight":[32]},null,{"rows":[{"handleRowsChange":0}]}]]],["p-5c4fd9c1",[[512,"sd-circle-progress",{"indeterminate":[516],"value":[2],"type":[513],"label":[1]}]]],["p-46faa7ed",[[512,"sd-ghost-button",{"icon":[1],"size":[1],"intent":[1],"ariaLabel":[1,"aria-label"],"disabled":[4]}]]],["p-c1bac61e",[[512,"sd-calendar",{"value":[1025],"selectable":[16],"events":[16],"elevated":[4],"currentYear":[32],"currentMonth":[32]},null,{"value":[{"handleValueChange":0}]}],[512,"sd-date-picker-trigger",{"displayText":[1,"display-text"],"placeholder":[1],"disabled":[4],"size":[1]}]]],["p-cffa6da7",[[772,"sd-portal",{"to":[1],"parentRef":[16],"offset":[16],"viewportPadding":[2,"viewport-padding"],"zIndex":[2,"z-index"],"open":[4]},[[9,"scroll","updatePosition"],[9,"resize","updatePosition"],[9,"mousedown","handleMouseDown"],[8,"click","handleWindowClick"]],{"open":[{"handleOpenChange":0}]}]]],["p-3e2b5e01",[[512,"sd-date-picker",{"value":[1025],"size":[513],"placeholder":[513],"selectable":[16],"disabled":[516],"width":[8],"label":[1],"labelWidth":[8,"label-width"],"addonLabel":[1,"addon-label"],"addonAlign":[1,"addon-align"],"hint":[1],"errorMessage":[1,"error-message"],"rules":[16],"error":[1028],"icon":[16],"labelTooltip":[1,"label-tooltip"],"labelTooltipProps":[16],"name":[1],"isOpen":[32],"isAnimatingOut":[32],"focused":[32],"hovered":[32],"sdValidate":[64],"sdReset":[64],"sdResetValidate":[64]},null,{"isOpen":[{"watchIsOpen":0}]}],[512,"sd-date-range-picker",{"value":[1040],"size":[513],"placeholder":[513],"selectable":[16],"maxRange":[2,"max-range"],"disabled":[516],"width":[8],"label":[1],"labelWidth":[8,"label-width"],"addonLabel":[1,"addon-label"],"addonAlign":[1,"addon-align"],"hint":[1],"errorMessage":[1,"error-message"],"rules":[16],"error":[1028],"icon":[16],"labelTooltip":[1,"label-tooltip"],"labelTooltipProps":[16],"name":[1],"isOpen":[32],"isAnimatingOut":[32],"focused":[32],"hovered":[32],"sdValidate":[64],"sdReset":[64],"sdResetValidate":[64]},null,{"isOpen":[{"watchIsOpen":0}]}],[512,"sd-file-picker",{"value":[1040],"placeholder":[513],"disabled":[516],"inline":[516],"multiple":[516],"accept":[1],"maxFileSize":[8,"max-file-size"],"maxTotalSize":[8,"max-total-size"],"maxFiles":[8,"max-files"],"name":[1],"label":[1],"labelWidth":[8,"label-width"],"addonLabel":[1,"addon-label"],"addonAlign":[1,"addon-align"],"hint":[1],"errorMessage":[1,"error-message"],"width":[8],"rules":[16],"error":[1028],"status":[1],"icon":[16],"labelTooltip":[1,"label-tooltip"],"labelTooltipProps":[16],"focused":[1028],"hovered":[1028],"internalValue":[32],"showTooltip":[32],"sdValidate":[64],"sdReset":[64],"sdResetValidate":[64]},null,{"value":[{"valueChanged":0}]}],[772,"sd-input",{"value":[1032],"type":[1],"size":[1],"addonLabel":[1,"addon-label"],"addonAlign":[1,"addon-align"],"placeholder":[1],"disabled":[4],"clearable":[4],"width":[8],"rules":[16],"autoFocus":[4,"auto-focus"],"autocomplete":[1],"maxlength":[2],"minlength":[2],"inputmode":[1],"enterkeyhint":[1],"spellcheck":[4],"status":[1],"hint":[1],"errorMessage":[1,"error-message"],"inputClass":[1,"input-class"],"readonly":[4],"error":[1028],"focused":[1028],"hovered":[1028],"label":[1],"labelWidth":[8,"label-width"],"icon":[16],"labelTooltip":[1,"label-tooltip"],"labelTooltipProps":[16],"inputStyle":[16],"name":[1],"internalValue":[32],"passwordVisible":[32],"sdGetNativeElement":[64],"sdValidate":[64],"sdReset":[64],"sdResetValidate":[64],"sdFocus":[64]},null,{"value":[{"valueChanged":0}],"internalValue":[{"internalValueChanged":0}]}],[512,"sd-number-input",{"size":[1],"min":[2],"max":[2],"step":[2],"useButton":[4,"use-button"],"useDecimal":[4,"use-decimal"],"value":[1032],"label":[1],"labelWidth":[8,"label-width"],"icon":[16],"labelTooltip":[1,"label-tooltip"],"labelTooltipProps":[16],"addonLabel":[1,"addon-label"],"addonAlign":[1,"addon-align"],"placeholder":[1],"disabled":[4],"width":[8],"rules":[16],"autoFocus":[4,"auto-focus"],"status":[1],"hint":[1],"errorMessage":[1,"error-message"],"inputPrefix":[1,"input-prefix"],"inputSuffix":[1,"input-suffix"],"inputClass":[1,"input-class"],"readonly":[4],"inputStyle":[16],"error":[1028],"focused":[1028],"hovered":[1028],"name":[1],"internalValue":[32],"displayValue":[32],"sdValidate":[64],"sdReset":[64],"sdResetValidate":[64],"sdFocus":[64],"sdGetNativeElement":[64]},null,{"value":[{"valueChanged":0}],"internalValue":[{"internalValueChanged":0}]}],[512,"sd-textarea",{"value":[1025],"placeholder":[1],"disabled":[4],"readonly":[4],"autoFocus":[4,"auto-focus"],"textareaClass":[1,"textarea-class"],"textareaStyle":[16],"maxLength":[2,"max-length"],"rows":[2],"spellcheck":[4],"width":[8],"label":[1],"labelWidth":[8,"label-width"],"addonLabel":[1,"addon-label"],"addonAlign":[1,"addon-align"],"hint":[1],"errorMessage":[1,"error-message"],"icon":[16],"labelTooltip":[1,"label-tooltip"],"labelTooltipProps":[16],"rules":[16],"error":[1028],"status":[1],"focused":[1028],"hovered":[1028],"name":[1],"internalValue":[32],"sdGetNativeElement":[64],"sdValidate":[64],"sdReset":[64],"sdResetValidate":[64],"sdFocus":[64]},null,{"value":[{"valueChanged":0}],"internalValue":[{"internalValueChanged":0}]}],[512,"sd-radio-group",{"value":[1032],"options":[1040],"direction":[1],"disabled":[4],"groupName":[1,"group-name"]},null,{"value":[{"valueChanged":0}]}]]],["p-4b43648c",[[512,"sd-checkbox",{"value":[1028],"val":[8],"disabled":[516],"inverse":[516],"label":[1],"isChecked":[32]},null,{"value":[{"watchValueHandler":0}]}]]],["p-deec1ef0",[[512,"sd-select-list-item",{"option":[16],"depth":[2],"isSelected":[4,"is-selected"],"isFocused":[4,"is-focused"],"useCheckbox":[4,"use-checkbox"],"countInfo":[16]}],[512,"sd-select-list-item-search",{"isScrolled":[4,"is-scrolled"],"searchText":[32],"sdFocus":[64]}]]],["p-0de5a53b",[[772,"sd-field",{"name":[1],"rules":[16],"error":[1028],"disabled":[1028],"readonly":[1028],"hovered":[1028],"focused":[1028],"status":[1],"hint":[1],"errorMessage":[1,"error-message"],"width":[8],"size":[513],"label":[1],"labelWidth":[8,"label-width"],"addonLabel":[1,"addon-label"],"addonAlign":[1,"addon-align"],"icon":[16],"labelTooltip":[1,"label-tooltip"],"labelTooltipProps":[16],"errorMsg":[32],"sdValidate":[64],"sdReset":[64],"sdResetValidation":[64],"sdFocus":[64]}],[512,"sd-tooltip",{"trigger":[1],"placement":[1],"color":[1],"tooltipType":[1,"tooltip-type"],"icon":[1],"iconSize":[2,"icon-size"],"label":[1],"name":[1],"rightIcon":[1,"right-icon"],"ariaLabel":[1,"aria-label"],"disabled":[4],"type":[1],"sdClass":[1,"sd-class"],"showTooltip":[32],"slotContentHTML":[32]}],[772,"sd-floating-portal",{"to":[1],"parentRef":[16],"offset":[16],"zIndex":[2,"z-index"],"placement":[1],"open":[4]},[[9,"scroll","updatePosition"],[9,"resize","updatePosition"],[9,"mousedown","handleMouseDown"],[8,"click","handleWindowClick"],[8,"keydown","handleKeydown"]]]]],["p-25204798",[[512,"sd-select",{"type":[1],"value":[1032],"options":[16],"placeholder":[1],"maxDropdownWidth":[1,"max-dropdown-width"],"dropdownHeight":[1,"dropdown-height"],"disabled":[4],"label":[1],"labelWidth":[8,"label-width"],"addonLabel":[1,"addon-label"],"addonAlign":[1,"addon-align"],"error":[1028],"hint":[1],"errorMessage":[1,"error-message"],"rules":[16],"icon":[16],"labelTooltip":[1,"label-tooltip"],"labelTooltipProps":[16],"emitValue":[4,"emit-value"],"width":[8],"useSearch":[4,"use-search"],"allSelectedLabel":[1,"all-selected-label"],"useSelectAll":[4,"use-select-all"],"name":[1],"isOpen":[32],"isAnimatingOut":[32],"triggerWidth":[32],"resolvedDropdownHeight":[32],"resolvedMaxDropdownWidth":[32],"focused":[32],"hovered":[32],"sdFocus":[64],"sdOpen":[64]},null,{"isOpen":[{"watchIsOpen":0}]}],[513,"sd-select-listbox",{"type":[1],"options":[16],"value":[8],"emitValue":[4,"emit-value"],"useSearch":[4,"use-search"],"useSelectAll":[4,"use-select-all"],"triggerWidth":[1,"trigger-width"],"maxWidth":[1,"max-width"],"maxHeight":[1,"max-height"],"searchKeyword":[32],"isScrolled":[32],"focusedIndex":[32]},null,{"searchKeyword":[{"resetFocusOnFilter":0}]}],[512,"sd-select-trigger",{"displayText":[1,"display-text"],"placeholder":[1],"disabled":[4],"isOpen":[4,"is-open"],"sdFocus":[64]}]]]]'),e))));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as e,a as s,h as i}from"./p-DNWwGHho.js";import{n as r}from"./p-CCwNgVmC.js";import{c as h,S as o,f as l,E as n,L as c,a as d,b as a,d as u}from"./p-CxOCk_ge.js";const g=class{constructor(s){t(this,s),this.update=e(this,"sdUpdate",7),this.dropDownShow=e(this,"sdDropDownShow",7)}static VIEWPORT_PADDING=20;static PORTAL_OFFSET_Y=4;static CLOSE_ANIMATION_DURATION=150;get el(){return s(this)}type="default";value=null;options=[];placeholder="선택";maxDropdownWidth="640px";dropdownHeight="260px";disabled=!1;label="";labelWidth="";addonLabel="";addonAlign="start";error=!1;hint="";errorMessage="";rules=[];icon=void 0;labelTooltip="";labelTooltipProps=null;emitValue=!1;width="";useSearch=!1;allSelectedLabel="전체";useSelectAll=!1;isOpen=!1;isAnimatingOut=!1;triggerWidth="200px";resolvedDropdownHeight="260px";resolvedMaxDropdownWidth="640px";focused=!1;hovered=!1;update;dropDownShow;async sdFocus(){this.disabled||await(this.triggerComponentRef?.sdFocus())}async sdOpen(){await new Promise((t=>setTimeout(t,0))),this.disabled||this.isOpen||(this.prepareDropdownGeometry(),this.closeAnimationTimer&&clearTimeout(this.closeAnimationTimer),this.isAnimatingOut=!1,this.isOpen=!0)}triggerRef;triggerComponentRef;closeAnimationTimer;name=r();triggerHasFocus=!1;watchIsOpen(t){this.syncFocusedState(t),this.dropDownShow.emit({isOpen:t})}get isMulti(){return"multi"===this.type||"multi_depth"===this.type}get displayText(){if(this.isMulti){if(!Array.isArray(this.value)||0===this.value.length)return"";const t=this.getNonDisabledLeaves(this.options),e=this.getSelectedOptions();if(t.length>0&&t.every((t=>e.some((e=>e.value===t.value)))))return this.allSelectedLabel??"전체";const s=this.flattenOptions(this.options);return this.value.map((t=>{if(null!=t&&"object"==typeof t){const e=t;return e.label??s.find((t=>t.value===e.value))?.label??""}return s.find((e=>e.value===t))?.label??""})).filter(Boolean).join(", ")}if(null==this.value)return"";if(!this.emitValue&&"object"==typeof this.value&&!Array.isArray(this.value))return this.value.label??"";const t=this.flattenOptions(this.options).find((t=>t.value===this.value));return t?.label??""}flattenOptions(t){return t.flatMap((t=>t.children?this.flattenOptions(t.children):[t]))}getNonDisabledLeaves(t){return t.flatMap((t=>t.disabled?[]:t.children?this.getNonDisabledLeaves(t.children):[t]))}getSelectedOptions(){const t=this.value;return null!=t&&Array.isArray(t)?this.emitValue?t.map((t=>this.findOriginalOption(t,this.options))).filter((t=>!!t)):t:[]}toMultiValue(t){return this.emitValue?t.map((t=>t.value)):t}parsePixelValue(t,e){const s=Number.parseFloat(t);return Number.isFinite(s)?s:e}updateDropdownViewportConstraints(){if(!this.triggerRef)return;const t=this.triggerRef.getBoundingClientRect(),e=g.VIEWPORT_PADDING,s=g.PORTAL_OFFSET_Y,i=this.parsePixelValue(this.dropdownHeight,260),r=this.parsePixelValue(this.maxDropdownWidth,640),h=Math.max(window.innerHeight-t.bottom-e-s,0),o=Math.max(t.top-e-s,0),l=Math.max(h,o),n=Math.max(window.innerWidth-2*e,0);this.resolvedDropdownHeight=`${Math.min(i,l)}px`,this.resolvedMaxDropdownWidth=`${Math.min(r,n)}px`}handleViewportResize=()=>{this.isOpen&&this.updateDropdownViewportConstraints()};findOriginalOption(t,e){for(const s of e){if(s.value===t)return s;if(s.children){const e=this.findOriginalOption(t,s.children);if(e)return e}}}closeDropdown(){this.isOpen&&(this.isOpen=!1,this.isAnimatingOut=!0,this.closeAnimationTimer&&clearTimeout(this.closeAnimationTimer),this.closeAnimationTimer=setTimeout((()=>{this.isAnimatingOut=!1}),g.CLOSE_ANIMATION_DURATION))}prepareDropdownGeometry(){this.triggerRef&&(this.triggerWidth=`${this.triggerRef.offsetWidth}px`),this.updateDropdownViewportConstraints()}syncFocusedState(t=this.isOpen){this.focused=t||this.triggerHasFocus}handleTriggerFocus=()=>{this.triggerHasFocus=!0,this.syncFocusedState()};handleTriggerBlur=()=>{this.triggerHasFocus=!1,this.syncFocusedState()};handleTriggerClick=()=>{this.isOpen?this.closeDropdown():(this.prepareDropdownGeometry(),this.closeAnimationTimer&&clearTimeout(this.closeAnimationTimer),this.isAnimatingOut=!1,this.isOpen=!0)};emitUpdate(t){this.update.emit(t)}handleOptionSelect=t=>{const{option:e,leaves:s}=t;if(this.isMulti)this.handleMultiSelect(e,s);else{this.closeDropdown(),this.value=this.emitValue?e.value:e;const t=this.value;requestAnimationFrame((()=>{this.emitUpdate(t)}))}};handleMultiSelect(t,e){const s=this.getSelectedOptions();let i;if(t.children)if(e.every((t=>s.some((e=>e.value===t.value))))){const t=new Set(e.map((t=>t.value)));i=s.filter((e=>!t.has(e.value)))}else{const t=new Set(s.map((t=>t.value))),r=e.filter((e=>!t.has(e.value)));i=[...s,...r]}else i=s.some((e=>e.value===t.value))?s.filter((e=>e.value!==t.value)):[...s,t];this.value=this.toMultiValue(i),this.emitUpdate(this.value)}connectedCallback(){window.addEventListener("resize",this.handleViewportResize)}disconnectedCallback(){window.removeEventListener("resize",this.handleViewportResize),this.closeAnimationTimer&&clearTimeout(this.closeAnimationTimer)}render(){const t={open:this.isOpen,parentRef:this.triggerRef,viewportPadding:g.VIEWPORT_PADDING,onSdClose:()=>{this.closeDropdown()}};return i("sd-field",{key:"3c188cbdd8c612e78780d18c03acc382d32080c9",name:this.name,label:this.label,labelWidth:this.labelWidth,addonLabel:this.addonLabel,addonAlign:this.addonAlign,hint:this.hint,errorMessage:this.errorMessage,width:this.width,rules:this.rules,error:this.error,disabled:this.disabled,focused:this.focused,hovered:this.hovered,icon:this.icon,labelTooltip:this.labelTooltip,labelTooltipProps:this.labelTooltipProps,onMouseEnter:()=>{this.hovered=!0},onMouseLeave:()=>{this.hovered=!1}},i("div",{key:"be596d399856ed966408ba1525fea9dbdf8fcc7e",class:"sd-select",ref:t=>{this.triggerRef=t}},i("sd-select-trigger",{key:"f8a29b1ac2469c60af8c7101d05157674566f00f",ref:t=>{this.triggerComponentRef=t},displayText:this.displayText,placeholder:this.placeholder??"선택",disabled:this.disabled,isOpen:this.isOpen,onSdTriggerClick:this.handleTriggerClick,onSdTriggerFocus:this.handleTriggerFocus,onSdTriggerBlur:this.handleTriggerBlur})),(this.isOpen||this.isAnimatingOut)&&i("sd-portal",{key:"3cef3f95f69b09d0e4e8f6b01615df4cca031cff",...t},i("sd-select-listbox",{key:"e8833c547aa2e8084754c7a439d3860df5c97e5b",type:this.type,options:this.options,value:this.value,emitValue:this.emitValue,useSearch:this.useSearch,useSelectAll:this.useSelectAll,triggerWidth:this.triggerWidth,maxWidth:this.resolvedMaxDropdownWidth,maxHeight:this.resolvedDropdownHeight,onSdOptionSelect:t=>this.handleOptionSelect(t.detail)})))}static get watchers(){return{isOpen:[{watchIsOpen:0}]}}};g.style="sd-select{display:inline-flex}sd-select sd-portal{display:none}sd-select .sd-select{position:relative;width:100%;height:100%}";const p=class{constructor(s){t(this,s),this.optionSelect=e(this,"sdOptionSelect",7)}type="default";options=[];value=null;emitValue=!1;useSearch=!1;useSelectAll=!1;triggerWidth="200px";maxWidth="640px";maxHeight="260px";searchKeyword="";isScrolled=!1;focusedIndex=-1;optionSelect;listEl;lastScrolledIndex=-1;keydownAttached=!1;suppressHover=!1;get isDepth(){return"default_depth"===this.type||"multi_depth"===this.type}get isMulti(){return"multi"===this.type||"multi_depth"===this.type}static SELECT_ALL_OPTION={value:"__select_all__",label:"전체"};get showSelectAll(){return this.useSelectAll&&this.isMulti&&this.getAllNonDisabledLeaves().length>0}getAllNonDisabledLeaves(){const t=e=>e.flatMap((e=>e.disabled?[]:e.children?t(e.children):[e]));return t(this.options)}get selectAllState(){if(!this.showSelectAll)return!1;const t=this.getAllNonDisabledLeaves();if(0===t.length)return!1;const e=this.getSelectedValues(),s=t.filter((t=>e.has(t.value))).length;return 0!==s&&(s===t.length||null)}get showSearch(){return!!this.useSearch&&(this.isDepth?h(this.options):this.options.length)>=o}get filteredOptions(){if(""===this.searchKeyword)return this.options;if(this.isDepth)return l(this.options,this.searchKeyword);const t=this.searchKeyword.toLowerCase();return this.options.filter((e=>e.label.toLowerCase().includes(t)))}get isEmpty(){return this.isDepth?0===h(this.filteredOptions)&&0===this.filteredOptions.length:0===this.filteredOptions.length}getSelectedValues(){return null!=this.value&&Array.isArray(this.value)?this.emitValue?new Set(this.value):new Set(this.value.map((t=>t.value))):new Set}isOptionSelected(t){return this.isMulti?this.getSelectedValues().has(t.value):this.emitValue||null==this.value||"object"!=typeof this.value||Array.isArray(this.value)?this.value===t.value:this.value.value===t.value}getGroupSelectionState(t){if(!this.isMulti||!t.children)return!1;const e=this.getSelectedValues();if(0===e.size)return!1;const s=this.collectVisibleLeaves(t);if(0===s.length)return!1;const i=s.filter((t=>e.has(t.value))).length;return 0!==i&&(i===s.length||null)}getCountInfo(t){if(!this.isMulti||!t.children)return;const e=this.getSelectedValues(),s=this.collectVisibleLeaves(t);return{selected:s.filter((t=>e.has(t.value))).length,total:s.length}}findOriginalOption(t,e){for(const s of e){if(s.value===t)return s;if(s.children){const e=this.findOriginalOption(t,s.children);if(e)return e}}}collectLeaves(t){return t.children?t.children.flatMap((t=>this.collectLeaves(t))):[t]}collectVisibleLeaves(t){if(t.disabled)return[];if(!t.children)return[t];if(0===t.children.length){const e=this.findOriginalOption(t.value,this.options);return e?this.collectLeaves(e).filter((t=>!t.disabled)):[]}return t.children.flatMap((t=>this.collectVisibleLeaves(t)))}get navigableOptions(){const t=[];this.showSelectAll&&t.push(p.SELECT_ALL_OPTION);const e=s=>{for(const i of s){const s=!!i.children;(!s||this.isMulti)&&!i.disabled&&t.push(i),s&&i.children&&i.children.length>0&&e(i.children)}};return e(this.filteredOptions),t}isSelectAllOption(t){return this.showSelectAll&&t.value===p.SELECT_ALL_OPTION.value}emitSelectAll(){if(!this.showSelectAll)return;const t=this.getAllNonDisabledLeaves();this.optionSelect.emit({option:{...p.SELECT_ALL_OPTION,children:t},leaves:t})}handleSelectAllClick=t=>{t.stopPropagation(),this.emitSelectAll()};isOptionFocused(t){if(this.focusedIndex<0)return!1;const e=this.navigableOptions[this.focusedIndex];return null!=e&&e.value===t.value}resetFocusOnFilter(){this.focusedIndex=this.navigableOptions.length>0?0:-1,this.suppressHover&&(document.removeEventListener("mousemove",this.releaseHoverSuppress,!0),this.suppressHover=!1)}handleSearchFilter=t=>{this.searchKeyword=t.detail};handleScroll=t=>{this.isScrolled=t.target.scrollTop>0};emitOptionSelect(t){this.optionSelect.emit({option:t,leaves:this.collectVisibleLeaves(t)})}handleOptionClick=t=>{t.stopPropagation(),this.emitOptionSelect(t.detail)};handleOptionHover=t=>{if(this.suppressHover)return;const e=this.navigableOptions.findIndex((e=>e.value===t.value));e>=0&&(this.focusedIndex=e)};releaseHoverSuppress=()=>{this.suppressHover=!1,document.removeEventListener("mousemove",this.releaseHoverSuppress,!0)};handleKeyDown=t=>{const e=this.navigableOptions;if("ArrowDown"===t.key){if(0===e.length)return;t.preventDefault(),t.stopPropagation(),this.focusedIndex=this.focusedIndex<0?0:(this.focusedIndex+1)%e.length,this.beginHoverSuppression()}else if("ArrowUp"===t.key){if(0===e.length)return;t.preventDefault(),t.stopPropagation(),this.focusedIndex=this.focusedIndex<=0?e.length-1:this.focusedIndex-1,this.beginHoverSuppression()}else if("Enter"===t.key){if(this.focusedIndex<0||this.focusedIndex>=e.length)return;t.preventDefault(),t.stopPropagation();const s=e[this.focusedIndex];this.isSelectAllOption(s)?this.emitSelectAll():this.emitOptionSelect(s)}};beginHoverSuppression(){this.suppressHover||(this.suppressHover=!0,document.addEventListener("mousemove",this.releaseHoverSuppress,!0))}scrollFocusedIntoView(){const t=this.listEl,e=t?.querySelector(".sd-select-list-item--focused");if(!t||!e)return;const s=t.getBoundingClientRect(),i=e.getBoundingClientRect();i.top<s.top?t.scrollTop+=i.top-s.top:i.bottom>s.bottom&&(t.scrollTop+=i.bottom-s.bottom)}connectedCallback(){this.keydownAttached||(document.addEventListener("keydown",this.handleKeyDown,!0),this.keydownAttached=!0)}disconnectedCallback(){this.keydownAttached&&(document.removeEventListener("keydown",this.handleKeyDown,!0),this.keydownAttached=!1),this.suppressHover&&(document.removeEventListener("mousemove",this.releaseHoverSuppress,!0),this.suppressHover=!1)}componentDidRender(){this.focusedIndex!==this.lastScrolledIndex&&(this.lastScrolledIndex=this.focusedIndex,this.focusedIndex>=0&&this.scrollFocusedIntoView())}renderOptions(t,e=1){return t.map((t=>{const s=!!t.children;return[i("sd-select-list-item",{option:t,depth:e,isSelected:s?this.getGroupSelectionState(t):this.isOptionSelected(t),isFocused:this.isOptionFocused(t),useCheckbox:this.isMulti,countInfo:this.getCountInfo(t),onSdListItemClick:this.handleOptionClick,onMouseEnter:()=>this.handleOptionHover(t)}),s&&t.children?this.renderOptions(t.children,e+1):null]}))}render(){return i("div",{key:"49f10bc8511fedcc0224729593498273088e16a3",class:"sd-select-listbox",style:{"--listbox-trigger-width":this.triggerWidth??"200px","--listbox-max-width":this.maxWidth??"640px","--listbox-max-height":this.maxHeight??"260px","--listbox-radius":`${c.radius}px`}},this.showSearch&&i("sd-select-list-item-search",{key:"2eab7f77c0e900f90a79b2b2e9a7e60da2349409",isScrolled:this.isScrolled,onSdSearchFilter:this.handleSearchFilter}),i("div",{key:"46407c47a1d24ee8d997060c2b54f2443c163700",class:"sd-select-listbox__list",onScroll:this.handleScroll,ref:t=>{this.listEl=t}},this.showSelectAll&&i("sd-select-list-item",{key:"9c4a35e6515fb9bc9cd4feafc69a44c432b75139",option:p.SELECT_ALL_OPTION,depth:1,isSelected:this.selectAllState,isFocused:this.isOptionFocused(p.SELECT_ALL_OPTION),useCheckbox:!0,onSdListItemClick:this.handleSelectAllClick,onMouseEnter:()=>this.handleOptionHover(p.SELECT_ALL_OPTION)}),this.isEmpty?i("div",{class:"sd-select-listbox__empty"},n):this.isDepth?this.renderOptions(this.filteredOptions):this.filteredOptions.map((t=>i("sd-select-list-item",{option:t,depth:1,isSelected:this.isOptionSelected(t),isFocused:this.isOptionFocused(t),useCheckbox:this.isMulti,onSdListItemClick:this.handleOptionClick,onMouseEnter:()=>this.handleOptionHover(t)})))))}static get watchers(){return{searchKeyword:[{resetFocusOnFilter:0}]}}};p.style=":host{display:block}:host .sd-select-listbox{display:flex;flex-direction:column;width:var(--listbox-trigger-width);max-width:var(--listbox-max-width);max-height:var(--listbox-max-height);border-radius:var(--listbox-radius);background:white;box-shadow:2px 2px 12px 2px rgba(0, 0, 0, 0.1);overflow:hidden;outline:none}:host .sd-select-listbox__list{flex:1;min-height:0;overflow-y:auto;padding-bottom:0}:host .sd-select-listbox__empty{padding:12px;text-align:center;font-size:12px;line-height:20px;color:#888888}";const f=class{constructor(s){t(this,s),this.triggerClick=e(this,"sdTriggerClick",7),this.triggerFocus=e(this,"sdTriggerFocus",7),this.triggerBlur=e(this,"sdTriggerBlur",7)}displayText="";placeholder="선택";disabled=!1;isOpen=!1;triggerClick;triggerFocus;triggerBlur;triggerEl;async sdFocus(){this.disabled||this.triggerEl?.focus()}handleClick=()=>{this.disabled||this.triggerClick.emit()};handleFocus=()=>{this.triggerFocus.emit()};handleBlur=()=>{this.triggerBlur.emit()};render(){const t=""!==this.displayText;return i("div",{key:"3a97ed909e3088528714682050a3986081e19433",ref:t=>{this.triggerEl=t},role:"button","aria-haspopup":"listbox","aria-expanded":this.isOpen?"true":"false",tabindex:this.disabled?-1:0,class:{"sd-select-trigger":!0,"sd-select-trigger--open":this.isOpen,"sd-select-trigger--disabled":this.disabled},style:{"--trigger-padding-x":`${u.paddingX}px`,"--trigger-gap":`${u.gap}px`,"--trigger-font-size":`${a.fontSize}px`,"--trigger-line-height":`${a.lineHeight}px`,"--trigger-font-weight":a.fontWeight,"--trigger-color":this.disabled?d.text.disabled:t?d.text.default:d.icon.default,"--trigger-icon-color":this.disabled?d.icon.disabled:d.icon.default},onClick:this.handleClick,onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleClick())},onFocus:this.handleFocus,onBlur:this.handleBlur},i("div",{key:"986faba7d79980f0bcd10fff32495d2100e1805f",class:"sd-select-trigger__content"},i("span",{key:"c51b268186de7cdabcf06ac3d540ccb570c9e865",class:"sd-select-trigger__text"},t?this.displayText:this.placeholder??"선택"),i("sd-icon",{key:"8a03b400d5aef2e0ca9aeb4b1f6122db2932455a",name:"chevronDown",size:12,color:"var(--trigger-icon-color)",class:{"sd-select-trigger__icon":!0,"sd-select-trigger__icon--open":this.isOpen}})))}};f.style="sd-select-trigger{display:block;width:100%;height:100%}sd-select-trigger .sd-select-trigger{display:flex;width:100%;height:100%;cursor:pointer;user-select:none;overflow:hidden;border-radius:3px}sd-select-trigger .sd-select-trigger--disabled{cursor:not-allowed}sd-select-trigger .sd-select-trigger__content{display:flex;align-items:center;gap:var(--trigger-gap);flex:1;padding:0 var(--trigger-padding-x);min-width:0}sd-select-trigger .sd-select-trigger__text{flex:1;font-size:var(--trigger-font-size);line-height:var(--trigger-line-height);font-weight:var(--trigger-font-weight);color:var(--trigger-color);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}sd-select-trigger .sd-select-trigger__icon{flex-shrink:0;transition:transform 0.2s ease}sd-select-trigger .sd-select-trigger__icon--open{transform:rotate(180deg)}";export{g as sd_select,p as sd_select_listbox,f as sd_select_trigger}
|
|
@@ -316,7 +316,7 @@ const SdSelectListbox = class {
|
|
|
316
316
|
label: '전체',
|
|
317
317
|
};
|
|
318
318
|
get showSelectAll() {
|
|
319
|
-
return this.useSelectAll && this.isMulti;
|
|
319
|
+
return this.useSelectAll && this.isMulti && this.getAllNonDisabledLeaves().length > 0;
|
|
320
320
|
}
|
|
321
321
|
getAllNonDisabledLeaves() {
|
|
322
322
|
const collect = (opts) => opts.flatMap(o => {
|
|
@@ -635,9 +635,9 @@ const SdSelectListbox = class {
|
|
|
635
635
|
'--listbox-max-height': this.maxHeight ?? '260px',
|
|
636
636
|
'--listbox-radius': `${LIST_BOX_LAYOUT.radius}px`,
|
|
637
637
|
};
|
|
638
|
-
return (h("div", { key: '
|
|
638
|
+
return (h("div", { key: '49f10bc8511fedcc0224729593498273088e16a3', class: "sd-select-listbox", style: cssVars }, this.showSearch && (h("sd-select-list-item-search", { key: '2eab7f77c0e900f90a79b2b2e9a7e60da2349409', isScrolled: this.isScrolled, onSdSearchFilter: this.handleSearchFilter })), h("div", { key: '46407c47a1d24ee8d997060c2b54f2443c163700', class: "sd-select-listbox__list", onScroll: this.handleScroll, ref: el => {
|
|
639
639
|
this.listEl = el;
|
|
640
|
-
} }, this.showSelectAll && (h("sd-select-list-item", { key: '
|
|
640
|
+
} }, this.showSelectAll && (h("sd-select-list-item", { key: '9c4a35e6515fb9bc9cd4feafc69a44c432b75139', option: SdSelectListbox.SELECT_ALL_OPTION, depth: 1, isSelected: this.selectAllState, isFocused: this.isOptionFocused(SdSelectListbox.SELECT_ALL_OPTION), useCheckbox: true, onSdListItemClick: this.handleSelectAllClick, onMouseEnter: () => this.handleOptionHover(SdSelectListbox.SELECT_ALL_OPTION) })), this.isEmpty ? (h("div", { class: "sd-select-listbox__empty" }, EMPTY_MESSAGE)) : this.isDepth ? (this.renderOptions(this.filteredOptions)) : (this.filteredOptions.map(option => (h("sd-select-list-item", { option: option, depth: 1, isSelected: this.isOptionSelected(option), isFocused: this.isOptionFocused(option), useCheckbox: this.isMulti, onSdListItemClick: this.handleOptionClick, onMouseEnter: () => this.handleOptionHover(option) })))))));
|
|
641
641
|
}
|
|
642
642
|
static get watchers() { return {
|
|
643
643
|
"searchKeyword": [{
|
package/hydrate/index.js
CHANGED
|
@@ -14104,7 +14104,7 @@ class SdSelectListbox {
|
|
|
14104
14104
|
label: '전체',
|
|
14105
14105
|
};
|
|
14106
14106
|
get showSelectAll() {
|
|
14107
|
-
return this.useSelectAll && this.isMulti;
|
|
14107
|
+
return this.useSelectAll && this.isMulti && this.getAllNonDisabledLeaves().length > 0;
|
|
14108
14108
|
}
|
|
14109
14109
|
getAllNonDisabledLeaves() {
|
|
14110
14110
|
const collect = (opts) => opts.flatMap(o => {
|
|
@@ -14423,9 +14423,9 @@ class SdSelectListbox {
|
|
|
14423
14423
|
'--listbox-max-height': this.maxHeight ?? '260px',
|
|
14424
14424
|
'--listbox-radius': `${LIST_BOX_LAYOUT.radius}px`,
|
|
14425
14425
|
};
|
|
14426
|
-
return (hAsync("div", { key: '
|
|
14426
|
+
return (hAsync("div", { key: '49f10bc8511fedcc0224729593498273088e16a3', class: "sd-select-listbox", style: cssVars }, this.showSearch && (hAsync("sd-select-list-item-search", { key: '2eab7f77c0e900f90a79b2b2e9a7e60da2349409', isScrolled: this.isScrolled, onSdSearchFilter: this.handleSearchFilter })), hAsync("div", { key: '46407c47a1d24ee8d997060c2b54f2443c163700', class: "sd-select-listbox__list", onScroll: this.handleScroll, ref: el => {
|
|
14427
14427
|
this.listEl = el;
|
|
14428
|
-
} }, this.showSelectAll && (hAsync("sd-select-list-item", { key: '
|
|
14428
|
+
} }, this.showSelectAll && (hAsync("sd-select-list-item", { key: '9c4a35e6515fb9bc9cd4feafc69a44c432b75139', option: SdSelectListbox.SELECT_ALL_OPTION, depth: 1, isSelected: this.selectAllState, isFocused: this.isOptionFocused(SdSelectListbox.SELECT_ALL_OPTION), useCheckbox: true, onSdListItemClick: this.handleSelectAllClick, onMouseEnter: () => this.handleOptionHover(SdSelectListbox.SELECT_ALL_OPTION) })), this.isEmpty ? (hAsync("div", { class: "sd-select-listbox__empty" }, EMPTY_MESSAGE)) : this.isDepth ? (this.renderOptions(this.filteredOptions)) : (this.filteredOptions.map(option => (hAsync("sd-select-list-item", { option: option, depth: 1, isSelected: this.isOptionSelected(option), isFocused: this.isOptionFocused(option), useCheckbox: this.isMulti, onSdListItemClick: this.handleOptionClick, onMouseEnter: () => this.handleOptionHover(option) })))))));
|
|
14429
14429
|
}
|
|
14430
14430
|
static get watchers() { return {
|
|
14431
14431
|
"searchKeyword": [{
|
package/hydrate/index.mjs
CHANGED
|
@@ -14102,7 +14102,7 @@ class SdSelectListbox {
|
|
|
14102
14102
|
label: '전체',
|
|
14103
14103
|
};
|
|
14104
14104
|
get showSelectAll() {
|
|
14105
|
-
return this.useSelectAll && this.isMulti;
|
|
14105
|
+
return this.useSelectAll && this.isMulti && this.getAllNonDisabledLeaves().length > 0;
|
|
14106
14106
|
}
|
|
14107
14107
|
getAllNonDisabledLeaves() {
|
|
14108
14108
|
const collect = (opts) => opts.flatMap(o => {
|
|
@@ -14421,9 +14421,9 @@ class SdSelectListbox {
|
|
|
14421
14421
|
'--listbox-max-height': this.maxHeight ?? '260px',
|
|
14422
14422
|
'--listbox-radius': `${LIST_BOX_LAYOUT.radius}px`,
|
|
14423
14423
|
};
|
|
14424
|
-
return (hAsync("div", { key: '
|
|
14424
|
+
return (hAsync("div", { key: '49f10bc8511fedcc0224729593498273088e16a3', class: "sd-select-listbox", style: cssVars }, this.showSearch && (hAsync("sd-select-list-item-search", { key: '2eab7f77c0e900f90a79b2b2e9a7e60da2349409', isScrolled: this.isScrolled, onSdSearchFilter: this.handleSearchFilter })), hAsync("div", { key: '46407c47a1d24ee8d997060c2b54f2443c163700', class: "sd-select-listbox__list", onScroll: this.handleScroll, ref: el => {
|
|
14425
14425
|
this.listEl = el;
|
|
14426
|
-
} }, this.showSelectAll && (hAsync("sd-select-list-item", { key: '
|
|
14426
|
+
} }, this.showSelectAll && (hAsync("sd-select-list-item", { key: '9c4a35e6515fb9bc9cd4feafc69a44c432b75139', option: SdSelectListbox.SELECT_ALL_OPTION, depth: 1, isSelected: this.selectAllState, isFocused: this.isOptionFocused(SdSelectListbox.SELECT_ALL_OPTION), useCheckbox: true, onSdListItemClick: this.handleSelectAllClick, onMouseEnter: () => this.handleOptionHover(SdSelectListbox.SELECT_ALL_OPTION) })), this.isEmpty ? (hAsync("div", { class: "sd-select-listbox__empty" }, EMPTY_MESSAGE)) : this.isDepth ? (this.renderOptions(this.filteredOptions)) : (this.filteredOptions.map(option => (hAsync("sd-select-list-item", { option: option, depth: 1, isSelected: this.isOptionSelected(option), isFocused: this.isOptionFocused(option), useCheckbox: this.isMulti, onSdListItemClick: this.handleOptionClick, onMouseEnter: () => this.handleOptionHover(option) })))))));
|
|
14427
14427
|
}
|
|
14428
14428
|
static get watchers() { return {
|
|
14429
14429
|
"searchKeyword": [{
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{p as t,H as e,c as s,h as i,t as h}from"./p-pwNG5WaX.js";import{c as o,d as r,f as l,E as n,e as c}from"./p-C4uWhzoG.js";import{d}from"./p-Cye8r1MG.js";import{d as a}from"./p-DQj-S8AC.js";import{d as u}from"./p-DP0Dp12H.js";import{d as m}from"./p-EcuI_UmK.js";const p=t(class t extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.optionSelect=s(this,"sdOptionSelect",7)}type="default";options=[];value=null;emitValue=!1;useSearch=!1;useSelectAll=!1;triggerWidth="200px";maxWidth="640px";maxHeight="260px";searchKeyword="";isScrolled=!1;focusedIndex=-1;optionSelect;listEl;lastScrolledIndex=-1;keydownAttached=!1;suppressHover=!1;get isDepth(){return"default_depth"===this.type||"multi_depth"===this.type}get isMulti(){return"multi"===this.type||"multi_depth"===this.type}static SELECT_ALL_OPTION={value:"__select_all__",label:"전체"};get showSelectAll(){return this.useSelectAll&&this.isMulti}getAllNonDisabledLeaves(){const t=e=>e.flatMap((e=>e.disabled?[]:e.children?t(e.children):[e]));return t(this.options)}get selectAllState(){if(!this.showSelectAll)return!1;const t=this.getAllNonDisabledLeaves();if(0===t.length)return!1;const e=this.getSelectedValues(),s=t.filter((t=>e.has(t.value))).length;return 0!==s&&(s===t.length||null)}get showSearch(){return!!this.useSearch&&(this.isDepth?o(this.options):this.options.length)>=r}get filteredOptions(){if(""===this.searchKeyword)return this.options;if(this.isDepth)return l(this.options,this.searchKeyword);const t=this.searchKeyword.toLowerCase();return this.options.filter((e=>e.label.toLowerCase().includes(t)))}get isEmpty(){return this.isDepth?0===o(this.filteredOptions)&&0===this.filteredOptions.length:0===this.filteredOptions.length}getSelectedValues(){return null!=this.value&&Array.isArray(this.value)?this.emitValue?new Set(this.value):new Set(this.value.map((t=>t.value))):new Set}isOptionSelected(t){return this.isMulti?this.getSelectedValues().has(t.value):this.emitValue||null==this.value||"object"!=typeof this.value||Array.isArray(this.value)?this.value===t.value:this.value.value===t.value}getGroupSelectionState(t){if(!this.isMulti||!t.children)return!1;const e=this.getSelectedValues();if(0===e.size)return!1;const s=this.collectVisibleLeaves(t);if(0===s.length)return!1;const i=s.filter((t=>e.has(t.value))).length;return 0!==i&&(i===s.length||null)}getCountInfo(t){if(!this.isMulti||!t.children)return;const e=this.getSelectedValues(),s=this.collectVisibleLeaves(t);return{selected:s.filter((t=>e.has(t.value))).length,total:s.length}}findOriginalOption(t,e){for(const s of e){if(s.value===t)return s;if(s.children){const e=this.findOriginalOption(t,s.children);if(e)return e}}}collectLeaves(t){return t.children?t.children.flatMap((t=>this.collectLeaves(t))):[t]}collectVisibleLeaves(t){if(t.disabled)return[];if(!t.children)return[t];if(0===t.children.length){const e=this.findOriginalOption(t.value,this.options);return e?this.collectLeaves(e).filter((t=>!t.disabled)):[]}return t.children.flatMap((t=>this.collectVisibleLeaves(t)))}get navigableOptions(){const e=[];this.showSelectAll&&e.push(t.SELECT_ALL_OPTION);const s=t=>{for(const i of t){const t=!!i.children;(!t||this.isMulti)&&!i.disabled&&e.push(i),t&&i.children&&i.children.length>0&&s(i.children)}};return s(this.filteredOptions),e}isSelectAllOption(e){return this.showSelectAll&&e.value===t.SELECT_ALL_OPTION.value}emitSelectAll(){if(!this.showSelectAll)return;const e=this.getAllNonDisabledLeaves();this.optionSelect.emit({option:{...t.SELECT_ALL_OPTION,children:e},leaves:e})}handleSelectAllClick=t=>{t.stopPropagation(),this.emitSelectAll()};isOptionFocused(t){if(this.focusedIndex<0)return!1;const e=this.navigableOptions[this.focusedIndex];return null!=e&&e.value===t.value}resetFocusOnFilter(){this.focusedIndex=this.navigableOptions.length>0?0:-1,this.suppressHover&&(document.removeEventListener("mousemove",this.releaseHoverSuppress,!0),this.suppressHover=!1)}handleSearchFilter=t=>{this.searchKeyword=t.detail};handleScroll=t=>{this.isScrolled=t.target.scrollTop>0};emitOptionSelect(t){this.optionSelect.emit({option:t,leaves:this.collectVisibleLeaves(t)})}handleOptionClick=t=>{t.stopPropagation(),this.emitOptionSelect(t.detail)};handleOptionHover=t=>{if(this.suppressHover)return;const e=this.navigableOptions.findIndex((e=>e.value===t.value));e>=0&&(this.focusedIndex=e)};releaseHoverSuppress=()=>{this.suppressHover=!1,document.removeEventListener("mousemove",this.releaseHoverSuppress,!0)};handleKeyDown=t=>{const e=this.navigableOptions;if("ArrowDown"===t.key){if(0===e.length)return;t.preventDefault(),t.stopPropagation(),this.focusedIndex=this.focusedIndex<0?0:(this.focusedIndex+1)%e.length,this.beginHoverSuppression()}else if("ArrowUp"===t.key){if(0===e.length)return;t.preventDefault(),t.stopPropagation(),this.focusedIndex=this.focusedIndex<=0?e.length-1:this.focusedIndex-1,this.beginHoverSuppression()}else if("Enter"===t.key){if(this.focusedIndex<0||this.focusedIndex>=e.length)return;t.preventDefault(),t.stopPropagation();const s=e[this.focusedIndex];this.isSelectAllOption(s)?this.emitSelectAll():this.emitOptionSelect(s)}};beginHoverSuppression(){this.suppressHover||(this.suppressHover=!0,document.addEventListener("mousemove",this.releaseHoverSuppress,!0))}scrollFocusedIntoView(){const t=this.listEl,e=t?.querySelector(".sd-select-list-item--focused");if(!t||!e)return;const s=t.getBoundingClientRect(),i=e.getBoundingClientRect();i.top<s.top?t.scrollTop+=i.top-s.top:i.bottom>s.bottom&&(t.scrollTop+=i.bottom-s.bottom)}connectedCallback(){this.keydownAttached||(document.addEventListener("keydown",this.handleKeyDown,!0),this.keydownAttached=!0)}disconnectedCallback(){this.keydownAttached&&(document.removeEventListener("keydown",this.handleKeyDown,!0),this.keydownAttached=!1),this.suppressHover&&(document.removeEventListener("mousemove",this.releaseHoverSuppress,!0),this.suppressHover=!1)}componentDidRender(){this.focusedIndex!==this.lastScrolledIndex&&(this.lastScrolledIndex=this.focusedIndex,this.focusedIndex>=0&&this.scrollFocusedIntoView())}renderOptions(t,e=1){return t.map((t=>{const s=!!t.children;return[i("sd-select-list-item",{option:t,depth:e,isSelected:s?this.getGroupSelectionState(t):this.isOptionSelected(t),isFocused:this.isOptionFocused(t),useCheckbox:this.isMulti,countInfo:this.getCountInfo(t),onSdListItemClick:this.handleOptionClick,onMouseEnter:()=>this.handleOptionHover(t)}),s&&t.children?this.renderOptions(t.children,e+1):null]}))}render(){return i("div",{key:"7505e221ddb890880f0ba5088c3fdc76700e3b2f",class:"sd-select-listbox",style:{"--listbox-trigger-width":this.triggerWidth??"200px","--listbox-max-width":this.maxWidth??"640px","--listbox-max-height":this.maxHeight??"260px","--listbox-radius":`${c.radius}px`}},this.showSearch&&i("sd-select-list-item-search",{key:"54b97ad40c5e7abe92b478689d09337843736652",isScrolled:this.isScrolled,onSdSearchFilter:this.handleSearchFilter}),i("div",{key:"f7417f923cc34cbb2c2a56ae70ed54701d013d3d",class:"sd-select-listbox__list",onScroll:this.handleScroll,ref:t=>{this.listEl=t}},this.showSelectAll&&i("sd-select-list-item",{key:"5e8cfcb1f9f0953b9eaa6fc73de992b52a0a23d7",option:t.SELECT_ALL_OPTION,depth:1,isSelected:this.selectAllState,isFocused:this.isOptionFocused(t.SELECT_ALL_OPTION),useCheckbox:!0,onSdListItemClick:this.handleSelectAllClick,onMouseEnter:()=>this.handleOptionHover(t.SELECT_ALL_OPTION)}),this.isEmpty?i("div",{class:"sd-select-listbox__empty"},n):this.isDepth?this.renderOptions(this.filteredOptions):this.filteredOptions.map((t=>i("sd-select-list-item",{option:t,depth:1,isSelected:this.isOptionSelected(t),isFocused:this.isOptionFocused(t),useCheckbox:this.isMulti,onSdListItemClick:this.handleOptionClick,onMouseEnter:()=>this.handleOptionHover(t)})))))}static get watchers(){return{searchKeyword:[{resetFocusOnFilter:0}]}}static get style(){return":host{display:block}:host .sd-select-listbox{display:flex;flex-direction:column;width:var(--listbox-trigger-width);max-width:var(--listbox-max-width);max-height:var(--listbox-max-height);border-radius:var(--listbox-radius);background:white;box-shadow:2px 2px 12px 2px rgba(0, 0, 0, 0.1);overflow:hidden;outline:none}:host .sd-select-listbox__list{flex:1;min-height:0;overflow-y:auto;padding-bottom:0}:host .sd-select-listbox__empty{padding:12px;text-align:center;font-size:12px;line-height:20px;color:#888888}"}},[513,"sd-select-listbox",{type:[1],options:[16],value:[8],emitValue:[4,"emit-value"],useSearch:[4,"use-search"],useSelectAll:[4,"use-select-all"],triggerWidth:[1,"trigger-width"],maxWidth:[1,"max-width"],maxHeight:[1,"max-height"],searchKeyword:[32],isScrolled:[32],focusedIndex:[32]},void 0,{searchKeyword:[{resetFocusOnFilter:0}]}]);function f(){"undefined"!=typeof customElements&&["sd-select-listbox","sd-checkbox","sd-icon","sd-select-list-item","sd-select-list-item-search"].forEach((t=>{switch(t){case"sd-select-listbox":customElements.get(h(t))||customElements.define(h(t),p);break;case"sd-checkbox":customElements.get(h(t))||d();break;case"sd-icon":customElements.get(h(t))||a();break;case"sd-select-list-item":customElements.get(h(t))||u();break;case"sd-select-list-item-search":customElements.get(h(t))||m()}}))}export{p as S,f as d}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as e,a as s,h as i}from"./p-DNWwGHho.js";import{n as r}from"./p-CCwNgVmC.js";import{c as h,S as o,f as l,E as n,L as c,a as d,b as a,d as u}from"./p-CxOCk_ge.js";const g=class{constructor(s){t(this,s),this.update=e(this,"sdUpdate",7),this.dropDownShow=e(this,"sdDropDownShow",7)}static VIEWPORT_PADDING=20;static PORTAL_OFFSET_Y=4;static CLOSE_ANIMATION_DURATION=150;get el(){return s(this)}type="default";value=null;options=[];placeholder="선택";maxDropdownWidth="640px";dropdownHeight="260px";disabled=!1;label="";labelWidth="";addonLabel="";addonAlign="start";error=!1;hint="";errorMessage="";rules=[];icon=void 0;labelTooltip="";labelTooltipProps=null;emitValue=!1;width="";useSearch=!1;allSelectedLabel="전체";useSelectAll=!1;isOpen=!1;isAnimatingOut=!1;triggerWidth="200px";resolvedDropdownHeight="260px";resolvedMaxDropdownWidth="640px";focused=!1;hovered=!1;update;dropDownShow;async sdFocus(){this.disabled||await(this.triggerComponentRef?.sdFocus())}async sdOpen(){await new Promise((t=>setTimeout(t,0))),this.disabled||this.isOpen||(this.prepareDropdownGeometry(),this.closeAnimationTimer&&clearTimeout(this.closeAnimationTimer),this.isAnimatingOut=!1,this.isOpen=!0)}triggerRef;triggerComponentRef;closeAnimationTimer;name=r();triggerHasFocus=!1;watchIsOpen(t){this.syncFocusedState(t),this.dropDownShow.emit({isOpen:t})}get isMulti(){return"multi"===this.type||"multi_depth"===this.type}get displayText(){if(this.isMulti){if(!Array.isArray(this.value)||0===this.value.length)return"";const t=this.getNonDisabledLeaves(this.options),e=this.getSelectedOptions();if(t.length>0&&t.every((t=>e.some((e=>e.value===t.value)))))return this.allSelectedLabel??"전체";const s=this.flattenOptions(this.options);return this.value.map((t=>{if(null!=t&&"object"==typeof t){const e=t;return e.label??s.find((t=>t.value===e.value))?.label??""}return s.find((e=>e.value===t))?.label??""})).filter(Boolean).join(", ")}if(null==this.value)return"";if(!this.emitValue&&"object"==typeof this.value&&!Array.isArray(this.value))return this.value.label??"";const t=this.flattenOptions(this.options).find((t=>t.value===this.value));return t?.label??""}flattenOptions(t){return t.flatMap((t=>t.children?this.flattenOptions(t.children):[t]))}getNonDisabledLeaves(t){return t.flatMap((t=>t.disabled?[]:t.children?this.getNonDisabledLeaves(t.children):[t]))}getSelectedOptions(){const t=this.value;return null!=t&&Array.isArray(t)?this.emitValue?t.map((t=>this.findOriginalOption(t,this.options))).filter((t=>!!t)):t:[]}toMultiValue(t){return this.emitValue?t.map((t=>t.value)):t}parsePixelValue(t,e){const s=Number.parseFloat(t);return Number.isFinite(s)?s:e}updateDropdownViewportConstraints(){if(!this.triggerRef)return;const t=this.triggerRef.getBoundingClientRect(),e=g.VIEWPORT_PADDING,s=g.PORTAL_OFFSET_Y,i=this.parsePixelValue(this.dropdownHeight,260),r=this.parsePixelValue(this.maxDropdownWidth,640),h=Math.max(window.innerHeight-t.bottom-e-s,0),o=Math.max(t.top-e-s,0),l=Math.max(h,o),n=Math.max(window.innerWidth-2*e,0);this.resolvedDropdownHeight=`${Math.min(i,l)}px`,this.resolvedMaxDropdownWidth=`${Math.min(r,n)}px`}handleViewportResize=()=>{this.isOpen&&this.updateDropdownViewportConstraints()};findOriginalOption(t,e){for(const s of e){if(s.value===t)return s;if(s.children){const e=this.findOriginalOption(t,s.children);if(e)return e}}}closeDropdown(){this.isOpen&&(this.isOpen=!1,this.isAnimatingOut=!0,this.closeAnimationTimer&&clearTimeout(this.closeAnimationTimer),this.closeAnimationTimer=setTimeout((()=>{this.isAnimatingOut=!1}),g.CLOSE_ANIMATION_DURATION))}prepareDropdownGeometry(){this.triggerRef&&(this.triggerWidth=`${this.triggerRef.offsetWidth}px`),this.updateDropdownViewportConstraints()}syncFocusedState(t=this.isOpen){this.focused=t||this.triggerHasFocus}handleTriggerFocus=()=>{this.triggerHasFocus=!0,this.syncFocusedState()};handleTriggerBlur=()=>{this.triggerHasFocus=!1,this.syncFocusedState()};handleTriggerClick=()=>{this.isOpen?this.closeDropdown():(this.prepareDropdownGeometry(),this.closeAnimationTimer&&clearTimeout(this.closeAnimationTimer),this.isAnimatingOut=!1,this.isOpen=!0)};emitUpdate(t){this.update.emit(t)}handleOptionSelect=t=>{const{option:e,leaves:s}=t;if(this.isMulti)this.handleMultiSelect(e,s);else{this.closeDropdown(),this.value=this.emitValue?e.value:e;const t=this.value;requestAnimationFrame((()=>{this.emitUpdate(t)}))}};handleMultiSelect(t,e){const s=this.getSelectedOptions();let i;if(t.children)if(e.every((t=>s.some((e=>e.value===t.value))))){const t=new Set(e.map((t=>t.value)));i=s.filter((e=>!t.has(e.value)))}else{const t=new Set(s.map((t=>t.value))),r=e.filter((e=>!t.has(e.value)));i=[...s,...r]}else i=s.some((e=>e.value===t.value))?s.filter((e=>e.value!==t.value)):[...s,t];this.value=this.toMultiValue(i),this.emitUpdate(this.value)}connectedCallback(){window.addEventListener("resize",this.handleViewportResize)}disconnectedCallback(){window.removeEventListener("resize",this.handleViewportResize),this.closeAnimationTimer&&clearTimeout(this.closeAnimationTimer)}render(){const t={open:this.isOpen,parentRef:this.triggerRef,viewportPadding:g.VIEWPORT_PADDING,onSdClose:()=>{this.closeDropdown()}};return i("sd-field",{key:"3c188cbdd8c612e78780d18c03acc382d32080c9",name:this.name,label:this.label,labelWidth:this.labelWidth,addonLabel:this.addonLabel,addonAlign:this.addonAlign,hint:this.hint,errorMessage:this.errorMessage,width:this.width,rules:this.rules,error:this.error,disabled:this.disabled,focused:this.focused,hovered:this.hovered,icon:this.icon,labelTooltip:this.labelTooltip,labelTooltipProps:this.labelTooltipProps,onMouseEnter:()=>{this.hovered=!0},onMouseLeave:()=>{this.hovered=!1}},i("div",{key:"be596d399856ed966408ba1525fea9dbdf8fcc7e",class:"sd-select",ref:t=>{this.triggerRef=t}},i("sd-select-trigger",{key:"f8a29b1ac2469c60af8c7101d05157674566f00f",ref:t=>{this.triggerComponentRef=t},displayText:this.displayText,placeholder:this.placeholder??"선택",disabled:this.disabled,isOpen:this.isOpen,onSdTriggerClick:this.handleTriggerClick,onSdTriggerFocus:this.handleTriggerFocus,onSdTriggerBlur:this.handleTriggerBlur})),(this.isOpen||this.isAnimatingOut)&&i("sd-portal",{key:"3cef3f95f69b09d0e4e8f6b01615df4cca031cff",...t},i("sd-select-listbox",{key:"e8833c547aa2e8084754c7a439d3860df5c97e5b",type:this.type,options:this.options,value:this.value,emitValue:this.emitValue,useSearch:this.useSearch,useSelectAll:this.useSelectAll,triggerWidth:this.triggerWidth,maxWidth:this.resolvedMaxDropdownWidth,maxHeight:this.resolvedDropdownHeight,onSdOptionSelect:t=>this.handleOptionSelect(t.detail)})))}static get watchers(){return{isOpen:[{watchIsOpen:0}]}}};g.style="sd-select{display:inline-flex}sd-select sd-portal{display:none}sd-select .sd-select{position:relative;width:100%;height:100%}";const p=class{constructor(s){t(this,s),this.optionSelect=e(this,"sdOptionSelect",7)}type="default";options=[];value=null;emitValue=!1;useSearch=!1;useSelectAll=!1;triggerWidth="200px";maxWidth="640px";maxHeight="260px";searchKeyword="";isScrolled=!1;focusedIndex=-1;optionSelect;listEl;lastScrolledIndex=-1;keydownAttached=!1;suppressHover=!1;get isDepth(){return"default_depth"===this.type||"multi_depth"===this.type}get isMulti(){return"multi"===this.type||"multi_depth"===this.type}static SELECT_ALL_OPTION={value:"__select_all__",label:"전체"};get showSelectAll(){return this.useSelectAll&&this.isMulti}getAllNonDisabledLeaves(){const t=e=>e.flatMap((e=>e.disabled?[]:e.children?t(e.children):[e]));return t(this.options)}get selectAllState(){if(!this.showSelectAll)return!1;const t=this.getAllNonDisabledLeaves();if(0===t.length)return!1;const e=this.getSelectedValues(),s=t.filter((t=>e.has(t.value))).length;return 0!==s&&(s===t.length||null)}get showSearch(){return!!this.useSearch&&(this.isDepth?h(this.options):this.options.length)>=o}get filteredOptions(){if(""===this.searchKeyword)return this.options;if(this.isDepth)return l(this.options,this.searchKeyword);const t=this.searchKeyword.toLowerCase();return this.options.filter((e=>e.label.toLowerCase().includes(t)))}get isEmpty(){return this.isDepth?0===h(this.filteredOptions)&&0===this.filteredOptions.length:0===this.filteredOptions.length}getSelectedValues(){return null!=this.value&&Array.isArray(this.value)?this.emitValue?new Set(this.value):new Set(this.value.map((t=>t.value))):new Set}isOptionSelected(t){return this.isMulti?this.getSelectedValues().has(t.value):this.emitValue||null==this.value||"object"!=typeof this.value||Array.isArray(this.value)?this.value===t.value:this.value.value===t.value}getGroupSelectionState(t){if(!this.isMulti||!t.children)return!1;const e=this.getSelectedValues();if(0===e.size)return!1;const s=this.collectVisibleLeaves(t);if(0===s.length)return!1;const i=s.filter((t=>e.has(t.value))).length;return 0!==i&&(i===s.length||null)}getCountInfo(t){if(!this.isMulti||!t.children)return;const e=this.getSelectedValues(),s=this.collectVisibleLeaves(t);return{selected:s.filter((t=>e.has(t.value))).length,total:s.length}}findOriginalOption(t,e){for(const s of e){if(s.value===t)return s;if(s.children){const e=this.findOriginalOption(t,s.children);if(e)return e}}}collectLeaves(t){return t.children?t.children.flatMap((t=>this.collectLeaves(t))):[t]}collectVisibleLeaves(t){if(t.disabled)return[];if(!t.children)return[t];if(0===t.children.length){const e=this.findOriginalOption(t.value,this.options);return e?this.collectLeaves(e).filter((t=>!t.disabled)):[]}return t.children.flatMap((t=>this.collectVisibleLeaves(t)))}get navigableOptions(){const t=[];this.showSelectAll&&t.push(p.SELECT_ALL_OPTION);const e=s=>{for(const i of s){const s=!!i.children;(!s||this.isMulti)&&!i.disabled&&t.push(i),s&&i.children&&i.children.length>0&&e(i.children)}};return e(this.filteredOptions),t}isSelectAllOption(t){return this.showSelectAll&&t.value===p.SELECT_ALL_OPTION.value}emitSelectAll(){if(!this.showSelectAll)return;const t=this.getAllNonDisabledLeaves();this.optionSelect.emit({option:{...p.SELECT_ALL_OPTION,children:t},leaves:t})}handleSelectAllClick=t=>{t.stopPropagation(),this.emitSelectAll()};isOptionFocused(t){if(this.focusedIndex<0)return!1;const e=this.navigableOptions[this.focusedIndex];return null!=e&&e.value===t.value}resetFocusOnFilter(){this.focusedIndex=this.navigableOptions.length>0?0:-1,this.suppressHover&&(document.removeEventListener("mousemove",this.releaseHoverSuppress,!0),this.suppressHover=!1)}handleSearchFilter=t=>{this.searchKeyword=t.detail};handleScroll=t=>{this.isScrolled=t.target.scrollTop>0};emitOptionSelect(t){this.optionSelect.emit({option:t,leaves:this.collectVisibleLeaves(t)})}handleOptionClick=t=>{t.stopPropagation(),this.emitOptionSelect(t.detail)};handleOptionHover=t=>{if(this.suppressHover)return;const e=this.navigableOptions.findIndex((e=>e.value===t.value));e>=0&&(this.focusedIndex=e)};releaseHoverSuppress=()=>{this.suppressHover=!1,document.removeEventListener("mousemove",this.releaseHoverSuppress,!0)};handleKeyDown=t=>{const e=this.navigableOptions;if("ArrowDown"===t.key){if(0===e.length)return;t.preventDefault(),t.stopPropagation(),this.focusedIndex=this.focusedIndex<0?0:(this.focusedIndex+1)%e.length,this.beginHoverSuppression()}else if("ArrowUp"===t.key){if(0===e.length)return;t.preventDefault(),t.stopPropagation(),this.focusedIndex=this.focusedIndex<=0?e.length-1:this.focusedIndex-1,this.beginHoverSuppression()}else if("Enter"===t.key){if(this.focusedIndex<0||this.focusedIndex>=e.length)return;t.preventDefault(),t.stopPropagation();const s=e[this.focusedIndex];this.isSelectAllOption(s)?this.emitSelectAll():this.emitOptionSelect(s)}};beginHoverSuppression(){this.suppressHover||(this.suppressHover=!0,document.addEventListener("mousemove",this.releaseHoverSuppress,!0))}scrollFocusedIntoView(){const t=this.listEl,e=t?.querySelector(".sd-select-list-item--focused");if(!t||!e)return;const s=t.getBoundingClientRect(),i=e.getBoundingClientRect();i.top<s.top?t.scrollTop+=i.top-s.top:i.bottom>s.bottom&&(t.scrollTop+=i.bottom-s.bottom)}connectedCallback(){this.keydownAttached||(document.addEventListener("keydown",this.handleKeyDown,!0),this.keydownAttached=!0)}disconnectedCallback(){this.keydownAttached&&(document.removeEventListener("keydown",this.handleKeyDown,!0),this.keydownAttached=!1),this.suppressHover&&(document.removeEventListener("mousemove",this.releaseHoverSuppress,!0),this.suppressHover=!1)}componentDidRender(){this.focusedIndex!==this.lastScrolledIndex&&(this.lastScrolledIndex=this.focusedIndex,this.focusedIndex>=0&&this.scrollFocusedIntoView())}renderOptions(t,e=1){return t.map((t=>{const s=!!t.children;return[i("sd-select-list-item",{option:t,depth:e,isSelected:s?this.getGroupSelectionState(t):this.isOptionSelected(t),isFocused:this.isOptionFocused(t),useCheckbox:this.isMulti,countInfo:this.getCountInfo(t),onSdListItemClick:this.handleOptionClick,onMouseEnter:()=>this.handleOptionHover(t)}),s&&t.children?this.renderOptions(t.children,e+1):null]}))}render(){return i("div",{key:"7505e221ddb890880f0ba5088c3fdc76700e3b2f",class:"sd-select-listbox",style:{"--listbox-trigger-width":this.triggerWidth??"200px","--listbox-max-width":this.maxWidth??"640px","--listbox-max-height":this.maxHeight??"260px","--listbox-radius":`${c.radius}px`}},this.showSearch&&i("sd-select-list-item-search",{key:"54b97ad40c5e7abe92b478689d09337843736652",isScrolled:this.isScrolled,onSdSearchFilter:this.handleSearchFilter}),i("div",{key:"f7417f923cc34cbb2c2a56ae70ed54701d013d3d",class:"sd-select-listbox__list",onScroll:this.handleScroll,ref:t=>{this.listEl=t}},this.showSelectAll&&i("sd-select-list-item",{key:"5e8cfcb1f9f0953b9eaa6fc73de992b52a0a23d7",option:p.SELECT_ALL_OPTION,depth:1,isSelected:this.selectAllState,isFocused:this.isOptionFocused(p.SELECT_ALL_OPTION),useCheckbox:!0,onSdListItemClick:this.handleSelectAllClick,onMouseEnter:()=>this.handleOptionHover(p.SELECT_ALL_OPTION)}),this.isEmpty?i("div",{class:"sd-select-listbox__empty"},n):this.isDepth?this.renderOptions(this.filteredOptions):this.filteredOptions.map((t=>i("sd-select-list-item",{option:t,depth:1,isSelected:this.isOptionSelected(t),isFocused:this.isOptionFocused(t),useCheckbox:this.isMulti,onSdListItemClick:this.handleOptionClick,onMouseEnter:()=>this.handleOptionHover(t)})))))}static get watchers(){return{searchKeyword:[{resetFocusOnFilter:0}]}}};p.style=":host{display:block}:host .sd-select-listbox{display:flex;flex-direction:column;width:var(--listbox-trigger-width);max-width:var(--listbox-max-width);max-height:var(--listbox-max-height);border-radius:var(--listbox-radius);background:white;box-shadow:2px 2px 12px 2px rgba(0, 0, 0, 0.1);overflow:hidden;outline:none}:host .sd-select-listbox__list{flex:1;min-height:0;overflow-y:auto;padding-bottom:0}:host .sd-select-listbox__empty{padding:12px;text-align:center;font-size:12px;line-height:20px;color:#888888}";const f=class{constructor(s){t(this,s),this.triggerClick=e(this,"sdTriggerClick",7),this.triggerFocus=e(this,"sdTriggerFocus",7),this.triggerBlur=e(this,"sdTriggerBlur",7)}displayText="";placeholder="선택";disabled=!1;isOpen=!1;triggerClick;triggerFocus;triggerBlur;triggerEl;async sdFocus(){this.disabled||this.triggerEl?.focus()}handleClick=()=>{this.disabled||this.triggerClick.emit()};handleFocus=()=>{this.triggerFocus.emit()};handleBlur=()=>{this.triggerBlur.emit()};render(){const t=""!==this.displayText;return i("div",{key:"3a97ed909e3088528714682050a3986081e19433",ref:t=>{this.triggerEl=t},role:"button","aria-haspopup":"listbox","aria-expanded":this.isOpen?"true":"false",tabindex:this.disabled?-1:0,class:{"sd-select-trigger":!0,"sd-select-trigger--open":this.isOpen,"sd-select-trigger--disabled":this.disabled},style:{"--trigger-padding-x":`${u.paddingX}px`,"--trigger-gap":`${u.gap}px`,"--trigger-font-size":`${a.fontSize}px`,"--trigger-line-height":`${a.lineHeight}px`,"--trigger-font-weight":a.fontWeight,"--trigger-color":this.disabled?d.text.disabled:t?d.text.default:d.icon.default,"--trigger-icon-color":this.disabled?d.icon.disabled:d.icon.default},onClick:this.handleClick,onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleClick())},onFocus:this.handleFocus,onBlur:this.handleBlur},i("div",{key:"986faba7d79980f0bcd10fff32495d2100e1805f",class:"sd-select-trigger__content"},i("span",{key:"c51b268186de7cdabcf06ac3d540ccb570c9e865",class:"sd-select-trigger__text"},t?this.displayText:this.placeholder??"선택"),i("sd-icon",{key:"8a03b400d5aef2e0ca9aeb4b1f6122db2932455a",name:"chevronDown",size:12,color:"var(--trigger-icon-color)",class:{"sd-select-trigger__icon":!0,"sd-select-trigger__icon--open":this.isOpen}})))}};f.style="sd-select-trigger{display:block;width:100%;height:100%}sd-select-trigger .sd-select-trigger{display:flex;width:100%;height:100%;cursor:pointer;user-select:none;overflow:hidden;border-radius:3px}sd-select-trigger .sd-select-trigger--disabled{cursor:not-allowed}sd-select-trigger .sd-select-trigger__content{display:flex;align-items:center;gap:var(--trigger-gap);flex:1;padding:0 var(--trigger-padding-x);min-width:0}sd-select-trigger .sd-select-trigger__text{flex:1;font-size:var(--trigger-font-size);line-height:var(--trigger-line-height);font-weight:var(--trigger-font-weight);color:var(--trigger-color);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}sd-select-trigger .sd-select-trigger__icon{flex-shrink:0;transition:transform 0.2s ease}sd-select-trigger .sd-select-trigger__icon--open{transform:rotate(180deg)}";export{g as sd_select,p as sd_select_listbox,f as sd_select_trigger}
|