bt-core-app 1.1.8 → 1.2.0
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/bt-core-app.js +20837 -14524
- package/dist/components/BT-Btn.vue.d.ts +41 -0
- package/dist/components/BT-Col.vue.d.ts +49 -0
- package/dist/components/Dialog-Confirm.vue.d.ts +2 -2
- package/dist/components/Dialog-Select-Date.vue.d.ts +2 -2
- package/dist/components/Dialog-Select.vue.d.ts +2 -2
- package/dist/components/Dialog-Text.vue.d.ts +2 -2
- package/dist/composables/actions.d.ts +6 -6
- package/dist/composables/api.d.ts +1 -0
- package/dist/composables/auth.d.ts +1 -0
- package/dist/composables/cosmetics.d.ts +3 -1
- package/dist/composables/dates.d.ts +1 -0
- package/dist/composables/demo.d.ts +1 -0
- package/dist/composables/filters.d.ts +1 -0
- package/dist/composables/list.d.ts +2 -2
- package/dist/composables/navigation.d.ts +1 -0
- package/dist/composables/presets.d.ts +1 -0
- package/dist/composables/pwa.d.ts +1 -0
- package/dist/composables/stores.d.ts +17 -6
- package/dist/index.d.ts +11 -12
- package/dist/style.css +1 -1
- package/dist/useApi.d.ts +0 -30
- package/package.json +2 -1
- package/src/components/BT-Btn.vue +1 -1
- package/src/components/BT-Field-Checkbox.vue +70 -0
- package/src/components/BT-Field-Date.vue +112 -0
- package/src/components/BT-Field-Entity.vue +48 -0
- package/src/components/BT-Field-Select.vue +67 -0
- package/src/components/BT-Field-String.vue +78 -0
- package/src/components/BT-Field-Switch.vue +68 -0
- package/src/components/BT-Field-Tags.vue +66 -0
- package/src/components/BT-Field-Textarea.vue +67 -0
- package/src/components/BT-Field-Trigger.vue +315 -0
- package/src/components/BT-Header-Option.vue +39 -0
- package/src/components/BT-Json.vue +67 -0
- package/src/components/BT-Select-List-Box.vue +258 -0
- package/src/components/BT-Select.vue +46 -0
- package/src/components/BT-Snack.vue +31 -0
- package/src/components/Dialog-Select-Date.vue +1 -1
- package/src/composables/actions.ts +6 -6
- package/src/composables/api.ts +9 -1
- package/src/composables/auth.ts +8 -19
- package/src/composables/cosmetics.ts +27 -28
- package/src/composables/dates.ts +9 -1
- package/src/composables/demo.ts +9 -1
- package/src/composables/filters.ts +9 -1
- package/src/composables/list.ts +6 -3
- package/src/composables/navigation.ts +9 -1
- package/src/composables/presets.ts +9 -1
- package/src/composables/pwa.ts +9 -1
- package/src/composables/stores.ts +32 -11
- package/src/core.ts +49 -16
- package/src/index.ts +12 -12
- package/src/types.ts +5 -1
- package/src/useApi.ts +57 -57
- package/vite.config.ts +6 -2
- package/.vscode/extensions.json +0 -3
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-col
|
|
3
|
+
:lg="mLg"
|
|
4
|
+
:md="mMd"
|
|
5
|
+
:sm="mSm"
|
|
6
|
+
:cols="cols">
|
|
7
|
+
<v-text-field
|
|
8
|
+
v-bind="$attrs"
|
|
9
|
+
:hide-details="!rules"
|
|
10
|
+
:prefix="useCurrency ? '$' : undefined"
|
|
11
|
+
:readonly="!cIsEditing"
|
|
12
|
+
:rules="rules"
|
|
13
|
+
:variant="cIsEditing ? editVariant : variant"
|
|
14
|
+
v-model="value" />
|
|
15
|
+
</v-col>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup lang="ts">
|
|
19
|
+
// import { type BladeDensity } from '../types'
|
|
20
|
+
import { computed, inject, ref } from 'vue'
|
|
21
|
+
// import { useFilters } from '@/composables/filters'
|
|
22
|
+
|
|
23
|
+
defineOptions({
|
|
24
|
+
inheritAttrs: false
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
interface FieldProps {
|
|
28
|
+
cols?: string | boolean
|
|
29
|
+
horizontal?: boolean
|
|
30
|
+
isEditing?: boolean
|
|
31
|
+
isMobile?: boolean
|
|
32
|
+
lg?: string | boolean
|
|
33
|
+
md?: string | boolean
|
|
34
|
+
modelValue: any
|
|
35
|
+
rules?: any
|
|
36
|
+
sm?: string | boolean
|
|
37
|
+
useCurrency?: boolean
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const props = withDefaults(defineProps<FieldProps>(), {
|
|
41
|
+
isEditing: undefined,
|
|
42
|
+
cols: '12',
|
|
43
|
+
lg: false,
|
|
44
|
+
md: false,
|
|
45
|
+
sm: '6'
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const emit = defineEmits(['update:modelValue'])
|
|
49
|
+
|
|
50
|
+
const value = computed({
|
|
51
|
+
get() {
|
|
52
|
+
return props.modelValue
|
|
53
|
+
},
|
|
54
|
+
set(value) {
|
|
55
|
+
emit('update:modelValue', value)
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const mIsEditing = inject('isEditing', () => ref(false), true)
|
|
60
|
+
|
|
61
|
+
const cIsEditing = computed(() => props.isEditing ?? mIsEditing.value)
|
|
62
|
+
const mIsMobile = inject('isMobile', () => ref(false), true)
|
|
63
|
+
const variant = inject('fieldVariant', 'underlined')
|
|
64
|
+
const editVariant = inject('fieldEditVariant', 'outlined')
|
|
65
|
+
|
|
66
|
+
const mLg = computed(() => (props.isMobile ?? mIsMobile.value) ? false : props.lg)
|
|
67
|
+
const mMd = computed(() => (props.isMobile ?? mIsMobile.value) ? false : props.md)
|
|
68
|
+
const mSm = computed(() => (props.isMobile ?? mIsMobile.value) ? false : props.sm)
|
|
69
|
+
// const str: Ref<any> = ref(undefined)
|
|
70
|
+
|
|
71
|
+
// watch(props.modelValue, (v) => { str.value = v })
|
|
72
|
+
|
|
73
|
+
// function update(v: any) {
|
|
74
|
+
// emit('update:modelValue', v)
|
|
75
|
+
// emit('change', v)
|
|
76
|
+
// }
|
|
77
|
+
|
|
78
|
+
</script>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-col
|
|
3
|
+
:lg="mLg"
|
|
4
|
+
:md="mMd"
|
|
5
|
+
:sm="mSm"
|
|
6
|
+
:cols="cols">
|
|
7
|
+
<v-list-item>
|
|
8
|
+
<v-list-item-subtitle>{{ label }}</v-list-item-subtitle>
|
|
9
|
+
<v-list-item-title>{{ modelValue }}</v-list-item-title>
|
|
10
|
+
<template #append>
|
|
11
|
+
<v-switch
|
|
12
|
+
v-bind="$attrs"
|
|
13
|
+
:readonly="!cIsEditing"
|
|
14
|
+
:variant="cIsEditing ? editVariant : variant"
|
|
15
|
+
v-model="value" />
|
|
16
|
+
</template>
|
|
17
|
+
</v-list-item>
|
|
18
|
+
</v-col>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup lang="ts">
|
|
22
|
+
import { computed, inject, ref } from 'vue'
|
|
23
|
+
|
|
24
|
+
defineOptions({
|
|
25
|
+
inheritAttrs: false
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
interface FieldProps {
|
|
29
|
+
cols?: string | boolean
|
|
30
|
+
isEditing?: boolean
|
|
31
|
+
isMobile?: boolean
|
|
32
|
+
label?: string
|
|
33
|
+
lg?: string | boolean
|
|
34
|
+
md?: string | boolean
|
|
35
|
+
modelValue: any
|
|
36
|
+
sm?: string | boolean
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const props = withDefaults(defineProps<FieldProps>(), {
|
|
40
|
+
isEditing: undefined,
|
|
41
|
+
cols: '12',
|
|
42
|
+
lg: false,
|
|
43
|
+
md: false,
|
|
44
|
+
sm: '6'
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
const emit = defineEmits(['update:modelValue'])
|
|
48
|
+
|
|
49
|
+
const value = computed({
|
|
50
|
+
get() {
|
|
51
|
+
return props.modelValue
|
|
52
|
+
},
|
|
53
|
+
set(value) {
|
|
54
|
+
emit('update:modelValue', value)
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
const mIsEditing = inject('isEditing', () => ref(false), true)
|
|
59
|
+
|
|
60
|
+
const cIsEditing = computed(() => props.isEditing ?? mIsEditing.value)
|
|
61
|
+
const mIsMobile = inject('isMobile', () => ref(false), true)
|
|
62
|
+
const variant = inject('fieldVariant', 'underlined')
|
|
63
|
+
const editVariant = inject('fieldEditVariant', 'outlined')
|
|
64
|
+
|
|
65
|
+
const mLg = computed(() => (props.isMobile ?? mIsMobile.value) ? false : props.lg)
|
|
66
|
+
const mMd = computed(() => (props.isMobile ?? mIsMobile.value) ? false : props.md)
|
|
67
|
+
const mSm = computed(() => (props.isMobile ?? mIsMobile.value) ? false : props.sm)
|
|
68
|
+
</script>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-col
|
|
3
|
+
:lg="mLg"
|
|
4
|
+
:md="mMd"
|
|
5
|
+
:sm="mSm"
|
|
6
|
+
:cols="cols">
|
|
7
|
+
<v-combobox
|
|
8
|
+
v-bind="$attrs"
|
|
9
|
+
chips
|
|
10
|
+
:closableChips="cIsEditing"
|
|
11
|
+
multiple
|
|
12
|
+
:readonly="!cIsEditing"
|
|
13
|
+
:variant="cIsEditing ? editVariant : variant"
|
|
14
|
+
v-model="value" />
|
|
15
|
+
</v-col>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup lang="ts">
|
|
19
|
+
import { computed, inject, ref } from 'vue'
|
|
20
|
+
import { isLengthyArray } from '../composables/helpers'
|
|
21
|
+
|
|
22
|
+
defineOptions({
|
|
23
|
+
inheritAttrs: false
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
interface FieldProps {
|
|
27
|
+
cols?: string | boolean
|
|
28
|
+
isEditing?: boolean
|
|
29
|
+
isMobile?: boolean
|
|
30
|
+
lg?: string | boolean
|
|
31
|
+
md?: string | boolean
|
|
32
|
+
modelValue: string | undefined
|
|
33
|
+
rules?: any
|
|
34
|
+
sm?: string | boolean
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const props = withDefaults(defineProps<FieldProps>(), {
|
|
38
|
+
isEditing: undefined,
|
|
39
|
+
cols: '12',
|
|
40
|
+
lg: false,
|
|
41
|
+
md: false,
|
|
42
|
+
sm: '6'
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
const emit = defineEmits(['update:modelValue'])
|
|
46
|
+
|
|
47
|
+
const value = computed({
|
|
48
|
+
get() {
|
|
49
|
+
return props.modelValue?.split(',')
|
|
50
|
+
},
|
|
51
|
+
set(value) {
|
|
52
|
+
emit('update:modelValue', isLengthyArray(value) ? value!.toString() : null)
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
const mIsEditing = inject('isEditing', () => ref(false), true)
|
|
57
|
+
|
|
58
|
+
const cIsEditing = computed(() => props.isEditing ?? mIsEditing.value)
|
|
59
|
+
const mIsMobile = inject('isMobile', () => ref(false), true)
|
|
60
|
+
const variant = inject('fieldVariant', 'underlined')
|
|
61
|
+
const editVariant = inject('fieldEditVariant', 'outlined')
|
|
62
|
+
|
|
63
|
+
const mLg = computed(() => (props.isMobile ?? mIsMobile.value) ? false : props.lg)
|
|
64
|
+
const mMd = computed(() => (props.isMobile ?? mIsMobile.value) ? false : props.md)
|
|
65
|
+
const mSm = computed(() => (props.isMobile ?? mIsMobile.value) ? false : props.sm)
|
|
66
|
+
</script>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-col
|
|
3
|
+
:lg="mLg"
|
|
4
|
+
:md="mMd"
|
|
5
|
+
:sm="mSm"
|
|
6
|
+
:cols="cols">
|
|
7
|
+
<v-textarea
|
|
8
|
+
v-bind="$attrs"
|
|
9
|
+
:readonly="!cIsEditing"
|
|
10
|
+
:rules="rules"
|
|
11
|
+
:variant="cIsEditing ? editVariant : variant"
|
|
12
|
+
v-model="value" />
|
|
13
|
+
</v-col>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
// import { type BladeDensity } from '@/composables/blade'
|
|
18
|
+
import { computed, inject, ref } from 'vue'
|
|
19
|
+
|
|
20
|
+
defineOptions({
|
|
21
|
+
inheritAttrs: false
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
interface FieldProps {
|
|
25
|
+
cols?: string | boolean
|
|
26
|
+
horizontal?: boolean
|
|
27
|
+
isEditing?: boolean
|
|
28
|
+
isMobile?: boolean
|
|
29
|
+
// label: any
|
|
30
|
+
lg?: string | boolean
|
|
31
|
+
md?: string | boolean
|
|
32
|
+
// mode?: 'view' | 'edit' | 'new'
|
|
33
|
+
modelValue: any
|
|
34
|
+
rules?: any
|
|
35
|
+
sm?: string | boolean
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const props = withDefaults(defineProps<FieldProps>(), {
|
|
39
|
+
isEditing: undefined,
|
|
40
|
+
cols: '12',
|
|
41
|
+
lg: false,
|
|
42
|
+
md: false,
|
|
43
|
+
sm: '6'
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const emit = defineEmits(['update:modelValue'])
|
|
47
|
+
|
|
48
|
+
const value = computed({
|
|
49
|
+
get() {
|
|
50
|
+
return props.modelValue
|
|
51
|
+
},
|
|
52
|
+
set(value) {
|
|
53
|
+
emit('update:modelValue', value)
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
const mIsEditing = inject('isEditing', () => ref(false), true)
|
|
58
|
+
|
|
59
|
+
const cIsEditing = computed(() => props.isEditing ?? mIsEditing.value)
|
|
60
|
+
const mIsMobile = inject('isMobile', () => ref(false), true)
|
|
61
|
+
const variant = inject('fieldVariant', 'underlined')
|
|
62
|
+
const editVariant = inject('fieldEditVariant', 'outlined')
|
|
63
|
+
|
|
64
|
+
const mLg = computed(() => (props.isMobile ?? mIsMobile.value) ? false : props.lg)
|
|
65
|
+
const mMd = computed(() => (props.isMobile ?? mIsMobile.value) ? false : props.md)
|
|
66
|
+
const mSm = computed(() => (props.isMobile ?? mIsMobile.value) ? false : props.sm)
|
|
67
|
+
</script>
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-col
|
|
3
|
+
:lg="mLg"
|
|
4
|
+
:md="mMd"
|
|
5
|
+
:sm="mSm"
|
|
6
|
+
:cols="cols">
|
|
7
|
+
<v-list-item>
|
|
8
|
+
<v-list-item-subtitle>{{ label }}</v-list-item-subtitle>
|
|
9
|
+
<v-list-item-title>
|
|
10
|
+
<v-row dense>
|
|
11
|
+
<span v-if="useAutomation || useAutomationDaily || useAutomationLarge" class="mx-1">{{ automation }}</span>
|
|
12
|
+
<span v-if="useGuide || useGuideList" class="mx-1">{{ guide }}</span>
|
|
13
|
+
<span v-if="useTrigger || useScheduledTrigger || useTriggerList" class="mx-1">{{ trigger }}</span>
|
|
14
|
+
<span v-if="useCustom || useCustomList" class="mx-1">{{ custom }}</span>
|
|
15
|
+
</v-row>
|
|
16
|
+
|
|
17
|
+
</v-list-item-title>
|
|
18
|
+
<template #append>
|
|
19
|
+
<v-row dense>
|
|
20
|
+
<v-col>
|
|
21
|
+
<v-menu v-if="useAutomation || useAutomationDaily || useAutomationLarge">
|
|
22
|
+
<template #activator="{ props }">
|
|
23
|
+
<v-btn v-bind="props" :disabled="!cIsEditing" :size="mSize" append-icon="mdi-menu-down" title="Automation">{{ automation ?? 'select' }}</v-btn>
|
|
24
|
+
</template>
|
|
25
|
+
<v-list
|
|
26
|
+
:items="automationOptions"
|
|
27
|
+
item-title="text"
|
|
28
|
+
return-object
|
|
29
|
+
select-strategy="single-independent"
|
|
30
|
+
v-model:selected="automationValue" />
|
|
31
|
+
</v-menu>
|
|
32
|
+
</v-col>
|
|
33
|
+
|
|
34
|
+
<v-col>
|
|
35
|
+
<v-menu v-if="useGuideList">
|
|
36
|
+
<template #activator="{ props }">
|
|
37
|
+
<v-btn v-bind="props" :disabled="!cIsEditing" :size="mSize" append-icon="mdi-menu-down" title="Guide">{{ guide ?? 'select' }}</v-btn>
|
|
38
|
+
</template>
|
|
39
|
+
<v-list
|
|
40
|
+
:items="guideOptions"
|
|
41
|
+
item-title="text"
|
|
42
|
+
return-object
|
|
43
|
+
select-strategy="single-independent"
|
|
44
|
+
v-model:selected="guideListValue" />
|
|
45
|
+
</v-menu>
|
|
46
|
+
</v-col>
|
|
47
|
+
|
|
48
|
+
<v-col>
|
|
49
|
+
<v-btn-toggle
|
|
50
|
+
v-if="useGuide"
|
|
51
|
+
v-bind="$attrs"
|
|
52
|
+
v-model="guideValue"
|
|
53
|
+
color="primary"
|
|
54
|
+
:disabled="!cIsEditing"
|
|
55
|
+
title="Guide">
|
|
56
|
+
<v-btn v-for="(opt, ind) in guideOptions"
|
|
57
|
+
:key="ind"
|
|
58
|
+
:icon="opt.icon"
|
|
59
|
+
:size="mSize"
|
|
60
|
+
:text="opt.text" />
|
|
61
|
+
</v-btn-toggle>
|
|
62
|
+
</v-col>
|
|
63
|
+
|
|
64
|
+
<v-col>
|
|
65
|
+
<v-menu v-if="useTriggerList">
|
|
66
|
+
<template #activator="{ props }">
|
|
67
|
+
<v-btn v-bind="props" :disabled="!cIsEditing" append-icon="mdi-menu-down" title="Trigger">{{ trigger ?? 'select' }}</v-btn>
|
|
68
|
+
</template>
|
|
69
|
+
<v-list
|
|
70
|
+
:items="triggerOptions"
|
|
71
|
+
item-title="text"
|
|
72
|
+
return-object
|
|
73
|
+
select-strategy="single-independent"
|
|
74
|
+
v-model:selected="triggerListValue" />
|
|
75
|
+
</v-menu>
|
|
76
|
+
</v-col>
|
|
77
|
+
|
|
78
|
+
<v-col>
|
|
79
|
+
<v-btn-toggle
|
|
80
|
+
v-if="useTrigger"
|
|
81
|
+
v-bind="$attrs"
|
|
82
|
+
v-model="triggerValue"
|
|
83
|
+
color="primary"
|
|
84
|
+
:disabled="!cIsEditing"
|
|
85
|
+
title="Trigger">
|
|
86
|
+
<v-btn v-for="(opt, ind) in triggerOptions"
|
|
87
|
+
:key="ind"
|
|
88
|
+
:icon="opt.icon"
|
|
89
|
+
:size="mSize"
|
|
90
|
+
:text="opt.text" />
|
|
91
|
+
</v-btn-toggle>
|
|
92
|
+
</v-col>
|
|
93
|
+
|
|
94
|
+
<v-col>
|
|
95
|
+
<v-menu v-if="useCustomList">
|
|
96
|
+
<template #activator="{ props }">
|
|
97
|
+
<v-btn v-bind="props" :disabled="!cIsEditing" append-icon="mdi-menu-down">{{ custom ?? 'select' }}</v-btn>
|
|
98
|
+
</template>
|
|
99
|
+
<v-list
|
|
100
|
+
:items="customOptions"
|
|
101
|
+
item-title="text"
|
|
102
|
+
return-object
|
|
103
|
+
select-strategy="single-independent"
|
|
104
|
+
v-model:selected="customListValue" />
|
|
105
|
+
</v-menu>
|
|
106
|
+
</v-col>
|
|
107
|
+
|
|
108
|
+
<v-col>
|
|
109
|
+
<v-btn-toggle
|
|
110
|
+
v-if="useCustom"
|
|
111
|
+
v-bind="$attrs"
|
|
112
|
+
v-model="customValue"
|
|
113
|
+
color="primary"
|
|
114
|
+
:disabled="!cIsEditing">
|
|
115
|
+
<v-btn v-for="(opt, ind) in customOptions"
|
|
116
|
+
:key="ind"
|
|
117
|
+
:icon="opt.icon"
|
|
118
|
+
:size="mSize"
|
|
119
|
+
:text="opt.text" />
|
|
120
|
+
</v-btn-toggle>
|
|
121
|
+
</v-col>
|
|
122
|
+
</v-row>
|
|
123
|
+
</template>
|
|
124
|
+
</v-list-item>
|
|
125
|
+
</v-col>
|
|
126
|
+
</template>
|
|
127
|
+
|
|
128
|
+
<script setup lang="ts">
|
|
129
|
+
import { type BladeDensity } from '../types'
|
|
130
|
+
import { computed, inject, ref, type Ref } from 'vue'
|
|
131
|
+
|
|
132
|
+
defineOptions({
|
|
133
|
+
inheritAttrs: false
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
interface Option {
|
|
137
|
+
text?: string
|
|
138
|
+
value?: string
|
|
139
|
+
icon?: string
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
interface FieldProps {
|
|
143
|
+
automation?: any
|
|
144
|
+
cols?: string | boolean
|
|
145
|
+
custom?: any
|
|
146
|
+
density?: BladeDensity
|
|
147
|
+
guide?: any
|
|
148
|
+
isEditing?: boolean
|
|
149
|
+
isMobile?: boolean
|
|
150
|
+
label: any
|
|
151
|
+
lg?: string | boolean
|
|
152
|
+
md?: string | boolean
|
|
153
|
+
sm?: string | boolean
|
|
154
|
+
options?: Option[]
|
|
155
|
+
trigger?: any
|
|
156
|
+
useAutomation?: boolean
|
|
157
|
+
useAutomationDaily?: boolean
|
|
158
|
+
useAutomationLarge?: boolean
|
|
159
|
+
useCustom?: boolean
|
|
160
|
+
useCustomList?: boolean
|
|
161
|
+
useGuide?: boolean
|
|
162
|
+
useGuideList?: boolean
|
|
163
|
+
useScheduledTrigger?: boolean
|
|
164
|
+
useTrigger?: boolean
|
|
165
|
+
useTriggerList?: boolean
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const props = withDefaults(defineProps<FieldProps>(), {
|
|
169
|
+
isEditing: undefined,
|
|
170
|
+
cols: '12',
|
|
171
|
+
lg: false,
|
|
172
|
+
md: false,
|
|
173
|
+
sm: '6'
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
const mSize = inject('size', () => ref('small'), true)
|
|
177
|
+
|
|
178
|
+
const emit = defineEmits(['update:automation', 'update:custom', 'update:guide', 'update:trigger'])
|
|
179
|
+
let automationOptions: Ref<Option[]> = ref([])
|
|
180
|
+
let customOptions: Ref<Option[]> = ref(props.options ?? [])
|
|
181
|
+
let guideOptions: Ref<Option[]> = ref([])
|
|
182
|
+
let triggerOptions: Ref<Option[]> = ref([])
|
|
183
|
+
|
|
184
|
+
if (props.useScheduledTrigger) {
|
|
185
|
+
triggerOptions.value = [
|
|
186
|
+
{ text: 'Manual', value: 'Manual', icon: 'mdi-account' },
|
|
187
|
+
{ text: 'Auto', value: 'Auto', icon: 'mdi-robot' },
|
|
188
|
+
{ text: 'Scheduled', value: 'Scheduled', icon: 'mdi-calendar' }
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (props.useTrigger) {
|
|
193
|
+
triggerOptions.value = [
|
|
194
|
+
{ text: 'Manual', value: 'Manual', icon: 'mdi-account' },
|
|
195
|
+
{ text: 'Auto', value: 'Auto', icon: 'mdi-robot' },
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (props.useGuide) {
|
|
200
|
+
guideOptions.value = [
|
|
201
|
+
{ text: 'Global', value: 'Settings', icon: 'mdi-earth' },
|
|
202
|
+
{ text: 'Individual', value: 'Agreements', icon: 'mdi-account-circle-outline' }
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (props.useAutomation) {
|
|
207
|
+
automationOptions.value = [
|
|
208
|
+
{ text: 'Off', value: 'Off' },
|
|
209
|
+
{ text: 'Hourly', value: 'Hourly' },
|
|
210
|
+
{ text: '3 Hourly', value: 'EveryThreeHours' },
|
|
211
|
+
{ text: '12 Hourly', value: 'EveryTwelveHours' },
|
|
212
|
+
{ text: 'Daily', value: 'Daily' },
|
|
213
|
+
{ text: 'Weekly', value: 'Weekly' }
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (props.useAutomationDaily) {
|
|
218
|
+
automationOptions.value = [
|
|
219
|
+
{ text: 'Off', value: 'Off' },
|
|
220
|
+
{ text: 'Daily', value: 'Daily' }
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if (props.useAutomationLarge) {
|
|
225
|
+
automationOptions.value = [
|
|
226
|
+
{ text: 'Off', value: 'Off' },
|
|
227
|
+
{ text: 'Daily', value: 'Daily' },
|
|
228
|
+
{ text: 'Weekly', value: 'Weekly' },
|
|
229
|
+
{ text: 'Monthly', value: 'Monthly' },
|
|
230
|
+
{ text: 'Yearly', value: 'Yearly' }
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const automationValue = computed({
|
|
235
|
+
get() {
|
|
236
|
+
const v = props.automation != null ? automationOptions.value.find((x: any) => (x.value ?? x.text) == props.automation) : []
|
|
237
|
+
return v ? [v] : []
|
|
238
|
+
},
|
|
239
|
+
set(value) {
|
|
240
|
+
const v = (value?.length > 0 ? value[0] : undefined) as Option | undefined
|
|
241
|
+
emit('update:automation', v?.value ?? v?.text ?? null)
|
|
242
|
+
}
|
|
243
|
+
})
|
|
244
|
+
|
|
245
|
+
const customListValue = computed({
|
|
246
|
+
get() {
|
|
247
|
+
return props.custom != null ? customOptions.value.filter((x: any) => (x.value ?? x.text) == props.automation) : []
|
|
248
|
+
// const v = props.custom != null ? customOptions.value.find((x: any) => (x.value ?? x.text) == props.automation) : []
|
|
249
|
+
// return v ? [v] : []
|
|
250
|
+
},
|
|
251
|
+
set(value) {
|
|
252
|
+
const v = (value?.length > 0 ? value[0] : undefined) as Option | undefined
|
|
253
|
+
emit('update:custom', v?.value ?? v?.text ?? null)
|
|
254
|
+
}
|
|
255
|
+
})
|
|
256
|
+
|
|
257
|
+
const customValue = computed({
|
|
258
|
+
get() {
|
|
259
|
+
return props.custom != null ? customOptions.value.findIndex((x: any) => (x.value ?? x.text) == props.custom) : null
|
|
260
|
+
},
|
|
261
|
+
set(value) {
|
|
262
|
+
emit('update:custom', (value == null || value < 0) ? null : (customOptions.value[value].value ?? customOptions.value[value].text))
|
|
263
|
+
}
|
|
264
|
+
})
|
|
265
|
+
|
|
266
|
+
const guideListValue = computed({
|
|
267
|
+
get() {
|
|
268
|
+
const v = props.guide != null ? guideOptions.value.find((x: any) => (x.value ?? x.text) == props.guide) : []
|
|
269
|
+
return v ? [v] : []
|
|
270
|
+
},
|
|
271
|
+
set(value) {
|
|
272
|
+
const v = (value?.length > 0 ? value[0] : undefined) as Option | undefined
|
|
273
|
+
emit('update:guide', v?.value ?? v?.text ?? null)
|
|
274
|
+
}
|
|
275
|
+
})
|
|
276
|
+
|
|
277
|
+
const guideValue = computed({
|
|
278
|
+
get() {
|
|
279
|
+
return props.guide != null ? guideOptions.value.findIndex((x: any) => (x.value ?? x.text) == props.guide) : null
|
|
280
|
+
},
|
|
281
|
+
set(value) {
|
|
282
|
+
emit('update:guide', (value == null || value < 0) ? null : (guideOptions.value[value].value ?? guideOptions.value[value].text))
|
|
283
|
+
}
|
|
284
|
+
})
|
|
285
|
+
|
|
286
|
+
const triggerListValue = computed({
|
|
287
|
+
get() {
|
|
288
|
+
const v = props.trigger != null ? triggerOptions.value.find((x: any) => (x.value ?? x.text) == props.trigger) : []
|
|
289
|
+
return v ? [v] : []
|
|
290
|
+
},
|
|
291
|
+
set(value) {
|
|
292
|
+
const v = (value?.length > 0 ? value[0] : undefined) as Option | undefined
|
|
293
|
+
emit('update:trigger', v?.value ?? v?.text ?? null)
|
|
294
|
+
}
|
|
295
|
+
})
|
|
296
|
+
|
|
297
|
+
const triggerValue = computed({
|
|
298
|
+
get() {
|
|
299
|
+
return props.trigger != null ? triggerOptions.value.findIndex((x: any) => (x.value ?? x.text) == props.trigger) : null
|
|
300
|
+
},
|
|
301
|
+
set(value) {
|
|
302
|
+
emit('update:trigger', (value == null || value < 0) ? null : (triggerOptions.value[value].value ?? triggerOptions.value[value].text))
|
|
303
|
+
}
|
|
304
|
+
})
|
|
305
|
+
|
|
306
|
+
const mIsEditing = inject('isEditing', () => ref(false), true)
|
|
307
|
+
|
|
308
|
+
const cIsEditing = computed(() => props.isEditing ?? mIsEditing.value)
|
|
309
|
+
const mIsMobile = inject('isMobile', () => ref(false), true)
|
|
310
|
+
|
|
311
|
+
const mLg = computed(() => (props.isMobile ?? mIsMobile.value) ? false : props.lg)
|
|
312
|
+
const mMd = computed(() => (props.isMobile ?? mIsMobile.value) ? false : props.md)
|
|
313
|
+
const mSm = computed(() => (props.isMobile ?? mIsMobile.value) ? false : props.sm)
|
|
314
|
+
|
|
315
|
+
</script>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-slide-x-transition group>
|
|
3
|
+
<span v-if="option.prefix != null">{{ option.prefix }}</span>
|
|
4
|
+
<span v-if="option.bool != null">
|
|
5
|
+
<v-icon v-if="nestedValue(data, option.value) === true" :size="size">mdi-check</v-icon>
|
|
6
|
+
</span>
|
|
7
|
+
<bt-entity
|
|
8
|
+
v-else-if="option.nav != null && (option.itemText != null || option.textFilter != null)"
|
|
9
|
+
inline
|
|
10
|
+
:itemText="option.itemText"
|
|
11
|
+
:itemId="nestedValue(data, option.value)"
|
|
12
|
+
:nav="option.nav"
|
|
13
|
+
:single="option.single"
|
|
14
|
+
:textFilter="option.textFilter" />
|
|
15
|
+
<span v-else>{{ displayText(data) }}</span>
|
|
16
|
+
</v-slide-x-transition>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script setup lang="ts">
|
|
20
|
+
import { type TableColumn } from '../composables/list'
|
|
21
|
+
import { nestedValue } from '../composables/helpers'
|
|
22
|
+
import { useFilters } from '../composables/filters'
|
|
23
|
+
import { computed } from 'vue';
|
|
24
|
+
|
|
25
|
+
interface Props {
|
|
26
|
+
data: any
|
|
27
|
+
option: TableColumn
|
|
28
|
+
size?: string | number
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const props = defineProps<Props>()
|
|
32
|
+
const filters = useFilters()
|
|
33
|
+
const displayText = computed(() => (item: any) => {
|
|
34
|
+
let v = nestedValue(item, props.option.value)
|
|
35
|
+
v = props.option.textFunction != null ? props.option.textFunction(v) : v
|
|
36
|
+
return props.option.textFilter != null ? filters.findFilter(props.option.textFilter)(v) : v
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
</script>
|