bt-core-app 1.4.2 → 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 (68) hide show
  1. package/package.json +8 -2
  2. package/dist/useApi.d.ts +0 -0
  3. package/src/assets/vue.svg +0 -1
  4. package/src/components/BT-Btn.vue +0 -41
  5. package/src/components/BT-Col.vue +0 -36
  6. package/src/components/BT-Field-Checkbox.vue +0 -70
  7. package/src/components/BT-Field-Date.vue +0 -108
  8. package/src/components/BT-Field-Entity.vue +0 -48
  9. package/src/components/BT-Field-Select.vue +0 -67
  10. package/src/components/BT-Field-String.vue +0 -78
  11. package/src/components/BT-Field-Switch.vue +0 -68
  12. package/src/components/BT-Field-Tags.vue +0 -66
  13. package/src/components/BT-Field-Textarea.vue +0 -67
  14. package/src/components/BT-Field-Trigger.vue +0 -315
  15. package/src/components/BT-Header-Option.vue +0 -39
  16. package/src/components/BT-Json.vue +0 -67
  17. package/src/components/BT-Nav-Menu-Item.vue +0 -60
  18. package/src/components/BT-Nav-Sidebar.vue +0 -78
  19. package/src/components/BT-Select-List-Box.vue +0 -258
  20. package/src/components/BT-Select.vue +0 -46
  21. package/src/components/BT-Snack.vue +0 -31
  22. package/src/components/BT-Span.vue +0 -21
  23. package/src/components/Dialog-Confirm.vue +0 -47
  24. package/src/components/Dialog-Select-Date.vue +0 -89
  25. package/src/components/Dialog-Select.vue +0 -140
  26. package/src/components/Dialog-Text.vue +0 -59
  27. package/src/composables/actions-tracker.ts +0 -99
  28. package/src/composables/actions.ts +0 -354
  29. package/src/composables/api.ts +0 -479
  30. package/src/composables/auth.ts +0 -452
  31. package/src/composables/cosmetics.ts +0 -177
  32. package/src/composables/csv.ts +0 -198
  33. package/src/composables/dates.ts +0 -86
  34. package/src/composables/demo.ts +0 -33
  35. package/src/composables/dialogs.ts +0 -114
  36. package/src/composables/document-meta.ts +0 -44
  37. package/src/composables/draggable.ts +0 -189
  38. package/src/composables/filters.ts +0 -264
  39. package/src/composables/forage.ts +0 -49
  40. package/src/composables/helpers.ts +0 -647
  41. package/src/composables/id.ts +0 -20
  42. package/src/composables/list.ts +0 -604
  43. package/src/composables/navigation.ts +0 -222
  44. package/src/composables/presets.ts +0 -28
  45. package/src/composables/pwa.ts +0 -97
  46. package/src/composables/resizable.ts +0 -382
  47. package/src/composables/rules.ts +0 -40
  48. package/src/composables/stores.ts +0 -818
  49. package/src/composables/track.ts +0 -55
  50. package/src/composables/urls.ts +0 -66
  51. package/src/core.ts +0 -113
  52. package/src/index.ts +0 -48
  53. package/src/types.ts +0 -17
  54. package/src/useApi.ts +0 -68
  55. package/src/vite-env.d.ts +0 -1
  56. package/test/api.test.ts +0 -84
  57. package/test/auth.test.ts +0 -74
  58. package/test/forage.test.ts +0 -31
  59. package/test/helpers.test.ts +0 -231
  60. package/test/navigation.test.ts +0 -99
  61. package/test/stores-last-update.test.ts +0 -138
  62. package/test/stores-session.test.ts +0 -118
  63. package/test/track.test.ts +0 -29
  64. package/test/urls.test.ts +0 -42
  65. package/test/utils.ts +0 -15
  66. package/tsconfig.json +0 -28
  67. package/tsconfig.node.json +0 -11
  68. package/vite.config.ts +0 -45
