@sellmate/design-system 1.0.74 → 1.0.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/dist/cjs/design-system.cjs.js +1 -1
  2. package/dist/cjs/index.cjs.js +5 -0
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/sd-button_4.cjs.entry.js +2 -2
  5. package/dist/cjs/sd-confirm-modal_2.cjs.entry.js +1 -1
  6. package/dist/cjs/sd-ghost-button.cjs.entry.js +10 -5
  7. package/dist/cjs/sd-modal-container.cjs.entry.js +76 -68
  8. package/dist/cjs/sd-pagination_5.cjs.entry.js +889 -0
  9. package/dist/cjs/sd-radio-button.cjs.entry.js +6 -1
  10. package/dist/cjs/sd-select-v2-list-item_4.cjs.entry.js +65 -5
  11. package/dist/cjs/sd-switch.cjs.entry.js +1 -1
  12. package/dist/cjs/sd-table.cjs.entry.js +167 -20
  13. package/dist/cjs/sd-tabs.cjs.entry.js +1 -1
  14. package/dist/cjs/sd-tag.cjs.entry.js +2 -2
  15. package/dist/cjs/sd-td.cjs.entry.js +53 -1
  16. package/dist/cjs/sd-text-link.cjs.entry.js +3 -3
  17. package/dist/cjs/sd-textarea.cjs.entry.js +1 -1
  18. package/dist/cjs/sd-toast-container.cjs.entry.js +1 -1
  19. package/dist/cjs/sd-toast.cjs.entry.js +2 -2
  20. package/dist/cjs/sd-toggle.cjs.entry.js +1 -1
  21. package/dist/collection/components/sd-ghost-button/sd-ghost-button.js +10 -5
  22. package/dist/collection/components/sd-loading-modal/sd-loading-modal.js +3 -3
  23. package/dist/collection/components/sd-modal-container/sd-modal-container.js +77 -71
  24. package/dist/collection/components/sd-radio-button/sd-radio-button.js +6 -1
  25. package/dist/collection/components/sd-select-v2/sd-select-v2-listbox/sd-select-v2-listbox.js +103 -3
  26. package/dist/collection/components/sd-select-v2/sd-select-v2-trigger/sd-select-v2-trigger.js +2 -2
  27. package/dist/collection/components/sd-select-v2/sd-select-v2.js +82 -4
  28. package/dist/collection/components/sd-switch/sd-switch.js +1 -1
  29. package/dist/collection/components/sd-table/sd-table.css +1 -1
  30. package/dist/collection/components/sd-table/sd-table.js +170 -21
  31. package/dist/collection/components/sd-table/sd-tbody/sd-tbody.js +7 -2
  32. package/dist/collection/components/sd-table/sd-td/sd-td.js +91 -1
  33. package/dist/collection/components/sd-table/sd-thead/sd-thead.js +9 -4
  34. package/dist/collection/components/sd-table/sd-tr/sd-tr.css +8 -0
  35. package/dist/collection/components/sd-table/sd-tr/sd-tr.js +62 -12
  36. package/dist/collection/components/sd-tabs/sd-tabs.js +1 -1
  37. package/dist/collection/components/sd-tag/sd-tag.js +2 -2
  38. package/dist/collection/components/sd-text-link/sd-text-link.js +3 -3
  39. package/dist/collection/components/sd-textarea/sd-textarea.js +1 -1
  40. package/dist/collection/components/sd-toast/sd-toast.js +2 -2
  41. package/dist/collection/components/sd-toast-container/sd-toast-container.js +1 -1
  42. package/dist/collection/components/sd-toggle/sd-toggle.js +1 -1
  43. package/dist/collection/components/sd-tooltip/sd-tooltip.js +2 -2
  44. package/dist/collection/utils/modal.js +5 -0
  45. package/dist/components/index.js +1 -1
  46. package/dist/components/{p-BALOEavB.js → p-6AvsuYqF.js} +1 -1
  47. package/dist/components/{p-CTwEbxRN.js → p-6PsyRF61.js} +1 -1
  48. package/dist/components/{p-DEBakAhm.js → p-7DKZPPev.js} +1 -1
  49. package/dist/components/p-BBD_1E3n.js +1 -0
  50. package/dist/components/p-BQvugXhH.js +1 -0
  51. package/dist/components/p-BRfPoWUn.js +1 -0
  52. package/dist/components/{p-CHFGWh0m.js → p-C-BOe23n.js} +1 -1
  53. package/dist/components/p-C7h8lwnU.js +1 -0
  54. package/dist/components/{p-SDBnyM8D.js → p-CUg9NH6y.js} +1 -1
  55. package/dist/components/{p-C3dI7f7C.js → p-CgMyz4NQ.js} +1 -1
  56. package/dist/components/p-Csfj4h1A.js +1 -0
  57. package/dist/components/{p-Bp0B8tcl.js → p-DAC3TaZV.js} +1 -1
  58. package/dist/components/p-DQfNwvwx.js +1 -0
  59. package/dist/components/p-DfOYYI9m.js +1 -0
  60. package/dist/components/{p-H-9uoufd.js → p-d4UB2UF7.js} +1 -1
  61. package/dist/components/p-eEC3ITv0.js +1 -0
  62. package/dist/components/{p-CWEeXx2E.js → p-nVHDJc9g.js} +1 -1
  63. package/dist/components/{p-D8fG9Yt7.js → p-rnbt1m4L.js} +1 -1
  64. package/dist/components/sd-action-modal.js +1 -1
  65. package/dist/components/sd-barcode-input.js +1 -1
  66. package/dist/components/sd-chip.js +1 -1
  67. package/dist/components/sd-confirm-modal.js +1 -1
  68. package/dist/components/sd-date-picker-calendar.js +1 -1
  69. package/dist/components/sd-date-picker.js +1 -1
  70. package/dist/components/sd-date-range-picker-calendar.js +1 -1
  71. package/dist/components/sd-date-range-picker.js +1 -1
  72. package/dist/components/sd-field.js +1 -1
  73. package/dist/components/sd-file-picker.js +1 -1
  74. package/dist/components/sd-ghost-button.js +1 -1
  75. package/dist/components/sd-guide.js +1 -1
  76. package/dist/components/sd-input.js +1 -1
  77. package/dist/components/sd-loading-modal.js +1 -1
  78. package/dist/components/sd-modal-container.js +1 -1
  79. package/dist/components/sd-number-input.js +1 -1
  80. package/dist/components/sd-popover.js +1 -1
  81. package/dist/components/sd-radio-button.js +1 -1
  82. package/dist/components/sd-select-dropdown.js +1 -1
  83. package/dist/components/sd-select-group.js +1 -1
  84. package/dist/components/sd-select-multiple-group.js +1 -1
  85. package/dist/components/sd-select-multiple.js +1 -1
  86. package/dist/components/sd-select-search-input.js +1 -1
  87. package/dist/components/sd-select-v2-listbox.js +1 -1
  88. package/dist/components/sd-select-v2-trigger.js +1 -1
  89. package/dist/components/sd-select-v2.js +1 -1
  90. package/dist/components/sd-select.js +1 -1
  91. package/dist/components/sd-switch.js +1 -1
  92. package/dist/components/sd-table.js +1 -1
  93. package/dist/components/sd-tabs.js +1 -1
  94. package/dist/components/sd-tag.js +1 -1
  95. package/dist/components/sd-tbody.js +1 -1
  96. package/dist/components/sd-td.js +1 -1
  97. package/dist/components/sd-text-link.js +1 -1
  98. package/dist/components/sd-textarea.js +1 -1
  99. package/dist/components/sd-thead.js +1 -1
  100. package/dist/components/sd-toast-container.js +1 -1
  101. package/dist/components/sd-toast.js +1 -1
  102. package/dist/components/sd-toggle.js +1 -1
  103. package/dist/components/sd-tooltip.js +1 -1
  104. package/dist/components/sd-tr.js +1 -1
  105. package/dist/design-system/design-system.esm.js +1 -1
  106. package/dist/design-system/index.esm.js +1 -1
  107. package/dist/design-system/p-0e1b27cc.entry.js +1 -0
  108. package/dist/design-system/p-11029f6e.entry.js +1 -0
  109. package/dist/design-system/{p-cc62c180.entry.js → p-140b40ab.entry.js} +1 -1
  110. package/dist/design-system/p-34f7345b.entry.js +1 -0
  111. package/dist/design-system/p-363c9451.entry.js +1 -0
  112. package/dist/design-system/{p-fdcfaa7c.entry.js → p-506f2b68.entry.js} +1 -1
  113. package/dist/design-system/{p-8200b5f2.entry.js → p-531a6a82.entry.js} +1 -1
  114. package/dist/design-system/p-55b65a41.entry.js +1 -0
  115. package/dist/design-system/{p-d1dfa0e1.entry.js → p-68d0d67e.entry.js} +1 -1
  116. package/dist/design-system/p-7fe3a466.entry.js +1 -0
  117. package/dist/design-system/{p-05a1c092.entry.js → p-9466cd93.entry.js} +1 -1
  118. package/dist/design-system/{p-33bec0e3.entry.js → p-b683f2fe.entry.js} +1 -1
  119. package/dist/design-system/p-c521e731.entry.js +1 -0
  120. package/dist/design-system/p-c7bcb232.entry.js +1 -0
  121. package/dist/design-system/{p-16a15368.entry.js → p-c9eb70f5.entry.js} +1 -1
  122. package/dist/design-system/p-d1846df9.entry.js +1 -0
  123. package/dist/design-system/{p-2d154fe0.entry.js → p-fdb52620.entry.js} +1 -1
  124. package/dist/esm/design-system.js +1 -1
  125. package/dist/esm/index.js +5 -0
  126. package/dist/esm/loader.js +1 -1
  127. package/dist/esm/sd-button_4.entry.js +2 -2
  128. package/dist/esm/sd-confirm-modal_2.entry.js +1 -1
  129. package/dist/esm/sd-ghost-button.entry.js +10 -5
  130. package/dist/esm/sd-modal-container.entry.js +76 -68
  131. package/dist/esm/sd-pagination_5.entry.js +883 -0
  132. package/dist/esm/sd-radio-button.entry.js +6 -1
  133. package/dist/esm/sd-select-v2-list-item_4.entry.js +65 -5
  134. package/dist/esm/sd-switch.entry.js +1 -1
  135. package/dist/esm/sd-table.entry.js +168 -21
  136. package/dist/esm/sd-tabs.entry.js +1 -1
  137. package/dist/esm/sd-tag.entry.js +2 -2
  138. package/dist/esm/sd-td.entry.js +53 -1
  139. package/dist/esm/sd-text-link.entry.js +3 -3
  140. package/dist/esm/sd-textarea.entry.js +1 -1
  141. package/dist/esm/sd-toast-container.entry.js +1 -1
  142. package/dist/esm/sd-toast.entry.js +2 -2
  143. package/dist/esm/sd-toggle.entry.js +1 -1
  144. package/dist/types/components/sd-ghost-button/sd-ghost-button.d.ts +1 -0
  145. package/dist/types/components/sd-loading-modal/sd-loading-modal.d.ts +1 -1
  146. package/dist/types/components/sd-modal-container/sd-modal-container.config.d.ts +1 -1
  147. package/dist/types/components/sd-modal-container/sd-modal-container.d.ts +6 -4
  148. package/dist/types/components/sd-radio-button/sd-radio-button.d.ts +1 -0
  149. package/dist/types/components/sd-select-v2/sd-select-v2-listbox/sd-select-v2-listbox.d.ts +9 -0
  150. package/dist/types/components/sd-select-v2/sd-select-v2.d.ts +4 -0
  151. package/dist/types/components/sd-table/sd-table.d.ts +17 -0
  152. package/dist/types/components/sd-table/sd-td/sd-td.d.ts +8 -0
  153. package/dist/types/components/sd-table/sd-tr/sd-tr.d.ts +4 -0
  154. package/dist/types/components.d.ts +55 -3
  155. package/hydrate/index.js +482 -142
  156. package/hydrate/index.mjs +482 -142
  157. package/package.json +1 -1
  158. package/dist/cjs/sd-pagination_2.cjs.entry.js +0 -427
  159. package/dist/cjs/sd-tbody.cjs.entry.js +0 -66
  160. package/dist/cjs/sd-thead.cjs.entry.js +0 -179
  161. package/dist/cjs/sd-tr.cjs.entry.js +0 -171
  162. package/dist/components/p-Bbs5Ws0k.js +0 -1
  163. package/dist/components/p-Biplmgfa.js +0 -1
  164. package/dist/components/p-CgL8_FSD.js +0 -1
  165. package/dist/components/p-DuMkBStM.js +0 -1
  166. package/dist/components/p-vQDL-PZ8.js +0 -1
  167. package/dist/design-system/p-109a10e4.entry.js +0 -1
  168. package/dist/design-system/p-380198bc.entry.js +0 -1
  169. package/dist/design-system/p-6b537e2f.entry.js +0 -1
  170. package/dist/design-system/p-6e90fb80.entry.js +0 -1
  171. package/dist/design-system/p-7b77c65c.entry.js +0 -1
  172. package/dist/design-system/p-8f88bd67.entry.js +0 -1
  173. package/dist/design-system/p-ba5fea6f.entry.js +0 -1
  174. package/dist/design-system/p-be54d6bd.entry.js +0 -1
  175. package/dist/design-system/p-c3379a6e.entry.js +0 -1
  176. package/dist/design-system/p-dc07d618.entry.js +0 -1
  177. package/dist/design-system/p-ef09409c.entry.js +0 -1
  178. package/dist/design-system/p-f8237991.entry.js +0 -1
  179. package/dist/esm/sd-pagination_2.entry.js +0 -424
  180. package/dist/esm/sd-tbody.entry.js +0 -64
  181. package/dist/esm/sd-thead.entry.js +0 -177
  182. package/dist/esm/sd-tr.entry.js +0 -169
