bt-core-app 1.4.1 → 1.4.3

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.
Files changed (96) hide show
  1. package/dist/bt-core-app.js +4079 -28248
  2. package/dist/index.d.ts +0 -4
  3. package/package.json +8 -2
  4. package/dist/components/BT-Btn.vue.d.ts +0 -41
  5. package/dist/components/BT-Col.vue.d.ts +0 -49
  6. package/dist/components/BT-Field-Checkbox.vue.d.ts +0 -56
  7. package/dist/components/BT-Field-Date.vue.d.ts +0 -64
  8. package/dist/components/BT-Field-Entity.vue.d.ts +0 -46
  9. package/dist/components/BT-Field-Select.vue.d.ts +0 -54
  10. package/dist/components/BT-Field-String.vue.d.ts +0 -53
  11. package/dist/components/BT-Field-Switch.vue.d.ts +0 -51
  12. package/dist/components/BT-Field-Tags.vue.d.ts +0 -51
  13. package/dist/components/BT-Field-Textarea.vue.d.ts +0 -52
  14. package/dist/components/BT-Field-Trigger.vue.d.ts +0 -79
  15. package/dist/components/BT-Header-Option.vue.d.ts +0 -18
  16. package/dist/components/BT-Json.vue.d.ts +0 -8
  17. package/dist/components/BT-Nav-Menu-Item.vue.d.ts +0 -36
  18. package/dist/components/BT-Nav-Sidebar.vue.d.ts +0 -25
  19. package/dist/components/BT-Select-List-Box.vue.d.ts +0 -108
  20. package/dist/components/BT-Select.vue.d.ts +0 -53
  21. package/dist/components/BT-Snack.vue.d.ts +0 -33
  22. package/dist/components/BT-Span.vue.d.ts +0 -17
  23. package/dist/components/Dialog-Confirm.vue.d.ts +0 -38
  24. package/dist/components/Dialog-Select-Date.vue.d.ts +0 -36
  25. package/dist/components/Dialog-Select.vue.d.ts +0 -48
  26. package/dist/components/Dialog-Text.vue.d.ts +0 -33
  27. package/dist/main.d.ts +0 -0
  28. package/dist/style.css +0 -1
  29. package/dist/useApi.d.ts +0 -0
  30. package/src/assets/vue.svg +0 -1
  31. package/src/components/BT-Btn.vue +0 -41
  32. package/src/components/BT-Col.vue +0 -36
  33. package/src/components/BT-Field-Checkbox.vue +0 -70
  34. package/src/components/BT-Field-Date.vue +0 -108
  35. package/src/components/BT-Field-Entity.vue +0 -48
  36. package/src/components/BT-Field-Select.vue +0 -67
  37. package/src/components/BT-Field-String.vue +0 -78
  38. package/src/components/BT-Field-Switch.vue +0 -68
  39. package/src/components/BT-Field-Tags.vue +0 -66
  40. package/src/components/BT-Field-Textarea.vue +0 -67
  41. package/src/components/BT-Field-Trigger.vue +0 -315
  42. package/src/components/BT-Header-Option.vue +0 -39
  43. package/src/components/BT-Json.vue +0 -67
  44. package/src/components/BT-Nav-Menu-Item.vue +0 -61
  45. package/src/components/BT-Nav-Sidebar.vue +0 -79
  46. package/src/components/BT-Select-List-Box.vue +0 -258
  47. package/src/components/BT-Select.vue +0 -46
  48. package/src/components/BT-Snack.vue +0 -31
  49. package/src/components/BT-Span.vue +0 -21
  50. package/src/components/Dialog-Confirm.vue +0 -47
  51. package/src/components/Dialog-Select-Date.vue +0 -89
  52. package/src/components/Dialog-Select.vue +0 -140
  53. package/src/components/Dialog-Text.vue +0 -59
  54. package/src/composables/actions-tracker.ts +0 -99
  55. package/src/composables/actions.ts +0 -354
  56. package/src/composables/api.ts +0 -479
  57. package/src/composables/auth.ts +0 -452
  58. package/src/composables/cosmetics.ts +0 -177
  59. package/src/composables/csv.ts +0 -198
  60. package/src/composables/dates.ts +0 -86
  61. package/src/composables/demo.ts +0 -33
  62. package/src/composables/dialogs.ts +0 -115
  63. package/src/composables/document-meta.ts +0 -44
  64. package/src/composables/draggable.ts +0 -189
  65. package/src/composables/filters.ts +0 -264
  66. package/src/composables/forage.ts +0 -49
  67. package/src/composables/helpers.ts +0 -647
  68. package/src/composables/id.ts +0 -20
  69. package/src/composables/list.ts +0 -604
  70. package/src/composables/navigation.ts +0 -222
  71. package/src/composables/presets.ts +0 -28
  72. package/src/composables/pwa.ts +0 -97
  73. package/src/composables/resizable.ts +0 -382
  74. package/src/composables/rules.ts +0 -40
  75. package/src/composables/stores.ts +0 -818
  76. package/src/composables/track.ts +0 -55
  77. package/src/composables/urls.ts +0 -66
  78. package/src/core.ts +0 -121
  79. package/src/index.ts +0 -48
  80. package/src/main.ts +0 -6
  81. package/src/types.ts +0 -17
  82. package/src/useApi.ts +0 -68
  83. package/src/vite-env.d.ts +0 -1
  84. package/test/api.test.ts +0 -84
  85. package/test/auth.test.ts +0 -74
  86. package/test/forage.test.ts +0 -31
  87. package/test/helpers.test.ts +0 -231
  88. package/test/navigation.test.ts +0 -99
  89. package/test/stores-last-update.test.ts +0 -138
  90. package/test/stores-session.test.ts +0 -118
  91. package/test/track.test.ts +0 -29
  92. package/test/urls.test.ts +0 -42
  93. package/test/utils.ts +0 -15
  94. package/tsconfig.json +0 -28
  95. package/tsconfig.node.json +0 -11
  96. package/vite.config.ts +0 -45
