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