@ithinkdt/ui 4.0.0-12 → 4.0.0-14
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
|
@@ -23,7 +23,7 @@ export const NCheckboxes = defineComponent({
|
|
|
23
23
|
type: [Number, String, Array],
|
|
24
24
|
default: undefined,
|
|
25
25
|
},
|
|
26
|
-
|
|
26
|
+
modelValue: {
|
|
27
27
|
type: Array,
|
|
28
28
|
default: undefined,
|
|
29
29
|
},
|
|
@@ -45,7 +45,8 @@ export const NCheckboxes = defineComponent({
|
|
|
45
45
|
},
|
|
46
46
|
},
|
|
47
47
|
emits: {
|
|
48
|
-
'update:
|
|
48
|
+
'update:modelValue': () => true,
|
|
49
|
+
'updateModelValue': () => true,
|
|
49
50
|
},
|
|
50
51
|
|
|
51
52
|
setup(props, { emit, attrs }) {
|
|
@@ -59,13 +60,14 @@ export const NCheckboxes = defineComponent({
|
|
|
59
60
|
const checked = ref([])
|
|
60
61
|
|
|
61
62
|
watch(
|
|
62
|
-
() => props.
|
|
63
|
+
() => props.modelValue,
|
|
63
64
|
v => (checked.value = v),
|
|
64
65
|
{ immediate: true },
|
|
65
66
|
)
|
|
66
67
|
|
|
67
68
|
const emitValue = (v) => {
|
|
68
|
-
emit('update:
|
|
69
|
+
emit('update:modelValue', v)
|
|
70
|
+
emit('updateModelValue', v)
|
|
69
71
|
}
|
|
70
72
|
const onAll = () => {
|
|
71
73
|
emitValue(
|
|
@@ -74,7 +74,7 @@ export const DataActions = /* @__PURE__ */ defineComponent({
|
|
|
74
74
|
onUpdateCount={onUpdateCount}
|
|
75
75
|
onUpdateOverflow={onUpdateOverflow}
|
|
76
76
|
updateCounter={updateCounter}
|
|
77
|
-
style="
|
|
77
|
+
style="margin-top: 2px"
|
|
78
78
|
>
|
|
79
79
|
{ {
|
|
80
80
|
default: () => props.options.map((act) => {
|
|
@@ -84,15 +84,13 @@ export const DataActions = /* @__PURE__ */ defineComponent({
|
|
|
84
84
|
? act.color
|
|
85
85
|
: 'primary'
|
|
86
86
|
return (
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
</NButton>
|
|
91
|
-
</span>
|
|
87
|
+
<NButton quaternary type={color} size="small" onClick={act.onClick}>
|
|
88
|
+
{act.text}
|
|
89
|
+
</NButton>
|
|
92
90
|
)
|
|
93
91
|
}),
|
|
94
92
|
counter: () => (
|
|
95
|
-
<span ref={counter}>
|
|
93
|
+
<span ref={counter} style="position: absolute">
|
|
96
94
|
<NDropdown options={moreOptions.value} renderLabel={renderLabel} onSelect={onSelect}>
|
|
97
95
|
<NButton quaternary size="small"><IMore style="font-size: 14px; color: #888" /></NButton>
|
|
98
96
|
</NDropdown>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toReactive, unrefElement, until } from '@vueuse/core'
|
|
2
|
-
import { NButton, NDataTable, NFlex, NIcon, NTooltip } from 'ithinkdt-ui'
|
|
2
|
+
import { NButton, NDataTable, NFlex, NIcon, NPerformantEllipsis, NTooltip } from 'ithinkdt-ui'
|
|
3
3
|
import { Sortable } from 'sortablejs'
|
|
4
4
|
import { computed, defineComponent, inject, mergeProps, nextTick, ref, shallowRef, toValue, useTemplateRef, watch, withDirectives } from 'vue'
|
|
5
5
|
|
|
@@ -43,40 +43,52 @@ function _map(columns, width) {
|
|
|
43
43
|
},
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
if (
|
|
47
|
-
column.children = _map(
|
|
46
|
+
if (col.children?.length) {
|
|
47
|
+
column.children = _map(col.children, width.value)
|
|
48
48
|
} else {
|
|
49
|
-
if (
|
|
49
|
+
if (col.hidden !== true) {
|
|
50
50
|
column.width ??= 100
|
|
51
51
|
width.value += Number(column.width)
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const render0 =
|
|
55
|
-
if (
|
|
56
|
-
column.ellipsis =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
54
|
+
const render0 = col.render ?? (v => v)
|
|
55
|
+
if (col.ellipsis !== false) {
|
|
56
|
+
column.ellipsis = false
|
|
57
|
+
column.render = (...params) => {
|
|
58
|
+
const vnode = render0(...params)
|
|
59
|
+
return (
|
|
60
|
+
<NPerformantEllipsis
|
|
61
|
+
{...mergeProps(
|
|
62
|
+
{
|
|
63
|
+
expandTrigger: 'click',
|
|
64
|
+
lineClamp: 1,
|
|
65
|
+
tooltip: {
|
|
66
|
+
style: {
|
|
67
|
+
maxWidth: '61.8vw',
|
|
68
|
+
wordBreak: 'break-all',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
typeof col.ellipsis === 'boolean' ? {} : col.ellipsis,
|
|
73
|
+
)}
|
|
74
|
+
>
|
|
75
|
+
{
|
|
76
|
+
vnode
|
|
77
|
+
}
|
|
78
|
+
</NPerformantEllipsis>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (col.ellipsisTooltip === true) {
|
|
70
83
|
column.ellipsisTooltip ??= render0
|
|
71
84
|
}
|
|
72
85
|
}
|
|
73
86
|
|
|
74
87
|
Object.assign(column, {
|
|
75
|
-
resizable:
|
|
76
|
-
sorter:
|
|
77
|
-
type: ['selection', 'expand'].includes(
|
|
78
|
-
disabled:
|
|
79
|
-
ellipsisComponent: 'performant-ellipsis',
|
|
88
|
+
resizable: col.resizable !== false,
|
|
89
|
+
sorter: col.sortable,
|
|
90
|
+
type: ['selection', 'expand'].includes(col.type) ? col.type : undefined,
|
|
91
|
+
disabled: col.selectable ? model => col.selectable(model) === false : undefined,
|
|
80
92
|
})
|
|
81
93
|
}
|
|
82
94
|
|
|
@@ -38,9 +38,17 @@ export const NRadios = defineComponent({
|
|
|
38
38
|
type: String,
|
|
39
39
|
default: 'disabled',
|
|
40
40
|
},
|
|
41
|
+
modelValue: {
|
|
42
|
+
type: [String, Number, Boolean],
|
|
43
|
+
default: undefined,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
emits: {
|
|
47
|
+
'update:modelValue': () => true,
|
|
48
|
+
'updateModelValue': () => true,
|
|
41
49
|
},
|
|
42
50
|
|
|
43
|
-
setup(props) {
|
|
51
|
+
setup(props, { emit }) {
|
|
44
52
|
const { t } = useI18n()
|
|
45
53
|
|
|
46
54
|
const defaultLabel = computed(() => {
|
|
@@ -56,6 +64,12 @@ export const NRadios = defineComponent({
|
|
|
56
64
|
'--n-button-text-color-active': 'var(--color-base)',
|
|
57
65
|
}
|
|
58
66
|
: {})
|
|
67
|
+
|
|
68
|
+
const emitValue = (v) => {
|
|
69
|
+
emit('update:modelValue', v)
|
|
70
|
+
emit('updateModelValue', v)
|
|
71
|
+
}
|
|
72
|
+
|
|
59
73
|
return () => {
|
|
60
74
|
const Comp = props.type === 'button' ? NRadioButton : NRadio
|
|
61
75
|
|
|
@@ -103,7 +117,7 @@ export const NRadios = defineComponent({
|
|
|
103
117
|
</>
|
|
104
118
|
)
|
|
105
119
|
return (
|
|
106
|
-
<NRadioGroup style={props.vertical ? { ...groupStyle.value, padding: '6px 0 0' } : groupStyle.value}>
|
|
120
|
+
<NRadioGroup style={props.vertical ? { ...groupStyle.value, padding: '6px 0 0' } : groupStyle.value} value={props.modelValue} onUpdateValue={emitValue}>
|
|
107
121
|
{props.type === 'radio'
|
|
108
122
|
? (
|
|
109
123
|
<NFlex size={props.vertical ? undefined : 'small'} vertical={props.vertical}>
|
|
@@ -17,7 +17,7 @@ export const DtUserDept = defineComponent({
|
|
|
17
17
|
users: { type: Array, default: () => [] },
|
|
18
18
|
groups: { type: Array, default: () => [] },
|
|
19
19
|
depts: { type: Array, default: () => [] },
|
|
20
|
-
|
|
20
|
+
modelValue: { type: [Array, String], default: undefined },
|
|
21
21
|
placeholder: { type: String, default: undefined },
|
|
22
22
|
size: { type: String, default: undefined },
|
|
23
23
|
type: { type: String, default: 'user' },
|
|
@@ -36,9 +36,9 @@ export const DtUserDept = defineComponent({
|
|
|
36
36
|
|
|
37
37
|
const valueArray = computed(() => {
|
|
38
38
|
if (props.multiple) {
|
|
39
|
-
return props.
|
|
39
|
+
return props.modelValue || []
|
|
40
40
|
}
|
|
41
|
-
const value = props.
|
|
41
|
+
const value = props.modelValue?.trim()
|
|
42
42
|
return value ? [value] : []
|
|
43
43
|
})
|
|
44
44
|
|
|
@@ -301,7 +301,7 @@ export const DtUserDept = defineComponent({
|
|
|
301
301
|
options={options}
|
|
302
302
|
renderSourceList={({ onCheck, pattern }) => renderSourceList(value, onCheck, pattern)}
|
|
303
303
|
renderTargetList={
|
|
304
|
-
props.placeholder?.trim() && !props.
|
|
304
|
+
props.placeholder?.trim() && !props.modelValue?.length ? renderTargetListEmpty : undefined
|
|
305
305
|
}
|
|
306
306
|
sourceFilterable={props.filterable}
|
|
307
307
|
size={props.size}
|
|
@@ -400,7 +400,7 @@ export const DtUserDept = defineComponent({
|
|
|
400
400
|
checkable={props.multiple}
|
|
401
401
|
multiple={props.multiple}
|
|
402
402
|
filter={(pattern, it) => it.label.includes(pattern) || it.value.includes(pattern)}
|
|
403
|
-
value={props.
|
|
403
|
+
value={props.modelValue}
|
|
404
404
|
onUpdateValue={(v) => {
|
|
405
405
|
if (props.multiple && props.max && v?.length > props.max) return
|
|
406
406
|
emit('updateModelValue', v)
|
|
@@ -439,7 +439,7 @@ export const DtUserDept = defineComponent({
|
|
|
439
439
|
size={props.size}
|
|
440
440
|
placeholder={props.placeholder}
|
|
441
441
|
disabled={props.disabled || undefined}
|
|
442
|
-
value={props.
|
|
442
|
+
value={props.modelValue}
|
|
443
443
|
renderTag={props.multiple ? renderTag : undefined}
|
|
444
444
|
onFocus={isDropdown ? undefined : showDialog}
|
|
445
445
|
onUpdateValue={(v) => {
|
|
@@ -571,7 +571,7 @@ export const DtDeptRender = /* @__PURE__ */ defineComponent({
|
|
|
571
571
|
setup(props) {
|
|
572
572
|
const depts = ref([])
|
|
573
573
|
const map = {}
|
|
574
|
-
watch([() => props.
|
|
574
|
+
watch([() => props.modelValue, () => props.multiple],
|
|
575
575
|
([value, multiple]) => {
|
|
576
576
|
depts.value = []
|
|
577
577
|
const deptcodes = value ? (multiple ? (Array.isArray(value) ? value : value.trim() ? value.trim().split(',') : []) : [value]) : []
|
|
@@ -613,7 +613,7 @@ export const DtUserRender = /* @__PURE__ */ defineComponent({
|
|
|
613
613
|
setup(props) {
|
|
614
614
|
const users = ref([])
|
|
615
615
|
const map = {}
|
|
616
|
-
watch([() => props.
|
|
616
|
+
watch([() => props.modelValue, () => props.multiple],
|
|
617
617
|
([value, multiple]) => {
|
|
618
618
|
users.value = []
|
|
619
619
|
const usernames = value ? (multiple ? (Array.isArray(value) ? value : value.trim() ? value.trim().split(',') : []) : [value]) : []
|
package/src/page.jsx
CHANGED
|
@@ -218,6 +218,7 @@ export function createPageFormHelper({
|
|
|
218
218
|
{
|
|
219
219
|
...props,
|
|
220
220
|
...params,
|
|
221
|
+
options: options0,
|
|
221
222
|
modelValue,
|
|
222
223
|
},
|
|
223
224
|
)
|
|
@@ -251,6 +252,7 @@ export function createPageFormHelper({
|
|
|
251
252
|
{
|
|
252
253
|
...props,
|
|
253
254
|
...params,
|
|
255
|
+
options: options0,
|
|
254
256
|
modelValue,
|
|
255
257
|
},
|
|
256
258
|
)
|