@@ -1,89 +0,0 @@
1
- <template>
2
- <v-dialog v-model="show">
3
- <div>
4
- <v-card
5
- :max-width="maxWidth ?? '400'"
6
- :min-width="minWidth"
7
- class="mx-auto"
8
- :title="title">
9
- <v-card-text class="pa-0">
10
- <VueDatePicker
11
- auto-apply
12
- dark
13
- :enable-time-picker="useTime"
14
- inline
15
- :is-24="false"
16
- :model-auto="range"
17
- :range="range"
18
- :time-picker-inline="!range && useTime"
19
- :timezone="timeZone"
20
- utc
21
- v-bind="$attrs"
22
- v-model="date" />
23
- </v-card-text>
24
- <v-card-actions>
25
- <v-row no-gutters>
26
- <v-col cols="6">
27
- <v-btn v-if="required !== true" block @click="cancel">{{ cancelText ?? 'Cancel' }}</v-btn>
28
- </v-col>
29
- <v-col cols="6">
30
- <v-btn block @click="accept" :disabled="!canAccept">{{ confirmText ?? 'OK' }}</v-btn>
31
- </v-col>
32
- </v-row>
33
- </v-card-actions>
34
- </v-card>
35
- </div>
36
- </v-dialog>
37
- </template>
38
-
39
- <script setup lang="ts">
40
- import { computed, onMounted, ref } from 'vue'
41
- import VueDatePicker from '@vuepic/vue-datepicker'
42
- import '@vuepic/vue-datepicker/dist/main.css'
43
- import { useAuth } from '../composables/auth'
44
- import { type SelectDateProps } from '../composables/dialogs'
45
-
46
- const props = withDefaults(defineProps<SelectDateProps>(), {
47
- cancelValue: false,
48
- height: '400'
49
- })
50
-
51
- const emit = defineEmits(['confirm', 'cancel'])
52
- const date = ref()
53
- const { timeZone } = useAuth()
54
-
55
- const canAccept = computed(() => {
56
- return !props.required || date.value
57
- })
58
-
59
- let show = false
60
-
61
- function accept() {
62
- if (props.required && !date.value) {
63
- //required
64
- return
65
- }
66
-
67
- show = false
68
- emit('confirm', date.value)
69
- }
70
-
71
- // function maybeAccept(items: any) {
72
- // if (!props.multiple) {
73
- // if (isArrayOfLength(items, 1) || (props.canUnselect && !isLengthyArray(items))) {
74
- // show = false
75
- // emit('confirm', getSelectedValues(items))
76
- // }
77
- // }
78
- // }
79
-
80
- function cancel() {
81
- show = false
82
- emit('cancel', undefined)
83
- }
84
-
85
- onMounted(() => {
86
- show = true
87
- })
88
-
89
- </script>
@@ -1,140 +0,0 @@
1
- <template>
2
- <v-dialog v-model="show">
3
- <div>
4
- <v-card
5
- :max-width="maxWidth ?? '400'"
6
- :min-width="minWidth"
7
- class="mx-auto"
8
- :title="title">
9
- <!-- <v-card-title v-if="title != null">{{ title }}</v-card-title> -->
10
- <v-card-text class="pa-0">
11
- <v-text-field
12
- v-if="ui.showSearch.value"
13
- append-inner-icon="mdi-magnify"
14
- density="compact"
15
- hide-details
16
- placeholder="Search"
17
- v-model="ui.searchString.value" />
18
- <!-- <div v-if="multiple" @click="selectAll" class="text-center my-1">
19
- <v-btn>Select All</v-btn>
20
- </div> -->
21
- <v-list v-if="isLengthyArray(ui.filteredItems.value)"
22
- class="overflow-y-auto"
23
- v-model:selected="selection"
24
- :height="height"
25
- :select-strategy="multiple ? 'independent' : 'single-independent'"
26
- @update:selected="maybeAccept">
27
- <template v-for="(fItem) in ui.filteredItems.value" :key="index">
28
- <v-list-item :value="fItem">
29
- <slot v-bind:item="fItem">
30
- <v-list-item-title v-if="itemText != null || textFilter != null || textFunction != null">
31
- {{ displayTitle(fItem) }}
32
- </v-list-item-title>
33
- <v-list-item-subtitle v-if="itemSubtext != null || subtextFilter != null || subtextFunction != null">
34
- {{ displaySubtitle(fItem) }}
35
- </v-list-item-subtitle>
36
- </slot>
37
- </v-list-item>
38
- </template>
39
- </v-list>
40
- </v-card-text>
41
- <v-card-actions>
42
- <v-row no-gutters>
43
- <v-col :cols="multiple ? 6 : 12">
44
- <v-btn v-if="required !== true" block @click="cancel">{{ cancelText ?? 'Cancel' }}</v-btn>
45
- </v-col>
46
- <v-col v-if="multiple == true" cols="6">
47
- <v-btn block @click="accept" :disabled="!canAccept">{{ confirmText ?? 'OK' }}</v-btn>
48
- </v-col>
49
-
50
- </v-row>
51
- </v-card-actions>
52
- <v-overlay
53
- v-model="ui.isLoading.value"
54
- class="align-center justify-center text-center"
55
- contained
56
- persistent>
57
- <v-progress-circular indeterminate />
58
- <p>{{ ui.loadingMsg }}</p>
59
- </v-overlay>
60
- </v-card>
61
- </div>
62
- </v-dialog>
63
- </template>
64
-
65
- <script setup lang="ts">
66
- import { computed, onMounted, ref } from 'vue';
67
- import { isLengthyArray, isArrayOfLength, nestedValue } from '../composables/helpers'
68
- import { useFilters } from '../composables/filters'
69
- import { useList } from '../composables/list';
70
- import { type SelectDialogProps } from '../composables/dialogs'
71
-
72
- const props = withDefaults(defineProps<SelectDialogProps>(), {
73
- cancelValue: false,
74
- height: '400',
75
- showSearch: true
76
- })
77
-
78
- const emit = defineEmits(['confirm', 'cancel'])
79
-
80
- const ui = useList(props)
81
- const filters = useFilters()
82
- const selection = ref([])
83
-
84
- const displaySubtitle = computed(() => (item: any) => {
85
- let v = props.subtextFunction != null ? props.subtextFunction(item) : item
86
- v = props.itemSubtext != null ? nestedValue(v, props.itemSubtext) : v
87
- return props.subtextFilter != null ? filters.findFilter(props.subtextFilter)(v) : v
88
- })
89
-
90
- const displayTitle = computed(() => (item: any) => {
91
- let v = props.textFunction != null ? props.textFunction(item) : item
92
- v = props.itemText != null ? nestedValue(v, props.itemText) : v
93
- return props.textFilter != null ? filters.findFilter(props.textFilter)(v) : v
94
- })
95
-
96
- const canAccept = computed(() => {
97
- return !props.required || isLengthyArray(selection.value)
98
- })
99
-
100
- let show = false
101
-
102
- function getSelectedValues(items: any) {
103
- const res = props.itemValue != null ? items.map((x: any) => nestedValue(x, props.itemValue)) : items
104
- if (props.multiple) {
105
- return res
106
- }
107
- else {
108
- return res.length > 0 ? res[0] : null
109
- }
110
- }
111
-
112
- function accept() {
113
- if (props.required && !isLengthyArray(selection.value)) {
114
- //required
115
- return
116
- }
117
-
118
- show = false
119
- emit('confirm', getSelectedValues(selection.value))
120
- }
121
-
122
- function maybeAccept(items: any) {
123
- if (!props.multiple) {
124
- if (isArrayOfLength(items, 1) || (props.canUnselect && !isLengthyArray(items))) {
125
- show = false
126
- emit('confirm', getSelectedValues(items))
127
- }
128
- }
129
- }
130
-
131
- function cancel() {
132
- show = false
133
- emit('cancel', undefined)
134
- }
135
-
136
- onMounted(() => {
137
- show = true
138
- })
139
-
140
- </script>
@@ -1,59 +0,0 @@
1
- <template>
2
- <v-dialog v-model="show">
3
- <div>
4
- <v-card :max-width="maxWidth ?? '400'" :min-width="minWidth" :title="title" class="mx-auto">
5
- <v-card-text>
6
- <v-text-field
7
- :label="label"
8
- v-model="mVal" />
9
- <div class="text-h6">{{ msg }}</div>
10
- </v-card-text>
11
- <v-card-actions>
12
- <v-btn @click="cancel">{{ cancelText ?? 'Cancel' }}</v-btn>
13
- <v-btn @click="confirm" :disabled="!canAccept">{{ confirmText ?? 'Done' }}</v-btn>
14
- </v-card-actions>
15
- </v-card>
16
- </div>
17
- </v-dialog>
18
- </template>
19
-
20
- <script setup lang="ts">
21
- import { computed, onMounted, ref } from 'vue';
22
- import { type TextDialogProps } from '../composables/dialogs'
23
-
24
-
25
- const props = withDefaults(defineProps<TextDialogProps>(), {
26
- height: '400'
27
- })
28
-
29
- const emit = defineEmits(['confirm', 'cancel'])
30
-
31
- const canAccept = computed(() => {
32
- return !props.required || mVal.value != null
33
- })
34
-
35
- let show = false
36
-
37
- const mVal = ref(props.value)
38
-
39
- function confirm() {
40
- if (props.required && mVal.value == null) {
41
- //required
42
- return
43
- }
44
-
45
- show = false
46
-
47
- emit('confirm', mVal.value)
48
- }
49
-
50
- function cancel() {
51
- show = false
52
- emit('cancel', undefined)
53
- }
54
-
55
- onMounted(() => {
56
- show = true
57
- })
58
-
59
- </script>
@@ -1,99 +0,0 @@
1
- import { computed, ref, shallowRef } from 'vue'
2
- import type { ShallowRef, Ref } from 'vue'
3
- import { useConfirmAsync } from '../composables/dialogs'
4
- import { watchArray } from '@vueuse/core'
5
- import { useId } from '../composables/id'
6
-
7
- interface LoadingMsg {
8
- id: string,
9
- msg: string
10
- }
11
-
12
- export interface DoActionOptions {
13
- completionMsg?: string
14
- confirmationMsg?: string
15
- errorMsg?: string
16
- loadingMsg?: string
17
- requireConfirmation?: boolean,
18
- throwError?: boolean
19
- }
20
-
21
- export function useActionsTracker(useOptions?: DoActionOptions) {
22
- const loadingMsgs: Ref<LoadingMsg[]> = ref([])
23
- const mLoadingMsg: ShallowRef<string | undefined> = shallowRef()
24
- const mErrorMsg: ShallowRef<string | undefined> = shallowRef()
25
- const mCompletionMsg: ShallowRef<string | undefined> = shallowRef()
26
- const isLoading = computed(() => mLoadingMsg.value != null)
27
-
28
- function endLoading(id: string) {
29
- loadingMsgs.value = loadingMsgs.value.filter(x => x.id != id)
30
- }
31
-
32
- function startLoading(msg?: string): string {
33
- const e = {
34
- id: useId(),
35
- msg: msg ?? 'Loading'
36
- }
37
- loadingMsgs.value.push(e)
38
- return e.id
39
- }
40
-
41
- function logError(err?: string | Error) {
42
- if (err != null)
43
- mErrorMsg.value = err.toString()
44
- }
45
-
46
- function clearErrors() {
47
- mErrorMsg.value = undefined
48
- }
49
-
50
- async function doAction(action: any, options?: DoActionOptions) {
51
- const opt = { ...options }
52
- opt.completionMsg ??= useOptions?.completionMsg
53
- opt.confirmationMsg ??= useOptions?.confirmationMsg
54
- opt.errorMsg ??= useOptions?.errorMsg
55
- opt.loadingMsg ??= useOptions?.loadingMsg ?? 'Loading'
56
- opt.requireConfirmation ??= useOptions?.requireConfirmation
57
-
58
- const id = startLoading(opt.loadingMsg)
59
- let res: any = null
60
-
61
- try {
62
- if (opt.requireConfirmation || opt.confirmationMsg) {
63
- if (!await useConfirmAsync(opt.confirmationMsg ?? 'Are you sure?'))
64
- return
65
- }
66
-
67
- res = await action()
68
-
69
- if (opt.completionMsg != null) {
70
- mCompletionMsg.value = opt.completionMsg
71
- }
72
-
73
- return res
74
- }
75
- catch (err) {
76
- if (opt.throwError == true)
77
- return res
78
- else
79
- logError(opt.errorMsg ?? (err as string) ?? 'error')
80
- }
81
- finally {
82
- endLoading(id)
83
- }
84
- }
85
-
86
- watchArray(loadingMsgs, (newList: LoadingMsg[]) => {
87
- mLoadingMsg.value = newList.length > 0 ? newList[0].msg : undefined
88
- }, { deep: true })
89
-
90
- return {
91
- actionErrorMsg: mErrorMsg,
92
- actionLoadingMsg: mLoadingMsg,
93
- actionCompleteMsg: mCompletionMsg,
94
- clearErrors,
95
- doAction,
96
- isLoading,
97
- logError
98
- }
99
- }