vome-core 0.1.34 → 0.1.36
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/dist/admin/components/vm-group-cascader.vue +3 -6
- package/dist/admin/components/vm-icon-picker.vue +3 -11
- package/dist/admin/components/vm-role-picker.vue +3 -11
- package/dist/admin/config/plugin-dev.js +1 -1
- package/dist/admin/crud/components/vm-color-picker.vue +3 -11
- package/dist/admin/crud/components/vm-date-calendar-panel.vue +506 -0
- package/dist/admin/crud/components/vm-date-picker.vue +25 -30
- package/dist/admin/crud/components/vm-date-range.vue +28 -216
- package/dist/admin/crud/components/vm-datetime-field.vue +249 -0
- package/dist/admin/crud/components/vm-multi-select.vue +1 -1
- package/dist/admin/crud/components/vm-richtext-extensions.js +1 -1
- package/dist/admin/crud/components/vm-select.vue +3 -11
- package/dist/admin/crud/components/vm-tree-select.vue +3 -11
- package/dist/admin/crud/config.js +1 -1
- package/dist/admin/crud/confirm.js +1 -1
- package/dist/admin/crud/dict.js +1 -1
- package/dist/admin/crud/key.js +1 -1
- package/dist/admin/crud/mitt.js +1 -1
- package/dist/admin/crud/plugins.js +1 -1
- package/dist/admin/crud/span.js +1 -1
- package/dist/admin/crud/style.js +1 -1
- package/dist/admin/crud/validate.js +1 -1
- package/dist/admin/crud/vm-search.vue +7 -2
- package/dist/admin/directives/perm.js +1 -1
- package/dist/admin/hooks/useUpload.js +1 -1
- package/dist/admin/lib/browser.js +1 -1
- package/dist/admin/lib/cn.js +1 -1
- package/dist/admin/lib/dialog-float.js +1 -1
- package/dist/admin/lib/export-excel.js +1 -1
- package/dist/admin/lib/import-excel.js +1 -1
- package/dist/admin/lib/json.js +1 -1
- package/dist/admin/lib/menu.js +1 -1
- package/dist/admin/lib/tree.js +1 -1
- package/dist/admin/lib/upload.js +1 -1
- package/dist/admin/lib/video-frame.js +1 -1
- package/dist/index.js +1 -1
- package/dist/server/index.js +1 -1
- package/dist/shared/datetime-picker.d.ts +33 -0
- package/dist/shared/datetime-picker.js +1 -0
- package/dist/shared/excel.js +1 -1
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.js +1 -1
- package/dist/shared/locale-json.js +1 -1
- package/dist/shared/tree.js +1 -1
- package/package.json +1 -1
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
:
|
|
5
|
-
:
|
|
2
|
+
<VmDatetimeField
|
|
3
|
+
:model-value="inner"
|
|
4
|
+
:precision="precision"
|
|
5
|
+
:placeholder="placeholderText"
|
|
6
6
|
:disabled="disabled"
|
|
7
7
|
:style="{ width }"
|
|
8
|
-
@
|
|
8
|
+
@update:model-value="onUpdate"
|
|
9
|
+
@change="onUpdate"
|
|
9
10
|
/>
|
|
10
11
|
</template>
|
|
11
12
|
|
|
12
13
|
<script setup lang="ts">
|
|
13
14
|
import { computed } from 'vue'
|
|
14
15
|
import { useCrud } from '../useCrud'
|
|
16
|
+
import VmDatetimeField from './vm-datetime-field.vue'
|
|
15
17
|
|
|
16
18
|
defineOptions({ name: 'vm-date-picker' })
|
|
17
19
|
|
|
@@ -24,6 +26,7 @@ const props = withDefaults(
|
|
|
24
26
|
width?: string
|
|
25
27
|
disabled?: boolean
|
|
26
28
|
refreshOnChange?: boolean
|
|
29
|
+
placeholder?: string
|
|
27
30
|
}>(),
|
|
28
31
|
{
|
|
29
32
|
type: 'date',
|
|
@@ -39,37 +42,29 @@ const emit = defineEmits<{
|
|
|
39
42
|
|
|
40
43
|
const crud = useCrud()
|
|
41
44
|
|
|
42
|
-
const
|
|
43
|
-
if (props.type === 'datetime') return '
|
|
45
|
+
const precision = computed(() => {
|
|
46
|
+
if (props.type === 'datetime') return 'minute'
|
|
44
47
|
if (props.type === 'month') return 'month'
|
|
45
|
-
return '
|
|
48
|
+
if (props.type === 'year') return 'year'
|
|
49
|
+
return 'day'
|
|
46
50
|
})
|
|
47
51
|
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
if (props.type === 'datetime'
|
|
51
|
-
return
|
|
52
|
+
const placeholderText = computed(() => {
|
|
53
|
+
if (props.placeholder) return props.placeholder
|
|
54
|
+
if (props.type === 'datetime') return '选择日期时间'
|
|
55
|
+
if (props.type === 'month') return '选择月份'
|
|
56
|
+
if (props.type === 'year') return '选择年份'
|
|
57
|
+
return '选择日期'
|
|
52
58
|
})
|
|
53
59
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
emit('
|
|
60
|
+
const inner = computed(() => props.modelValue || null)
|
|
61
|
+
|
|
62
|
+
function onUpdate(v: string | null) {
|
|
63
|
+
const out = v || ''
|
|
64
|
+
emit('update:modelValue', out)
|
|
65
|
+
emit('change', out)
|
|
59
66
|
if (props.prop && props.refreshOnChange) {
|
|
60
|
-
crud.refresh({ page: 1, [props.prop]:
|
|
67
|
+
crud.refresh({ page: 1, [props.prop]: out || undefined })
|
|
61
68
|
}
|
|
62
69
|
}
|
|
63
70
|
</script>
|
|
64
|
-
|
|
65
|
-
<style lang="scss" scoped>
|
|
66
|
-
.vm-date-picker {
|
|
67
|
-
height: var(--vm-control-height);
|
|
68
|
-
padding: 0 var(--vm-control-padding-x);
|
|
69
|
-
border: 1px solid var(--border);
|
|
70
|
-
border-radius: var(--vm-control-radius);
|
|
71
|
-
background: var(--card);
|
|
72
|
-
color: var(--foreground);
|
|
73
|
-
font-size: 13px;
|
|
74
|
-
}
|
|
75
|
-
</style>
|
|
@@ -1,53 +1,34 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="vm-date-range" :class="{ 'is-disabled': disabled }">
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
:type="inputType"
|
|
14
|
-
:step="step"
|
|
15
|
-
:disabled="disabled"
|
|
16
|
-
:value="display(0)"
|
|
17
|
-
@click.stop="open(0)"
|
|
18
|
-
@change="(e) => set(0, e)"
|
|
19
|
-
/>
|
|
20
|
-
</div>
|
|
21
|
-
<i class="ri-calendar-line vm-date-range__icon" aria-hidden="true" />
|
|
22
|
-
</div>
|
|
3
|
+
<VmDatetimeField
|
|
4
|
+
class="vm-date-range__field"
|
|
5
|
+
embedded
|
|
6
|
+
:model-value="props.modelValue?.[0] ?? null"
|
|
7
|
+
:precision="precision"
|
|
8
|
+
:placeholder="startPlaceholder"
|
|
9
|
+
:disabled="disabled"
|
|
10
|
+
@update:model-value="(v) => set(0, v)"
|
|
11
|
+
@change="(v) => set(0, v)"
|
|
12
|
+
/>
|
|
23
13
|
<span class="vm-date-range__sep">-</span>
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
:type="inputType"
|
|
35
|
-
:step="step"
|
|
36
|
-
:disabled="disabled"
|
|
37
|
-
:value="display(1)"
|
|
38
|
-
@click.stop="open(1)"
|
|
39
|
-
@change="(e) => set(1, e)"
|
|
40
|
-
/>
|
|
41
|
-
</div>
|
|
42
|
-
<i class="ri-calendar-line vm-date-range__icon" aria-hidden="true" />
|
|
43
|
-
</div>
|
|
14
|
+
<VmDatetimeField
|
|
15
|
+
class="vm-date-range__field"
|
|
16
|
+
embedded
|
|
17
|
+
:model-value="props.modelValue?.[1] ?? null"
|
|
18
|
+
:precision="precision"
|
|
19
|
+
:placeholder="endPlaceholder"
|
|
20
|
+
:disabled="disabled"
|
|
21
|
+
@update:model-value="(v) => set(1, v)"
|
|
22
|
+
@change="(v) => set(1, v)"
|
|
23
|
+
/>
|
|
44
24
|
</div>
|
|
45
25
|
</template>
|
|
46
26
|
|
|
47
27
|
<script setup lang="ts">
|
|
48
|
-
import { ref, computed } from 'vue'
|
|
49
28
|
defineOptions({ name: 'vm-date-range' })
|
|
50
29
|
|
|
30
|
+
import VmDatetimeField from './vm-datetime-field.vue'
|
|
31
|
+
|
|
51
32
|
const props = withDefaults(
|
|
52
33
|
defineProps<{
|
|
53
34
|
modelValue?: Array<string | null>
|
|
@@ -69,76 +50,12 @@ const emit = defineEmits<{
|
|
|
69
50
|
change: [v: Array<string | null>]
|
|
70
51
|
}>()
|
|
71
52
|
|
|
72
|
-
|
|
73
|
-
const endEl = ref<HTMLInputElement | null>(null)
|
|
74
|
-
|
|
75
|
-
const inputType = computed(() => {
|
|
76
|
-
const p = props.precision
|
|
77
|
-
if (p === 'year') return 'number'
|
|
78
|
-
if (p === 'month') return 'month'
|
|
79
|
-
if (p === 'day') return 'date'
|
|
80
|
-
return 'datetime-local'
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
const step = computed(() => {
|
|
84
|
-
const p = props.precision
|
|
85
|
-
if (p === 'hour') return 3600
|
|
86
|
-
if (p === 'minute') return 60
|
|
87
|
-
if (p === 'second') return 1
|
|
88
|
-
if (p === 'year') return 1
|
|
89
|
-
return undefined
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
function toApi(raw: string): string | null {
|
|
93
|
-
if (!raw) return null
|
|
94
|
-
const p = props.precision
|
|
95
|
-
if (p === 'year') return raw
|
|
96
|
-
if (p === 'month' || p === 'day') return raw
|
|
97
|
-
let v = raw.replace('T', ' ')
|
|
98
|
-
if (p === 'hour') {
|
|
99
|
-
v = v.length >= 13 ? `${v.slice(0, 13)}:00:00` : `${v}:00:00`
|
|
100
|
-
} else if (p === 'minute') {
|
|
101
|
-
v = v.length >= 16 ? `${v.slice(0, 16)}:00` : `${v}:00`
|
|
102
|
-
} else if (v.length === 16) {
|
|
103
|
-
v = `${v}:00`
|
|
104
|
-
}
|
|
105
|
-
return v
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function toInput(api: string | null | undefined): string {
|
|
109
|
-
if (!api) return ''
|
|
110
|
-
const p = props.precision
|
|
111
|
-
if (p === 'year' || p === 'month' || p === 'day') {
|
|
112
|
-
return String(api).slice(0, p === 'year' ? 4 : p === 'month' ? 7 : 10)
|
|
113
|
-
}
|
|
114
|
-
const s = String(api).replace(' ', 'T')
|
|
115
|
-
if (p === 'hour') return s.slice(0, 13)
|
|
116
|
-
if (p === 'minute') return s.slice(0, 16)
|
|
117
|
-
return s.slice(0, 19)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function display(idx: 0 | 1) {
|
|
121
|
-
return toInput(props.modelValue?.[idx] ?? null)
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function open(idx: 0 | 1) {
|
|
125
|
-
if (props.disabled) return
|
|
126
|
-
const el = idx === 0 ? startEl.value : endEl.value
|
|
127
|
-
if (!el) return
|
|
128
|
-
try {
|
|
129
|
-
el.showPicker?.()
|
|
130
|
-
} catch {
|
|
131
|
-
el.focus()
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function set(idx: 0 | 1, e: Event) {
|
|
136
|
-
const raw = (e.target as HTMLInputElement).value
|
|
53
|
+
function set(idx: 0 | 1, v: string | null) {
|
|
137
54
|
const next: Array<string | null> = [
|
|
138
55
|
props.modelValue?.[0] ?? null,
|
|
139
56
|
props.modelValue?.[1] ?? null,
|
|
140
57
|
]
|
|
141
|
-
next[idx] =
|
|
58
|
+
next[idx] = v
|
|
142
59
|
emit('update:modelValue', next)
|
|
143
60
|
emit('change', next)
|
|
144
61
|
}
|
|
@@ -162,128 +79,23 @@ function set(idx: 0 | 1, e: Event) {
|
|
|
162
79
|
pointer-events: none;
|
|
163
80
|
}
|
|
164
81
|
|
|
165
|
-
|
|
82
|
+
/* 整条一起激活:含任一侧打开日历(子组件 class 须 :deep) */
|
|
83
|
+
&:focus-within,
|
|
84
|
+
&:has(:deep(.is-open)) {
|
|
166
85
|
border-color: var(--focus-border);
|
|
167
86
|
}
|
|
168
87
|
}
|
|
169
88
|
|
|
170
|
-
.vm-date-range__side {
|
|
171
|
-
display: flex;
|
|
172
|
-
min-width: 0;
|
|
173
|
-
flex: 1 1 0;
|
|
174
|
-
height: 100%;
|
|
175
|
-
align-items: center;
|
|
176
|
-
gap: 6px;
|
|
177
|
-
cursor: pointer;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
89
|
.vm-date-range__field {
|
|
181
|
-
position: relative;
|
|
182
|
-
display: flex;
|
|
183
|
-
min-width: 0;
|
|
184
90
|
flex: 1 1 0;
|
|
185
|
-
height: 100%;
|
|
186
|
-
align-items: center;
|
|
187
|
-
justify-content: center;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.vm-date-range__ph {
|
|
191
|
-
position: absolute;
|
|
192
|
-
z-index: 0;
|
|
193
|
-
left: 50%;
|
|
194
|
-
max-width: 100%;
|
|
195
|
-
overflow: hidden;
|
|
196
|
-
color: var(--muted-foreground);
|
|
197
|
-
font-size: 12px;
|
|
198
|
-
text-align: center;
|
|
199
|
-
text-overflow: ellipsis;
|
|
200
|
-
white-space: nowrap;
|
|
201
|
-
pointer-events: none;
|
|
202
|
-
transform: translateX(-50%);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.vm-date-range__icon {
|
|
206
|
-
display: inline-flex;
|
|
207
|
-
flex: 0 0 auto;
|
|
208
|
-
width: 14px;
|
|
209
|
-
height: 14px;
|
|
210
|
-
align-items: center;
|
|
211
|
-
justify-content: center;
|
|
212
|
-
color: var(--muted-foreground);
|
|
213
|
-
font-size: 14px;
|
|
214
|
-
line-height: 1;
|
|
215
|
-
pointer-events: none;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
.vm-date-range__input {
|
|
219
|
-
position: relative;
|
|
220
|
-
z-index: 1;
|
|
221
|
-
box-sizing: border-box;
|
|
222
|
-
width: 100%;
|
|
223
91
|
min-width: 0;
|
|
224
92
|
height: 100%;
|
|
225
|
-
padding: 0;
|
|
226
|
-
border: none;
|
|
227
|
-
background: transparent !important;
|
|
228
|
-
color: var(--foreground);
|
|
229
|
-
font-size: 12px;
|
|
230
|
-
text-align: center;
|
|
231
|
-
outline: none;
|
|
232
|
-
cursor: pointer;
|
|
233
|
-
appearance: textfield;
|
|
234
|
-
color-scheme: inherit;
|
|
235
|
-
|
|
236
|
-
&::-webkit-datetime-edit {
|
|
237
|
-
width: 100%;
|
|
238
|
-
padding: 0;
|
|
239
|
-
text-align: center;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
&::-webkit-datetime-edit-fields-wrapper {
|
|
243
|
-
display: flex;
|
|
244
|
-
width: 100%;
|
|
245
|
-
justify-content: center;
|
|
246
|
-
padding: 0;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
&::-webkit-date-and-time-value {
|
|
250
|
-
margin: 0 auto;
|
|
251
|
-
text-align: center;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
&.is-empty {
|
|
255
|
-
color: transparent;
|
|
256
|
-
|
|
257
|
-
&::-webkit-datetime-edit,
|
|
258
|
-
&::-webkit-datetime-edit-fields-wrapper,
|
|
259
|
-
&::-webkit-datetime-edit-text,
|
|
260
|
-
&::-webkit-datetime-edit-year-field,
|
|
261
|
-
&::-webkit-datetime-edit-month-field,
|
|
262
|
-
&::-webkit-datetime-edit-day-field,
|
|
263
|
-
&::-webkit-datetime-edit-hour-field,
|
|
264
|
-
&::-webkit-datetime-edit-minute-field,
|
|
265
|
-
&::-webkit-datetime-edit-second-field,
|
|
266
|
-
&::-webkit-datetime-edit-ampm-field {
|
|
267
|
-
color: transparent;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
&::-webkit-calendar-picker-indicator {
|
|
272
|
-
position: absolute;
|
|
273
|
-
inset: 0;
|
|
274
|
-
width: 100%;
|
|
275
|
-
height: 100%;
|
|
276
|
-
margin: 0;
|
|
277
|
-
padding: 0;
|
|
278
|
-
cursor: pointer;
|
|
279
|
-
opacity: 0;
|
|
280
|
-
}
|
|
281
93
|
}
|
|
282
94
|
|
|
283
95
|
.vm-date-range__sep {
|
|
284
96
|
flex: 0 0 auto;
|
|
285
97
|
padding: 0 8px;
|
|
286
|
-
color: var(--muted-foreground);
|
|
98
|
+
color: var(--muted-foreground, #94a3b8);
|
|
287
99
|
font-size: 13px;
|
|
288
100
|
font-weight: 600;
|
|
289
101
|
line-height: 1;
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="rootRef"
|
|
4
|
+
class="vm-dt-field"
|
|
5
|
+
:class="{
|
|
6
|
+
'is-disabled': disabled,
|
|
7
|
+
'is-open': open,
|
|
8
|
+
'is-embedded': embedded,
|
|
9
|
+
}"
|
|
10
|
+
@click="onRootClick"
|
|
11
|
+
>
|
|
12
|
+
<div class="vm-dt-field__side">
|
|
13
|
+
<div class="vm-dt-field__box">
|
|
14
|
+
<span v-if="!displayText && placeholder" class="vm-dt-field__ph">{{
|
|
15
|
+
placeholder
|
|
16
|
+
}}</span>
|
|
17
|
+
<span class="vm-dt-field__val">{{ displayText }}</span>
|
|
18
|
+
</div>
|
|
19
|
+
<i class="ri-calendar-line vm-dt-field__icon" aria-hidden="true" />
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<Teleport to="body">
|
|
23
|
+
<div
|
|
24
|
+
v-if="open"
|
|
25
|
+
ref="panelWrapRef"
|
|
26
|
+
class="vm-dt-field__panel-wrap"
|
|
27
|
+
:style="panelStyle"
|
|
28
|
+
@pointerdown.stop
|
|
29
|
+
@mousedown.stop
|
|
30
|
+
>
|
|
31
|
+
<VmDateCalendarPanel
|
|
32
|
+
:model-value="modelValue"
|
|
33
|
+
:precision="precision"
|
|
34
|
+
@update:model-value="onPick"
|
|
35
|
+
@clear="onClear"
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
</Teleport>
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script setup lang="ts">
|
|
43
|
+
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
|
44
|
+
import VmDateCalendarPanel from './vm-date-calendar-panel.vue'
|
|
45
|
+
import {
|
|
46
|
+
dateTimeDisplayText,
|
|
47
|
+
normalizeDateTimePrecision,
|
|
48
|
+
type DateTimePrecision,
|
|
49
|
+
} from '../../../shared/datetime-picker'
|
|
50
|
+
|
|
51
|
+
defineOptions({ name: 'vm-datetime-field' })
|
|
52
|
+
|
|
53
|
+
const props = withDefaults(
|
|
54
|
+
defineProps<{
|
|
55
|
+
modelValue?: string | null
|
|
56
|
+
precision?: DateTimePrecision | string
|
|
57
|
+
placeholder?: string
|
|
58
|
+
disabled?: boolean
|
|
59
|
+
/** 嵌在范围条内:无独立底/边框,激活态由外层统一画 */
|
|
60
|
+
embedded?: boolean
|
|
61
|
+
}>(),
|
|
62
|
+
{
|
|
63
|
+
modelValue: null,
|
|
64
|
+
precision: 'day',
|
|
65
|
+
placeholder: '选择日期时间',
|
|
66
|
+
disabled: false,
|
|
67
|
+
embedded: false,
|
|
68
|
+
},
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
const emit = defineEmits<{
|
|
72
|
+
'update:modelValue': [v: string | null]
|
|
73
|
+
change: [v: string | null]
|
|
74
|
+
}>()
|
|
75
|
+
|
|
76
|
+
const rootRef = ref<HTMLElement | null>(null)
|
|
77
|
+
const panelWrapRef = ref<HTMLElement | null>(null)
|
|
78
|
+
const open = ref(false)
|
|
79
|
+
const panelStyle = ref<Record<string, string>>({})
|
|
80
|
+
|
|
81
|
+
const precision = computed(() => normalizeDateTimePrecision(props.precision))
|
|
82
|
+
|
|
83
|
+
const displayText = computed(() =>
|
|
84
|
+
dateTimeDisplayText(props.modelValue, precision.value),
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
function syncPanelPos() {
|
|
88
|
+
// 范围条:弹层贴整条外框左侧 + 底边
|
|
89
|
+
const el =
|
|
90
|
+
(props.embedded
|
|
91
|
+
? (rootRef.value?.closest('.vm-date-range') as HTMLElement | null)
|
|
92
|
+
: null) || rootRef.value
|
|
93
|
+
if (!el) return
|
|
94
|
+
const r = el.getBoundingClientRect()
|
|
95
|
+
panelStyle.value = {
|
|
96
|
+
position: 'fixed',
|
|
97
|
+
left: `${r.left}px`,
|
|
98
|
+
top: `${r.bottom + 2}px`,
|
|
99
|
+
zIndex: '10050',
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function close() {
|
|
104
|
+
open.value = false
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function openPanel() {
|
|
108
|
+
if (props.disabled) return
|
|
109
|
+
open.value = true
|
|
110
|
+
syncPanelPos()
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function onRootClick() {
|
|
114
|
+
if (props.disabled) return
|
|
115
|
+
if (open.value) close()
|
|
116
|
+
else openPanel()
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function onPick(v: string) {
|
|
120
|
+
emit('update:modelValue', v)
|
|
121
|
+
emit('change', v)
|
|
122
|
+
if (
|
|
123
|
+
precision.value === 'day' ||
|
|
124
|
+
precision.value === 'month' ||
|
|
125
|
+
precision.value === 'year'
|
|
126
|
+
) {
|
|
127
|
+
close()
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function onClear() {
|
|
132
|
+
emit('update:modelValue', null)
|
|
133
|
+
emit('change', null)
|
|
134
|
+
close()
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function onDocPointer(e: PointerEvent) {
|
|
138
|
+
if (!open.value) return
|
|
139
|
+
const t = e.target as Node
|
|
140
|
+
if (rootRef.value?.contains(t) || panelWrapRef.value?.contains(t)) return
|
|
141
|
+
close()
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function onViewportChange() {
|
|
145
|
+
if (open.value) syncPanelPos()
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
watch(open, (v) => {
|
|
149
|
+
if (v) syncPanelPos()
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
onMounted(() => {
|
|
153
|
+
document.addEventListener('pointerdown', onDocPointer, true)
|
|
154
|
+
window.addEventListener('resize', onViewportChange)
|
|
155
|
+
window.addEventListener('scroll', onViewportChange, true)
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
onBeforeUnmount(() => {
|
|
159
|
+
document.removeEventListener('pointerdown', onDocPointer, true)
|
|
160
|
+
window.removeEventListener('resize', onViewportChange)
|
|
161
|
+
window.removeEventListener('scroll', onViewportChange, true)
|
|
162
|
+
})
|
|
163
|
+
</script>
|
|
164
|
+
|
|
165
|
+
<style lang="scss" scoped>
|
|
166
|
+
.vm-dt-field {
|
|
167
|
+
box-sizing: border-box;
|
|
168
|
+
width: 100%;
|
|
169
|
+
height: var(--vm-control-height, 38px);
|
|
170
|
+
border: 1px solid transparent;
|
|
171
|
+
border-radius: 12px;
|
|
172
|
+
background: var(--muted, #f4f6fb);
|
|
173
|
+
cursor: pointer;
|
|
174
|
+
transition: border-color 0.15s ease;
|
|
175
|
+
|
|
176
|
+
&.is-open,
|
|
177
|
+
&:focus-within {
|
|
178
|
+
border-color: var(--focus-border, var(--primary, #4e5dff));
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
&.is-embedded {
|
|
182
|
+
border: 0;
|
|
183
|
+
border-radius: 0;
|
|
184
|
+
background: transparent;
|
|
185
|
+
|
|
186
|
+
&.is-open,
|
|
187
|
+
&:focus-within {
|
|
188
|
+
border-color: transparent;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
&.is-disabled {
|
|
193
|
+
opacity: 0.55;
|
|
194
|
+
pointer-events: none;
|
|
195
|
+
cursor: not-allowed;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.vm-dt-field__side {
|
|
200
|
+
display: flex;
|
|
201
|
+
height: 100%;
|
|
202
|
+
align-items: center;
|
|
203
|
+
gap: 6px;
|
|
204
|
+
padding: 0 10px;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.vm-dt-field.is-embedded .vm-dt-field__side {
|
|
208
|
+
padding: 0;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.vm-dt-field__box {
|
|
212
|
+
position: relative;
|
|
213
|
+
display: flex;
|
|
214
|
+
flex: 1 1 auto;
|
|
215
|
+
height: 100%;
|
|
216
|
+
min-width: 0;
|
|
217
|
+
align-items: center;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.vm-dt-field__ph {
|
|
221
|
+
position: absolute;
|
|
222
|
+
right: 0;
|
|
223
|
+
left: 0;
|
|
224
|
+
overflow: hidden;
|
|
225
|
+
color: var(--muted-foreground, #94a3b8);
|
|
226
|
+
font-size: inherit;
|
|
227
|
+
text-overflow: ellipsis;
|
|
228
|
+
white-space: nowrap;
|
|
229
|
+
pointer-events: none;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.vm-dt-field__val {
|
|
233
|
+
position: relative;
|
|
234
|
+
z-index: 1;
|
|
235
|
+
overflow: hidden;
|
|
236
|
+
color: var(--foreground, #1f2937);
|
|
237
|
+
font-size: inherit;
|
|
238
|
+
text-overflow: ellipsis;
|
|
239
|
+
white-space: nowrap;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.vm-dt-field__icon {
|
|
243
|
+
flex: none;
|
|
244
|
+
color: var(--muted-foreground, #94a3b8);
|
|
245
|
+
font-size: 16px;
|
|
246
|
+
line-height: 1;
|
|
247
|
+
pointer-events: none;
|
|
248
|
+
}
|
|
249
|
+
</style>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x458bd5=_0xb0a0;(function(_0x4d050a,_0x26e0cf){const _0x3dcd1f=_0xb0a0,_0x21ecbf=_0x4d050a();while(!![]){try{const _0x896c8c=-parseInt(_0x3dcd1f(0xe9))/0x1+parseInt(_0x3dcd1f(0xe4))/0x2*(-parseInt(_0x3dcd1f(0xe2))/0x3)+-parseInt(_0x3dcd1f(0xec))/0x4+-parseInt(_0x3dcd1f(0xe8))/0x5+parseInt(_0x3dcd1f(0xe5))/0x6*(-parseInt(_0x3dcd1f(0xea))/0x7)+-parseInt(_0x3dcd1f(0xe1))/0x8+parseInt(_0x3dcd1f(0xe6))/0x9;if(_0x896c8c===_0x26e0cf)break;else _0x21ecbf['push'](_0x21ecbf['shift']());}catch(_0x3248bd){_0x21ecbf['push'](_0x21ecbf['shift']());}}}(_0x3d53,0xba028));import{Node,mergeAttributes}from'@tiptap/core';export const VmRichtextVideo=Node[_0x458bd5(0xeb)]({'name':_0x458bd5(0xe7),'group':'block','atom':!![],'selectable':!![],'draggable':!![],'addAttributes'(){return{'src':{'default':null},'controls':{'default':!![]}};},'parseHTML'(){return[{'tag':'video[src]'}];},'renderHTML'({HTMLAttributes:_0x3c65b7}){const _0x2c1fd1=_0x458bd5;return[_0x2c1fd1(0xe7),mergeAttributes(_0x3c65b7,{'controls':!![],'style':_0x2c1fd1(0xed)})];},'addCommands'(){const _0x328847=_0x458bd5;return{'setVideo':_0x171e89=>({commands:_0x203e3e})=>_0x203e3e[_0x328847(0xe3)]({'type':this['name'],'attrs':_0x171e89})};}});function _0xb0a0(_0x582bb8,_0x33d878){_0x582bb8=_0x582bb8-0xe1;const _0x3d5328=_0x3d53();let _0xb0a0da=_0x3d5328[_0x582bb8];if(_0xb0a0['SmhWfO']===undefined){var _0x36e5ff=function(_0x101ec5){const _0x2871d1='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3c65b7='',_0x171e89='';for(let _0x203e3e=0x0,_0x4623b4,_0x1a4f56,_0x4172d2=0x0;_0x1a4f56=_0x101ec5['charAt'](_0x4172d2++);~_0x1a4f56&&(_0x4623b4=_0x203e3e%0x4?_0x4623b4*0x40+_0x1a4f56:_0x1a4f56,_0x203e3e++%0x4)?_0x3c65b7+=String['fromCharCode'](0xff&_0x4623b4>>(-0x2*_0x203e3e&0x6)):0x0){_0x1a4f56=_0x2871d1['indexOf'](_0x1a4f56);}for(let _0x2930b9=0x0,_0x270864=_0x3c65b7['length'];_0x2930b9<_0x270864;_0x2930b9++){_0x171e89+='%'+('00'+_0x3c65b7['charCodeAt'](_0x2930b9)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x171e89);};_0xb0a0['lyFZCt']=_0x36e5ff,_0xb0a0['ejOyUG']={},_0xb0a0['SmhWfO']=!![];}const _0xf87f07=_0x3d5328[0x0],_0x27738b=_0x582bb8+_0xf87f07,_0x5f2f9d=_0xb0a0['ejOyUG'][_0x27738b];return!_0x5f2f9d?(_0xb0a0da=_0xb0a0['lyFZCt'](_0xb0a0da),_0xb0a0['ejOyUG'][_0x27738b]=_0xb0a0da):_0xb0a0da=_0x5f2f9d,_0xb0a0da;}export const VM_RICHTEXT_EMOJIS=['\uD83D\uDE00','\uD83D\uDE03','\uD83D\uDE04','\uD83D\uDE01','\uD83D\uDE06','\uD83D\uDE05','\uD83E\uDD23','\uD83D\uDE02','\uD83D\uDE42','\uD83D\uDE43','\uD83D\uDE09','\uD83D\uDE0A','\uD83D\uDE07','\uD83E\uDD70','\uD83D\uDE0D','\uD83E\uDD29','\uD83D\uDE18','\uD83D\uDE17','\uD83D\uDE1A','\uD83D\uDE19','\uD83D\uDE0B','\uD83D\uDE1B','\uD83D\uDE1C','\uD83E\uDD2A','\uD83D\uDE1D','\uD83E\uDD11','\uD83E\uDD17','\uD83E\uDD2D','\uD83E\uDD2B','\uD83E\uDD14','\uD83E\uDD10','\uD83E\uDD28','\uD83D\uDE10','\uD83D\uDE11','\uD83D\uDE36','\uD83D\uDE0F','\uD83D\uDE12','\uD83D\uDE44','\uD83D\uDE2C','\uD83E\uDD25','\uD83D\uDE0C','\uD83D\uDE14','\uD83D\uDE2A','\uD83E\uDD24','\uD83D\uDE34','\uD83D\uDE37','\uD83E\uDD12','\uD83E\uDD15','\uD83E\uDD22','\uD83E\uDD2E','\uD83E\uDD75','\uD83E\uDD76','\uD83E\uDD74','\uD83D\uDE35','\uD83E\uDD2F','\uD83E\uDD20','\uD83E\uDD73','\uD83D\uDE0E','\uD83E\uDD13','\uD83E\uDDD0','\uD83D\uDE15','\uD83D\uDE1F','\uD83D\uDE41','☹️','\uD83D\uDE2E','\uD83D\uDE2F','\uD83D\uDE32','\uD83D\uDE33','\uD83E\uDD7A','\uD83D\uDE26','\uD83D\uDE27','\uD83D\uDE28','\uD83D\uDE30','\uD83D\uDE25','\uD83D\uDE22','\uD83D\uDE2D','\uD83D\uDE31','\uD83D\uDE16','\uD83D\uDE23','\uD83D\uDE1E','\uD83D\uDE13','\uD83D\uDE29','\uD83D\uDE2B','\uD83E\uDD71','\uD83D\uDE24','\uD83D\uDE21','\uD83D\uDE20','\uD83E\uDD2C','\uD83D\uDE08','\uD83D\uDC7F','\uD83D\uDC4B','\uD83E\uDD1A','\uD83D\uDD90','✋','\uD83D\uDD96','\uD83D\uDC4C','\uD83E\uDD0C','\uD83E\uDD0F','✌️','\uD83E\uDD1E','\uD83E\uDD1F','\uD83E\uDD18','\uD83E\uDD19','\uD83D\uDC48','\uD83D\uDC49','\uD83D\uDC46','\uD83D\uDD95','\uD83D\uDC47','☝️','\uD83D\uDC4D','\uD83D\uDC4E','✊','\uD83D\uDC4A','\uD83E\uDD1B','\uD83E\uDD1C','\uD83D\uDC4F','\uD83D\uDE4C','\uD83D\uDC50','\uD83E\uDD32','\uD83E\uDD1D','\uD83D\uDE4F','\uD83D\uDCAA','\uD83E\uDDBE','✍️','\uD83D\uDC85','\uD83E\uDD33','❤️','\uD83E\uDDE1','\uD83D\uDC9B','\uD83D\uDC9A','\uD83D\uDC99','\uD83D\uDC9C','\uD83D\uDDA4','\uD83E\uDD0D','\uD83E\uDD0E','\uD83D\uDC94','❣️','\uD83D\uDC95','\uD83D\uDC9E','\uD83D\uDC93','\uD83D\uDC97','\uD83D\uDC96','\uD83D\uDC98','\uD83D\uDC9D','\uD83D\uDC9F','☮️','✝️','☪️','\uD83D\uDD49','☸️','✡️','\uD83D\uDD2F','\uD83D\uDD4E','☯️','☦️','\uD83D\uDED0','⭐','\uD83C\uDF1F','✨','⚡','\uD83D\uDD25','\uD83D\uDCA5','☀️','\uD83C\uDF19','⭐️','\uD83C\uDF08','✅','❌','⭕','❗','❓','‼️','⁉️','\uD83D\uDCAF','\uD83D\uDD14','\uD83D\uDD15','\uD83D\uDCCC','\uD83D\uDCCD','\uD83D\uDCCE','\uD83D\uDD17','\uD83D\uDD12','\uD83D\uDD13','\uD83D\uDD11','\uD83D\uDDDD','\uD83D\uDCA1','\uD83D\uDD26','\uD83D\uDCDD','✏️','✒️','\uD83D\uDD8A','\uD83D\uDD8B','\uD83D\uDD8C','\uD83D\uDD8D','\uD83D\uDCBC','\uD83D\uDCC1','\uD83D\uDCC2','\uD83D\uDCC5','\uD83D\uDCC6','\uD83D\uDDD3','\uD83D\uDCC7','\uD83D\uDCC8','\uD83D\uDCC9','\uD83D\uDCCA','\uD83D\uDCCB','\uD83D\uDCE4','\uD83D\uDCE5','\uD83D\uDCE6','\uD83D\uDCEB','\uD83D\uDCEC','\uD83D\uDCED','\uD83D\uDCEE','\uD83D\uDCEF','\uD83D\uDCDC','\uD83D\uDCC3','\uD83D\uDCC4','\uD83D\uDCD1','☕','\uD83C\uDF75','\uD83E\uDDC3','\uD83E\uDD64','\uD83E\uDDCB','\uD83C\uDF7A','\uD83C\uDF7B','\uD83E\uDD42','\uD83C\uDF77','\uD83C\uDF78','\uD83C\uDF55','\uD83C\uDF54','\uD83C\uDF5F','\uD83C\uDF2D','\uD83C\uDF7F','\uD83C\uDF69','\uD83C\uDF6A','\uD83C\uDF82','\uD83C\uDF70','\uD83E\uDDC1','\uD83C\uDF4E','\uD83C\uDF4A','\uD83C\uDF4B','\uD83C\uDF4C','\uD83C\uDF49','\uD83C\uDF47','\uD83C\uDF53','\uD83E\uDED0','\uD83C\uDF52','\uD83C\uDF51','⚽','\uD83C\uDFC0','\uD83C\uDFC8','⚾','\uD83C\uDFBE','\uD83C\uDFD0','\uD83C\uDFC9','\uD83C\uDFB1','\uD83C\uDFD3','\uD83C\uDFF8','\uD83C\uDFAE','\uD83D\uDD79','\uD83C\uDFB2','\uD83E\uDDE9','\uD83C\uDFAF','\uD83C\uDFB3','\uD83C\uDFB0','\uD83C\uDFB8','\uD83C\uDFB9','\uD83E\uDD41','\uD83C\uDFA4','\uD83C\uDFA7','\uD83C\uDFAC','\uD83C\uDFA5','\uD83D\uDCF7','\uD83D\uDCF8','\uD83D\uDCF9','\uD83D\uDCFA','\uD83D\uDCFB','\uD83C\uDF99','\uD83D\uDE80','✈️','\uD83D\uDEE9','\uD83D\uDEEB','\uD83D\uDEEC','\uD83D\uDEF0','\uD83D\uDCBA','\uD83D\uDEF8','\uD83D\uDE81','\uD83D\uDEF6','\uD83D\uDE97','\uD83D\uDE95','\uD83D\uDE99','\uD83D\uDE8C','\uD83D\uDE8E','\uD83C\uDFCE','\uD83D\uDE93','\uD83D\uDE91','\uD83D\uDE92','\uD83D\uDE90','\uD83C\uDFE0','\uD83C\uDFE1','\uD83C\uDFE2','\uD83C\uDFE3','\uD83C\uDFE4','\uD83C\uDFE5','\uD83C\uDFE6','\uD83C\uDFE8','\uD83C\uDFE9','\uD83C\uDFEA','\uD83D\uDC36','\uD83D\uDC31','\uD83D\uDC2D','\uD83D\uDC39','\uD83D\uDC30','\uD83E\uDD8A','\uD83D\uDC3B','\uD83D\uDC3C',_0x458bd5(0xee),'\uD83D\uDC28','\uD83D\uDC2F','\uD83E\uDD81','\uD83D\uDC2E','\uD83D\uDC37','\uD83D\uDC38','\uD83D\uDC35','\uD83D\uDE48','\uD83D\uDE49','\uD83D\uDE4A','\uD83D\uDC12','\uD83D\uDC14','\uD83D\uDC27','\uD83D\uDC26','\uD83D\uDC24','\uD83D\uDC23','\uD83D\uDC25','\uD83E\uDD86','\uD83E\uDD85','\uD83E\uDD89','\uD83E\uDD87','\uD83C\uDF89','\uD83C\uDF8A','\uD83C\uDF88','\uD83C\uDF81','\uD83C\uDF80','\uD83C\uDF97','\uD83C\uDFAB','\uD83C\uDF9F','\uD83C\uDFC6','\uD83C\uDFC5'];function _0x3d53(){const _0x267750=['Bwf4lxDPzhrOoJeWmcu7yM9YzgvYlxjHzgL1CZO4ChG','8j+qU+kaJEkDHo+4JW','mtCYmda2neD5r3jnyG','mZiXntq2DevsBvvW','Aw5Zzxj0q29UDgvUDa','mJzLEMHswvC','mtm4v1PRB2L0','mZy1mJeZmZrYCKjSru0','DMLKzw8','mtm4mZe2mfjkwwP1CW','nJGZmJq3CvH5twPw','mtu4mJKXAhDqBxbc','y3jLyxrL','odmWnZeYr2rezerj'];_0x3d53=function(){return _0x267750;};return _0x3d53();}
|