@ithinkdt/ui 4.0.0-38 → 4.0.0-400
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/auto-imports.js +1 -1
- package/dist/components-B_qzc9ro.js +1736 -0
- package/dist/components.js +5 -0
- package/dist/directives-qqYcWl1I.js +194 -0
- package/dist/directives.js +3 -0
- package/dist/index.js +1212 -0
- package/dist/page.js +519 -0
- package/dist/use-i18n-Dx7V4KrY.js +6 -0
- package/dist/use-style-DcT-1dj4.js +29 -0
- package/dist/use-style.js +2 -0
- package/{src → esm}/components.d.ts +56 -15
- package/esm/components.js +1 -0
- package/esm/directives.js +1 -0
- package/esm/index.js +1 -0
- package/{src → esm}/page.d.ts +2 -2
- package/esm/page.js +1 -0
- package/esm/use-style.js +1 -0
- package/package.json +29 -26
- package/unocss-preset.d.ts +5 -0
- package/unocss-preset.js +163 -0
- package/src/components/Checkboxes.jsx +0 -130
- package/src/components/DataActions.jsx +0 -105
- package/src/components/DataCustom.jsx +0 -187
- package/src/components/DataFilter.jsx +0 -119
- package/src/components/DataForm.jsx +0 -264
- package/src/components/DataLocaleInput.jsx +0 -121
- package/src/components/DataPagination.jsx +0 -62
- package/src/components/DataSelection.jsx +0 -57
- package/src/components/DataTable.jsx +0 -302
- package/src/components/Radios.jsx +0 -134
- package/src/components/UserDept.jsx +0 -643
- package/src/components/assets.jsx +0 -274
- package/src/components/index.js +0 -11
- package/src/design/Account.jsx +0 -154
- package/src/design/Appearance.jsx +0 -89
- package/src/design/Breadcrumb.jsx +0 -67
- package/src/design/Fullscreen.jsx +0 -65
- package/src/design/Language.jsx +0 -45
- package/src/design/Layout.jsx +0 -241
- package/src/design/Logo.jsx +0 -92
- package/src/design/Menu.jsx +0 -133
- package/src/design/MultiTabs.jsx +0 -501
- package/src/design/Notification.jsx +0 -311
- package/src/design/Tenant.jsx +0 -88
- package/src/design/common.jsx +0 -21
- package/src/design/index.js +0 -11
- package/src/directives/index.js +0 -2
- package/src/directives/spin.js +0 -181
- package/src/directives/tooltip.jsx +0 -121
- package/src/index.js +0 -18
- package/src/page.jsx +0 -740
- package/src/use-i18n.js +0 -8
- package/src/use-style.js +0 -58
- package/src/utils.js +0 -20
- package/unocss.d.ts +0 -5
- package/unocss.js +0 -94
- /package/{src → esm}/design.d.ts +0 -0
- /package/{src → esm}/directives.d.ts +0 -0
- /package/{src → esm}/index.d.ts +0 -0
- /package/{src → esm}/use-style.d.ts +0 -0
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { NButton, NCheckbox, NEllipsis, NFlex, NIcon, NPopover } from 'ithinkdt-ui'
|
|
2
|
-
import { Sortable } from 'sortablejs/modular/sortable.core.esm.js'
|
|
3
|
-
import { defineComponent, ref, toValue, watch, withDirectives } from 'vue'
|
|
4
|
-
|
|
5
|
-
import { vTooltip } from '../directives/tooltip.jsx'
|
|
6
|
-
import { useI18n } from '../use-i18n.js'
|
|
7
|
-
|
|
8
|
-
import { ICustom, IDrag, ILeft, IRight } from './assets.jsx'
|
|
9
|
-
|
|
10
|
-
const DataCustomItem = /* @__PURE__ */ defineComponent({
|
|
11
|
-
name: 'DataCustomRow',
|
|
12
|
-
props: {
|
|
13
|
-
label: [String, Function],
|
|
14
|
-
disabled: Boolean,
|
|
15
|
-
hidden: Boolean,
|
|
16
|
-
showFixed: Boolean,
|
|
17
|
-
fixed: [Boolean, String],
|
|
18
|
-
},
|
|
19
|
-
emits: ['update-hidden', 'update-fixed'],
|
|
20
|
-
setup(props, { emit }) {
|
|
21
|
-
return () => {
|
|
22
|
-
return (
|
|
23
|
-
<NFlex align="center" wrap={false} size="small">
|
|
24
|
-
<NButton type="primary" text class="icon-drag">
|
|
25
|
-
<NIcon size="18">
|
|
26
|
-
<IDrag />
|
|
27
|
-
</NIcon>
|
|
28
|
-
</NButton>
|
|
29
|
-
<NCheckbox
|
|
30
|
-
checked={!props.hidden}
|
|
31
|
-
disabled={props.disabled}
|
|
32
|
-
onUpdateChecked={v => emit('update-hidden', !v)}
|
|
33
|
-
/>
|
|
34
|
-
<NEllipsis style="flex: 1 1 auto">{toValue(props.label)}</NEllipsis>
|
|
35
|
-
{
|
|
36
|
-
props.showFixed
|
|
37
|
-
? [
|
|
38
|
-
<NButton
|
|
39
|
-
text
|
|
40
|
-
type={props.fixed === 'left' ? 'primary' : undefined}
|
|
41
|
-
onClick={() => emit('update-fixed', props.fixed === 'left' ? false : 'left')}
|
|
42
|
-
>
|
|
43
|
-
<NIcon>
|
|
44
|
-
<ILeft />
|
|
45
|
-
</NIcon>
|
|
46
|
-
</NButton>,
|
|
47
|
-
<NButton
|
|
48
|
-
text
|
|
49
|
-
type={props.fixed === 'right' ? 'primary' : undefined}
|
|
50
|
-
onClick={() => emit('update-fixed', props.fixed === 'right' ? false : 'right')}
|
|
51
|
-
>
|
|
52
|
-
<NIcon>
|
|
53
|
-
<IRight />
|
|
54
|
-
</NIcon>
|
|
55
|
-
</NButton>,
|
|
56
|
-
]
|
|
57
|
-
: undefined
|
|
58
|
-
}
|
|
59
|
-
</NFlex>
|
|
60
|
-
)
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
export const DataCustom = /* @__PURE__ */ defineComponent({
|
|
66
|
-
name: 'DataCustom',
|
|
67
|
-
props: {
|
|
68
|
-
data: {
|
|
69
|
-
type: Array,
|
|
70
|
-
required: true,
|
|
71
|
-
},
|
|
72
|
-
keyField: {
|
|
73
|
-
type: String,
|
|
74
|
-
default: 'key',
|
|
75
|
-
},
|
|
76
|
-
labelField: {
|
|
77
|
-
type: String,
|
|
78
|
-
default: 'label',
|
|
79
|
-
},
|
|
80
|
-
fixedField: {
|
|
81
|
-
type: String,
|
|
82
|
-
default: 'fixed',
|
|
83
|
-
},
|
|
84
|
-
hiddenField: {
|
|
85
|
-
type: String,
|
|
86
|
-
default: 'hidden',
|
|
87
|
-
},
|
|
88
|
-
showFixed: {
|
|
89
|
-
type: Boolean,
|
|
90
|
-
default: true,
|
|
91
|
-
},
|
|
92
|
-
disabledField: {
|
|
93
|
-
type: String,
|
|
94
|
-
default: 'disabled',
|
|
95
|
-
},
|
|
96
|
-
visiblityField: {
|
|
97
|
-
type: String,
|
|
98
|
-
default: 'visiblity',
|
|
99
|
-
},
|
|
100
|
-
tooltip: [String, Object],
|
|
101
|
-
size: {
|
|
102
|
-
type: Number,
|
|
103
|
-
default: 20,
|
|
104
|
-
},
|
|
105
|
-
type: {
|
|
106
|
-
type: String,
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
emits: {
|
|
110
|
-
custom: () => true,
|
|
111
|
-
},
|
|
112
|
-
setup(props, { emit }) {
|
|
113
|
-
const { t } = useI18n()
|
|
114
|
-
|
|
115
|
-
function emitCols(col, field, value) {
|
|
116
|
-
emit('custom', {
|
|
117
|
-
key: col[props.keyField],
|
|
118
|
-
[field]: value,
|
|
119
|
-
})
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const ulRef = ref()
|
|
123
|
-
|
|
124
|
-
watch(ulRef, (inst) => {
|
|
125
|
-
if (!inst.$el) return
|
|
126
|
-
Sortable.create(inst.$el, {
|
|
127
|
-
animation: 150,
|
|
128
|
-
ghostClass: 'ghost',
|
|
129
|
-
handle: '.icon-drag',
|
|
130
|
-
filter: '.disabled',
|
|
131
|
-
onEnd(e) {
|
|
132
|
-
const orders = props.data.map(item => item[props.keyField])
|
|
133
|
-
const [curr] = orders.splice(e.oldIndex, 1)
|
|
134
|
-
orders.splice(e.newIndex, 0, curr)
|
|
135
|
-
emit('custom', orders)
|
|
136
|
-
},
|
|
137
|
-
})
|
|
138
|
-
})
|
|
139
|
-
|
|
140
|
-
return () => (
|
|
141
|
-
<NPopover
|
|
142
|
-
trigger="click"
|
|
143
|
-
scrollable
|
|
144
|
-
placement="left-start"
|
|
145
|
-
displayDirective="show"
|
|
146
|
-
style="max-height: 400px; width: 240px"
|
|
147
|
-
>
|
|
148
|
-
{{
|
|
149
|
-
trigger: () =>
|
|
150
|
-
withDirectives(
|
|
151
|
-
<NButton text type={props.type}>
|
|
152
|
-
<NIcon size={props.size}>
|
|
153
|
-
<ICustom />
|
|
154
|
-
</NIcon>
|
|
155
|
-
</NButton>,
|
|
156
|
-
[[vTooltip, props.tooltip ?? t('common.page.custom.tooltip')]],
|
|
157
|
-
),
|
|
158
|
-
default: () => (
|
|
159
|
-
<NFlex vertical>
|
|
160
|
-
<NFlex justify="space-between">
|
|
161
|
-
<div style="font-weight: bold">{props.tooltip ?? t('common.page.custom.tooltip') }</div>
|
|
162
|
-
<NButton text type="primary" size="small" onClick={() => emit('custom', true)}>
|
|
163
|
-
{ t('common.page.custom.reset') }
|
|
164
|
-
</NButton>
|
|
165
|
-
</NFlex>
|
|
166
|
-
<NFlex ref={ulRef} vertical>
|
|
167
|
-
{props.data
|
|
168
|
-
.filter(item => item[props.visiblityField] !== false)
|
|
169
|
-
.map(item => (
|
|
170
|
-
<DataCustomItem
|
|
171
|
-
key={item[props.keyField]}
|
|
172
|
-
label={item[props.labelField]}
|
|
173
|
-
hidden={item[props.hiddenField]}
|
|
174
|
-
fixed={item[props.fixedField]}
|
|
175
|
-
showFixed={props.showFixed}
|
|
176
|
-
onUpdateHidden={v => emitCols(item, 'hidden', v)}
|
|
177
|
-
onUpdateFixed={v => emitCols(item, 'fixed', v)}
|
|
178
|
-
/>
|
|
179
|
-
))}
|
|
180
|
-
</NFlex>
|
|
181
|
-
</NFlex>
|
|
182
|
-
),
|
|
183
|
-
}}
|
|
184
|
-
</NPopover>
|
|
185
|
-
)
|
|
186
|
-
},
|
|
187
|
-
})
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { NButton, NFlex, formProps } from 'ithinkdt-ui'
|
|
2
|
-
import { defineComponent, reactive, ref } from 'vue'
|
|
3
|
-
|
|
4
|
-
import { pickProps } from '@ithinkdt/common/object'
|
|
5
|
-
|
|
6
|
-
import { useI18n } from '../use-i18n.js'
|
|
7
|
-
|
|
8
|
-
import { DataCustom } from './DataCustom.jsx'
|
|
9
|
-
import { DataForm } from './DataForm.jsx'
|
|
10
|
-
import { IDown, IUp } from './assets.jsx'
|
|
11
|
-
|
|
12
|
-
export const DataFilter = /* @__PURE__ */ defineComponent({
|
|
13
|
-
name: 'DataFilter',
|
|
14
|
-
props: {
|
|
15
|
-
grid: {
|
|
16
|
-
type: Object,
|
|
17
|
-
default: () => ({}),
|
|
18
|
-
},
|
|
19
|
-
...pickProps(formProps, 'disabled', 'model'),
|
|
20
|
-
labelWidth: { type: [String, Number], default: '5em' },
|
|
21
|
-
labelPlacement: { type: String, default: 'left' },
|
|
22
|
-
items: { type: Array, required: true },
|
|
23
|
-
loading: { type: Boolean, required: false, default: false },
|
|
24
|
-
filterOnReset: { type: Boolean, required: false, default: true },
|
|
25
|
-
filterText: { type: String, default: undefined },
|
|
26
|
-
resetText: { type: String, default: undefined },
|
|
27
|
-
customizable: { type: Boolean, required: false, default: true },
|
|
28
|
-
collapsible: { type: Boolean, required: false, default: true },
|
|
29
|
-
defaultCollapsed: { type: Boolean, required: false, default: true },
|
|
30
|
-
},
|
|
31
|
-
emits: ['filter', 'reset', 'custom', 'collapse'],
|
|
32
|
-
setup(props, { expose, emit }) {
|
|
33
|
-
const { t } = useI18n()
|
|
34
|
-
|
|
35
|
-
const onSubmit = (e) => {
|
|
36
|
-
emit('filter', props.model, e)
|
|
37
|
-
}
|
|
38
|
-
const onReset = (e) => {
|
|
39
|
-
emit('reset', e)
|
|
40
|
-
if (props.filterOnReset) {
|
|
41
|
-
emit('filter', props.model, e)
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
const collapsed = ref(props.defaultCollapsed)
|
|
45
|
-
const collapse = (collapsedValue) => {
|
|
46
|
-
collapsed.value = collapsedValue
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
expose({
|
|
50
|
-
collapse,
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
const action = reactive({
|
|
54
|
-
span: 6,
|
|
55
|
-
suffix: true,
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
return () => {
|
|
59
|
-
const { filterOnReset, filterText, resetText, customizable, defaultCollapsed, collapsible, grid, ...formProps } = props
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<DataForm
|
|
63
|
-
grid={
|
|
64
|
-
{
|
|
65
|
-
cols: '12 768:18 1280:24 1536:30',
|
|
66
|
-
yGap: 20,
|
|
67
|
-
xGap: 8,
|
|
68
|
-
...grid,
|
|
69
|
-
collapsed: collapsed.value,
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
{...formProps}
|
|
73
|
-
showFeedback={false}
|
|
74
|
-
showAction={action}
|
|
75
|
-
onSubmit={onSubmit}
|
|
76
|
-
onReset={onReset}
|
|
77
|
-
>
|
|
78
|
-
{{
|
|
79
|
-
action: ({ cols, spans }) => {
|
|
80
|
-
action.suffix = cols < (spans + action.span)
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<NFlex justify={action.suffix ? 'end' : 'start'} align="center">
|
|
84
|
-
{action.suffix ? undefined : <span> </span>}
|
|
85
|
-
<NButton attrType="submit" type="primary" disabled={props.disabled} loading={props.loading}>
|
|
86
|
-
{filterText || t('common.page.filter.submitText') }
|
|
87
|
-
</NButton>
|
|
88
|
-
<NButton attrType="reset" disabled={props.disabled || props.loading}>
|
|
89
|
-
{resetText || t('common.page.form.resetText') }
|
|
90
|
-
</NButton>
|
|
91
|
-
{
|
|
92
|
-
customizable
|
|
93
|
-
? <DataCustom keyField="name" showFixed={false} data={formProps.items} onCustom={e => emit('custom', e)} size={18} type="primary" />
|
|
94
|
-
: undefined
|
|
95
|
-
}
|
|
96
|
-
{
|
|
97
|
-
collapsible && action.suffix
|
|
98
|
-
? (
|
|
99
|
-
<NButton
|
|
100
|
-
text
|
|
101
|
-
type="primary"
|
|
102
|
-
iconPlacement="right"
|
|
103
|
-
renderIcon={collapsed.value ? IDown : IUp}
|
|
104
|
-
onClick={() => collapse(!collapsed.value)}
|
|
105
|
-
>
|
|
106
|
-
{collapsed.value ? t('common.page.filter.expand') : t('common.page.filter.collapse') }
|
|
107
|
-
</NButton>
|
|
108
|
-
)
|
|
109
|
-
: undefined
|
|
110
|
-
}
|
|
111
|
-
</NFlex>
|
|
112
|
-
)
|
|
113
|
-
},
|
|
114
|
-
}}
|
|
115
|
-
</DataForm>
|
|
116
|
-
)
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
})
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import { useCurrentElement, useElementSize, watchDebounced } from '@vueuse/core'
|
|
2
|
-
import { NButton, NFlex, NForm, NFormItem, NGi, NGrid, NIcon, NText, NTooltip, formProps } from 'ithinkdt-ui'
|
|
3
|
-
import { defineComponent, ref, toRaw, toValue } from 'vue'
|
|
4
|
-
|
|
5
|
-
import { pickProps } from '@ithinkdt/common/object'
|
|
6
|
-
|
|
7
|
-
import { useI18n } from '../use-i18n.js'
|
|
8
|
-
|
|
9
|
-
import { ICheck, IHelp } from './assets.jsx'
|
|
10
|
-
|
|
11
|
-
export const DataForm = /* @__PURE__ */ defineComponent({
|
|
12
|
-
name: 'DataForm',
|
|
13
|
-
props: {
|
|
14
|
-
grid: {
|
|
15
|
-
type: Object,
|
|
16
|
-
default: () => ({}),
|
|
17
|
-
},
|
|
18
|
-
...pickProps(formProps, 'disabled', 'model', 'labelWidth', 'labelAlign', 'showFeedback', 'size'),
|
|
19
|
-
readonly: { type: Boolean, required: false, default: undefined },
|
|
20
|
-
items: { type: Array, required: true },
|
|
21
|
-
validation: { type: Object, default: () => ({}) },
|
|
22
|
-
loading: Boolean,
|
|
23
|
-
showColon: Boolean,
|
|
24
|
-
actionAlign: { type: String, default: 'start' },
|
|
25
|
-
showAction: { type: [Boolean, Object], default: undefined },
|
|
26
|
-
submitText: { type: [String, Number, Object], default: undefined },
|
|
27
|
-
resetText: { type: [String, Number, Object], default: undefined },
|
|
28
|
-
cancelText: { type: [String, Number, Object], default: undefined },
|
|
29
|
-
showSubmitBtn: { type: Boolean, required: false, default: true },
|
|
30
|
-
showResetBtn: { type: Boolean, required: false, default: true },
|
|
31
|
-
showCancelBtn: { type: Boolean, required: false, default: false },
|
|
32
|
-
submitDisabled: Boolean,
|
|
33
|
-
succeeded: Boolean,
|
|
34
|
-
successText: { type: [String, Number, Object], default: undefined },
|
|
35
|
-
tooltipPlacement: { type: String, default: 'bottom' },
|
|
36
|
-
requireMarkPlacement: { type: String, default: 'left' },
|
|
37
|
-
labelPlacement: { type: String, default: 'left' },
|
|
38
|
-
},
|
|
39
|
-
emits: ['submit', 'reset', 'cancel'],
|
|
40
|
-
setup(props, { emit, slots }) {
|
|
41
|
-
const { t } = useI18n()
|
|
42
|
-
|
|
43
|
-
const onSubmit = (e) => {
|
|
44
|
-
e?.preventDefault?.()
|
|
45
|
-
emit('submit', { ...toRaw(props.model) }, e)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const onReset = (e) => {
|
|
49
|
-
e?.preventDefault?.()
|
|
50
|
-
emit('reset')
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const onCancel = (e) => {
|
|
54
|
-
e?.preventDefault?.()
|
|
55
|
-
emit('cancel')
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const gridRef = ref()
|
|
59
|
-
|
|
60
|
-
const cols = ref()
|
|
61
|
-
const { width } = useElementSize(useCurrentElement())
|
|
62
|
-
watchDebounced([gridRef, width], () => {
|
|
63
|
-
cols.value = undefined
|
|
64
|
-
setTimeout(() => {
|
|
65
|
-
cols.value = gridRef.value?.responsiveCols || undefined
|
|
66
|
-
}, 30)
|
|
67
|
-
}, { immediate: true, debounce: 100 })
|
|
68
|
-
|
|
69
|
-
return () => {
|
|
70
|
-
const { items, loading, validation, showColon, showAction, actionAlign, submitText, submitDisabled, resetText, tooltipPlacement, showFeedback: _showFeedback,
|
|
71
|
-
labelWidth = '7.2em', labelAlign = props.labelPlacement === 'top' ? 'left' : 'right', grid, succeeded, successText = submitText, ...formProps } = props
|
|
72
|
-
|
|
73
|
-
const showFeedback = !props.readonly && _showFeedback !== false
|
|
74
|
-
return (
|
|
75
|
-
<NForm
|
|
76
|
-
labelWidth={labelWidth}
|
|
77
|
-
labelAlign={labelAlign}
|
|
78
|
-
onReset={onReset}
|
|
79
|
-
onSubmit={onSubmit}
|
|
80
|
-
showFeedback={showFeedback}
|
|
81
|
-
{...formProps}
|
|
82
|
-
>
|
|
83
|
-
<NGrid
|
|
84
|
-
ref={gridRef}
|
|
85
|
-
itemResponsive
|
|
86
|
-
{...grid}
|
|
87
|
-
yGap={showFeedback ? 0 : (grid?.yGap ?? 24)}
|
|
88
|
-
>
|
|
89
|
-
{{ default: () => {
|
|
90
|
-
let spans = 0
|
|
91
|
-
return (
|
|
92
|
-
<>
|
|
93
|
-
{
|
|
94
|
-
items.map(({
|
|
95
|
-
hidden, name, render, label, showColon, span = 6, rowSpan, offset = 0, tooltip, tooltipPlacement = props.tooltipPlacement,
|
|
96
|
-
validationStatus = validation[name]?.errors?.some(it => it !== undefined)
|
|
97
|
-
? 'error'
|
|
98
|
-
: (validation[name]?.warnings?.some(it => it !== undefined)
|
|
99
|
-
? 'warnings'
|
|
100
|
-
: (validation[name] ? 'success' : undefined)),
|
|
101
|
-
readonly = props.readonly,
|
|
102
|
-
showRequireMark = !readonly,
|
|
103
|
-
showTooltipWhenReadonly = false,
|
|
104
|
-
...itemProps
|
|
105
|
-
}) => {
|
|
106
|
-
if (hidden) return
|
|
107
|
-
spans += span
|
|
108
|
-
let content
|
|
109
|
-
if (name[0] === '$') {
|
|
110
|
-
content = render({})
|
|
111
|
-
} else {
|
|
112
|
-
content = (
|
|
113
|
-
<NFormItem
|
|
114
|
-
path={name}
|
|
115
|
-
validationStatus={validationStatus}
|
|
116
|
-
showRequireMark={itemProps.required && showRequireMark}
|
|
117
|
-
{...itemProps}
|
|
118
|
-
>
|
|
119
|
-
{{
|
|
120
|
-
label: () => (
|
|
121
|
-
<NText depth={props.readonly ? 3 : 2} style="display: inline-flex; align-items: flex-start; gap: 1px">
|
|
122
|
-
<span>{toValue(label)}</span>
|
|
123
|
-
{tooltipPlacement === 'icon'
|
|
124
|
-
? (
|
|
125
|
-
<NTooltip>
|
|
126
|
-
{{
|
|
127
|
-
default: () => toValue(tooltip),
|
|
128
|
-
trigger: () => (
|
|
129
|
-
<NButton
|
|
130
|
-
text
|
|
131
|
-
style="font-size: 1.25em; opacity: 0.8"
|
|
132
|
-
>
|
|
133
|
-
<NIcon>
|
|
134
|
-
<IHelp />
|
|
135
|
-
</NIcon>
|
|
136
|
-
</NButton>
|
|
137
|
-
),
|
|
138
|
-
}}
|
|
139
|
-
</NTooltip>
|
|
140
|
-
)
|
|
141
|
-
: undefined}
|
|
142
|
-
{props.showColon && showColon !== false
|
|
143
|
-
? <span style="place-self: center">:</span>
|
|
144
|
-
: undefined}
|
|
145
|
-
</NText>
|
|
146
|
-
),
|
|
147
|
-
default: () => {
|
|
148
|
-
const vnode = (
|
|
149
|
-
<div style="width: 100%; font-size: calc(1rem - 2px); min-height: 32px; display: flex; align-items: center">
|
|
150
|
-
{render({ disabled: props.disabled, size: props.size, readonly: props.readonly })}
|
|
151
|
-
</div>
|
|
152
|
-
)
|
|
153
|
-
const showTooltip = tooltip && tooltipPlacement === 'bottom' && (!props.readonly || showTooltipWhenReadonly)
|
|
154
|
-
|
|
155
|
-
return showTooltip
|
|
156
|
-
? (
|
|
157
|
-
<div
|
|
158
|
-
style="width: 100%; display: flex; flex-direction: column"
|
|
159
|
-
>
|
|
160
|
-
{vnode}
|
|
161
|
-
<NText depth={3} style="font-size: calc(1rem - 3px); margin-top: 6px">{toValue(tooltip)}</NText>
|
|
162
|
-
</div>
|
|
163
|
-
)
|
|
164
|
-
: vnode
|
|
165
|
-
},
|
|
166
|
-
feedback: () => {
|
|
167
|
-
return validation[name]?.errors[0] ?? validation[name]?.warnings[0]
|
|
168
|
-
},
|
|
169
|
-
}}
|
|
170
|
-
</NFormItem>
|
|
171
|
-
)
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
if (props.grid === false) {
|
|
175
|
-
return content
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return (
|
|
179
|
-
<NGi
|
|
180
|
-
key={name}
|
|
181
|
-
offset={offset}
|
|
182
|
-
span={span}
|
|
183
|
-
style={rowSpan ? { gridRowEnd: `span ${rowSpan}` } : undefined}
|
|
184
|
-
>
|
|
185
|
-
{content}
|
|
186
|
-
</NGi>
|
|
187
|
-
)
|
|
188
|
-
})
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
{ showAction === false || (props.readonly === true && !slots.action)
|
|
192
|
-
? undefined
|
|
193
|
-
: (
|
|
194
|
-
<NGi
|
|
195
|
-
key="action"
|
|
196
|
-
span={Number.MAX_SAFE_INTEGER}
|
|
197
|
-
{
|
|
198
|
-
...(typeof props.showAction === 'object' ? props.showAction : {})
|
|
199
|
-
}
|
|
200
|
-
>
|
|
201
|
-
{{
|
|
202
|
-
default: ({ overflow }) => {
|
|
203
|
-
if (slots.action) return slots.action({ cols: cols.value, spans, overflow })
|
|
204
|
-
|
|
205
|
-
return (
|
|
206
|
-
<NFormItem
|
|
207
|
-
label={props.actionAlign === 'start' ? ' ' : undefined}
|
|
208
|
-
showLabel={props.labelPlacement !== 'top'}
|
|
209
|
-
style="padding-top: 16px"
|
|
210
|
-
>
|
|
211
|
-
<NFlex justify={props.actionAlign} align="center">
|
|
212
|
-
{
|
|
213
|
-
props.showSubmitBtn === false
|
|
214
|
-
? undefined
|
|
215
|
-
: (
|
|
216
|
-
<NButton attrType="submit" type={succeeded ? 'success' : 'primary'} disabled={succeeded || props.disabled || props.submitDisabled || loading} loading={loading}>
|
|
217
|
-
{{
|
|
218
|
-
default: () => (succeeded ? successText : submitText) || t('common.page.form.submitText'),
|
|
219
|
-
icon: () => succeeded ? <NIcon><ICheck /></NIcon> : undefined,
|
|
220
|
-
}}
|
|
221
|
-
</NButton>
|
|
222
|
-
)
|
|
223
|
-
}
|
|
224
|
-
{
|
|
225
|
-
props.showResetBtn === false
|
|
226
|
-
? undefined
|
|
227
|
-
: (
|
|
228
|
-
<NButton
|
|
229
|
-
attrType="reset"
|
|
230
|
-
disabled={props.disabled || loading}
|
|
231
|
-
type={props.showCancelBtn ? 'primary' : 'default'}
|
|
232
|
-
secondary={props.showCancelBtn}
|
|
233
|
-
>
|
|
234
|
-
{props.resetText || t('common.page.form.resetText') }
|
|
235
|
-
</NButton>
|
|
236
|
-
)
|
|
237
|
-
}
|
|
238
|
-
{
|
|
239
|
-
props.showCancelBtn === false
|
|
240
|
-
? undefined
|
|
241
|
-
: (
|
|
242
|
-
<NButton attrType="button" disabled={props.disabled || loading} onClick={onCancel}>
|
|
243
|
-
{props.cancelText || t('common.page.form.cancelText') }
|
|
244
|
-
</NButton>
|
|
245
|
-
)
|
|
246
|
-
}
|
|
247
|
-
</NFlex>
|
|
248
|
-
</NFormItem>
|
|
249
|
-
)
|
|
250
|
-
},
|
|
251
|
-
}}
|
|
252
|
-
</NGi>
|
|
253
|
-
)}
|
|
254
|
-
|
|
255
|
-
</>
|
|
256
|
-
)
|
|
257
|
-
} }}
|
|
258
|
-
|
|
259
|
-
</NGrid>
|
|
260
|
-
</NForm>
|
|
261
|
-
)
|
|
262
|
-
}
|
|
263
|
-
},
|
|
264
|
-
})
|