@sellmate/design-system-vue 1.0.17 → 1.0.19

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.
@@ -0,0 +1,241 @@
1
+ import { type PropType } from 'vue';
2
+ import type { Row as SdTableRow, SdTableColumn, SelectOption } from '@sellmate/design-system';
3
+ type TablePagination = {
4
+ page: number;
5
+ rowsPerPage: number;
6
+ lastPage?: number;
7
+ };
8
+ type TableVirtualScroll = {
9
+ vertical?: boolean;
10
+ horizontal?: boolean;
11
+ };
12
+ type TableVirtualBufferSize = {
13
+ vertical?: number;
14
+ horizontal?: number;
15
+ };
16
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
17
+ columns: {
18
+ type: PropType<SdTableColumn[]>;
19
+ required: true;
20
+ };
21
+ rows: {
22
+ type: PropType<SdTableRow[]>;
23
+ required: true;
24
+ };
25
+ modelValue: {
26
+ type: PropType<SdTableRow[]>;
27
+ default: any;
28
+ };
29
+ selected: {
30
+ type: PropType<SdTableRow[]>;
31
+ default: any;
32
+ };
33
+ rowKey: {
34
+ type: StringConstructor;
35
+ default: string;
36
+ };
37
+ selectable: {
38
+ type: BooleanConstructor;
39
+ default: boolean;
40
+ };
41
+ resizable: {
42
+ type: BooleanConstructor;
43
+ default: boolean;
44
+ };
45
+ width: {
46
+ type: StringConstructor;
47
+ default: any;
48
+ };
49
+ height: {
50
+ type: StringConstructor;
51
+ default: any;
52
+ };
53
+ stickyHeader: {
54
+ type: BooleanConstructor;
55
+ default: boolean;
56
+ };
57
+ stickyColumn: {
58
+ type: PropType<{
59
+ left?: number;
60
+ right?: number;
61
+ }>;
62
+ default: () => {
63
+ left: number;
64
+ right: number;
65
+ };
66
+ };
67
+ noDataLabel: {
68
+ type: StringConstructor;
69
+ default: string;
70
+ };
71
+ isLoading: {
72
+ type: BooleanConstructor;
73
+ default: boolean;
74
+ };
75
+ pagination: {
76
+ type: PropType<TablePagination | undefined>;
77
+ default: any;
78
+ };
79
+ useInternalPagination: {
80
+ type: BooleanConstructor;
81
+ default: boolean;
82
+ };
83
+ useRowsPerPageSelect: {
84
+ type: BooleanConstructor;
85
+ default: boolean;
86
+ };
87
+ rowsPerPageOption: {
88
+ type: PropType<SelectOption[]>;
89
+ default: () => {
90
+ label: string;
91
+ value: number;
92
+ }[];
93
+ };
94
+ useVirtualScroll: {
95
+ type: PropType<TableVirtualScroll>;
96
+ default: () => {};
97
+ };
98
+ virtualRowHeight: {
99
+ type: NumberConstructor;
100
+ default: number;
101
+ };
102
+ virtualColumnWidth: {
103
+ type: NumberConstructor;
104
+ default: number;
105
+ };
106
+ virtualBufferSize: {
107
+ type: PropType<TableVirtualBufferSize>;
108
+ default: () => {
109
+ vertical: number;
110
+ horizontal: number;
111
+ };
112
+ };
113
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
114
+ [key: string]: any;
115
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "sdSelectChange" | "sdPageChange" | "sdRowsPerPageChange")[], "update:modelValue" | "sdSelectChange" | "sdPageChange" | "sdRowsPerPageChange", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
116
+ columns: {
117
+ type: PropType<SdTableColumn[]>;
118
+ required: true;
119
+ };
120
+ rows: {
121
+ type: PropType<SdTableRow[]>;
122
+ required: true;
123
+ };
124
+ modelValue: {
125
+ type: PropType<SdTableRow[]>;
126
+ default: any;
127
+ };
128
+ selected: {
129
+ type: PropType<SdTableRow[]>;
130
+ default: any;
131
+ };
132
+ rowKey: {
133
+ type: StringConstructor;
134
+ default: string;
135
+ };
136
+ selectable: {
137
+ type: BooleanConstructor;
138
+ default: boolean;
139
+ };
140
+ resizable: {
141
+ type: BooleanConstructor;
142
+ default: boolean;
143
+ };
144
+ width: {
145
+ type: StringConstructor;
146
+ default: any;
147
+ };
148
+ height: {
149
+ type: StringConstructor;
150
+ default: any;
151
+ };
152
+ stickyHeader: {
153
+ type: BooleanConstructor;
154
+ default: boolean;
155
+ };
156
+ stickyColumn: {
157
+ type: PropType<{
158
+ left?: number;
159
+ right?: number;
160
+ }>;
161
+ default: () => {
162
+ left: number;
163
+ right: number;
164
+ };
165
+ };
166
+ noDataLabel: {
167
+ type: StringConstructor;
168
+ default: string;
169
+ };
170
+ isLoading: {
171
+ type: BooleanConstructor;
172
+ default: boolean;
173
+ };
174
+ pagination: {
175
+ type: PropType<TablePagination | undefined>;
176
+ default: any;
177
+ };
178
+ useInternalPagination: {
179
+ type: BooleanConstructor;
180
+ default: boolean;
181
+ };
182
+ useRowsPerPageSelect: {
183
+ type: BooleanConstructor;
184
+ default: boolean;
185
+ };
186
+ rowsPerPageOption: {
187
+ type: PropType<SelectOption[]>;
188
+ default: () => {
189
+ label: string;
190
+ value: number;
191
+ }[];
192
+ };
193
+ useVirtualScroll: {
194
+ type: PropType<TableVirtualScroll>;
195
+ default: () => {};
196
+ };
197
+ virtualRowHeight: {
198
+ type: NumberConstructor;
199
+ default: number;
200
+ };
201
+ virtualColumnWidth: {
202
+ type: NumberConstructor;
203
+ default: number;
204
+ };
205
+ virtualBufferSize: {
206
+ type: PropType<TableVirtualBufferSize>;
207
+ default: () => {
208
+ vertical: number;
209
+ horizontal: number;
210
+ };
211
+ };
212
+ }>> & Readonly<{
213
+ "onUpdate:modelValue"?: (...args: any[]) => any;
214
+ onSdSelectChange?: (...args: any[]) => any;
215
+ onSdPageChange?: (...args: any[]) => any;
216
+ onSdRowsPerPageChange?: (...args: any[]) => any;
217
+ }>, {
218
+ modelValue: SdTableRow[];
219
+ selected: SdTableRow[];
220
+ rowKey: string;
221
+ selectable: boolean;
222
+ resizable: boolean;
223
+ width: string;
224
+ height: string;
225
+ stickyHeader: boolean;
226
+ stickyColumn: {
227
+ left?: number;
228
+ right?: number;
229
+ };
230
+ noDataLabel: string;
231
+ isLoading: boolean;
232
+ pagination: TablePagination;
233
+ useInternalPagination: boolean;
234
+ useRowsPerPageSelect: boolean;
235
+ rowsPerPageOption: SelectOption[];
236
+ useVirtualScroll: TableVirtualScroll;
237
+ virtualRowHeight: number;
238
+ virtualColumnWidth: number;
239
+ virtualBufferSize: TableVirtualBufferSize;
240
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
241
+ export default _default;
@@ -0,0 +1,191 @@
1
+ import { computed, defineComponent, h, ref, useAttrs, useSlots, watch, } from 'vue';
2
+ const SLOT_WRAPPER_STYLE = {
3
+ display: 'contents',
4
+ };
5
+ const getCellValue = (column, row) => {
6
+ const { field, format, name } = column;
7
+ const value = typeof field === 'function' ? field(row) : field ? row[field] : row[name];
8
+ return format ? format(value, row) : value;
9
+ };
10
+ export default defineComponent({
11
+ name: 'SdTable',
12
+ inheritAttrs: false,
13
+ props: {
14
+ columns: {
15
+ type: Array,
16
+ required: true,
17
+ },
18
+ rows: {
19
+ type: Array,
20
+ required: true,
21
+ },
22
+ modelValue: {
23
+ type: Array,
24
+ default: undefined,
25
+ },
26
+ selected: {
27
+ type: Array,
28
+ default: undefined,
29
+ },
30
+ rowKey: {
31
+ type: String,
32
+ default: 'id',
33
+ },
34
+ selectable: {
35
+ type: Boolean,
36
+ default: false,
37
+ },
38
+ resizable: {
39
+ type: Boolean,
40
+ default: false,
41
+ },
42
+ width: {
43
+ type: String,
44
+ default: undefined,
45
+ },
46
+ height: {
47
+ type: String,
48
+ default: undefined,
49
+ },
50
+ stickyHeader: {
51
+ type: Boolean,
52
+ default: false,
53
+ },
54
+ stickyColumn: {
55
+ type: Object,
56
+ default: () => ({ left: 0, right: 0 }),
57
+ },
58
+ noDataLabel: {
59
+ type: String,
60
+ default: '데이터가 없습니다.',
61
+ },
62
+ isLoading: {
63
+ type: Boolean,
64
+ default: false,
65
+ },
66
+ pagination: {
67
+ type: Object,
68
+ default: undefined,
69
+ },
70
+ useInternalPagination: {
71
+ type: Boolean,
72
+ default: false,
73
+ },
74
+ useRowsPerPageSelect: {
75
+ type: Boolean,
76
+ default: false,
77
+ },
78
+ rowsPerPageOption: {
79
+ type: Array,
80
+ default: () => [
81
+ { label: '10개씩 보기', value: 10 },
82
+ { label: '25개씩 보기', value: 25 },
83
+ { label: '50개씩 보기', value: 50 },
84
+ { label: '100개씩 보기', value: 100 },
85
+ ],
86
+ },
87
+ useVirtualScroll: {
88
+ type: Object,
89
+ default: () => ({}),
90
+ },
91
+ virtualRowHeight: {
92
+ type: Number,
93
+ default: 44,
94
+ },
95
+ virtualColumnWidth: {
96
+ type: Number,
97
+ default: 120,
98
+ },
99
+ virtualBufferSize: {
100
+ type: Object,
101
+ default: () => ({
102
+ vertical: 5,
103
+ horizontal: 5,
104
+ }),
105
+ },
106
+ },
107
+ emits: ['update:modelValue', 'sdSelectChange', 'sdPageChange', 'sdRowsPerPageChange'],
108
+ setup(props, { emit }) {
109
+ const attrs = useAttrs();
110
+ const slots = useSlots();
111
+ const normalizedRows = computed(() => props.rows ?? []);
112
+ const currentPage = ref(props.pagination?.page || 1);
113
+ const currentRowsPerPage = ref(props.pagination?.rowsPerPage || normalizedRows.value.length || 0);
114
+ watch(() => props.pagination, pagination => {
115
+ currentPage.value = pagination?.page || 1;
116
+ currentRowsPerPage.value = pagination?.rowsPerPage || normalizedRows.value.length || 0;
117
+ }, { immediate: true, deep: true });
118
+ watch(() => normalizedRows.value.length, rowLength => {
119
+ if (!currentRowsPerPage.value) {
120
+ currentRowsPerPage.value = rowLength;
121
+ }
122
+ });
123
+ const renderedRows = computed(() => {
124
+ if (!props.useInternalPagination || !currentRowsPerPage.value) {
125
+ return normalizedRows.value;
126
+ }
127
+ const startIndex = (currentPage.value - 1) * currentRowsPerPage.value;
128
+ return normalizedRows.value.slice(startIndex, startIndex + currentRowsPerPage.value);
129
+ });
130
+ return () => {
131
+ const slotChildren = [];
132
+ const noDataSlot = slots['no-data'];
133
+ if (noDataSlot) {
134
+ slotChildren.push(h('span', {
135
+ key: 'no-data',
136
+ slot: 'no-data',
137
+ style: SLOT_WRAPPER_STYLE,
138
+ }, noDataSlot()));
139
+ }
140
+ props.columns.forEach(column => {
141
+ const headerSlot = slots[`header-${column.name}`] || slots.header;
142
+ if (headerSlot) {
143
+ slotChildren.push(h('span', {
144
+ key: `header-${column.name}`,
145
+ slot: `header-cell-${column.name}`,
146
+ style: SLOT_WRAPPER_STYLE,
147
+ }, headerSlot({ column })));
148
+ }
149
+ });
150
+ renderedRows.value.forEach((row, rowIndex) => {
151
+ props.columns.forEach(column => {
152
+ const cellSlot = slots[`cell-${column.name}`] || slots.cell;
153
+ if (!cellSlot)
154
+ return;
155
+ slotChildren.push(h('span', {
156
+ key: `cell-${column.name}-${rowIndex}`,
157
+ slot: `body-cell-${column.name}-${rowIndex}`,
158
+ style: SLOT_WRAPPER_STYLE,
159
+ }, cellSlot({
160
+ column,
161
+ row,
162
+ rowIndex,
163
+ value: getCellValue(column, row),
164
+ })));
165
+ });
166
+ });
167
+ return h('sd-table', {
168
+ ...attrs,
169
+ ...props,
170
+ rows: normalizedRows.value,
171
+ selected: props.modelValue ?? props.selected,
172
+ onSdSelectChange: (event) => {
173
+ emit('update:modelValue', event.detail);
174
+ emit('sdSelectChange', event);
175
+ },
176
+ onSdPageChange: (event) => {
177
+ currentPage.value = event.detail;
178
+ emit('sdPageChange', event);
179
+ },
180
+ onSdRowsPerPageChange: (event) => {
181
+ currentRowsPerPage.value = event.detail;
182
+ const lastPage = Math.max(1, Math.ceil(normalizedRows.value.length / event.detail));
183
+ currentPage.value = Math.min(currentPage.value, lastPage);
184
+ emit('sdRowsPerPageChange', event);
185
+ },
186
+ }, {
187
+ default: () => slotChildren,
188
+ });
189
+ };
190
+ },
191
+ });
@@ -31,7 +31,6 @@ export declare const SdSelectMultipleGroup: StencilVueComponent<JSX.SdSelectMult
31
31
  export declare const SdSelectOption: StencilVueComponent<JSX.SdSelectOption>;
32
32
  export declare const SdSelectOptionGroup: StencilVueComponent<JSX.SdSelectOptionGroup>;
33
33
  export declare const SdSelectSearchInput: StencilVueComponent<JSX.SdSelectSearchInput>;
34
- export declare const SdTable: StencilVueComponent<JSX.SdTable, JSX.SdTable["selected"]>;
35
34
  export declare const SdTabs: StencilVueComponent<JSX.SdTabs, JSX.SdTabs["value"]>;
36
35
  export declare const SdTag: StencilVueComponent<JSX.SdTag>;
37
36
  export declare const SdTextarea: StencilVueComponent<JSX.SdTextarea, JSX.SdTextarea["value"]>;
@@ -19,11 +19,14 @@ export const SdButton = /*@__PURE__*/ defineContainer('sd-button', undefined, [
19
19
  'iconSize',
20
20
  'iconRight',
21
21
  'noHover',
22
- 'class'
22
+ 'sdClass',
23
+ 'sdClick'
24
+ ], [
25
+ 'sdClick'
23
26
  ]);
24
27
  export const SdCard = /*@__PURE__*/ defineContainer('sd-card', undefined, [
25
28
  'bordered',
26
- 'cardClassName'
29
+ 'sdClass'
27
30
  ]);
28
31
  export const SdCheckbox = /*@__PURE__*/ defineContainer('sd-checkbox', undefined, [
29
32
  'value',
@@ -171,7 +174,7 @@ export const SdModalCard = /*@__PURE__*/ defineContainer('sd-modal-card', undefi
171
174
  'buttonFlexDirection',
172
175
  'buttonProps',
173
176
  'message',
174
- 'modalClass',
177
+ 'sdClass',
175
178
  'sdClose',
176
179
  'sdConfirm'
177
180
  ], [
@@ -338,7 +341,6 @@ export const SdSelectMultiple = /*@__PURE__*/ defineContainer('sd-select-multipl
338
341
  'useLabelRequired',
339
342
  'labelTooltip',
340
343
  'labelTooltipProps',
341
- 'name',
342
344
  'rules',
343
345
  'error',
344
346
  'optionRenderer',
@@ -366,7 +368,6 @@ export const SdSelectMultipleGroup = /*@__PURE__*/ defineContainer('sd-select-mu
366
368
  'useLabelRequired',
367
369
  'labelTooltip',
368
370
  'labelTooltipProps',
369
- 'name',
370
371
  'rules',
371
372
  'error',
372
373
  'containerStyle',
@@ -416,37 +417,6 @@ export const SdSelectSearchInput = /*@__PURE__*/ defineContainer('sd-select-sear
416
417
  'sdSearchInput',
417
418
  'sdSearchFocus'
418
419
  ]);
419
- export const SdTable = /*@__PURE__*/ defineContainer('sd-table', undefined, [
420
- 'columns',
421
- 'rows',
422
- 'selected',
423
- 'rowKey',
424
- 'selectable',
425
- 'resizable',
426
- 'width',
427
- 'height',
428
- 'stickyHeader',
429
- 'stickyColumn',
430
- 'noDataLabel',
431
- 'isLoading',
432
- 'pagination',
433
- 'headerCellRenderer',
434
- 'bodyCellRenderer',
435
- 'useInternalPagination',
436
- 'useRowsPerPageSelect',
437
- 'rowsPerPageOption',
438
- 'useVirtualScroll',
439
- 'virtualRowHeight',
440
- 'virtualColumnWidth',
441
- 'virtualBufferSize',
442
- 'sdSelectChange',
443
- 'sdPageChange',
444
- 'sdRowsPerPageChange'
445
- ], [
446
- 'sdSelectChange',
447
- 'sdPageChange',
448
- 'sdRowsPerPageChange'
449
- ], 'selected', 'sdSelectChange', undefined);
450
420
  export const SdTabs = /*@__PURE__*/ defineContainer('sd-tabs', undefined, [
451
421
  'value',
452
422
  'tabs',
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './components';
2
2
  export * from './plugin';
3
+ export { default as SdTable } from './SdTable';
3
4
  export type { SdTableSortDir, SdTableColumn, Row as SdTableRow, SelectOption, SelectOptionGroup, SelectEvents, SelectMultipleEvents, SelectStyleProps, RadioValue, RadioOption, ButtonVariant, ButtonSize, Rule, ValidatableField, SdModalCardButtonProps, SdTooltipProps, TagColor, TagSize, ToastType, CheckedType, Type as DateBoxType, TabOption, } from '@sellmate/design-system';
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './components';
2
2
  export * from './plugin';
3
+ export { default as SdTable } from './SdTable';
package/lib/SdTable.ts ADDED
@@ -0,0 +1,260 @@
1
+ import {
2
+ computed,
3
+ defineComponent,
4
+ h,
5
+ ref,
6
+ useAttrs,
7
+ useSlots,
8
+ watch,
9
+ type PropType,
10
+ } from 'vue';
11
+ import type { Row as SdTableRow, SdTableColumn, SelectOption } from '@sellmate/design-system';
12
+
13
+ type TablePagination = {
14
+ page: number;
15
+ rowsPerPage: number;
16
+ lastPage?: number;
17
+ };
18
+
19
+ type TableVirtualScroll = {
20
+ vertical?: boolean;
21
+ horizontal?: boolean;
22
+ };
23
+
24
+ type TableVirtualBufferSize = {
25
+ vertical?: number;
26
+ horizontal?: number;
27
+ };
28
+
29
+ const SLOT_WRAPPER_STYLE = {
30
+ display: 'contents',
31
+ };
32
+
33
+ const getCellValue = (column: SdTableColumn, row: SdTableRow) => {
34
+ const { field, format, name } = column;
35
+ const value = typeof field === 'function' ? field(row) : field ? row[field] : row[name];
36
+ return format ? format(value, row) : value;
37
+ };
38
+
39
+ export default defineComponent({
40
+ name: 'SdTable',
41
+ inheritAttrs: false,
42
+ props: {
43
+ columns: {
44
+ type: Array as PropType<SdTableColumn[]>,
45
+ required: true,
46
+ },
47
+ rows: {
48
+ type: Array as PropType<SdTableRow[]>,
49
+ required: true,
50
+ },
51
+ modelValue: {
52
+ type: Array as PropType<SdTableRow[]>,
53
+ default: undefined,
54
+ },
55
+ selected: {
56
+ type: Array as PropType<SdTableRow[]>,
57
+ default: undefined,
58
+ },
59
+ rowKey: {
60
+ type: String,
61
+ default: 'id',
62
+ },
63
+ selectable: {
64
+ type: Boolean,
65
+ default: false,
66
+ },
67
+ resizable: {
68
+ type: Boolean,
69
+ default: false,
70
+ },
71
+ width: {
72
+ type: String,
73
+ default: undefined,
74
+ },
75
+ height: {
76
+ type: String,
77
+ default: undefined,
78
+ },
79
+ stickyHeader: {
80
+ type: Boolean,
81
+ default: false,
82
+ },
83
+ stickyColumn: {
84
+ type: Object as PropType<{ left?: number; right?: number }>,
85
+ default: () => ({ left: 0, right: 0 }),
86
+ },
87
+ noDataLabel: {
88
+ type: String,
89
+ default: '데이터가 없습니다.',
90
+ },
91
+ isLoading: {
92
+ type: Boolean,
93
+ default: false,
94
+ },
95
+ pagination: {
96
+ type: Object as PropType<TablePagination | undefined>,
97
+ default: undefined,
98
+ },
99
+ useInternalPagination: {
100
+ type: Boolean,
101
+ default: false,
102
+ },
103
+ useRowsPerPageSelect: {
104
+ type: Boolean,
105
+ default: false,
106
+ },
107
+ rowsPerPageOption: {
108
+ type: Array as PropType<SelectOption[]>,
109
+ default: () => [
110
+ { label: '10개씩 보기', value: 10 },
111
+ { label: '25개씩 보기', value: 25 },
112
+ { label: '50개씩 보기', value: 50 },
113
+ { label: '100개씩 보기', value: 100 },
114
+ ],
115
+ },
116
+ useVirtualScroll: {
117
+ type: Object as PropType<TableVirtualScroll>,
118
+ default: () => ({}),
119
+ },
120
+ virtualRowHeight: {
121
+ type: Number,
122
+ default: 44,
123
+ },
124
+ virtualColumnWidth: {
125
+ type: Number,
126
+ default: 120,
127
+ },
128
+ virtualBufferSize: {
129
+ type: Object as PropType<TableVirtualBufferSize>,
130
+ default: () => ({
131
+ vertical: 5,
132
+ horizontal: 5,
133
+ }),
134
+ },
135
+ },
136
+ emits: ['update:modelValue', 'sdSelectChange', 'sdPageChange', 'sdRowsPerPageChange'],
137
+ setup(props, { emit }) {
138
+ const attrs = useAttrs();
139
+ const slots = useSlots();
140
+ const normalizedRows = computed(() => props.rows ?? []);
141
+ const currentPage = ref(props.pagination?.page || 1);
142
+ const currentRowsPerPage = ref(props.pagination?.rowsPerPage || normalizedRows.value.length || 0);
143
+
144
+ watch(
145
+ () => props.pagination,
146
+ pagination => {
147
+ currentPage.value = pagination?.page || 1;
148
+ currentRowsPerPage.value = pagination?.rowsPerPage || normalizedRows.value.length || 0;
149
+ },
150
+ { immediate: true, deep: true },
151
+ );
152
+
153
+ watch(
154
+ () => normalizedRows.value.length,
155
+ rowLength => {
156
+ if (!currentRowsPerPage.value) {
157
+ currentRowsPerPage.value = rowLength;
158
+ }
159
+ },
160
+ );
161
+
162
+ const renderedRows = computed(() => {
163
+ if (!props.useInternalPagination || !currentRowsPerPage.value) {
164
+ return normalizedRows.value;
165
+ }
166
+
167
+ const startIndex = (currentPage.value - 1) * currentRowsPerPage.value;
168
+ return normalizedRows.value.slice(startIndex, startIndex + currentRowsPerPage.value);
169
+ });
170
+
171
+ return () => {
172
+ const slotChildren = [];
173
+
174
+ const noDataSlot = slots['no-data'];
175
+ if (noDataSlot) {
176
+ slotChildren.push(
177
+ h(
178
+ 'span',
179
+ {
180
+ key: 'no-data',
181
+ slot: 'no-data',
182
+ style: SLOT_WRAPPER_STYLE,
183
+ },
184
+ noDataSlot(),
185
+ ),
186
+ );
187
+ }
188
+
189
+ props.columns.forEach(column => {
190
+ const headerSlot = slots[`header-${column.name}`] || slots.header;
191
+
192
+ if (headerSlot) {
193
+ slotChildren.push(
194
+ h(
195
+ 'span',
196
+ {
197
+ key: `header-${column.name}`,
198
+ slot: `header-cell-${column.name}`,
199
+ style: SLOT_WRAPPER_STYLE,
200
+ },
201
+ headerSlot({ column }),
202
+ ),
203
+ );
204
+ }
205
+ });
206
+
207
+ renderedRows.value.forEach((row, rowIndex) => {
208
+ props.columns.forEach(column => {
209
+ const cellSlot = slots[`cell-${column.name}`] || slots.cell;
210
+
211
+ if (!cellSlot) return;
212
+
213
+ slotChildren.push(
214
+ h(
215
+ 'span',
216
+ {
217
+ key: `cell-${column.name}-${rowIndex}`,
218
+ slot: `body-cell-${column.name}-${rowIndex}`,
219
+ style: SLOT_WRAPPER_STYLE,
220
+ },
221
+ cellSlot({
222
+ column,
223
+ row,
224
+ rowIndex,
225
+ value: getCellValue(column, row),
226
+ }),
227
+ ),
228
+ );
229
+ });
230
+ });
231
+
232
+ return h(
233
+ 'sd-table',
234
+ {
235
+ ...attrs,
236
+ ...props,
237
+ rows: normalizedRows.value,
238
+ selected: props.modelValue ?? props.selected,
239
+ onSdSelectChange: (event: CustomEvent<SdTableRow[]>) => {
240
+ emit('update:modelValue', event.detail);
241
+ emit('sdSelectChange', event);
242
+ },
243
+ onSdPageChange: (event: CustomEvent<number>) => {
244
+ currentPage.value = event.detail;
245
+ emit('sdPageChange', event);
246
+ },
247
+ onSdRowsPerPageChange: (event: CustomEvent<number>) => {
248
+ currentRowsPerPage.value = event.detail;
249
+ const lastPage = Math.max(1, Math.ceil(normalizedRows.value.length / event.detail));
250
+ currentPage.value = Math.min(currentPage.value, lastPage);
251
+ emit('sdRowsPerPageChange', event);
252
+ },
253
+ },
254
+ {
255
+ default: () => slotChildren,
256
+ },
257
+ );
258
+ };
259
+ },
260
+ });
package/lib/components.ts CHANGED
@@ -27,13 +27,16 @@ export const SdButton: StencilVueComponent<JSX.SdButton> = /*@__PURE__*/ defineC
27
27
  'iconSize',
28
28
  'iconRight',
29
29
  'noHover',
30
- 'class'
30
+ 'sdClass',
31
+ 'sdClick'
32
+ ], [
33
+ 'sdClick'
31
34
  ]);
32
35
 
33
36
 
34
37
  export const SdCard: StencilVueComponent<JSX.SdCard> = /*@__PURE__*/ defineContainer<JSX.SdCard>('sd-card', undefined, [
35
38
  'bordered',
36
- 'cardClassName'
39
+ 'sdClass'
37
40
  ]);
38
41
 
39
42
 
@@ -212,7 +215,7 @@ export const SdModalCard: StencilVueComponent<JSX.SdModalCard> = /*@__PURE__*/ d
212
215
  'buttonFlexDirection',
213
216
  'buttonProps',
214
217
  'message',
215
- 'modalClass',
218
+ 'sdClass',
216
219
  'sdClose',
217
220
  'sdConfirm'
218
221
  ], [
@@ -407,7 +410,6 @@ export const SdSelectMultiple: StencilVueComponent<JSX.SdSelectMultiple, JSX.SdS
407
410
  'useLabelRequired',
408
411
  'labelTooltip',
409
412
  'labelTooltipProps',
410
- 'name',
411
413
  'rules',
412
414
  'error',
413
415
  'optionRenderer',
@@ -438,7 +440,6 @@ export const SdSelectMultipleGroup: StencilVueComponent<JSX.SdSelectMultipleGrou
438
440
  'useLabelRequired',
439
441
  'labelTooltip',
440
442
  'labelTooltipProps',
441
- 'name',
442
443
  'rules',
443
444
  'error',
444
445
  'containerStyle',
@@ -497,40 +498,6 @@ export const SdSelectSearchInput: StencilVueComponent<JSX.SdSelectSearchInput> =
497
498
  ]);
498
499
 
499
500
 
500
- export const SdTable: StencilVueComponent<JSX.SdTable, JSX.SdTable["selected"]> = /*@__PURE__*/ defineContainer<JSX.SdTable, JSX.SdTable["selected"]>('sd-table', undefined, [
501
- 'columns',
502
- 'rows',
503
- 'selected',
504
- 'rowKey',
505
- 'selectable',
506
- 'resizable',
507
- 'width',
508
- 'height',
509
- 'stickyHeader',
510
- 'stickyColumn',
511
- 'noDataLabel',
512
- 'isLoading',
513
- 'pagination',
514
- 'headerCellRenderer',
515
- 'bodyCellRenderer',
516
- 'useInternalPagination',
517
- 'useRowsPerPageSelect',
518
- 'rowsPerPageOption',
519
- 'useVirtualScroll',
520
- 'virtualRowHeight',
521
- 'virtualColumnWidth',
522
- 'virtualBufferSize',
523
- 'sdSelectChange',
524
- 'sdPageChange',
525
- 'sdRowsPerPageChange'
526
- ], [
527
- 'sdSelectChange',
528
- 'sdPageChange',
529
- 'sdRowsPerPageChange'
530
- ],
531
- 'selected', 'sdSelectChange', undefined);
532
-
533
-
534
501
  export const SdTabs: StencilVueComponent<JSX.SdTabs, JSX.SdTabs["value"]> = /*@__PURE__*/ defineContainer<JSX.SdTabs, JSX.SdTabs["value"]>('sd-tabs', undefined, [
535
502
  'value',
536
503
  'tabs',
@@ -573,7 +540,7 @@ export const SdTextarea: StencilVueComponent<JSX.SdTextarea, JSX.SdTextarea["val
573
540
  'value', 'sdUpdate', undefined);
574
541
 
575
542
 
576
- export const SdToastMessage: StencilVueComponent<JSX.SdToastMessage> = /*@__PURE__*/ defineContainer<JSX.SdToastMessage>('sd-toast-message', undefined, [
543
+ export const SdToast: StencilVueComponent<JSX.SdToast> = /*@__PURE__*/ defineContainer<JSX.SdToast>('sd-toast', undefined, [
577
544
  'icon',
578
545
  'message',
579
546
  'link',
package/lib/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './components';
2
2
  export * from './plugin';
3
+ export { default as SdTable } from './SdTable';
3
4
 
4
5
  // Export commonly used types for Vue usage
5
6
  export type {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sellmate/design-system-vue",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "description": "Design System - Vue Component Wrappers",
5
5
  "keywords": [
6
6
  "vue",
@@ -45,7 +45,7 @@
45
45
  "vue": "^3.4.38"
46
46
  },
47
47
  "dependencies": {
48
- "@sellmate/design-system": "^1.0.16",
48
+ "@sellmate/design-system": "^1.0.18",
49
49
  "@stencil/vue-output-target": "^0.11.8"
50
50
  },
51
51
  "peerDependencies": {