webcake-ui-kit 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webcake-ui-kit",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "UI Kit for Vue 2 && 3 - Pure Options API",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -97,7 +97,15 @@
97
97
  />
98
98
  </slot>
99
99
  <slot v-if="showEmpty" name="empty">
100
- <Empty description="No data" />
100
+ <Empty description="No data">
101
+ <template #media>
102
+ <div class="select-empty">
103
+ <img
104
+ src="https://content.pancake.vn/web-media-262/2e/2a/0c/96/c2b58ae9f06c4dc2a3b83016e56d5b4132ff40637862ba23435e43a0-w:224-h:224-l:3927-t:image/png.png"
105
+ />
106
+ </div>
107
+ </template>
108
+ </Empty>
101
109
  </slot>
102
110
  </div>
103
111
  </Menu>
@@ -138,7 +146,7 @@ export default {
138
146
  optionSize: {
139
147
  type: String,
140
148
  default: 'md',
141
- validator: v => ['xs', 'md', 'lg'].indexOf(v) !== -1
149
+ validator: v => ['sm', 'md', 'lg'].indexOf(v) !== -1
142
150
  },
143
151
  value: {
144
152
  type: [String, Array],
@@ -213,8 +213,9 @@
213
213
  font-size: 14px;
214
214
  }
215
215
 
216
- .ui-select--multiple.ui-select--xs .ui-select__search::placeholder {
217
- font-size: 12px;
216
+ .ui-select--xs .ui-select__search::placeholder {
217
+ font-size: var(--paragraph-mini-font-size);
218
+ line-height: var(--paragraph-mini-line-height);
218
219
  }
219
220
 
220
221
  .ui-select__search--single {
@@ -247,6 +248,13 @@
247
248
  border-radius: 3px;
248
249
  }
249
250
 
250
- .ui-select__empty {
251
- padding: var(--spacing-sm) var(--spacing-xs);
251
+ .ui-select__list ::v-deep .select-empty {
252
+ height: 100px;
253
+ width: 100px;
254
+ }
255
+
256
+ .ui-select__list ::v-deep .select-empty img {
257
+ width: 100%;
258
+ height: 100%;
259
+ object-fit: cover;
252
260
  }
@@ -15,13 +15,13 @@
15
15
  :aria-disabled="isDisabled ? 'true' : null"
16
16
  @click="handleClick"
17
17
  >
18
- <span v-if="$slots.prefix" class="ui-select-option__prefix">
18
+ <span v-if="hasPrefix" class="ui-select-option__prefix">
19
19
  <slot name="prefix" />
20
20
  </span>
21
21
  <span class="ui-select-option--label">
22
22
  <slot>{{ label || value }}</slot>
23
23
  </span>
24
- <span v-if="$slots.suffix" class="ui-select-option__suffix">
24
+ <span v-if="hasSuffix" class="ui-select-option__suffix">
25
25
  <slot name="suffix" />
26
26
  </span>
27
27
  <WkiCheck v-if="isSelected && isMultiMode" :size="16" color="var(--muted-fg)" />
@@ -100,6 +100,12 @@ export default {
100
100
  // explicit prop wins; otherwise inherit from parent Select; else regular
101
101
  return this.size || (this.select && (this.select.optionSize || this.select.size)) || 'md'
102
102
  },
103
+ hasPrefix() {
104
+ return !!((this.$scopedSlots && this.$scopedSlots.prefix) || this.$slots.prefix)
105
+ },
106
+ hasSuffix() {
107
+ return !!((this.$scopedSlots && this.$scopedSlots.suffix) || this.$slots.suffix)
108
+ },
103
109
  isHidden() {
104
110
  if (!this.select || !this.select.filterText) return false
105
111
  var q = this.select.filterText.toLowerCase()
@@ -6,6 +6,9 @@
6
6
  <template #bodyCell="slotData">
7
7
  <slot name="bodyCell" v-bind="slotData"></slot>
8
8
  </template>
9
+ <template #empty>
10
+ <slot name="empty"></slot>
11
+ </template>
9
12
  </TableWrapper>
10
13
  </TableResizeObserver>
11
14
  </TableLoading>
@@ -19,7 +22,6 @@ import { sortData } from './composables/useSorter.js'
19
22
  import { computeOffsets } from './composables/useSticky.js'
20
23
  import { SELECTION_COLUMN, DRAGGABLE_COLUMN } from './constants.js'
21
24
  import TableWrapper from './TableWrapper.vue'
22
- import TableEmpty from './TableEmpty.vue'
23
25
  import TableLoading from './TableLoading.vue'
24
26
  import TableResizeObserver from './TableResizeObserver.vue'
25
27
 
@@ -57,7 +59,8 @@ export default {
57
59
  enableFixedLeft: { type: Boolean, default: false },
58
60
  rowHeight: { type: Number, default: 36 },
59
61
  headerHeight: { type: Number, default: 50 },
60
- emptyText: { type: String, default: '' }
62
+ emptyText: { type: String, default: '' },
63
+ height: { type: [Number, String], default: 0 }
61
64
  },
62
65
 
63
66
  emits: ['change', 'sort-change', 'select-change'],
@@ -90,7 +93,8 @@ export default {
90
93
  size: this.size,
91
94
  scroll: this.scroll,
92
95
  rowHeight: this.rowHeight,
93
- headerHeight: this.headerHeight
96
+ headerHeight: this.headerHeight,
97
+ height: this.height
94
98
  }
95
99
  },
96
100
 
@@ -171,6 +175,7 @@ export default {
171
175
  this.tableCtx.layout.size = v.size
172
176
  this.tableCtx.layout.scroll = v.scroll
173
177
  this.tableCtx.layout.tableLayout = v.scroll && v.scroll.y ? 'fixed' : 'auto'
178
+ this.tableCtx.layout.height = v.height
174
179
  }
175
180
  },
176
181
 
@@ -1,5 +1,4 @@
1
1
  <script>
2
- import { getCurrentInstance } from 'vue'
3
2
  import { findDOMNode } from '../../utils/common'
4
3
 
5
4
  export default {
@@ -14,7 +13,6 @@ export default {
14
13
  offsetHeight: 0,
15
14
  offsetWidth: 0
16
15
  },
17
- instance: getCurrentInstance(),
18
16
  currentElement: null,
19
17
  resizeObserver: null
20
18
  }
@@ -27,6 +27,9 @@
27
27
  <template #bodyCell="slotData">
28
28
  <slot name="bodyCell" v-bind="slotData"></slot>
29
29
  </template>
30
+ <template #empty>
31
+ <slot name="empty"></slot>
32
+ </template>
30
33
  </TableBody>
31
34
  </table>
32
35
  </div>
@@ -41,6 +44,9 @@
41
44
  <template #bodyCell="slotData">
42
45
  <slot name="bodyCell" v-bind="slotData"></slot>
43
46
  </template>
47
+ <template #empty>
48
+ <slot name="empty"></slot>
49
+ </template>
44
50
  </TableBody>
45
51
  </table>
46
52
  </div>
@@ -75,6 +81,10 @@ export default {
75
81
  return this.tableContext.layout.scroll
76
82
  },
77
83
 
84
+ minHeight: function () {
85
+ return this.tableContext.layout.height
86
+ },
87
+
78
88
  isEmpty() {
79
89
  return this.tableContext.data.display.length === 0
80
90
  },
@@ -135,9 +145,13 @@ export default {
135
145
 
136
146
  // Case 3 — body scroll container
137
147
  bodyHoldStyle: function () {
148
+ const rowHeight = this.tableContext.layout.headerHeight
149
+ const deduct = `${this.toCssSize(rowHeight)}`
150
+
138
151
  var style = {
139
152
  overflowY: 'auto',
140
- maxHeight: this.toCssSize(this.scroll.y)
153
+ maxHeight: `calc(${this.toCssSize(this.scroll.y)} - ${deduct})`,
154
+ minHeight: this.minHeight > 0 ? `calc(${this.toCssSize(this.minHeight)} - ${deduct})` : undefined
141
155
  }
142
156
  if (this.hasScrollX) {
143
157
  style.overflowX = 'auto'
@@ -2,10 +2,10 @@
2
2
  <table
3
3
  class="ui-table-v2__drag-preview"
4
4
  aria-hidden="true"
5
- :style="{ width: containerWidth ? containerWidth + 'px' : '100%' }"
5
+ :style="{ width: containerWidth ? containerWidth + 'px' : '100%', tableLayout: 'fixed' }"
6
6
  >
7
7
  <tbody class="ui-table-v2__body">
8
- <tr class="ui-table-v2__row">
8
+ <tr class="ui-table-v2__row" v-if="record">
9
9
  <td v-for="col in columns" :key="col.key">
10
10
  <div v-if="col.type === DRAGGABLE_COLUMN" class="wrapper-option">
11
11
  <span class="drag-handle">
@@ -9,13 +9,15 @@
9
9
  <template v-if="isEmpty">
10
10
  <tr class="ui-table-v2__row">
11
11
  <td colspan="100">
12
- <div class="ui-table-v2__row-empty ui-table-v2__empty">
13
- <div class="wrapper-img">
14
- <img
15
- src="https://content.pancake.vn/web-media-262/2e/2a/0c/96/c2b58ae9f06c4dc2a3b83016e56d5b4132ff40637862ba23435e43a0-w:224-h:224-l:3927-t:image/png.png"
16
- />
17
- </div>
18
- <span class="wk-paragraph-small">{{ emptyText }}</span>
12
+ <div class="ui-table-v2__row-empty ui-table-v2__empty" :style="emptyStyle">
13
+ <slot name="empty">
14
+ <div class="wrapper-img">
15
+ <img
16
+ src="https://content.pancake.vn/web-media-262/2e/2a/0c/96/c2b58ae9f06c4dc2a3b83016e56d5b4132ff40637862ba23435e43a0-w:224-h:224-l:3927-t:image/png.png"
17
+ />
18
+ </div>
19
+ <span class="wk-paragraph-small">{{ emptyText }}</span>
20
+ </slot>
19
21
  </div>
20
22
  </td>
21
23
  </tr>
@@ -70,6 +72,11 @@ export default {
70
72
  computed: {
71
73
  emptyText() {
72
74
  return this.tableContext.data.emptyText || 'Không có dữ liệu'
75
+ },
76
+ emptyStyle() {
77
+ const { height, rowHeight } = this.tableContext.layout
78
+ if (!height) return {}
79
+ return { minHeight: `calc(${height}px - ${rowHeight}px)` }
73
80
  }
74
81
  },
75
82
  beforeUnmount: function () {
@@ -20,7 +20,13 @@
20
20
  </span>
21
21
  </div>
22
22
 
23
- <slot name="bodyCell" :column="column" :text="record[column.dataIndex]" :record="record">
23
+ <slot
24
+ v-if="!isSelectionCol && !isDraggableCol"
25
+ name="bodyCell"
26
+ :column="column"
27
+ :text="record[column.dataIndex]"
28
+ :record="record"
29
+ >
24
30
  <span :class="[column.ellipsis && 'ui-table-v2__cell--ellipsis']">
25
31
  {{ record[column.dataIndex] }}
26
32
  </span>
@@ -27,7 +27,8 @@ export function createTableContext() {
27
27
  containerWidth: 0,
28
28
  columnWidths: new Map(),
29
29
  rowHeight: 50,
30
- headerHeight: 36
30
+ headerHeight: 36,
31
+ height: 0
31
32
  },
32
33
 
33
34
  sort: {
@@ -1,2 +0,0 @@
1
- {"t":0,"agent":"ae435b9","agent_type":"unknown","event":"agent_stop","success":true}
2
- {"t":0,"agent":"ae345ba","agent_type":"unknown","event":"agent_stop","success":true}
@@ -1,7 +0,0 @@
1
- {
2
- "agents": [],
3
- "total_spawned": 0,
4
- "total_completed": 0,
5
- "total_failed": 0,
6
- "last_updated": "2026-05-12T04:07:51.819Z"
7
- }