@@ -0,0 +1,883 @@
1
+ import { r as registerInstance, c as createEvent, h, F as Fragment, a as getElement, H as Host } from './index-Bp7ytJz5.js';
2
+ import { n as nanoid } from './index-CCwNgVmC.js';
3
+ import { T as TABLE_ID_ATTR } from './constants-sZMi_32I.js';
4
+
5
+ const pagination = {
6
+ height: "24",
7
+ paddingX: "6",
8
+ radius: "6",
9
+ gap: "12",
10
+ move: {
11
+ gap: "4"
12
+ },
13
+ icon: "12",
14
+ typography: {
15
+ "default": {
16
+ fontFamily: "Pretendard Variable, Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Segoe UI, Apple SD Gothic Neo, Noto Sans KR, Malgun Gothic, Apple Color Emoji, Segoe UI Emoji, sans-serif",
17
+ fontSize: "12",
18
+ fontWeight: "500",
19
+ lineHeight: "20"},
20
+ selected: {
21
+ fontWeight: "700"}
22
+ },
23
+ item: {
24
+ bg: {
25
+ hover: "#EEEEEE",
26
+ selected: "#E6F1FF"
27
+ },
28
+ content: {
29
+ "default": "#555555",
30
+ hover: "#004290",
31
+ selected: "#004290"
32
+ }
33
+ }
34
+ };
35
+ var paginationTokens = {
36
+ pagination: pagination
37
+ };
38
+
39
+ const PAGINATION_LAYOUT = {
40
+ height: `${paginationTokens.pagination.height}px`,
41
+ paddingX: `${paginationTokens.pagination.paddingX}px`,
42
+ radius: `${paginationTokens.pagination.radius}px`,
43
+ gap: `${paginationTokens.pagination.gap}px`,
44
+ moveGap: `${paginationTokens.pagination.move.gap}px`,
45
+ iconSize: Number(paginationTokens.pagination.icon),
46
+ };
47
+ const PAGINATION_TYPOGRAPHY = {
48
+ fontFamily: paginationTokens.pagination.typography.default.fontFamily,
49
+ fontSize: `${paginationTokens.pagination.typography.default.fontSize}px`,
50
+ lineHeight: `${paginationTokens.pagination.typography.default.lineHeight}px`,
51
+ fontWeightDefault: paginationTokens.pagination.typography.default.fontWeight,
52
+ fontWeightSelected: paginationTokens.pagination.typography.selected.fontWeight,
53
+ };
54
+ const PAGINATION_COLORS = {
55
+ contentDefault: paginationTokens.pagination.item.content.default,
56
+ contentHover: paginationTokens.pagination.item.content.hover,
57
+ contentSelected: paginationTokens.pagination.item.content.selected,
58
+ bgHover: paginationTokens.pagination.item.bg.hover,
59
+ bgSelected: paginationTokens.pagination.item.bg.selected,
60
+ // TODO: 토큰 반영 후 교체 — nav 화살표 색상은 현재 토큰에 없음
61
+ iconDefault: '#888888',
62
+ };
63
+
64
+ const sdPaginationCss = () => `sd-pagination{display:inline-flex}.sd-pagination{display:inline-flex;align-items:center;gap:var(--sd-pagination-gap);font-family:var(--sd-pagination-font-family)}.sd-pagination__group{display:inline-flex;align-items:center;gap:var(--sd-pagination-move-gap);min-width:calc(var(--sd-pagination-height) * 2 + var(--sd-pagination-move-gap))}.sd-pagination__group--prev{justify-content:flex-end}.sd-pagination__group--next{justify-content:flex-start}.sd-pagination__numbers{display:inline-flex;align-items:center;gap:var(--sd-pagination-move-gap)}.sd-pagination__nav{display:inline-flex;align-items:center;justify-content:center;width:var(--sd-pagination-height);height:var(--sd-pagination-height);padding:0;background:transparent;border:0;border-radius:var(--sd-pagination-radius);cursor:pointer;outline:none}.sd-pagination__nav:hover{background-color:var(--sd-pagination-bg-hover)}.sd-pagination__item{display:inline-flex;align-items:center;justify-content:center;width:var(--sd-pagination-item-width);height:var(--sd-pagination-height);padding:0 var(--sd-pagination-padding-x);background:transparent;border:0;border-radius:var(--sd-pagination-radius);color:var(--sd-pagination-content);font-size:var(--sd-pagination-font-size);font-weight:var(--sd-pagination-font-weight-default);line-height:var(--sd-pagination-line-height);cursor:pointer;outline:none;box-sizing:border-box}.sd-pagination__item:hover{background-color:var(--sd-pagination-bg-hover);color:var(--sd-pagination-content-hover)}.sd-pagination__item--selected{background-color:var(--sd-pagination-bg-selected);color:var(--sd-pagination-content-selected);font-weight:var(--sd-pagination-font-weight-selected)}.sd-pagination__item--selected:hover{background-color:var(--sd-pagination-bg-selected);color:var(--sd-pagination-content-selected)}.sd-pagination__info{display:inline-flex;align-items:center;gap:var(--sd-pagination-move-gap);height:var(--sd-pagination-height);padding:0 var(--sd-pagination-padding-x);color:var(--sd-pagination-content);font-size:var(--sd-pagination-font-size);font-weight:var(--sd-pagination-font-weight-default);line-height:var(--sd-pagination-line-height)}.sd-pagination__current{color:var(--sd-pagination-content-selected);font-weight:var(--sd-pagination-font-weight-selected)}`;
65
+
66
+ const PER_PAGE = 10;
67
+ const BUTTON_WIDTH = {
68
+ 1: 24,
69
+ 2: 34,
70
+ 3: 40,
71
+ 4: 48,
72
+ 5: 56,
73
+ };
74
+ const SdPagination = class {
75
+ constructor(hostRef) {
76
+ registerInstance(this, hostRef);
77
+ this.pageChange = createEvent(this, "sdPageChange", 7);
78
+ }
79
+ currentPage = 1;
80
+ lastPage = 1;
81
+ simple = false;
82
+ pageChange;
83
+ get pageNumbers() {
84
+ const start = Math.floor((this.currentPage - 1) / PER_PAGE) * PER_PAGE + 1;
85
+ const end = Math.min(start + PER_PAGE - 1, this.lastPage);
86
+ return Array.from({ length: end - start + 1 }, (_, i) => start + i);
87
+ }
88
+ get buttonWidth() {
89
+ const lastPageNum = this.pageNumbers.at(-1) ?? 1;
90
+ const maxPageLength = lastPageNum.toString().length;
91
+ return BUTTON_WIDTH[maxPageLength] || BUTTON_WIDTH[1];
92
+ }
93
+ get isFirstGroup() {
94
+ return this.currentPage <= PER_PAGE;
95
+ }
96
+ get isLastGroup() {
97
+ const startPageGroup = Math.floor((this.currentPage - 1) / PER_PAGE) * PER_PAGE + 1;
98
+ return startPageGroup + PER_PAGE - 1 >= this.lastPage;
99
+ }
100
+ handlePageChange = (page) => {
101
+ if (page < 1 || page > this.lastPage)
102
+ return;
103
+ this.currentPage = page;
104
+ this.pageChange.emit(page);
105
+ };
106
+ handleGroupChange = (direction) => {
107
+ const delta = direction === 'forward' ? PER_PAGE : -PER_PAGE;
108
+ const newPage = Math.min(Math.max(this.currentPage + delta, 1), this.lastPage);
109
+ this.handlePageChange(newPage);
110
+ };
111
+ renderNavButton(iconName, ariaLabel, onClick) {
112
+ return (h("button", { type: "button", class: "sd-pagination__nav", "aria-label": ariaLabel, onClick: onClick }, h("sd-icon", { name: iconName, size: PAGINATION_LAYOUT.iconSize, color: PAGINATION_COLORS.iconDefault })));
113
+ }
114
+ renderPrevButtons() {
115
+ if (this.simple) {
116
+ if (this.currentPage <= 1)
117
+ return null;
118
+ return (h(Fragment, null, this.renderNavButton('chevronLeftEnd', 'Go to first page', () => this.handlePageChange(1)), this.renderNavButton('chevronLeft', 'Go to previous page', () => this.handlePageChange(this.currentPage - 1))));
119
+ }
120
+ if (this.isFirstGroup)
121
+ return null;
122
+ return (h(Fragment, null, this.renderNavButton('chevronLeftEnd', 'Go to first page', () => this.handlePageChange(1)), this.renderNavButton('chevronLeft', 'Go to previous page group', () => this.handleGroupChange('backward'))));
123
+ }
124
+ renderNextButtons() {
125
+ if (this.simple) {
126
+ if (this.currentPage >= this.lastPage)
127
+ return null;
128
+ return (h(Fragment, null, this.renderNavButton('chevronRight', 'Go to next page', () => this.handlePageChange(this.currentPage + 1)), this.renderNavButton('chevronRightEnd', 'Go to last page', () => this.handlePageChange(this.lastPage))));
129
+ }
130
+ if (this.isLastGroup)
131
+ return null;
132
+ return (h(Fragment, null, this.renderNavButton('chevronRight', 'Go to next page group', () => this.handleGroupChange('forward')), this.renderNavButton('chevronRightEnd', 'Go to last page', () => this.handlePageChange(this.lastPage))));
133
+ }
134
+ render() {
135
+ const cssVars = {
136
+ '--sd-pagination-height': PAGINATION_LAYOUT.height,
137
+ '--sd-pagination-padding-x': PAGINATION_LAYOUT.paddingX,
138
+ '--sd-pagination-radius': PAGINATION_LAYOUT.radius,
139
+ '--sd-pagination-gap': PAGINATION_LAYOUT.gap,
140
+ '--sd-pagination-move-gap': PAGINATION_LAYOUT.moveGap,
141
+ '--sd-pagination-font-family': PAGINATION_TYPOGRAPHY.fontFamily,
142
+ '--sd-pagination-font-size': PAGINATION_TYPOGRAPHY.fontSize,
143
+ '--sd-pagination-line-height': PAGINATION_TYPOGRAPHY.lineHeight,
144
+ '--sd-pagination-font-weight-default': PAGINATION_TYPOGRAPHY.fontWeightDefault,
145
+ '--sd-pagination-font-weight-selected': PAGINATION_TYPOGRAPHY.fontWeightSelected,
146
+ '--sd-pagination-content': PAGINATION_COLORS.contentDefault,
147
+ '--sd-pagination-content-hover': PAGINATION_COLORS.contentHover,
148
+ '--sd-pagination-content-selected': PAGINATION_COLORS.contentSelected,
149
+ '--sd-pagination-bg-hover': PAGINATION_COLORS.bgHover,
150
+ '--sd-pagination-bg-selected': PAGINATION_COLORS.bgSelected,
151
+ '--sd-pagination-item-width': `${this.buttonWidth}px`,
152
+ };
153
+ return (h("div", { key: '386fdd2d1c0b5a7284c299201f19fd3384670ab1', class: {
154
+ 'sd-pagination': true,
155
+ 'sd-pagination--simple': this.simple,
156
+ }, style: cssVars }, h("div", { key: 'cd73997ae59f87b70c31e88fd5b4246bd6044bd0', class: "sd-pagination__group sd-pagination__group--prev" }, this.renderPrevButtons()), this.simple ? (h("div", { class: "sd-pagination__info" }, h("span", { class: "sd-pagination__current" }, this.currentPage), h("span", { class: "sd-pagination__divider" }, "/"), h("span", { class: "sd-pagination__last" }, this.lastPage))) : (h("div", { class: "sd-pagination__numbers" }, this.pageNumbers.map(n => (h("button", { type: "button", "aria-current": this.currentPage === n ? 'page' : undefined, class: {
157
+ 'sd-pagination__item': true,
158
+ 'sd-pagination__item--selected': this.currentPage === n,
159
+ }, onClick: () => this.handlePageChange(n) }, n))))), h("div", { key: '86389ea83d2965efdd938d2f9b2e2c3469f05fe8', class: "sd-pagination__group sd-pagination__group--next" }, this.renderNextButtons())));
160
+ }
161
+ };
162
+ SdPagination.style = sdPaginationCss();
163
+
164
+ const sdSelectV2Css = () => `sd-select-v2{display:inline-flex}sd-select-v2 sd-portal{display:none}sd-select-v2 .sd-select-v2{position:relative;width:100%;height:100%}`;
165
+
166
+ const SdSelectV2 = class {
167
+ constructor(hostRef) {
168
+ registerInstance(this, hostRef);
169
+ this.update = createEvent(this, "sdUpdate", 7);
170
+ this.dropDownShow = createEvent(this, "sdDropDownShow", 7);
171
+ }
172
+ static VIEWPORT_PADDING = 20;
173
+ static PORTAL_OFFSET_Y = 4;
174
+ static CLOSE_ANIMATION_DURATION = 150;
175
+ get el() { return getElement(this); }
176
+ type = 'default';
177
+ value = null;
178
+ options = [];
179
+ placeholder = '선택';
180
+ maxDropdownWidth = '640px';
181
+ dropdownHeight = '260px';
182
+ disabled = false;
183
+ label = '';
184
+ labelWidth = '';
185
+ addonLabel = '';
186
+ addonAlign = 'start';
187
+ error = false;
188
+ hint = '';
189
+ errorMessage = '';
190
+ rules = [];
191
+ icon = undefined;
192
+ labelTooltip = '';
193
+ labelTooltipProps = null;
194
+ emitValue = false;
195
+ width = '';
196
+ useSearch = false;
197
+ allSelectedLabel = '전체';
198
+ useSelectAll = false;
199
+ isOpen = false;
200
+ isAnimatingOut = false;
201
+ triggerWidth = '200px';
202
+ resolvedDropdownHeight = '260px';
203
+ resolvedMaxDropdownWidth = '640px';
204
+ focused = false;
205
+ hovered = false;
206
+ update;
207
+ dropDownShow;
208
+ async sdFocus() {
209
+ if (this.disabled)
210
+ return;
211
+ await this.triggerComponentRef?.sdFocus();
212
+ }
213
+ async sdOpen() {
214
+ // sdFocus 직후 호출 시 트리거 ref/레이아웃이 안정될 때까지 한 틱 대기
215
+ await new Promise(resolve => setTimeout(resolve, 0));
216
+ if (this.disabled || this.isOpen)
217
+ return;
218
+ this.prepareDropdownGeometry();
219
+ if (this.closeAnimationTimer)
220
+ clearTimeout(this.closeAnimationTimer);
221
+ this.isAnimatingOut = false;
222
+ this.isOpen = true;
223
+ }
224
+ triggerRef;
225
+ triggerComponentRef;
226
+ closeAnimationTimer;
227
+ name = nanoid();
228
+ triggerHasFocus = false;
229
+ watchIsOpen(newValue) {
230
+ this.syncFocusedState(newValue);
231
+ this.dropDownShow.emit({ isOpen: newValue });
232
+ }
233
+ get isMulti() {
234
+ return this.type === 'multi' || this.type === 'multi_depth';
235
+ }
236
+ get displayText() {
237
+ if (this.isMulti) {
238
+ if (!Array.isArray(this.value) || this.value.length === 0)
239
+ return '';
240
+ const nonDisabledLeaves = this.getNonDisabledLeaves(this.options);
241
+ const selected = this.getSelectedOptions();
242
+ const allSelected = nonDisabledLeaves.length > 0 &&
243
+ nonDisabledLeaves.every(leaf => selected.some(s => s.value === leaf.value));
244
+ if (allSelected)
245
+ return this.allSelectedLabel ?? '전체';
246
+ const flat = this.flattenOptions(this.options);
247
+ return this.value
248
+ .map(item => {
249
+ if (item != null && typeof item === 'object') {
250
+ const opt = item;
251
+ return opt.label ?? flat.find(o => o.value === opt.value)?.label ?? '';
252
+ }
253
+ return flat.find(o => o.value === item)?.label ?? '';
254
+ })
255
+ .filter(Boolean)
256
+ .join(', ');
257
+ }
258
+ if (this.value == null)
259
+ return '';
260
+ if (!this.emitValue && typeof this.value === 'object' && !Array.isArray(this.value)) {
261
+ return this.value.label ?? '';
262
+ }
263
+ const flat = this.flattenOptions(this.options);
264
+ const found = flat.find(o => o.value === this.value);
265
+ return found?.label ?? '';
266
+ }
267
+ flattenOptions(options) {
268
+ return options.flatMap(o => (o.children ? this.flattenOptions(o.children) : [o]));
269
+ }
270
+ getNonDisabledLeaves(options) {
271
+ return options.flatMap(o => {
272
+ if (o.disabled)
273
+ return [];
274
+ if (o.children)
275
+ return this.getNonDisabledLeaves(o.children);
276
+ return [o];
277
+ });
278
+ }
279
+ getSelectedOptions() {
280
+ const val = this.value;
281
+ if (!val || !Array.isArray(val))
282
+ return [];
283
+ if (this.emitValue) {
284
+ return val
285
+ .map(v => this.findOriginalOption(v, this.options))
286
+ .filter((o) => !!o);
287
+ }
288
+ return val;
289
+ }
290
+ toMultiValue(options) {
291
+ return this.emitValue ? options.map(o => o.value) : options;
292
+ }
293
+ parsePixelValue(value, fallback) {
294
+ const parsed = Number.parseFloat(value);
295
+ return Number.isFinite(parsed) ? parsed : fallback;
296
+ }
297
+ updateDropdownViewportConstraints() {
298
+ if (!this.triggerRef)
299
+ return;
300
+ const triggerRect = this.triggerRef.getBoundingClientRect();
301
+ const viewportPadding = SdSelectV2.VIEWPORT_PADDING;
302
+ const offsetY = SdSelectV2.PORTAL_OFFSET_Y;
303
+ const preferredHeight = this.parsePixelValue(this.dropdownHeight, 260);
304
+ const preferredWidth = this.parsePixelValue(this.maxDropdownWidth, 640);
305
+ const availableBelow = Math.max(window.innerHeight - triggerRect.bottom - viewportPadding - offsetY, 0);
306
+ const availableAbove = Math.max(triggerRect.top - viewportPadding - offsetY, 0);
307
+ const availableHeight = Math.max(availableBelow, availableAbove);
308
+ const availableWidth = Math.max(window.innerWidth - viewportPadding * 2, 0);
309
+ this.resolvedDropdownHeight = `${Math.min(preferredHeight, availableHeight)}px`;
310
+ this.resolvedMaxDropdownWidth = `${Math.min(preferredWidth, availableWidth)}px`;
311
+ }
312
+ handleViewportResize = () => {
313
+ if (!this.isOpen)
314
+ return;
315
+ this.updateDropdownViewportConstraints();
316
+ };
317
+ findOriginalOption(value, options) {
318
+ for (const opt of options) {
319
+ if (opt.value === value)
320
+ return opt;
321
+ if (opt.children) {
322
+ const found = this.findOriginalOption(value, opt.children);
323
+ if (found)
324
+ return found;
325
+ }
326
+ }
327
+ return undefined;
328
+ }
329
+ closeDropdown() {
330
+ if (!this.isOpen)
331
+ return;
332
+ this.isOpen = false;
333
+ this.isAnimatingOut = true;
334
+ if (this.closeAnimationTimer)
335
+ clearTimeout(this.closeAnimationTimer);
336
+ this.closeAnimationTimer = setTimeout(() => {
337
+ this.isAnimatingOut = false;
338
+ }, SdSelectV2.CLOSE_ANIMATION_DURATION);
339
+ }
340
+ prepareDropdownGeometry() {
341
+ if (this.triggerRef) {
342
+ this.triggerWidth = `${this.triggerRef.offsetWidth}px`;
343
+ }
344
+ this.updateDropdownViewportConstraints();
345
+ }
346
+ syncFocusedState(isOpen = this.isOpen) {
347
+ this.focused = isOpen || this.triggerHasFocus;
348
+ }
349
+ handleTriggerFocus = () => {
350
+ this.triggerHasFocus = true;
351
+ this.syncFocusedState();
352
+ };
353
+ handleTriggerBlur = () => {
354
+ this.triggerHasFocus = false;
355
+ this.syncFocusedState();
356
+ };
357
+ handleTriggerClick = () => {
358
+ if (this.isOpen) {
359
+ this.closeDropdown();
360
+ return;
361
+ }
362
+ this.prepareDropdownGeometry();
363
+ if (this.closeAnimationTimer)
364
+ clearTimeout(this.closeAnimationTimer);
365
+ this.isAnimatingOut = false;
366
+ this.isOpen = true;
367
+ };
368
+ emitUpdate(value) {
369
+ this.update.emit(value);
370
+ }
371
+ handleOptionSelect = (detail) => {
372
+ const { option, leaves } = detail;
373
+ if (this.isMulti) {
374
+ this.handleMultiSelect(option, leaves);
375
+ }
376
+ else {
377
+ this.closeDropdown();
378
+ this.value = this.emitValue ? option.value : option;
379
+ const nextValue = this.value;
380
+ requestAnimationFrame(() => {
381
+ this.emitUpdate(nextValue);
382
+ });
383
+ }
384
+ };
385
+ handleMultiSelect(option, leaves) {
386
+ const selected = this.getSelectedOptions();
387
+ const isGroup = !!option.children;
388
+ let newSelected;
389
+ if (isGroup) {
390
+ const allSelected = leaves.every(l => selected.some(s => s.value === l.value));
391
+ if (allSelected) {
392
+ const leafValues = new Set(leaves.map(l => l.value));
393
+ newSelected = selected.filter(s => !leafValues.has(s.value));
394
+ }
395
+ else {
396
+ const existing = new Set(selected.map(s => s.value));
397
+ const toAdd = leaves.filter(l => !existing.has(l.value));
398
+ newSelected = [...selected, ...toAdd];
399
+ }
400
+ }
401
+ else {
402
+ const exists = selected.some(s => s.value === option.value);
403
+ newSelected = exists ? selected.filter(s => s.value !== option.value) : [...selected, option];
404
+ }
405
+ this.value = this.toMultiValue(newSelected);
406
+ this.emitUpdate(this.value);
407
+ }
408
+ connectedCallback() {
409
+ window.addEventListener('resize', this.handleViewportResize);
410
+ }
411
+ disconnectedCallback() {
412
+ window.removeEventListener('resize', this.handleViewportResize);
413
+ if (this.closeAnimationTimer)
414
+ clearTimeout(this.closeAnimationTimer);
415
+ }
416
+ render() {
417
+ const portalProps = {
418
+ open: this.isOpen,
419
+ parentRef: this.triggerRef,
420
+ viewportPadding: SdSelectV2.VIEWPORT_PADDING,
421
+ onSdClose: () => {
422
+ this.closeDropdown();
423
+ },
424
+ };
425
+ return (h("sd-field", { key: '62bb998e1d455a3792001da4849ba867c60cdd9f', 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: () => {
426
+ this.hovered = true;
427
+ }, onMouseLeave: () => {
428
+ this.hovered = false;
429
+ } }, h("div", { key: '42fa82a3c53804d9f90aadb0465d52fd9f4e446e', class: "sd-select-v2", ref: el => {
430
+ this.triggerRef = el;
431
+ } }, h("sd-select-v2-trigger", { key: 'c97ae1e67019b099eee72f829d554b9e0350af30', ref: el => {
432
+ this.triggerComponentRef = el;
433
+ }, 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) && (h("sd-portal", { key: '5018c8bf4c60a13541f0872149d12b92f164ca96', ...portalProps }, h("sd-select-v2-listbox", { key: 'b7222f7649a8f096f085840a3dd97b7aa069152c', 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: event => this.handleOptionSelect(event.detail) })))));
434
+ }
435
+ static get watchers() { return {
436
+ "isOpen": [{
437
+ "watchIsOpen": 0
438
+ }]
439
+ }; }
440
+ };
441
+ SdSelectV2.style = sdSelectV2Css();
442
+
443
+ const sdTbodyCss = () => `:host{display:contents}:host *{box-sizing:border-box}.tbody{display:table-row-group}.tbody--empty .tbody__no-data-row{display:table-row}.tbody--empty .tbody__no-data-cell{display:table-cell;padding:0;border-bottom:none}`;
444
+
445
+ const SdTbody = class {
446
+ constructor(hostRef) {
447
+ registerInstance(this, hostRef);
448
+ }
449
+ get el() { return getElement(this); }
450
+ rows = [];
451
+ tableId = '';
452
+ topSpacerHeight = 0;
453
+ bottomSpacerHeight = 0;
454
+ tableEl = null;
455
+ handleRowsChange(newRows) {
456
+ const safeRows = newRows ?? [];
457
+ if (this.tableEl?.setRowCountSync) {
458
+ this.tableEl.setRowCountSync(safeRows.length);
459
+ }
460
+ }
461
+ componentWillLoad() {
462
+ this.syncTableContext();
463
+ this.rows = this.rows ?? [];
464
+ if (this.tableEl?.setRowCountSync) {
465
+ this.tableEl.setRowCountSync(this.rows.length);
466
+ }
467
+ this.el.setSpacersSync = (top, bottom) => {
468
+ this.topSpacerHeight = top;
469
+ this.bottomSpacerHeight = bottom;
470
+ };
471
+ }
472
+ componentDidLoad() {
473
+ this.syncTableContext();
474
+ }
475
+ syncTableContext() {
476
+ // sd-table이 shadow:true이므로 fallback content로 렌더되면 closest가 경계를 못 넘는다.
477
+ // 그 경우 getRootNode().host(=sd-table)로 폴백한다.
478
+ const closest = this.el.closest('sd-table');
479
+ const root = this.el.getRootNode();
480
+ const fromShadow = root instanceof ShadowRoot ? root.host : null;
481
+ const table = closest ?? fromShadow;
482
+ this.tableEl = table;
483
+ const fromMethod = table?.getTableIdSync?.();
484
+ const fromAttr = table?.getAttribute(TABLE_ID_ATTR);
485
+ const resolvedTableId = (fromMethod && fromMethod !== 'undefined' ? fromMethod : null) ??
486
+ (fromAttr && fromAttr !== 'undefined' ? fromAttr : null) ??
487
+ '';
488
+ if (resolvedTableId && resolvedTableId !== this.tableId) {
489
+ this.tableId = resolvedTableId;
490
+ }
491
+ }
492
+ render() {
493
+ const hasRows = this.rows.length > 0;
494
+ return (h(Host, { key: 'bc9fbd4f08f4d77da60b083dceef4e24e2fb5532', slot: `${this.tableId}-body` }, h("tbody", { key: '81ef875cbc39f988021a211ede716a98d3ea30cd', class: { 'tbody': true, 'tbody--empty': !hasRows } }, hasRows ? ([
495
+ this.topSpacerHeight > 0 && (h("tr", { key: "spacer-top", class: "tbody__spacer", style: { height: `${this.topSpacerHeight}px`, display: 'block' } })),
496
+ h("slot", null),
497
+ this.bottomSpacerHeight > 0 && (h("tr", { key: "spacer-bottom", class: "tbody__spacer", style: { height: `${this.bottomSpacerHeight}px`, display: 'block' } })),
498
+ ]) : (h("tr", { class: "tbody__no-data-row" }, h("td", { class: "tbody__no-data-cell", colSpan: 100 }, h("slot", { name: "no-data" })))))));
499
+ }
500
+ static get watchers() { return {
501
+ "rows": [{
502
+ "handleRowsChange": 0
503
+ }]
504
+ }; }
505
+ };
506
+ SdTbody.style = sdTbodyCss();
507
+
508
+ const sdTheadCss = () => `sd-thead{display:contents}sd-thead *{box-sizing:border-box}.thead{display:table-header-group;height:36px}.thead--sticky{position:sticky;top:0;z-index:120}.tr{display:table-row;width:100%}.th{display:table-cell;background:#F5FAFF;height:36px;padding:0 16px;font-weight:500;vertical-align:middle;border-bottom:1px solid #E1E1E1;-webkit-user-select:none;user-select:none;position:relative;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all}.th--selected{position:relative;width:52px !important;max-width:52px !important;min-width:52px !important;padding:0 10px 0 24px;text-align:left}.th--selected sd-checkbox label{position:relative}.th--selected sd-checkbox label:before{content:"";position:absolute;inset:-6px}.th.sticky-left{position:sticky;background-color:#F5FAFF;z-index:110 !important;left:var(--sticky-left-offset, 0)}.th.sticky-right{position:sticky;background-color:#F5FAFF;z-index:110 !important;right:var(--sticky-right-offset, 0)}.th.sticky-left-edge:after{content:"";position:absolute;top:0;left:100%;right:-20px;width:20px;height:100%;z-index:101 !important;box-shadow:inset 12px 0 20px -25px;opacity:0;pointer-events:none;transition:opacity 0.2s}.th.sticky-right-edge:after{content:"";position:absolute;top:0;left:-20px;width:20px;height:100%;z-index:101 !important;box-shadow:inset -12px 0 20px -25px;opacity:0;pointer-events:none;transition:opacity 0.2s}.th.sticky-left-edge.is-scrolled-left{overflow:visible}.th.sticky-left-edge.is-scrolled-left:after{opacity:1}.th.sticky-right-edge.is-scrolled-right{overflow:visible}.th.sticky-right-edge.is-scrolled-right:after{opacity:1}.th__content{display:flex;flex-flow:row nowrap;align-items:center;gap:4px}.th__content--left{justify-content:flex-start}.th__content--center{justify-content:center}.th__content--right{justify-content:flex-end}.th__content--label{white-space:nowrap;text-overflow:ellipsis;word-break:keep-all}.th__resizer{position:absolute;top:50%;right:0;transform:translateY(-50%);width:4px;height:16px;cursor:col-resize;z-index:3;border-left:1px solid #CCCCCC;border-right:1px solid #CCCCCC}.th__resizer--left{right:auto;left:0}`;
509
+
510
+ const SdThead = class {
511
+ constructor(hostRef) {
512
+ registerInstance(this, hostRef);
513
+ }
514
+ get el() { return getElement(this); }
515
+ columns;
516
+ selectable;
517
+ resizable;
518
+ stickyColumn;
519
+ stickyHeader;
520
+ scrolledLeft;
521
+ scrolledRight;
522
+ rows = [];
523
+ columnWidths = [];
524
+ tableId = '';
525
+ _columns = [];
526
+ _selectable = false;
527
+ _resizable = false;
528
+ _stickyColumn = { left: 0, right: 0 };
529
+ _stickyHeader = false;
530
+ _scrolledLeft = false;
531
+ _scrolledRight = false;
532
+ tableEl = null;
533
+ handleColumnsChange(newCols) {
534
+ if (Array.isArray(newCols) && (this.columnWidths ?? []).length === 0) {
535
+ this.columnWidths = newCols.map(c => parseInt(c.width || '120', 10));
536
+ }
537
+ }
538
+ componentWillLoad() {
539
+ this.syncTableContext();
540
+ this.columnWidths = Array.isArray(this.columnWidths) ? this.columnWidths : [];
541
+ this.resolveConfig();
542
+ if ((this.columnWidths ?? []).length === 0) {
543
+ this.columnWidths = this._columns.map(c => parseInt(c.width || '120', 10));
544
+ }
545
+ }
546
+ componentDidLoad() {
547
+ this.syncTableContext();
548
+ this.resolveConfig();
549
+ }
550
+ syncTableContext() {
551
+ // sd-table이 shadow:true이므로 fallback content로 렌더되면 closest가 경계를 못 넘는다.
552
+ // 그 경우 getRootNode().host(=sd-table)로 폴백한다.
553
+ const closest = this.el.closest('sd-table');
554
+ const root = this.el.getRootNode();
555
+ const fromShadow = root instanceof ShadowRoot ? root.host : null;
556
+ const table = closest ?? fromShadow;
557
+ this.tableEl = table;
558
+ const fromMethod = table?.getTableIdSync?.();
559
+ const fromAttr = table?.getAttribute(TABLE_ID_ATTR);
560
+ const resolvedTableId = (fromMethod && fromMethod !== 'undefined' ? fromMethod : null) ??
561
+ (fromAttr && fromAttr !== 'undefined' ? fromAttr : null) ??
562
+ '';
563
+ if (resolvedTableId && resolvedTableId !== this.tableId) {
564
+ this.tableId = resolvedTableId;
565
+ }
566
+ }
567
+ resolveConfig() {
568
+ const config = this.tableEl?.getConfigSync?.();
569
+ const resolvedColumns = Array.isArray(this.columns)
570
+ ? this.columns
571
+ : Array.isArray(config?.columns)
572
+ ? config.columns
573
+ : [];
574
+ this._columns = resolvedColumns;
575
+ this._selectable = this.selectable ?? config?.selectable ?? false;
576
+ this._resizable = this.resizable ?? config?.resizable ?? false;
577
+ this._stickyColumn = this.stickyColumn ?? config?.stickyColumn ?? { left: 0, right: 0 };
578
+ this._stickyHeader = this.stickyHeader ?? config?.stickyHeader ?? false;
579
+ this._scrolledLeft = this.scrolledLeft ?? config?.scrolledLeft ?? false;
580
+ this._scrolledRight = this.scrolledRight ?? config?.scrolledRight ?? false;
581
+ if (Array.isArray(config?.columnWidths) && (this.columnWidths ?? []).length === 0) {
582
+ this.columnWidths = [...config.columnWidths];
583
+ }
584
+ if (!Array.isArray(this.columnWidths)) {
585
+ this.columnWidths = [];
586
+ }
587
+ }
588
+ async refreshConfig() {
589
+ this.resolveConfig();
590
+ }
591
+ async setColumnWidths(widths) {
592
+ this.columnWidths = Array.isArray(widths) ? widths : [];
593
+ }
594
+ async refreshSelection() {
595
+ const checkbox = this.el.querySelector('sd-checkbox');
596
+ if (checkbox) {
597
+ checkbox.value = this.getIsAllChecked();
598
+ }
599
+ }
600
+ get visibleColumns() {
601
+ return this._columns.filter(col => col.visible !== false);
602
+ }
603
+ getStickyStyle(colIdx) {
604
+ if (this.tableEl?.getStickyStyleSync) {
605
+ return this.tableEl.getStickyStyleSync(colIdx);
606
+ }
607
+ const leftOffset = this.columnWidths.slice(0, colIdx).reduce((a, b) => a + b, 0) + (this._selectable ? 52 : 0);
608
+ const rightOffset = this.columnWidths
609
+ .filter((_, i) => i >= this.visibleColumns.length - (this._stickyColumn.right || 0) && i > colIdx)
610
+ .reduce((a, b) => a + b, 0);
611
+ return {
612
+ '--sticky-left-offset': `${leftOffset}px`,
613
+ '--sticky-right-offset': `${rightOffset}px`,
614
+ 'width': `${this.columnWidths[colIdx]}px`,
615
+ 'minWidth': `${this.columnWidths[colIdx]}px`,
616
+ 'maxWidth': `${this.columnWidths[colIdx]}px`,
617
+ };
618
+ }
619
+ handleResize(index, event, reversed = false) {
620
+ if (this.tableEl?.handleResize) {
621
+ this.tableEl.handleResize(index, event, reversed);
622
+ }
623
+ }
624
+ handleSelectAll(checked) {
625
+ const currentState = this.getIsAllChecked();
626
+ const nextChecked = currentState === null ? false : !!checked;
627
+ const safeRows = Array.isArray(this.rows) ? this.rows : [];
628
+ if (this.tableEl?.toggleSelectAllSync) {
629
+ this.tableEl.toggleSelectAllSync(nextChecked, safeRows);
630
+ }
631
+ }
632
+ getIsAllChecked() {
633
+ const safeRows = Array.isArray(this.rows) ? this.rows : [];
634
+ if (this.tableEl?.getIsAllCheckedSync && safeRows.length > 0) {
635
+ return this.tableEl.getIsAllCheckedSync(safeRows);
636
+ }
637
+ return false;
638
+ }
639
+ render() {
640
+ const safeRows = Array.isArray(this.rows) ? this.rows : [];
641
+ const stickyLeftCount = this._stickyColumn.left || 0;
642
+ const stickyRightCount = this._stickyColumn.right || 0;
643
+ const stickyLeftCols = this.visibleColumns.slice(0, stickyLeftCount);
644
+ const middleCols = this.visibleColumns.slice(stickyLeftCount, this.visibleColumns.length - stickyRightCount);
645
+ const stickyRightCols = this.visibleColumns.slice(this.visibleColumns.length - stickyRightCount);
646
+ return (h(Host, { key: '5aa1e38311b542d1a0b05b55abc7ef41927508bd', slot: `${this.tableId}-head` }, h("thead", { key: '6d17753988ecd02d900d8a3bd7f2115b534b68a7', class: {
647
+ 'thead': true,
648
+ 'thead--sticky': this._stickyHeader,
649
+ } }, h("tr", { key: '9cc729603e126da2f9c8923fe29ece10c7750bb4', class: "tr" }, this._selectable && (h("th", { key: '37b2bcfa77eaf4c44465684c49ae84d566acc18b', class: {
650
+ 'th': true,
651
+ 'th--selected': true,
652
+ 'sticky-left': true,
653
+ 'sticky-left-edge': stickyLeftCount === 0,
654
+ 'is-scrolled-left': stickyLeftCount === 0 && this._scrolledLeft,
655
+ }, style: { '--sticky-left-offset': '0px' } }, h("sd-checkbox", { key: '4284894821640ee1bdbd12b1759efb01e6c06488', value: this.getIsAllChecked(), disabled: !safeRows.length, onSdUpdate: (e) => this.handleSelectAll(e.detail) }))), stickyLeftCols.map((col, idx) => (h("th", { key: col.name, class: {
656
+ 'th': true,
657
+ [`${col.thClass}`]: Boolean(col.thClass),
658
+ 'sticky-left': true,
659
+ 'sticky-left-edge': idx === stickyLeftCount - 1,
660
+ 'is-scrolled-left': idx === stickyLeftCount - 1 && this._scrolledLeft,
661
+ }, style: { ...col.thStyle, ...this.getStickyStyle(idx) } }, h("div", { class: `th__content th__content--${col.align || 'left'}` }, h("div", { class: "th__content--label" }, col.label), col.usePageMoveIcon && h("sd-icon", { name: "pageMove", size: "12", color: "#006AC1" }), col.tooltip && (h("sd-tooltip", { ...col.tooltipOptions }, h("div", { slot: "content" }, col.tooltip.map(text => (h("p", null, text))))))), this._resizable && (h("div", { class: "th__resizer", onMouseDown: (evt) => this.handleResize(idx, evt) }))))), middleCols.map((col, relativeIdx) => {
662
+ const actualColIdx = stickyLeftCount + relativeIdx;
663
+ return (h("th", { key: col.name, class: {
664
+ th: true,
665
+ [`${col.thClass}`]: Boolean(col.thClass),
666
+ }, style: { ...col.thStyle, ...this.getStickyStyle(actualColIdx) } }, h("div", { class: `th__content th__content--${col.align || 'left'}` }, h("div", { class: "th__content--label" }, col.label), col.usePageMoveIcon && h("sd-icon", { name: "pageMove", size: "12", color: "#006AC1" }), col.tooltip && (h("sd-tooltip", { ...col.tooltipOptions }, h("div", { slot: "content" }, col.tooltip.map(text => (h("p", null, text))))))), this._resizable && (h("div", { class: "th__resizer", onMouseDown: (evt) => this.handleResize(actualColIdx, evt) }))));
667
+ }), stickyRightCols.map((col, relativeIdx) => {
668
+ const actualColIdx = this.visibleColumns.length - stickyRightCount + relativeIdx;
669
+ return (h("th", { key: col.name, class: {
670
+ 'th': true,
671
+ [`${col.thClass}`]: Boolean(col.thClass),
672
+ 'sticky-right': true,
673
+ 'sticky-right-edge': relativeIdx === 0,
674
+ 'is-scrolled-right': relativeIdx === 0 && this._scrolledRight,
675
+ }, style: { ...col.thStyle, ...this.getStickyStyle(actualColIdx) } }, h("div", { class: `th__content th__content--${col.align || 'left'}` }, h("div", { class: "th__content--label" }, col.label), col.usePageMoveIcon && h("sd-icon", { name: "pageMove", size: "12", color: "#006AC1" }), col.tooltip && (h("sd-tooltip", { ...col.tooltipOptions }, h("div", { slot: "content" }, col.tooltip.map(text => (h("p", null, text))))))), this._resizable && (h("div", { class: "th__resizer th__resizer--left", onMouseDown: (evt) => this.handleResize(actualColIdx, evt, true) }))));
676
+ })))));
677
+ }
678
+ static get watchers() { return {
679
+ "columns": [{
680
+ "handleColumnsChange": 0
681
+ }]
682
+ }; }
683
+ };
684
+ SdThead.style = sdTheadCss();
685
+
686
+ const sdTrCss = () => `sd-tr{display:contents}sd-tr *{box-sizing:border-box}.tr{display:table-row}.tr:hover .td{background-color:#F9F9F9}.tr--no-hover:hover .td{background-color:white}.td{display:table-cell;height:44px;padding:0 16px;border-bottom:1px solid #E1E1E1;background:white;vertical-align:middle;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all}.td--left{text-align:left}.td--center{text-align:center}.td--right{text-align:right}.td--selected{position:relative;width:52px !important;max-width:52px !important;min-width:52px !important;padding:0 10px 0 24px;text-align:left}.td--selected sd-checkbox label{position:relative}.td--selected sd-checkbox label:before{content:"";position:absolute;inset:-6px}.td.sticky-left{position:sticky;background-color:white;z-index:100 !important;left:var(--sticky-left-offset, 0)}.td.sticky-right{position:sticky;background-color:white;z-index:100 !important;right:var(--sticky-right-offset, 0)}.td.sticky-left-edge:after{content:"";position:absolute;top:0;left:100%;right:-20px;width:20px;height:100%;z-index:101 !important;box-shadow:inset 12px 0 20px -25px;opacity:0;pointer-events:none;transition:opacity 0.2s}.td.sticky-right-edge:after{content:"";position:absolute;top:0;left:-20px;width:20px;height:100%;z-index:101 !important;box-shadow:inset -12px 0 20px -25px;opacity:0;pointer-events:none;transition:opacity 0.2s}.td.sticky-left-edge.is-scrolled-left{overflow:visible}.td.sticky-left-edge.is-scrolled-left:after{opacity:1}.td.sticky-right-edge.is-scrolled-right{overflow:visible}.td.sticky-right-edge.is-scrolled-right:after{opacity:1}.tr:hover .td.sticky-left,.tr:hover .td.sticky-right{background-color:#F9F9F9}.tr--no-hover:hover .td.sticky-left,.tr--no-hover:hover .td.sticky-right{background-color:white}`;
687
+
688
+ const SdTr = class {
689
+ constructor(hostRef) {
690
+ registerInstance(this, hostRef);
691
+ }
692
+ get el() { return getElement(this); }
693
+ columns;
694
+ selectable;
695
+ stickyColumn;
696
+ rowKey = '';
697
+ row = {};
698
+ tableId = '';
699
+ columnWidths = [];
700
+ isVisible = true;
701
+ spansVersion = 0;
702
+ _columns = [];
703
+ _selectable = false;
704
+ _stickyColumn = { left: 0, right: 0 };
705
+ _scrolledLeft = false;
706
+ _scrolledRight = false;
707
+ tableEl = null;
708
+ componentWillLoad() {
709
+ this.syncTableContext();
710
+ this.columnWidths = this.columnWidths ?? [];
711
+ this.resolveConfig();
712
+ this.columnWidths = this._columns.map(c => parseInt(c.width || '120', 10));
713
+ this.updateVisibilitySync();
714
+ }
715
+ componentDidLoad() {
716
+ this.syncTableContext();
717
+ }
718
+ syncTableContext() {
719
+ // sd-table이 shadow:true이므로 fallback content로 렌더되면 closest가 경계를 못 넘는다.
720
+ // 그 경우 getRootNode().host(=sd-table)로 폴백한다.
721
+ const closest = this.el.closest('sd-table');
722
+ const root = this.el.getRootNode();
723
+ const fromShadow = root instanceof ShadowRoot ? root.host : null;
724
+ const table = closest ?? fromShadow;
725
+ this.tableEl = table;
726
+ const fromMethod = table?.getTableIdSync?.();
727
+ const fromAttr = table?.getAttribute(TABLE_ID_ATTR);
728
+ const resolvedTableId = (fromMethod && fromMethod !== 'undefined' ? fromMethod : null) ??
729
+ (fromAttr && fromAttr !== 'undefined' ? fromAttr : null) ??
730
+ '';
731
+ if (resolvedTableId && resolvedTableId !== this.tableId) {
732
+ this.tableId = resolvedTableId;
733
+ }
734
+ }
735
+ resolveConfig() {
736
+ const config = this.tableEl?.getConfigSync?.();
737
+ this._columns = this.columns ?? config?.columns ?? [];
738
+ this._selectable = this.selectable ?? config?.selectable ?? false;
739
+ this._stickyColumn = this.stickyColumn ?? config?.stickyColumn ?? { left: 0, right: 0 };
740
+ this._scrolledLeft = config?.scrolledLeft ?? false;
741
+ this._scrolledRight = config?.scrolledRight ?? false;
742
+ if (config?.columnWidths && (this.columnWidths ?? []).length === 0) {
743
+ this.columnWidths = [...config.columnWidths];
744
+ }
745
+ }
746
+ async refreshConfig() {
747
+ this.resolveConfig();
748
+ }
749
+ async bumpSpansVersion() {
750
+ this.spansVersion = this.spansVersion + 1;
751
+ }
752
+ async updateVisibility() {
753
+ this.updateVisibilitySync();
754
+ }
755
+ updateVisibilitySync() {
756
+ const rowIndex = parseInt(this.rowKey, 10);
757
+ const pageInfo = this.tableEl?.getPaginationInfoSync?.();
758
+ if (!pageInfo) {
759
+ this.isVisible = true;
760
+ return;
761
+ }
762
+ this.isVisible = rowIndex >= pageInfo.startIndex && rowIndex < pageInfo.endIndex;
763
+ }
764
+ async setColumnWidths(widths) {
765
+ this.columnWidths = widths;
766
+ }
767
+ async refreshSelection() {
768
+ const checkbox = this.el.querySelector('sd-checkbox');
769
+ if (checkbox) {
770
+ checkbox.value = this.isSelected();
771
+ }
772
+ }
773
+ get visibleColumns() {
774
+ return this._columns.filter(col => col.visible !== false);
775
+ }
776
+ formatValue(value) {
777
+ if (value === null || value === undefined) {
778
+ return '';
779
+ }
780
+ if (typeof value === 'number') {
781
+ return value.toLocaleString();
782
+ }
783
+ return String(value);
784
+ }
785
+ getCellValue(column) {
786
+ const { field, format, name } = column;
787
+ const value = typeof field === 'function' ? field(this.row) : field ? this.row[field] : this.row[name];
788
+ return format ? format(value, this.row) : this.formatValue(value);
789
+ }
790
+ getStickyStyle(colIdx) {
791
+ if (this.tableEl?.getStickyStyleSync) {
792
+ return this.tableEl.getStickyStyleSync(colIdx);
793
+ }
794
+ const leftOffset = this.columnWidths.slice(0, colIdx).reduce((a, b) => a + b, 0) + (this._selectable ? 52 : 0);
795
+ const rightOffset = this.columnWidths
796
+ .filter((_, i) => i >= this.visibleColumns.length - (this._stickyColumn.right || 0) && i > colIdx)
797
+ .reduce((a, b) => a + b, 0);
798
+ return {
799
+ '--sticky-left-offset': `${leftOffset}px`,
800
+ '--sticky-right-offset': `${rightOffset}px`,
801
+ 'width': `${this.columnWidths[colIdx]}px`,
802
+ 'minWidth': `${this.columnWidths[colIdx]}px`,
803
+ 'maxWidth': `${this.columnWidths[colIdx]}px`,
804
+ };
805
+ }
806
+ isSelected() {
807
+ if (this.tableEl?.isRowSelectedSync) {
808
+ return this.tableEl.isRowSelectedSync(this.row);
809
+ }
810
+ return false;
811
+ }
812
+ handleSelect() {
813
+ if (this.tableEl?.updateRowSelectSync) {
814
+ this.tableEl.updateRowSelectSync(this.row);
815
+ }
816
+ }
817
+ getSpanFor(col) {
818
+ if (!this.tableEl?.getSpanSync)
819
+ return undefined;
820
+ const fieldName = typeof col.field === 'string' ? col.field : col.name;
821
+ return this.tableEl.getSpanSync(this.rowKey, fieldName);
822
+ }
823
+ isCovered(colIdx) {
824
+ if (!this.tableEl?.isCoveredSync)
825
+ return false;
826
+ return this.tableEl.isCoveredSync(this.rowKey, colIdx, this._columns);
827
+ }
828
+ render() {
829
+ const stickyLeftCount = this._stickyColumn.left || 0;
830
+ const stickyRightCount = this._stickyColumn.right || 0;
831
+ const stickyLeftCols = this.visibleColumns.slice(0, stickyLeftCount);
832
+ const middleCols = this.visibleColumns.slice(stickyLeftCount, this.visibleColumns.length - stickyRightCount);
833
+ const stickyRightCols = this.visibleColumns.slice(this.visibleColumns.length - stickyRightCount);
834
+ const hasRowspan = this.tableEl?.hasRowspanSync?.() ?? false;
835
+ return (h(Host, { key: 'e8d387043d3384daffb5d548176b469a91264225', style: { display: this.isVisible ? '' : 'none' } }, h("tr", { key: '1d579819497a6186941b0c80c916a83c48dfcc0d', class: { 'tr': true, 'tr--no-hover': hasRowspan } }, this._selectable && (h("td", { key: '1a8ab44a8c65926eb9a7bd9e9224d0eed55ecfb1', class: {
836
+ 'td': true,
837
+ 'td--selected': true,
838
+ 'sticky-left': true,
839
+ 'sticky-left-edge': stickyLeftCount === 0,
840
+ 'is-scrolled-left': stickyLeftCount === 0 && this._scrolledLeft,
841
+ }, style: { '--sticky-left-offset': '0px' } }, h("sd-checkbox", { key: '72bdbadc76dcb0682eb4de496e9abda692a0ea7e', value: this.isSelected(), onSdUpdate: () => this.handleSelect() }))), stickyLeftCols.map((col, idx) => {
842
+ if (this.isCovered(idx))
843
+ return null;
844
+ const span = this.getSpanFor(col);
845
+ return (h("td", { key: col.name, rowSpan: span?.rowspan, colSpan: span?.colspan, class: {
846
+ 'td': true,
847
+ [`td--${col.align || 'left'}`]: true,
848
+ 'sticky-left': true,
849
+ 'sticky-left-edge': idx === stickyLeftCount - 1,
850
+ 'is-scrolled-left': idx === stickyLeftCount - 1 && this._scrolledLeft,
851
+ [`${col.tdClass}`]: Boolean(col.tdClass),
852
+ }, style: this.getStickyStyle(idx) }, h("slot", { name: `${this.tableId}-${typeof col.field === 'string' ? col.field : col.name}-${this.rowKey}` }, h("span", null, this.getCellValue(col)))));
853
+ }), middleCols.map((col, relativeIdx) => {
854
+ const actualColIdx = stickyLeftCount + relativeIdx;
855
+ if (this.isCovered(actualColIdx))
856
+ return null;
857
+ const fieldName = typeof col.field === 'string' ? col.field : col.name;
858
+ const span = this.getSpanFor(col);
859
+ return (h("td", { key: col.name, rowSpan: span?.rowspan, colSpan: span?.colspan, class: {
860
+ td: true,
861
+ [`td--${col.align || 'left'}`]: true,
862
+ [`${col.tdClass}`]: Boolean(col.tdClass),
863
+ }, style: this.getStickyStyle(actualColIdx) }, h("slot", { name: `${this.tableId}-${fieldName}-${this.rowKey}` }, h("span", null, this.getCellValue(col)))));
864
+ }), stickyRightCols.map((col, relativeIdx) => {
865
+ const actualColIdx = this.visibleColumns.length - stickyRightCount + relativeIdx;
866
+ if (this.isCovered(actualColIdx))
867
+ return null;
868
+ const fieldName = typeof col.field === 'string' ? col.field : col.name;
869
+ const span = this.getSpanFor(col);
870
+ return (h("td", { key: col.name, rowSpan: span?.rowspan, colSpan: span?.colspan, class: {
871
+ 'td': true,
872
+ [`td--${col.align || 'left'}`]: true,
873
+ 'sticky-right': true,
874
+ 'sticky-right-edge': relativeIdx === 0,
875
+ 'is-scrolled-right': relativeIdx === 0 && this._scrolledRight,
876
+ [`${col.tdClass}`]: Boolean(col.tdClass),
877
+ }, style: this.getStickyStyle(actualColIdx) }, h("slot", { name: `${this.tableId}-${fieldName}-${this.rowKey}` }, h("span", null, this.getCellValue(col)))));
878
+ }))));
879
+ }
880
+ };
881
+ SdTr.style = sdTrCss();
882
+
883
+ export { SdPagination as sd_pagination, SdSelectV2 as sd_select_v2, SdTbody as sd_tbody, SdThead as sd_thead, SdTr as sd_tr };