niuma-ui 1.1.0 → 1.1.1
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/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [1.1.1] - 2026-08-14
|
|
10
|
+
|
|
11
|
+
### 修复
|
|
12
|
+
|
|
13
|
+
- `RsTableCellEditor`:单元格 Select 的 `update:model-value` 对齐 `RsSelectModelValue`(含 number / 多选 / labelInValue)。
|
|
14
|
+
- `useRsTableCore`:`compact` / `size` 为 undefined 时回退默认值,避免宿主 `vue-tsc` 失败。
|
|
15
|
+
- `useRsTableHeadless`:`rowKey` 区分无参 getter 与行访问器,避免误当成需传入 row 的函数调用。
|
|
16
|
+
|
|
9
17
|
## [1.1.0] - 2026-08-14
|
|
10
18
|
|
|
11
19
|
### 新增
|
|
@@ -98,7 +106,8 @@
|
|
|
98
106
|
|
|
99
107
|
- 1.0 之前的私有 tag(如 `v0.1.0`)仅作历史记录;新接入请依赖 `v1.0.0` 及之后版本。
|
|
100
108
|
|
|
101
|
-
[Unreleased]: https://github.com/Blair-Shang/niuma-ui/compare/v1.1.
|
|
109
|
+
[Unreleased]: https://github.com/Blair-Shang/niuma-ui/compare/v1.1.1...HEAD
|
|
110
|
+
[1.1.1]: https://github.com/Blair-Shang/niuma-ui/releases/tag/v1.1.1
|
|
102
111
|
[1.1.0]: https://github.com/Blair-Shang/niuma-ui/releases/tag/v1.1.0
|
|
103
112
|
[1.0.2]: https://github.com/Blair-Shang/niuma-ui/releases/tag/v1.0.2
|
|
104
113
|
[1.0.1]: https://github.com/Blair-Shang/niuma-ui/releases/tag/v1.0.1
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import RsDatePicker from '../RsDatePicker.vue'
|
|
|
6
6
|
import RsInput from '../RsInput.vue'
|
|
7
7
|
import RsInputNumber from '../RsInputNumber.vue'
|
|
8
8
|
import RsSelect from '../RsSelect.vue'
|
|
9
|
-
import type { RsSelectOptions } from '../select-utils'
|
|
9
|
+
import type { RsSelectModelValue, RsSelectOptions } from '../select-utils'
|
|
10
10
|
import type { RsTableColumnEditorOptionsResolved, RsTableCellValueType } from '../table-utils'
|
|
11
11
|
import {
|
|
12
12
|
applyFocusMode,
|
|
@@ -223,9 +223,17 @@ function onKeydown(event: KeyboardEvent): void {
|
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
function onSelectUpdate(value:
|
|
226
|
+
function onSelectUpdate(value: RsSelectModelValue): void {
|
|
227
|
+
const toToken = (item: RsSelectModelValue): string => {
|
|
228
|
+
if (item == null || item === '') return ''
|
|
229
|
+
if (typeof item === 'object' && !Array.isArray(item) && 'value' in item) {
|
|
230
|
+
return String(item.value)
|
|
231
|
+
}
|
|
232
|
+
return String(item)
|
|
233
|
+
}
|
|
234
|
+
const tokens = Array.isArray(value) ? value.map(toToken) : toToken(value)
|
|
227
235
|
const empty =
|
|
228
|
-
|
|
236
|
+
tokens === '' || (Array.isArray(tokens) && tokens.length === 0)
|
|
229
237
|
// 表格内下拉默认不可清除:仅选择;显式 clearable 时才允许清空
|
|
230
238
|
if (empty) {
|
|
231
239
|
if (!props.editorOptions?.clearable) return
|
|
@@ -235,12 +243,12 @@ function onSelectUpdate(value: string | string[]): void {
|
|
|
235
243
|
return
|
|
236
244
|
}
|
|
237
245
|
if (isMultipleSelect.value) {
|
|
238
|
-
const list = Array.isArray(
|
|
246
|
+
const list = Array.isArray(tokens) ? tokens : [tokens]
|
|
239
247
|
model.value = joinMultiSelectDraft(list)
|
|
240
248
|
// 多选不在每次勾选时提交,等下拉关闭
|
|
241
249
|
return
|
|
242
250
|
}
|
|
243
|
-
model.value = Array.isArray(
|
|
251
|
+
model.value = Array.isArray(tokens) ? (tokens[0] ?? '') : tokens
|
|
244
252
|
if (shouldCommitOnChange()) emit('commit')
|
|
245
253
|
}
|
|
246
254
|
|
|
@@ -113,7 +113,9 @@ export function useRsTableCore<T extends RsTableRowData>(options: UseRsTableCore
|
|
|
113
113
|
emit: options.emit,
|
|
114
114
|
})
|
|
115
115
|
|
|
116
|
-
const resolvedSize = computed(() =>
|
|
116
|
+
const resolvedSize = computed(() =>
|
|
117
|
+
resolveTableSize(options.compact() ?? false, options.size() ?? 'md'),
|
|
118
|
+
)
|
|
117
119
|
|
|
118
120
|
const engine = useRsTableEngine<T>({
|
|
119
121
|
data: () => options.data(),
|
|
@@ -35,8 +35,16 @@ export function useRsTableHeadless<T extends RsTableRowData>(
|
|
|
35
35
|
) {
|
|
36
36
|
const getColumns = readRefOrGetter(options.columns)
|
|
37
37
|
const getData = readRefOrGetter(options.data)
|
|
38
|
-
const getRowKey = () =>
|
|
39
|
-
|
|
38
|
+
const getRowKey = (): RsTableRowKey<T> | undefined => {
|
|
39
|
+
const key = options.rowKey
|
|
40
|
+
if (key == null) return undefined
|
|
41
|
+
if (typeof key === 'string') return key
|
|
42
|
+
// 无参函数视为配置 getter;带 row 参数的视为字段访问器
|
|
43
|
+
if (typeof key === 'function' && key.length === 0) {
|
|
44
|
+
return (key as () => RsTableRowKey<T> | undefined)()
|
|
45
|
+
}
|
|
46
|
+
return key as RsTableRowKey<T>
|
|
47
|
+
}
|
|
40
48
|
const getFeatures = () =>
|
|
41
49
|
typeof options.features === 'function' ? options.features() : options.features
|
|
42
50
|
|