@xy-planning-network/trees 0.15.1-dev-1 → 0.15.2-dev.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/trees.es.js +15060 -10657
- package/dist/trees.umd.js +79 -13
- package/package.json +5 -2
- package/src/lib-components/lists/DataTable.vue +86 -2
- package/src/lib-components/lists/DynamicTable.vue +18 -90
- package/types/composables/badge.d.ts +8 -0
- package/types/composables/http.d.ts +8 -0
- package/types/composables/index.d.ts +3 -0
- package/types/composables/useFieldsSchema.d.ts +100 -0
- package/types/composables/useInlineMarkdown.d.ts +20 -0
- package/types/helpers/GetProperty.d.ts +21 -0
- package/types/helpers/Object.d.ts +8 -0
- package/types/helpers/SetProperty.d.ts +18 -0
- package/types/lib-components/forms/Combobox.vue.d.ts +16 -0
- package/types/lib-components/forms/DateRangePicker.vue.d.ts +2 -2
- package/types/lib-components/forms/FormCell.vue.d.ts +15 -0
- package/types/lib-components/forms/FormDisplay.vue.d.ts +30 -0
- package/types/lib-components/forms/FormGrid.vue.d.ts +19 -0
- package/types/lib-components/forms/FormSection.vue.d.ts +16 -0
- package/types/lib-components/forms/InputDisplay.vue.d.ts +14 -0
- package/types/lib-components/forms/MultiSelect.vue.d.ts +22 -0
- package/types/lib-components/forms/NumberInput.vue.d.ts +2 -2
- package/types/lib-components/forms/RadioCards.vue.d.ts +3 -0
- package/types/lib-components/forms/RangeCalendar.vue.d.ts +1 -1
- package/types/lib-components/index.d.ts +53 -89
- package/types/lib-components/indicators/DismissableBadge.vue.d.ts +13 -0
- package/types/lib-components/overlays/ContentModal.vue.d.ts +1 -1
- package/types/lib-components/overlays/Modal.vue.d.ts +1 -1
- package/types/lib-components/overlays/Slideover.vue.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xy-planning-network/trees",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2-dev.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"repository":
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/xy-planning-network/trees.git"
|
|
9
|
+
},
|
|
7
10
|
"files": [
|
|
8
11
|
"config/*",
|
|
9
12
|
"dist/*",
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { useTable } from "@/composables/useTable"
|
|
3
|
+
import { useBulkActions } from "@/composables/useBulkActions"
|
|
3
4
|
import type {
|
|
4
5
|
TableActions,
|
|
6
|
+
TableBulkActions,
|
|
5
7
|
TableColumns,
|
|
6
8
|
TableRowsData,
|
|
7
9
|
} from "@/composables/table"
|
|
@@ -11,19 +13,46 @@ import { toRef } from "vue"
|
|
|
11
13
|
const props = withDefaults(
|
|
12
14
|
defineProps<{
|
|
13
15
|
tableActions?: TableActions<any>
|
|
16
|
+
tableBulkActions?: TableBulkActions<any>
|
|
14
17
|
tableColumns: TableColumns<any>
|
|
15
18
|
tableData: TableRowsData
|
|
16
19
|
}>(),
|
|
17
20
|
{
|
|
18
21
|
tableActions: () => ({ type: "dropdown", actions: [] }),
|
|
22
|
+
tableBulkActions: () => ({ actions: [] }),
|
|
19
23
|
}
|
|
20
24
|
)
|
|
21
25
|
|
|
26
|
+
const selected = defineModel<number[]>("selected", {
|
|
27
|
+
required: false,
|
|
28
|
+
default: [],
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const {
|
|
32
|
+
bulkActions,
|
|
33
|
+
bulkSelectChecked,
|
|
34
|
+
bulkSelectIndeterminate,
|
|
35
|
+
bulkSelectOnChange,
|
|
36
|
+
hasBulkActions,
|
|
37
|
+
hasSelection,
|
|
38
|
+
publicMethods,
|
|
39
|
+
selectable,
|
|
40
|
+
selectedOnPage,
|
|
41
|
+
} = useBulkActions(
|
|
42
|
+
toRef(props, "tableData"),
|
|
43
|
+
toRef(props, "tableBulkActions"),
|
|
44
|
+
selected,
|
|
45
|
+
{ reconcileSelections: true }
|
|
46
|
+
)
|
|
47
|
+
|
|
22
48
|
const { columns, hasActions, isEmptyCellValue, rows } = useTable(
|
|
23
49
|
toRef(props, "tableData"),
|
|
24
50
|
toRef(props, "tableColumns"),
|
|
25
|
-
toRef(props, "tableActions")
|
|
51
|
+
toRef(props, "tableActions"),
|
|
52
|
+
publicMethods
|
|
26
53
|
)
|
|
54
|
+
|
|
55
|
+
defineExpose(publicMethods)
|
|
27
56
|
</script>
|
|
28
57
|
<template>
|
|
29
58
|
<div class="flex flex-col">
|
|
@@ -35,6 +64,25 @@ const { columns, hasActions, isEmptyCellValue, rows } = useTable(
|
|
|
35
64
|
<table class="min-w-full divide-y divide-gray-200">
|
|
36
65
|
<thead class="bg-gray-100">
|
|
37
66
|
<tr>
|
|
67
|
+
<th
|
|
68
|
+
v-if="hasBulkActions"
|
|
69
|
+
scope="col"
|
|
70
|
+
class="pl-6 w-4 leading-none"
|
|
71
|
+
>
|
|
72
|
+
<input
|
|
73
|
+
:class="[
|
|
74
|
+
'h-4 w-4 rounded cursor-pointer',
|
|
75
|
+
'disabled:bg-gray-100 disabled:border-gray-200 disabled:cursor-not-allowed disabled:opacity-100',
|
|
76
|
+
'checked:disabled:bg-xy-blue checked:disabled:border-xy-blue checked:disabled:opacity-50',
|
|
77
|
+
'border-gray-300 focus:ring-xy-blue-500',
|
|
78
|
+
]"
|
|
79
|
+
:checked="bulkSelectChecked"
|
|
80
|
+
:indeterminate="bulkSelectIndeterminate"
|
|
81
|
+
type="checkbox"
|
|
82
|
+
@change="bulkSelectOnChange"
|
|
83
|
+
/>
|
|
84
|
+
</th>
|
|
85
|
+
|
|
38
86
|
<th
|
|
39
87
|
v-for="(col, idx) in columns"
|
|
40
88
|
:key="idx"
|
|
@@ -50,6 +98,23 @@ const { columns, hasActions, isEmptyCellValue, rows } = useTable(
|
|
|
50
98
|
class="px-6 py-3 text-xs font-medium tracking-wider text-gray-900 uppercase leading-4"
|
|
51
99
|
/>
|
|
52
100
|
</tr>
|
|
101
|
+
|
|
102
|
+
<tr v-if="hasBulkActions && hasSelection">
|
|
103
|
+
<td colspan="100%" class="px-6 py-2.5 border-t bg-neutral-50">
|
|
104
|
+
<div class="flex items-center gap-x-3">
|
|
105
|
+
<div class="text-sm shrink-0">
|
|
106
|
+
Selected
|
|
107
|
+
<span class="font-medium">{{
|
|
108
|
+
selectedOnPage.length
|
|
109
|
+
}}</span>
|
|
110
|
+
of
|
|
111
|
+
<span class="font-medium">{{ selectable.length }}</span>
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<ActionsButtonGroup :actions="bulkActions" />
|
|
115
|
+
</div>
|
|
116
|
+
</td>
|
|
117
|
+
</tr>
|
|
53
118
|
</thead>
|
|
54
119
|
<tbody class="bg-white">
|
|
55
120
|
<tr
|
|
@@ -57,6 +122,21 @@ const { columns, hasActions, isEmptyCellValue, rows } = useTable(
|
|
|
57
122
|
:key="rowIdx"
|
|
58
123
|
class="even:bg-gray-50"
|
|
59
124
|
>
|
|
125
|
+
<td v-if="hasBulkActions" class="pl-6 w-4 leading-none">
|
|
126
|
+
<input
|
|
127
|
+
v-model="selected"
|
|
128
|
+
:class="[
|
|
129
|
+
'h-4 w-4 rounded cursor-pointer',
|
|
130
|
+
'disabled:bg-gray-100 disabled:border-gray-200 disabled:cursor-not-allowed disabled:opacity-100',
|
|
131
|
+
'checked:disabled:bg-xy-blue checked:disabled:border-xy-blue checked:disabled:opacity-50',
|
|
132
|
+
'border-gray-300 focus:ring-xy-blue-500',
|
|
133
|
+
]"
|
|
134
|
+
:disabled="!selectable.includes(row.rowData?.id)"
|
|
135
|
+
type="checkbox"
|
|
136
|
+
:value="row.rowData?.id"
|
|
137
|
+
/>
|
|
138
|
+
</td>
|
|
139
|
+
|
|
60
140
|
<template v-for="(cell, cellIdx) in row.cells" :key="cellIdx">
|
|
61
141
|
<component
|
|
62
142
|
:is="'td'"
|
|
@@ -89,7 +169,11 @@ const { columns, hasActions, isEmptyCellValue, rows } = useTable(
|
|
|
89
169
|
|
|
90
170
|
<tr v-if="rows.length === 0">
|
|
91
171
|
<td
|
|
92
|
-
:colspan="
|
|
172
|
+
:colspan="
|
|
173
|
+
columns.length +
|
|
174
|
+
(hasActions ? 1 : 0) +
|
|
175
|
+
(hasBulkActions ? 1 : 0)
|
|
176
|
+
"
|
|
93
177
|
class="px-6 py-4 text-sm text-gray-700 whitespace-nowrap leading-5"
|
|
94
178
|
>
|
|
95
179
|
No items were found!
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
import DateRangePicker from "../forms/DateRangePicker.vue"
|
|
9
9
|
import BaseAPI from "../../api/base"
|
|
10
10
|
import type {
|
|
11
|
-
DynamicTableAPI,
|
|
12
11
|
DynamicTableOptions,
|
|
13
12
|
TableActions,
|
|
14
13
|
TableBulkActions,
|
|
@@ -19,6 +18,7 @@ import { useAppFlasher } from "@/composables/useFlashes"
|
|
|
19
18
|
import { TrailsRespPaged } from "@/api/client"
|
|
20
19
|
import { DateRange, DateRangeProps } from "@/composables/date"
|
|
21
20
|
import { useTable } from "@/composables/useTable"
|
|
21
|
+
import { useBulkActions } from "@/composables/useBulkActions"
|
|
22
22
|
|
|
23
23
|
const props = withDefaults(
|
|
24
24
|
defineProps<{
|
|
@@ -141,100 +141,26 @@ const hasContent = computed((): boolean => {
|
|
|
141
141
|
return rows.value.length ? true : false
|
|
142
142
|
})
|
|
143
143
|
|
|
144
|
-
const clearSelections = () => {
|
|
145
|
-
selected.value = []
|
|
146
|
-
}
|
|
147
|
-
|
|
148
144
|
const selected = defineModel<number[]>("selected", {
|
|
149
145
|
required: false,
|
|
150
146
|
default: [],
|
|
151
147
|
})
|
|
152
148
|
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const bulkActions = computed(() => {
|
|
166
|
-
return props.tableBulkActions.actions
|
|
167
|
-
.filter((action) => {
|
|
168
|
-
return action.show ?? true
|
|
169
|
-
})
|
|
170
|
-
.map((action) => {
|
|
171
|
-
return {
|
|
172
|
-
...action,
|
|
173
|
-
disabled: selected.value.length === 0 || action.disabled,
|
|
174
|
-
onClick: (e?: Event) =>
|
|
175
|
-
action.onClick.apply(undefined, [
|
|
176
|
-
selected.value,
|
|
177
|
-
selectedData.value,
|
|
178
|
-
publicMethods,
|
|
179
|
-
e,
|
|
180
|
-
]),
|
|
181
|
-
}
|
|
182
|
-
})
|
|
183
|
-
})
|
|
184
|
-
|
|
185
|
-
const hasBulkActions = computed(() => bulkActions.value.length > 0)
|
|
186
|
-
|
|
187
|
-
const selectable = computed(() => {
|
|
188
|
-
return tableData.value
|
|
189
|
-
.filter((row) => {
|
|
190
|
-
// NOTE(spk): table data must have an "id" key for bulk actions.
|
|
191
|
-
if (row.id === undefined) {
|
|
192
|
-
return false
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (props.tableBulkActions.isSelectable === undefined) {
|
|
196
|
-
return true
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (props.tableBulkActions.isSelectable(row)) {
|
|
200
|
-
return true
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return false
|
|
204
|
-
})
|
|
205
|
-
.map((d) => d["id"])
|
|
206
|
-
})
|
|
207
|
-
|
|
208
|
-
const bulkSelectChecked = computed(
|
|
209
|
-
() =>
|
|
210
|
-
selectedOnPage.value.length > 0 &&
|
|
211
|
-
selectedOnPage.value.length === selectable.value.length
|
|
212
|
-
)
|
|
213
|
-
|
|
214
|
-
const bulkSelectIndeterminate = computed(
|
|
215
|
-
() =>
|
|
216
|
-
selectedOnPage.value.length > 0 &&
|
|
217
|
-
selectedOnPage.value.length < selectable.value.length
|
|
218
|
-
)
|
|
219
|
-
|
|
220
|
-
const bulkSelectOnChange = (e: Event) => {
|
|
221
|
-
const isChecked = (e.target as HTMLInputElement).checked
|
|
222
|
-
|
|
223
|
-
// set all records on current page to selection
|
|
224
|
-
if (isChecked) {
|
|
225
|
-
selected.value = selectable.value.map((id) => id)
|
|
226
|
-
return
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
clearSelections()
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
const publicMethods: DynamicTableAPI = {
|
|
233
|
-
clearSelection: clearSelections,
|
|
234
|
-
selectedData: selectedData,
|
|
149
|
+
const {
|
|
150
|
+
bulkActions,
|
|
151
|
+
bulkSelectChecked,
|
|
152
|
+
bulkSelectIndeterminate,
|
|
153
|
+
bulkSelectOnChange,
|
|
154
|
+
clearSelections,
|
|
155
|
+
hasBulkActions,
|
|
156
|
+
hasSelection,
|
|
157
|
+
publicMethods,
|
|
158
|
+
selectable,
|
|
159
|
+
selectedOnPage,
|
|
160
|
+
} = useBulkActions(tableData, toRef(props, "tableBulkActions"), selected, {
|
|
235
161
|
refresh: loadAndRender,
|
|
236
162
|
reset: reloadTable,
|
|
237
|
-
}
|
|
163
|
+
})
|
|
238
164
|
|
|
239
165
|
const { columns, hasActions, isEmptyCellValue, rows } = useTable(
|
|
240
166
|
tableData,
|
|
@@ -419,7 +345,7 @@ loadAndRender()
|
|
|
419
345
|
/>
|
|
420
346
|
</tr>
|
|
421
347
|
|
|
422
|
-
<tr v-if="hasBulkActions &&
|
|
348
|
+
<tr v-if="hasBulkActions && hasSelection">
|
|
423
349
|
<td colspan="100%" class="px-6 py-2.5 border-t bg-neutral-50">
|
|
424
350
|
<div class="flex items-center gap-x-3">
|
|
425
351
|
<div class="text-sm shrink-0">
|
|
@@ -489,7 +415,9 @@ loadAndRender()
|
|
|
489
415
|
|
|
490
416
|
<tr v-if="!hasContent">
|
|
491
417
|
<td
|
|
492
|
-
:colspan="
|
|
418
|
+
:colspan="
|
|
419
|
+
columns.length + (hasActions ? 1 : 0) + (hasBulkActions ? 1 : 0)
|
|
420
|
+
"
|
|
493
421
|
class="px-6 py-4 text-sm text-gray-700 whitespace-nowrap leading-5"
|
|
494
422
|
>
|
|
495
423
|
No items were found!
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const HTTP_BAD_REQUEST = 400;
|
|
2
|
+
export declare const HTTP_CONFLICT = 409;
|
|
3
|
+
export declare const HTTP_NOT_FOUND = 404;
|
|
4
|
+
export declare const HTTP_NOT_IMPLEMENTED = 501;
|
|
5
|
+
export declare const HTTP_UNPROCESSABLE_ENTITY = 422;
|
|
6
|
+
export declare const HTTP_TOO_MANY_REQUESTS = 429;
|
|
7
|
+
export declare const HTTP_INTERNAL_SERVER_ERROR = 500;
|
|
8
|
+
export declare const statusMessages: Record<number, string>;
|
|
@@ -16,3 +16,6 @@ import { isActionItemButton, isActionItemLink, useUrlSearchParams, useTabHistory
|
|
|
16
16
|
export { isActionItemButton, isActionItemLink, useUrlSearchParams, useTabHistory, };
|
|
17
17
|
import { useSpinnerDisplay, useAppSpinner } from "./useSpinner";
|
|
18
18
|
export { useSpinnerDisplay, useAppSpinner };
|
|
19
|
+
export * from "./badge";
|
|
20
|
+
export * from "./useFieldsSchema";
|
|
21
|
+
export * from "./useInlineMarkdown";
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Component, ComputedRef, MaybeRefOrGetter, Ref } from "vue";
|
|
2
|
+
import { type BooleanInput, type DateRangeInput, type Input, type MultiChoiceInput, type OptionsInput, type TextInputType, type TextLikeInput, type TextareaInput, type DateTimeInput, type NumericInput, type NumericInputType } from "../composables/forms";
|
|
3
|
+
/**
|
|
4
|
+
* FieldsSchema supports an Array of FieldSection(s)
|
|
5
|
+
* or simply an Array of FieldsSchemaInput(s)
|
|
6
|
+
*/
|
|
7
|
+
export type FieldsSchema = Array<FieldSection> | Array<FieldsSchemaInput>;
|
|
8
|
+
/**
|
|
9
|
+
* FieldsSchemaInput type declares the supported input components in a FieldsSchema
|
|
10
|
+
*/
|
|
11
|
+
export type FieldsSchemaInput = InputField<BooleanInput, "checkbox" | "toggle" | "yes-no-radio"> | InputField<MultiChoiceInput, "multi-checkbox"> | InputField<MultiChoiceInput & {
|
|
12
|
+
customValues?: boolean;
|
|
13
|
+
}, "multi-select"> | InputField<DateRangeInput, "date-range"> | InputField<DateTimeInput, "datetime"> | InputField<NumericInput, NumericInputType> | InputField<OptionsInput, "combobox" | "radio" | "radio-cards" | "select"> | InputField<TextareaInput, "textarea"> | InputField<TextLikeInput, Exclude<TextInputType, "number">>;
|
|
14
|
+
/**
|
|
15
|
+
* isTextInputType is a user defined type guard for
|
|
16
|
+
* narrowing if a FieldsSchemaInput in a FieldsSchema is a text
|
|
17
|
+
* like type, ex: input type="text | date | url..."
|
|
18
|
+
*
|
|
19
|
+
* @param type string
|
|
20
|
+
* @returns boolean
|
|
21
|
+
*/
|
|
22
|
+
export declare const isTextInputType: (type: string) => type is "number" | "url" | "search" | "time" | "text" | "date" | "email" | "month" | "password" | "tel" | "week";
|
|
23
|
+
/**
|
|
24
|
+
* isNumericInputType is a user defined type guard for
|
|
25
|
+
* narrowing if a FieldsSchemaInput in a FieldsSchema is a numeric
|
|
26
|
+
* like type, ex: input type="money | number..."
|
|
27
|
+
*
|
|
28
|
+
* @param type string
|
|
29
|
+
* @returns boolean
|
|
30
|
+
*/
|
|
31
|
+
export declare const isNumericInputType: (type: string) => type is "number" | "money" | "raw-number";
|
|
32
|
+
/**
|
|
33
|
+
* isInputsOnlySchema is a user defined type guard for narrowing that
|
|
34
|
+
* a FieldsSchema is only made up of FieldsSchemaInputs
|
|
35
|
+
*
|
|
36
|
+
* @param s FieldsSchema
|
|
37
|
+
* @returns boolean
|
|
38
|
+
*/
|
|
39
|
+
export declare const isInputsOnlySchema: (s: FieldsSchema) => s is FieldsSchemaInput[];
|
|
40
|
+
/**
|
|
41
|
+
* A FieldSection maps a grouping of inputs in a FieldsSchema
|
|
42
|
+
* to a FormSection in the FormGrid component.
|
|
43
|
+
*/
|
|
44
|
+
export interface FieldSection {
|
|
45
|
+
title?: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
fields: Array<FieldsSchemaInput>;
|
|
48
|
+
}
|
|
49
|
+
export type InputFieldType = (typeof inputFieldTypes)[number];
|
|
50
|
+
export declare const inputFieldTypes: readonly ["date", "email", "month", "number", "password", "search", "tel", "text", "time", "url", "week", "money", "number", "raw-number", "checkbox", "combobox", "date-range", "datetime", "multi-checkbox", "multi-select", "radio", "radio-cards", "select", "textarea", "toggle", "yes-no-radio"];
|
|
51
|
+
/**
|
|
52
|
+
* InputField is the type used to declare an option of FieldsSchemaInput
|
|
53
|
+
* The Input interface is enforced against the InputFieldType to avoid applying unsupported
|
|
54
|
+
* modelValues on the input as well as ensure required props are available for the InputFieldType.
|
|
55
|
+
*/
|
|
56
|
+
export type InputField<I extends Input, T extends InputFieldType> = I & {
|
|
57
|
+
type: T;
|
|
58
|
+
name: string;
|
|
59
|
+
columns?: 2 | 3;
|
|
60
|
+
span?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "full";
|
|
61
|
+
start?: boolean;
|
|
62
|
+
show?: boolean;
|
|
63
|
+
disabled?: boolean;
|
|
64
|
+
autocomplete?: string;
|
|
65
|
+
min?: number | string;
|
|
66
|
+
max?: number | string;
|
|
67
|
+
minlength?: number;
|
|
68
|
+
maxlength?: number;
|
|
69
|
+
pattern?: string;
|
|
70
|
+
required?: boolean;
|
|
71
|
+
$component?: Component;
|
|
72
|
+
$props?: Record<string, any>;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* disableSchemaFields is a utility function for disabling all input fields
|
|
76
|
+
* in a FieldSchema. Useful for rendering forms as read-only.
|
|
77
|
+
*
|
|
78
|
+
* @param schema FieldsSchema
|
|
79
|
+
* @returns FieldsSchema
|
|
80
|
+
*/
|
|
81
|
+
export declare const disableSchemaFields: (schema: FieldsSchema) => FieldsSchema;
|
|
82
|
+
/**
|
|
83
|
+
* extractInputs is a utility function for extracting all of the FieldsSchemaInput
|
|
84
|
+
* entries (nested or not) out of a FieldSchema.
|
|
85
|
+
*
|
|
86
|
+
* @param schema FieldsSchema
|
|
87
|
+
* @returns Array<FieldsSchemaInput>
|
|
88
|
+
*/
|
|
89
|
+
export declare const extractInputs: (schema: FieldsSchema) => Array<FieldsSchemaInput>;
|
|
90
|
+
/**
|
|
91
|
+
* useFieldsSchema computes the FieldSections of a FieldSchema and tracks
|
|
92
|
+
* input values on the model passed as the first argument. This encapsulates
|
|
93
|
+
* the necessary logic for maintaining input reactivity for use in form
|
|
94
|
+
* @param model Ref<Record<string, any>
|
|
95
|
+
* @param schema MaybeRefOrGetter<FieldsSchema>
|
|
96
|
+
* @returns { fieldSections: ComputedRef<FieldSection[]> }
|
|
97
|
+
*/
|
|
98
|
+
export declare const useFieldsSchema: (model: Ref<Record<string, any>>, schema: MaybeRefOrGetter<FieldsSchema>) => {
|
|
99
|
+
fieldSections: ComputedRef<FieldSection[]>;
|
|
100
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type VNode, type VNodeArrayChildren, type MaybeRefOrGetter, type ComputedRef } from "vue";
|
|
2
|
+
export type MarkdownNode = VNode | string | VNodeArrayChildren;
|
|
3
|
+
export interface InlineMarkdownConfig {
|
|
4
|
+
graphs: boolean;
|
|
5
|
+
}
|
|
6
|
+
export type UseInlineMarkdown = ComputedRef<(() => null) | (() => MarkdownNode | MarkdownNode[])>;
|
|
7
|
+
/**
|
|
8
|
+
* Creates a Vue render function for a subset of Markdown.
|
|
9
|
+
*
|
|
10
|
+
* `marked` is used only to tokenize the source. We parse those
|
|
11
|
+
* tokens and map supported syntax to VNodes instead of rendering and
|
|
12
|
+
* injecting HTML - this allows Vue to continue to do the sanitizing.
|
|
13
|
+
*
|
|
14
|
+
* Unsupported tokens, including raw HTML, remain plain text and
|
|
15
|
+
* are escaped by Vue.
|
|
16
|
+
*
|
|
17
|
+
* Enable `graphs` to preserve paragraph wrappers; otherwise
|
|
18
|
+
* all contents are rendered inline.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useInlineMarkdown(markdown: MaybeRefOrGetter<string>, conf?: InlineMarkdownConfig): UseInlineMarkdown;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* getProperty reads a nested property from an object using a dot-separated path.
|
|
3
|
+
* Numeric path segments can be used to access array elements, such as
|
|
4
|
+
* `items.0.name`.
|
|
5
|
+
*
|
|
6
|
+
* `defaultValue` is returned when the path cannot be fully traversed or when the
|
|
7
|
+
* resolved value is `undefined`.
|
|
8
|
+
*
|
|
9
|
+
* Type safety is intentionally limited because `path` is a dynamic string.
|
|
10
|
+
* TypeScript does not verify that the path exists on `O` or that its value is
|
|
11
|
+
* `T`; supplying `T` is a caller assertion and does not perform runtime
|
|
12
|
+
* validation. Omit `T` to receive `any | undefined` when no default is
|
|
13
|
+
* provided.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* getProperty<User, string>(user, "profile.name") // string | undefined
|
|
17
|
+
* getProperty<User, string>(user, "profile.name", "Unknown") // string
|
|
18
|
+
*/
|
|
19
|
+
declare function getProperty<O extends Record<string, any> = Record<string, any>, T = any>(obj: O, path: string): T | undefined;
|
|
20
|
+
declare function getProperty<O extends Record<string, any> = Record<string, any>, T = any>(obj: O, path: string, defaultValue: T): T;
|
|
21
|
+
export default getProperty;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safely gets a deeply nested value using dot notation
|
|
3
|
+
*/
|
|
4
|
+
export declare const get: <TDefault = unknown, TReturn = any>(obj: any, path: string, defaultValue?: TDefault) => TReturn | TDefault;
|
|
5
|
+
/**
|
|
6
|
+
* Safely sets a deeply nested value using dot notation (blocks Prototype Pollution)
|
|
7
|
+
*/
|
|
8
|
+
export declare const set: <T>(obj: T, path: string, value: any) => T;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* setProperty assigns a value on an object using a dot-separated path. It
|
|
3
|
+
* returns a new object without mutating `obj`. Each container along the path
|
|
4
|
+
* is cloned, while containers outside the path retain their references.
|
|
5
|
+
*
|
|
6
|
+
* Numeric path segments create arrays when a container is missing, so
|
|
7
|
+
* `items.0.name` creates an object within an `items` array. Other missing
|
|
8
|
+
* containers are created as objects.
|
|
9
|
+
*
|
|
10
|
+
* Paths containing `__proto__`, `constructor`, or `prototype` are ignored to
|
|
11
|
+
* avoid modifying object prototypes.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* setProperty(user, "profile.name", "Ada")
|
|
15
|
+
* setProperty(form, "items.0.name", "First item")
|
|
16
|
+
*/
|
|
17
|
+
declare function setProperty<O extends Record<string, any>>(obj: O, path: string, value: unknown): O;
|
|
18
|
+
export default setProperty;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type OptionsInput } from "../../composables/forms";
|
|
2
|
+
type __VLS_Props = OptionsInput;
|
|
3
|
+
type __VLS_PublicProps = {
|
|
4
|
+
modelValue?: OptionsInput["modelValue"];
|
|
5
|
+
} & __VLS_Props;
|
|
6
|
+
declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
+
"update:modelValue": (value: string | number | null | undefined) => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
9
|
+
"onUpdate:modelValue"?: ((value: string | number | null | undefined) => any) | undefined;
|
|
10
|
+
}>, {
|
|
11
|
+
label: string;
|
|
12
|
+
modelValue: string | number | null;
|
|
13
|
+
help: string;
|
|
14
|
+
placeholder: string;
|
|
15
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
export default _default;
|
|
@@ -34,10 +34,10 @@ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
34
34
|
} | undefined) => any;
|
|
35
35
|
}, import("vue").PublicProps, {
|
|
36
36
|
actions: import("../../composables/forms").DateRangeAction[];
|
|
37
|
-
borderless: boolean;
|
|
38
37
|
maxRange: number;
|
|
39
38
|
maxValue: Date | null;
|
|
40
39
|
minValue: Date;
|
|
40
|
+
borderless: boolean;
|
|
41
41
|
}, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
|
|
42
42
|
P: {};
|
|
43
43
|
B: {};
|
|
@@ -63,10 +63,10 @@ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
63
63
|
} | undefined) => any) | undefined;
|
|
64
64
|
}>, {}, {}, {}, {}, {
|
|
65
65
|
actions: import("../../composables/forms").DateRangeAction[];
|
|
66
|
-
borderless: boolean;
|
|
67
66
|
maxRange: number;
|
|
68
67
|
maxValue: Date | null;
|
|
69
68
|
minValue: Date;
|
|
69
|
+
borderless: boolean;
|
|
70
70
|
}> | null>>;
|
|
71
71
|
input: Readonly<import("vue").ShallowRef<HTMLInputElement | null>>;
|
|
72
72
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
start?: boolean;
|
|
3
|
+
span: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "full";
|
|
4
|
+
};
|
|
5
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
6
|
+
start: boolean;
|
|
7
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLDivElement>, {
|
|
8
|
+
default?(_: {}): any;
|
|
9
|
+
}>;
|
|
10
|
+
export default _default;
|
|
11
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
12
|
+
new (): {
|
|
13
|
+
$slots: S;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ReqMethod } from "../../api/client";
|
|
2
|
+
import { type FieldsSchema } from "../../composables/useFieldsSchema";
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
action: string;
|
|
5
|
+
btnText?: string;
|
|
6
|
+
btnDisabled?: boolean;
|
|
7
|
+
columns: 1 | 2;
|
|
8
|
+
flashError?: boolean;
|
|
9
|
+
flashSuccess?: boolean;
|
|
10
|
+
method: ReqMethod;
|
|
11
|
+
schema: FieldsSchema;
|
|
12
|
+
};
|
|
13
|
+
type __VLS_PublicProps = {
|
|
14
|
+
modelValue?: Record<string, any>;
|
|
15
|
+
} & __VLS_Props;
|
|
16
|
+
declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
17
|
+
error: (error: any) => any;
|
|
18
|
+
success: (result: any) => any;
|
|
19
|
+
"update:modelValue": (value: Record<string, any>) => any;
|
|
20
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
21
|
+
onError?: ((error: any) => any) | undefined;
|
|
22
|
+
onSuccess?: ((result: any) => any) | undefined;
|
|
23
|
+
"onUpdate:modelValue"?: ((value: Record<string, any>) => any) | undefined;
|
|
24
|
+
}>, {
|
|
25
|
+
btnText: string;
|
|
26
|
+
btnDisabled: boolean;
|
|
27
|
+
flashError: boolean;
|
|
28
|
+
flashSuccess: boolean;
|
|
29
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
30
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
as?: string;
|
|
3
|
+
btnText?: string;
|
|
4
|
+
btnDisabled?: boolean;
|
|
5
|
+
columns: 1 | 2;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
8
|
+
as: string;
|
|
9
|
+
btnText: string;
|
|
10
|
+
btnDisabled: boolean;
|
|
11
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
12
|
+
default?(_: {}): any;
|
|
13
|
+
}>;
|
|
14
|
+
export default _default;
|
|
15
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
16
|
+
new (): {
|
|
17
|
+
$slots: S;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
description?: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
};
|
|
5
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLDivElement>, {
|
|
9
|
+
default?(_: {}): any;
|
|
10
|
+
}>;
|
|
11
|
+
export default _default;
|
|
12
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
13
|
+
new (): {
|
|
14
|
+
$slots: S;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type FieldsSchema } from "../../composables/useFieldsSchema";
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
columns: 1 | 2;
|
|
4
|
+
schema: FieldsSchema;
|
|
5
|
+
};
|
|
6
|
+
type __VLS_PublicProps = {
|
|
7
|
+
modelValue: Record<string, any>;
|
|
8
|
+
} & __VLS_Props;
|
|
9
|
+
declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
"update:modelValue": (value: Record<string, any>) => any;
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
12
|
+
"onUpdate:modelValue"?: ((value: Record<string, any>) => any) | undefined;
|
|
13
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
export default _default;
|