@@ -1,315 +0,0 @@
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>
@@ -1,39 +0,0 @@
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>
@@ -1,67 +0,0 @@
1
- <template>
2
- <v-card max-height="350" class="overflow-y-auto">
3
- <v-card-text>
4
- <div v-for="(j, ind) in display" :key="ind">
5
- <pre v-html="syntaxHighlight(j)"></pre>
6
- </div>
7
- </v-card-text>
8
- </v-card>
9
- </template>
10
-
11
- <script setup lang="ts">
12
- import { computed } from 'vue'
13
-
14
- const props = defineProps(['value'])
15
-
16
- const display = computed(() => {
17
- if (props.value == null) {
18
- return []
19
- }
20
-
21
- if (Array.isArray(props.value))
22
- return props.value
23
-
24
- return [props.value]
25
- })
26
-
27
- function syntaxHighlight(json: any) {
28
- if (typeof json != 'string') {
29
- json = JSON.stringify(json, undefined, 2); //Object.keys(json).sort(), 2);
30
- }
31
- json = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
32
-
33
- const e = json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match: any) {
34
- var cls = 'number';
35
- if (/^"/.test(match)) {
36
- if (/:$/.test(match)) {
37
- cls = 'key';
38
- } else {
39
- cls = 'string';
40
- }
41
- } else if (/true|false/.test(match)) {
42
- cls = 'boolean';
43
- } else if (/null/.test(match)) {
44
- cls = 'null';
45
- }
46
- return '<span class="' + cls + '">' + match + '</span>';
47
- });
48
-
49
- return e
50
- }
51
-
52
- </script>
53
-
54
- <style>
55
- pre {
56
- outline: 1px solid #ccc;
57
- padding: 5px;
58
- margin: 5px; }
59
-
60
- pre .string {
61
- color: green;
62
- }
63
- pre .number { color: darkorange; }
64
- pre .boolean { color: rgb(191, 255, 0); }
65
- pre .null { color: magenta; }
66
- pre .key { color: rgb(141, 141, 141); }
67
- </style>
@@ -1,60 +0,0 @@
1
- <template>
2
- <v-list-group v-if="doShowItem && relevantChildren.length > 0"
3
- color="accent"
4
- :subGroup="isSubGroup"
5
- fluid>
6
- <template #activator="{ props }">
7
- <v-list-item v-bind="props"
8
- :prepend-icon="item.icon"
9
- :title="item.displayName" />
10
- </template>
11
- <BT-Nav-Menu-Item
12
- v-for="child in relevantChildren"
13
- :key="child.name"
14
- isSubGroup
15
- :item="child" />
16
- </v-list-group>
17
- <v-list-item v-else-if="doShowItem"
18
- color="accent"
19
- :prepend-icon="item.icon"
20
- nav
21
- :title="item.displayName ?? item.name"
22
- :to="{ name: item.name }">
23
- </v-list-item>
24
- <v-divider v-else-if="item.isDivider" />
25
- <div v-else>test</div>
26
- </template>
27
-
28
- <script setup lang="ts">
29
- import BTNavMenuItem from './BT-Nav-Menu-Item.vue'
30
- import { computed } from 'vue'
31
- import { useAuth } from '../composables/auth'
32
- import { isLengthyArray } from '../composables/helpers'
33
- import { type NavigationItem } from '../composables/navigation'
34
-
35
- interface ItemProps {
36
- allowedSubscriptionCodes?: string[],
37
- isSubGroup?: boolean,
38
- item?: any
39
- }
40
-
41
- const props = withDefaults(defineProps<ItemProps>(), {
42
- allowedSubscriptionCodes: () => [],
43
- isSubGroup: false,
44
- item: null
45
- })
46
-
47
- const { doShowByNav } = useAuth()
48
-
49
- const relevantChildren = computed(() => {
50
- const l = props.item.children?.filter((x: NavigationItem) => x.isInNavMenu !== false) ?? []
51
- if (!isLengthyArray(props.allowedSubscriptionCodes)) {
52
- return l
53
- }
54
-
55
- return l.filter((navItem: NavigationItem) => !isLengthyArray(navItem.subFilters) || props.allowedSubscriptionCodes.some(code => navItem.subFilters?.some(sFilter => sFilter == code)))
56
- })
57
-
58
- const doShowItem = computed(() => doShowByNav(props.item, true))
59
-
60
- </script>
@@ -1,78 +0,0 @@
1
- <template>
2
- <v-navigation-drawer
3
- v-if="isLoggedIn"
4
- disabled-resize-watcher
5
- expand-on-hover
6
- :rail="!state.drawerStick"
7
- permanent
8
- v-model="state.drawer">
9
- <slot>
10
- <v-list class="pt-1">
11
- <v-list-item nav :title="title">
12
- <template #prepend>
13
- <v-avatar size="36">
14
- <v-img :src="iconSrc" />
15
- </v-avatar>
16
- </template>
17
- <template #append>
18
- <v-row class="mr-1">
19
- <v-btn
20
- @click="toggleDrawerStick"
21
- flat
22
- icon
23
- size="small"
24
- title="Pin/Unpin Menu">
25
- <v-icon>{{ state.drawerStick ? 'mdi-pin-off' : 'mdi-pin' }}</v-icon>
26
- </v-btn>
27
- </v-row>
28
- </template>
29
- </v-list-item>
30
- <slot name="top-list">
31
-
32
- </slot>
33
- </v-list>
34
-
35
- <slot name="middle-list">
36
- <v-list nav>
37
- <BT-Nav-Menu-Item
38
- v-for="(item, index) in navItems"
39
- :key="index"
40
- :item="item" />
41
- </v-list>
42
- </slot>
43
- </slot>
44
- <template #append>
45
- <slot name="bottom-list">
46
- <v-list v-if="isLoggedIn" class="ma-0 pa-0">
47
- <v-list-item
48
- class="bg-primary"
49
- prepend-icon="mdi-logout"
50
- title="Logout"
51
- @click="() => logout()" />
52
- </v-list>
53
- </slot>
54
- </template>
55
- </v-navigation-drawer>
56
- </template>
57
-
58
- <script setup lang="ts">
59
- import BTNavMenuItem from './BT-Nav-Menu-Item.vue'
60
- import { useCosmetics } from '../composables/cosmetics'
61
- import { useNavigation } from '../composables/navigation'
62
- import { useAuth } from '../composables/auth'
63
- import { computed } from 'vue'
64
-
65
- interface SidebarProps {
66
- // greeting?: string
67
- iconSrc?: string
68
- title?: string
69
- }
70
-
71
- defineProps<SidebarProps>()
72
- const { state, toggleDrawerStick } = useCosmetics()
73
- const { isLoggedIn, logout } = useAuth()
74
- const navigation = useNavigation()
75
-
76
- const navItems = computed(() => navigation.navigationItems.filter(x => x.isInNavMenu !== false && navigation.backgroundName.value == x.background));
77
-
78
- </script>