@arrai-innovations/reactive-helpers 18.0.1 → 18.0.2
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/package.json +17 -2
- package/types/config/listCrud.d.ts +153 -0
- package/types/config/listCrud.d.ts.map +1 -0
- package/types/config/objectCrud.d.ts +171 -0
- package/types/config/objectCrud.d.ts.map +1 -0
- package/types/index.d.ts +37 -0
- package/types/index.d.ts.map +1 -0
- package/types/tests/unit/config/listCrud.spec.d.ts +2 -0
- package/types/tests/unit/config/listCrud.spec.d.ts.map +1 -0
- package/types/tests/unit/config/objectCrud.spec.d.ts +2 -0
- package/types/tests/unit/config/objectCrud.spec.d.ts.map +1 -0
- package/types/tests/unit/crudPromise.d.ts +25 -0
- package/types/tests/unit/crudPromise.d.ts.map +1 -0
- package/types/tests/unit/expectHelpers.d.ts +2 -0
- package/types/tests/unit/expectHelpers.d.ts.map +1 -0
- package/types/tests/unit/mockOnUnmounted.d.ts +2 -0
- package/types/tests/unit/mockOnUnmounted.d.ts.map +1 -0
- package/types/tests/unit/poll.d.ts +2 -0
- package/types/tests/unit/poll.d.ts.map +1 -0
- package/types/tests/unit/use/cancellableIntent.spec.d.ts +2 -0
- package/types/tests/unit/use/cancellableIntent.spec.d.ts.map +1 -0
- package/types/tests/unit/use/listCalculated.spec.d.ts +2 -0
- package/types/tests/unit/use/listCalculated.spec.d.ts.map +1 -0
- package/types/tests/unit/use/listFilter.spec.d.ts +2 -0
- package/types/tests/unit/use/listFilter.spec.d.ts.map +1 -0
- package/types/tests/unit/use/listInstance.spec.d.ts +2 -0
- package/types/tests/unit/use/listInstance.spec.d.ts.map +1 -0
- package/types/tests/unit/use/listRelated.spec.d.ts +2 -0
- package/types/tests/unit/use/listRelated.spec.d.ts.map +1 -0
- package/types/tests/unit/use/listSearch.spec.d.ts +2 -0
- package/types/tests/unit/use/listSearch.spec.d.ts.map +1 -0
- package/types/tests/unit/use/listSort.spec.d.ts +2 -0
- package/types/tests/unit/use/listSort.spec.d.ts.map +1 -0
- package/types/tests/unit/use/listSubscription.spec.d.ts +2 -0
- package/types/tests/unit/use/listSubscription.spec.d.ts.map +1 -0
- package/types/tests/unit/use/loadingError.spec.d.ts +2 -0
- package/types/tests/unit/use/loadingError.spec.d.ts.map +1 -0
- package/types/tests/unit/use/objectInstance.spec.d.ts +2 -0
- package/types/tests/unit/use/objectInstance.spec.d.ts.map +1 -0
- package/types/tests/unit/use/objectSubscription.spec.d.ts +2 -0
- package/types/tests/unit/use/objectSubscription.spec.d.ts.map +1 -0
- package/types/tests/unit/use/proxyLoadingError.spec.d.ts +2 -0
- package/types/tests/unit/use/proxyLoadingError.spec.d.ts.map +1 -0
- package/types/tests/unit/use/search.spec.d.ts +2 -0
- package/types/tests/unit/use/search.spec.d.ts.map +1 -0
- package/types/tests/unit/utils/assignReactiveObject.spec.d.ts +2 -0
- package/types/tests/unit/utils/assignReactiveObject.spec.d.ts.map +1 -0
- package/types/tests/unit/utils/classes.spec.d.ts +2 -0
- package/types/tests/unit/utils/classes.spec.d.ts.map +1 -0
- package/types/tests/unit/utils/deleteKey.spec.d.ts +2 -0
- package/types/tests/unit/utils/deleteKey.spec.d.ts.map +1 -0
- package/types/tests/unit/utils/flattenPaths.spec.d.ts +2 -0
- package/types/tests/unit/utils/flattenPaths.spec.d.ts.map +1 -0
- package/types/tests/unit/utils/keyDiff.spec.d.ts +2 -0
- package/types/tests/unit/utils/keyDiff.spec.d.ts.map +1 -0
- package/types/tests/unit/utils/set.spec.d.ts +2 -0
- package/types/tests/unit/utils/set.spec.d.ts.map +1 -0
- package/types/tests/unit/utils/watches.spec.d.ts +2 -0
- package/types/tests/unit/utils/watches.spec.d.ts.map +1 -0
- package/types/use/cancellableIntent.d.ts +129 -0
- package/types/use/cancellableIntent.d.ts.map +1 -0
- package/types/use/combineClasses.d.ts +43 -0
- package/types/use/combineClasses.d.ts.map +1 -0
- package/types/use/list.d.ts +176 -0
- package/types/use/list.d.ts.map +1 -0
- package/types/use/listCalculated.d.ts +192 -0
- package/types/use/listCalculated.d.ts.map +1 -0
- package/types/use/listFilter.d.ts +203 -0
- package/types/use/listFilter.d.ts.map +1 -0
- package/types/use/listInstance.d.ts +357 -0
- package/types/use/listInstance.d.ts.map +1 -0
- package/types/use/listKeys.d.ts +15 -0
- package/types/use/listKeys.d.ts.map +1 -0
- package/types/use/listRelated.d.ts +239 -0
- package/types/use/listRelated.d.ts.map +1 -0
- package/types/use/listSearch.d.ts +298 -0
- package/types/use/listSearch.d.ts.map +1 -0
- package/types/use/listSort.d.ts +235 -0
- package/types/use/listSort.d.ts.map +1 -0
- package/types/use/listSubscription.d.ts +218 -0
- package/types/use/listSubscription.d.ts.map +1 -0
- package/types/use/loadingError.d.ts +81 -0
- package/types/use/loadingError.d.ts.map +1 -0
- package/types/use/object.d.ts +67 -0
- package/types/use/object.d.ts.map +1 -0
- package/types/use/objectCalculated.d.ts +215 -0
- package/types/use/objectCalculated.d.ts.map +1 -0
- package/types/use/objectInstance.d.ts +289 -0
- package/types/use/objectInstance.d.ts.map +1 -0
- package/types/use/objectRelated.d.ts +264 -0
- package/types/use/objectRelated.d.ts.map +1 -0
- package/types/use/objectSubscription.d.ts +249 -0
- package/types/use/objectSubscription.d.ts.map +1 -0
- package/types/use/paginatedListInstance.d.ts +51 -0
- package/types/use/paginatedListInstance.d.ts.map +1 -0
- package/types/use/proxyLoadingError.d.ts +36 -0
- package/types/use/proxyLoadingError.d.ts.map +1 -0
- package/types/use/search.d.ts +144 -0
- package/types/use/search.d.ts.map +1 -0
- package/types/use/watchesRunning.d.ts +63 -0
- package/types/use/watchesRunning.d.ts.map +1 -0
- package/types/utils/assignReactiveObject.d.ts +115 -0
- package/types/utils/assignReactiveObject.d.ts.map +1 -0
- package/types/utils/classes.d.ts +22 -0
- package/types/utils/classes.d.ts.map +1 -0
- package/types/utils/compact.d.ts +4 -0
- package/types/utils/compact.d.ts.map +1 -0
- package/types/utils/deleteKey.d.ts +16 -0
- package/types/utils/deleteKey.d.ts.map +1 -0
- package/types/utils/flattenPaths.d.ts +23 -0
- package/types/utils/flattenPaths.d.ts.map +1 -0
- package/types/utils/getFakePk.d.ts +13 -0
- package/types/utils/getFakePk.d.ts.map +1 -0
- package/types/utils/keepAliveTry.d.ts +15 -0
- package/types/utils/keepAliveTry.d.ts.map +1 -0
- package/types/utils/keyDiff.d.ts +63 -0
- package/types/utils/keyDiff.d.ts.map +1 -0
- package/types/utils/loadingCombine.d.ts +9 -0
- package/types/utils/loadingCombine.d.ts.map +1 -0
- package/types/utils/proxyRunning.d.ts +9 -0
- package/types/utils/proxyRunning.d.ts.map +1 -0
- package/types/utils/relatedCalculatedHelpers.d.ts +5 -0
- package/types/utils/relatedCalculatedHelpers.d.ts.map +1 -0
- package/types/utils/set.d.ts +7 -0
- package/types/utils/set.d.ts.map +1 -0
- package/types/utils/transformWalk.d.ts +2 -0
- package/types/utils/transformWalk.d.ts.map +1 -0
- package/types/utils/watches.d.ts +155 -0
- package/types/utils/watches.d.ts.map +1 -0
- package/.circleci/config.yml +0 -88
- package/.commitlintrc.json +0 -3
- package/.editorconfig +0 -5
- package/.husky/commit-msg +0 -3
- package/.husky/pre-commit +0 -3
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/encodings.xml +0 -6
- package/.idea/inspectionProfiles/Project_Default.xml +0 -7
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -8
- package/.idea/reactive-helpers.iml +0 -15
- package/.prettierignore +0 -5
- package/.prettierrc.cjs +0 -5
- package/.vscode/extensions.json +0 -3
- package/docs/README.md +0 -45
- package/docs/config/listCrud.md +0 -422
- package/docs/config/objectCrud.md +0 -427
- package/docs/use/cancellableIntent.md +0 -165
- package/docs/use/combineClasses.md +0 -62
- package/docs/use/list.md +0 -361
- package/docs/use/listCalculated.md +0 -794
- package/docs/use/listFilter.md +0 -897
- package/docs/use/listInstance.md +0 -559
- package/docs/use/listKeys.md +0 -91
- package/docs/use/listRelated.md +0 -706
- package/docs/use/listSearch.md +0 -903
- package/docs/use/listSort.md +0 -1171
- package/docs/use/listSubscription.md +0 -393
- package/docs/use/loadingError.md +0 -115
- package/docs/use/object.md +0 -668
- package/docs/use/objectCalculated.md +0 -741
- package/docs/use/objectInstance.md +0 -685
- package/docs/use/objectRelated.md +0 -723
- package/docs/use/objectSubscription.md +0 -538
- package/docs/use/paginatedListInstance.md +0 -155
- package/docs/use/proxyLoadingError.md +0 -51
- package/docs/use/search.md +0 -321
- package/docs/use/watchesRunning.md +0 -84
- package/docs/utils/assignReactiveObject.md +0 -413
- package/docs/utils/classes.md +0 -139
- package/docs/utils/compact.md +0 -67
- package/docs/utils/deleteKey.md +0 -61
- package/docs/utils/flattenPaths.md +0 -53
- package/docs/utils/getFakePk.md +0 -39
- package/docs/utils/keepAliveTry.md +0 -59
- package/docs/utils/keyDiff.md +0 -117
- package/docs/utils/loadingCombine.md +0 -30
- package/docs/utils/proxyRunning.md +0 -39
- package/docs/utils/relatedCalculatedHelpers.md +0 -93
- package/docs/utils/set.md +0 -223
- package/docs/utils/transformWalk.md +0 -68
- package/docs/utils/watches.md +0 -489
- package/eslint.config.js +0 -125
- package/lint-staged.config.js +0 -10
- package/makeTypeDoc.sh +0 -25
- package/make_type_doc.js +0 -59
- package/tests/unit/config/listCrud.spec.js +0 -114
- package/tests/unit/config/objectCrud.spec.js +0 -160
- package/tests/unit/crudPromise.js +0 -40
- package/tests/unit/expectHelpers.js +0 -6
- package/tests/unit/mockOnUnmounted.js +0 -9
- package/tests/unit/poll.js +0 -50
- package/tests/unit/use/cancellableIntent.spec.js +0 -152
- package/tests/unit/use/listCalculated.spec.js +0 -135
- package/tests/unit/use/listFilter.spec.js +0 -484
- package/tests/unit/use/listInstance.spec.js +0 -1166
- package/tests/unit/use/listRelated.spec.js +0 -260
- package/tests/unit/use/listSearch.spec.js +0 -586
- package/tests/unit/use/listSort.spec.js +0 -418
- package/tests/unit/use/listSubscription.spec.js +0 -845
- package/tests/unit/use/loadingError.spec.js +0 -43
- package/tests/unit/use/objectInstance.spec.js +0 -1525
- package/tests/unit/use/objectSubscription.spec.js +0 -849
- package/tests/unit/use/proxyLoadingError.spec.js +0 -64
- package/tests/unit/use/search.spec.js +0 -248
- package/tests/unit/utils/assignReactiveObject.spec.js +0 -593
- package/tests/unit/utils/classes.spec.js +0 -427
- package/tests/unit/utils/deleteKey.spec.js +0 -265
- package/tests/unit/utils/flattenPaths.spec.js +0 -126
- package/tests/unit/utils/keyDiff.spec.js +0 -110
- package/tests/unit/utils/set.spec.js +0 -81
- package/tests/unit/utils/watches.spec.js +0 -276
- package/tsconfig.json +0 -19
- package/typedoc-local-plugins/customize-output.js +0 -13
- package/typedoc.json +0 -11
- package/vitest.config.js +0 -11
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sets default configuration options for all list sorting operations within the application. This function allows
|
|
3
|
+
* global settings to be specified that affect the behavior of sorting operations unless overridden by specific
|
|
4
|
+
* instance configurations.
|
|
5
|
+
*
|
|
6
|
+
* @param {object} options - Configuration options to set as defaults for list sorting.
|
|
7
|
+
* @param {number} options.sortThrottleWait - Default throttle wait time, in milliseconds, to control the rate at
|
|
8
|
+
* which sorting operations are processed, enhancing performance on large lists.
|
|
9
|
+
*/
|
|
10
|
+
export function setListSortDefaultOptions({ sortThrottleWait }: {
|
|
11
|
+
sortThrottleWait: number;
|
|
12
|
+
}): void;
|
|
13
|
+
/**
|
|
14
|
+
* Describes a rule for ordering elements in a list. Each rule can directly reference a property of the list items,
|
|
15
|
+
* or define a function to compute the value used for sorting. Rules can be configured to sort in ascending or descending
|
|
16
|
+
* order and can utilize locale-aware string comparison if necessary.
|
|
17
|
+
*
|
|
18
|
+
* @typedef {{
|
|
19
|
+
* key: string,
|
|
20
|
+
* keyFn?: (object: any, state: ListSortState) => any,
|
|
21
|
+
* desc?: boolean,
|
|
22
|
+
* localeCompare?: boolean
|
|
23
|
+
* }} OrderByRule
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Represents the raw state used by the list sorting functionality. Includes all configurations and state necessary
|
|
27
|
+
* to manage sorting operations within a Vue application.
|
|
28
|
+
*
|
|
29
|
+
* @typedef {object} ListSortRawState
|
|
30
|
+
* @property {OrderByRule[]} orderByRules - Current sorting rules applied to the list.
|
|
31
|
+
* @property {string[]} order - Array of IDs representing the current sort order of the list.
|
|
32
|
+
* @property {object} sortCriteria - Computed sort criteria used for dynamically sorting the list.
|
|
33
|
+
* @property {boolean[]} orderByDesc - Flags indicating whether each sort criterion is in descending order.
|
|
34
|
+
* @property {boolean} sortCriteriaWatchRunning - Flag to indicate if sorting criteria computations are actively updating.
|
|
35
|
+
* @property {boolean} sortWatchRunning - Flag to indicate if the sort operation is actively processing.
|
|
36
|
+
* @property {boolean} outstandingEffects - Flag to indicate if there are pending reactive effects needing resolution.
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
*
|
|
41
|
+
* @typedef {(
|
|
42
|
+
* import('./listInstance.js').ListInstanceRawState &
|
|
43
|
+
* Partial<import('./listSubscription.js').ListSubscriptionRawState> &
|
|
44
|
+
* Partial<import('./listRelated.js').ListRelatedRawState> &
|
|
45
|
+
* Partial<import('./listCalculated.js').ListCalculatedRawState> &
|
|
46
|
+
* Partial<import('./listFilter.js').ListFilterRawState> &
|
|
47
|
+
* Partial<import('./listSearch.js').ListSearchRawState>
|
|
48
|
+
* )} ListSortParentRawState
|
|
49
|
+
*/
|
|
50
|
+
/**
|
|
51
|
+
* @typedef {import('vue').UnwrapNestedRefs<ListSortParentRawState>} ListSortParentState
|
|
52
|
+
*/
|
|
53
|
+
/**
|
|
54
|
+
* The reactive state used by the list sorting functionality. Includes all configurations and state necessary to manage
|
|
55
|
+
* sorting operations within a Vue application.
|
|
56
|
+
*
|
|
57
|
+
* @typedef {import('vue').UnwrapNestedRefs<
|
|
58
|
+
* ListSortParentRawState &
|
|
59
|
+
* ListSortRawState
|
|
60
|
+
* >} ListSortState
|
|
61
|
+
*/
|
|
62
|
+
/**
|
|
63
|
+
* The configuration options for initializing a list sort instance.
|
|
64
|
+
*
|
|
65
|
+
* @typedef {object} ListSortOptions
|
|
66
|
+
* @property {ListSortParentState} parentState - The parent state containing the list data and any associated state needed for sorting.
|
|
67
|
+
* @property {OrderByRule[]|import('vue').Ref<OrderByRule[]>} orderByRules - Rules defining how the list should be sorted, including key and direction.
|
|
68
|
+
* @property {number | symbol} sortThrottleWait - Optional throttle wait time to limit the frequency of sort operations, enhancing performance.
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* The properties available on a list sort instance.
|
|
72
|
+
*
|
|
73
|
+
* @typedef {object} ListSortProperties
|
|
74
|
+
* @property {ListSortState} state - The reactive state for the list sort.
|
|
75
|
+
* @property {ListSortParentState} parentState - The parent state.
|
|
76
|
+
* @property {import('vue').EffectScope} effectScope - The effect scope for the list sort.
|
|
77
|
+
* @property {import('./watchesRunning.js').WatchesRunning} watchesRunning - The watches running instance.
|
|
78
|
+
*/
|
|
79
|
+
/**
|
|
80
|
+
* The list sort instance, including reactive state and utilities to manage list sorting operations.
|
|
81
|
+
*
|
|
82
|
+
* @typedef {ListSortProperties} ListSort
|
|
83
|
+
*/
|
|
84
|
+
/**
|
|
85
|
+
* Creates multiple list sort instances.
|
|
86
|
+
*
|
|
87
|
+
* @param {{
|
|
88
|
+
* [keys: string]: ListSortOptions,
|
|
89
|
+
* }} listSortArgs - The options for the list sort.
|
|
90
|
+
* @returns {{
|
|
91
|
+
* [keys: string]: ListSort
|
|
92
|
+
* }} The list sort instance.
|
|
93
|
+
*/
|
|
94
|
+
export function useListSorts(listSortArgs: {
|
|
95
|
+
[keys: string]: ListSortOptions;
|
|
96
|
+
}): {
|
|
97
|
+
[keys: string]: ListSort;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Initializes and manages sorting for a list of objects. This function sets up a reactive sorting mechanism
|
|
101
|
+
* that automatically updates the sort order of the list based on specified criteria. It supports multiple sorting
|
|
102
|
+
* rules, including direct property comparison and custom comparator functions, providing flexibility in handling
|
|
103
|
+
* various data types and structures.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```vue
|
|
107
|
+
* <script setup>
|
|
108
|
+
* import { reactive, computed } from 'vue';
|
|
109
|
+
* import { useListSort, useListInstance } from '@arrai-innovations/reactive-helpers';
|
|
110
|
+
* const listInstanceProps = reactive({
|
|
111
|
+
* crudArgs: {},
|
|
112
|
+
* listArgs: {},
|
|
113
|
+
* pkKey: 'id',
|
|
114
|
+
* retrieveArgs: {},
|
|
115
|
+
* intendToList: true,
|
|
116
|
+
* });
|
|
117
|
+
* const listInstance = useListInstance(listInstanceProps);
|
|
118
|
+
* const listSortProps = reactive({
|
|
119
|
+
* parentState: listInstance.state, // Providing the list instance state as the parent state
|
|
120
|
+
* orderByRules: [
|
|
121
|
+
* { key: 'name', desc: false }, // Sort by name in ascending order
|
|
122
|
+
* { key: 'age', desc: true }, // Sort by age in descending order
|
|
123
|
+
* { key: 'relatedItem.name', desc: false }, // Sort by a related item's name
|
|
124
|
+
* { key: 'calculatedItem.value', desc: true }, // Sort by a calculated value in descending order
|
|
125
|
+
* ],
|
|
126
|
+
* });
|
|
127
|
+
* const listSort = useListSort(listSortProps);
|
|
128
|
+
* </script>
|
|
129
|
+
* <template>
|
|
130
|
+
* <!-- reactive list of items sorted client-side -->
|
|
131
|
+
* <div v-for="item in listSort.state.objectsInOrder" :key="item.id">
|
|
132
|
+
* {{ item.name }}
|
|
133
|
+
* </div>
|
|
134
|
+
* </template>
|
|
135
|
+
* ```
|
|
136
|
+
*
|
|
137
|
+
* @param {ListSortOptions} options - The configuration options for initializing the list sort instance.
|
|
138
|
+
* @returns {ListSort} The initialized list sort instance, including reactive state and utilities to manage list sorting.
|
|
139
|
+
*/
|
|
140
|
+
export function useListSort({ parentState, orderByRules, sortThrottleWait }: ListSortOptions): ListSort;
|
|
141
|
+
/**
|
|
142
|
+
* Describes a rule for ordering elements in a list. Each rule can directly reference a property of the list items,
|
|
143
|
+
* or define a function to compute the value used for sorting. Rules can be configured to sort in ascending or descending
|
|
144
|
+
* order and can utilize locale-aware string comparison if necessary.
|
|
145
|
+
*/
|
|
146
|
+
export type OrderByRule = {
|
|
147
|
+
key: string;
|
|
148
|
+
keyFn?: (object: any, state: ListSortState) => any;
|
|
149
|
+
desc?: boolean;
|
|
150
|
+
localeCompare?: boolean;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Represents the raw state used by the list sorting functionality. Includes all configurations and state necessary
|
|
154
|
+
* to manage sorting operations within a Vue application.
|
|
155
|
+
*/
|
|
156
|
+
export type ListSortRawState = {
|
|
157
|
+
/**
|
|
158
|
+
* - Current sorting rules applied to the list.
|
|
159
|
+
*/
|
|
160
|
+
orderByRules: OrderByRule[];
|
|
161
|
+
/**
|
|
162
|
+
* - Array of IDs representing the current sort order of the list.
|
|
163
|
+
*/
|
|
164
|
+
order: string[];
|
|
165
|
+
/**
|
|
166
|
+
* - Computed sort criteria used for dynamically sorting the list.
|
|
167
|
+
*/
|
|
168
|
+
sortCriteria: object;
|
|
169
|
+
/**
|
|
170
|
+
* - Flags indicating whether each sort criterion is in descending order.
|
|
171
|
+
*/
|
|
172
|
+
orderByDesc: boolean[];
|
|
173
|
+
/**
|
|
174
|
+
* - Flag to indicate if sorting criteria computations are actively updating.
|
|
175
|
+
*/
|
|
176
|
+
sortCriteriaWatchRunning: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* - Flag to indicate if the sort operation is actively processing.
|
|
179
|
+
*/
|
|
180
|
+
sortWatchRunning: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* - Flag to indicate if there are pending reactive effects needing resolution.
|
|
183
|
+
*/
|
|
184
|
+
outstandingEffects: boolean;
|
|
185
|
+
};
|
|
186
|
+
export type ListSortParentRawState = (import("./listInstance.js").ListInstanceRawState & Partial<import("./listSubscription.js").ListSubscriptionRawState> & Partial<import("./listRelated.js").ListRelatedRawState> & Partial<import("./listCalculated.js").ListCalculatedRawState> & Partial<import("./listFilter.js").ListFilterRawState> & Partial<import("./listSearch.js").ListSearchRawState>);
|
|
187
|
+
export type ListSortParentState = import("vue").UnwrapNestedRefs<ListSortParentRawState>;
|
|
188
|
+
/**
|
|
189
|
+
* The reactive state used by the list sorting functionality. Includes all configurations and state necessary to manage
|
|
190
|
+
* sorting operations within a Vue application.
|
|
191
|
+
*/
|
|
192
|
+
export type ListSortState = import("vue").UnwrapNestedRefs<ListSortParentRawState & ListSortRawState>;
|
|
193
|
+
/**
|
|
194
|
+
* The configuration options for initializing a list sort instance.
|
|
195
|
+
*/
|
|
196
|
+
export type ListSortOptions = {
|
|
197
|
+
/**
|
|
198
|
+
* - The parent state containing the list data and any associated state needed for sorting.
|
|
199
|
+
*/
|
|
200
|
+
parentState: ListSortParentState;
|
|
201
|
+
/**
|
|
202
|
+
* - Rules defining how the list should be sorted, including key and direction.
|
|
203
|
+
*/
|
|
204
|
+
orderByRules: OrderByRule[] | import("vue").Ref<OrderByRule[]>;
|
|
205
|
+
/**
|
|
206
|
+
* - Optional throttle wait time to limit the frequency of sort operations, enhancing performance.
|
|
207
|
+
*/
|
|
208
|
+
sortThrottleWait: number | symbol;
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* The properties available on a list sort instance.
|
|
212
|
+
*/
|
|
213
|
+
export type ListSortProperties = {
|
|
214
|
+
/**
|
|
215
|
+
* - The reactive state for the list sort.
|
|
216
|
+
*/
|
|
217
|
+
state: ListSortState;
|
|
218
|
+
/**
|
|
219
|
+
* - The parent state.
|
|
220
|
+
*/
|
|
221
|
+
parentState: ListSortParentState;
|
|
222
|
+
/**
|
|
223
|
+
* - The effect scope for the list sort.
|
|
224
|
+
*/
|
|
225
|
+
effectScope: import("vue").EffectScope;
|
|
226
|
+
/**
|
|
227
|
+
* - The watches running instance.
|
|
228
|
+
*/
|
|
229
|
+
watchesRunning: import("./watchesRunning.js").WatchesRunning;
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* The list sort instance, including reactive state and utilities to manage list sorting operations.
|
|
233
|
+
*/
|
|
234
|
+
export type ListSort = ListSortProperties;
|
|
235
|
+
//# sourceMappingURL=listSort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listSort.d.ts","sourceRoot":"","sources":["../../use/listSort.js"],"names":[],"mappings":"AAsDA;;;;;;;;GAQG;AACH,gEAHG;IAAwB,gBAAgB,EAAhC,MAAM;CAEhB,QAGA;AAED;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;;;GAWG;AAEH;;GAEG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;GAOG;AAEH;;;;;;;;GAQG;AAIH;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,2CAPW;IACV,CAAO,IAAI,EAAE,MAAM,GAAG,eAAe,CAAC;CACnC,GACS;IACZ,CAAO,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAA;CAC3B,CASH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,6EAHW,eAAe,GACb,QAAQ,CAqOpB;;;;;;0BA3WY;IACN,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,aAAa,KAAK,GAAG,CAAC;IACnD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAA;CAC1B;;;;;;;;;kBAQU,WAAW,EAAE;;;;WACb,MAAM,EAAE;;;;kBACR,MAAM;;;;iBACN,OAAO,EAAE;;;;8BACT,OAAO;;;;sBACP,OAAO;;;;wBACP,OAAO;;qCAMR,CACZ,OAAa,mBAAmB,EAAE,oBAAoB,GAChD,OAAO,CAAC,OAAO,uBAAuB,EAAE,wBAAwB,CAAC,GACjE,OAAO,CAAC,OAAO,kBAAkB,EAAE,mBAAmB,CAAC,GACvD,OAAO,CAAC,OAAO,qBAAqB,EAAE,sBAAsB,CAAC,GAC7D,OAAO,CAAC,OAAO,iBAAiB,EAAE,kBAAkB,CAAC,GACrD,OAAO,CAAC,OAAO,iBAAiB,EAAE,kBAAkB,CAAC,CACxD;kCAIS,OAAO,KAAK,EAAE,gBAAgB,CAAC,sBAAsB,CAAC;;;;;4BAOtD,OAAO,KAAK,EAAE,gBAAgB,CACpC,sBAAsB,GACtB,gBAAgB,CACnB;;;;;;;;iBAOU,mBAAmB;;;;kBACnB,WAAW,EAAE,GAAC,OAAO,KAAK,EAAE,GAAG,CAAC,WAAW,EAAE,CAAC;;;;sBAC9C,MAAM,GAAG,MAAM;;;;;;;;;WAOf,aAAa;;;;iBACb,mBAAmB;;;;iBACnB,OAAO,KAAK,EAAE,WAAW;;;;oBACzB,OAAO,qBAAqB,EAAE,cAAc;;;;;uBAQ7C,kBAAkB"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The raw state of a list subscription.
|
|
3
|
+
*
|
|
4
|
+
* @typedef {object} ListSubscriptionRawState
|
|
5
|
+
* @property {Readonly<import('vue').Ref<boolean>>} subscriptionLoading - Whether the subscription is loading.
|
|
6
|
+
* @property {Readonly<import('vue').Ref<boolean>>} subscriptionErrored - Whether the subscription has errored.
|
|
7
|
+
* @property {Readonly<import('vue').Ref<Error>>} subscriptionError - The error that occurred.
|
|
8
|
+
* @property {boolean} intendToList - If this is true, the list should be fetched, or re-fetched if arguments change.
|
|
9
|
+
* @property {boolean} intendToSubscribe - If this is true, the subscription should start or restart if arguments change.
|
|
10
|
+
* @property {boolean} subscribed - Whether the subscription is active.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* A reactive object that manages a list of objects, as returned by `useListInstance`.
|
|
14
|
+
*
|
|
15
|
+
* @typedef {import('vue').UnwrapNestedRefs<
|
|
16
|
+
* ListSubscriptionRawState &
|
|
17
|
+
* import('./listInstance.js').ListInstanceRawState
|
|
18
|
+
* >} ListSubscriptionState
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* The methods available on a list subscription.
|
|
22
|
+
*
|
|
23
|
+
* @typedef {object} ListSubscriptionFunctions
|
|
24
|
+
* @property {Function} subscribe - Trigger a subscription to the list.
|
|
25
|
+
* @property {Function} unsubscribe - Unsubscribe from the list.
|
|
26
|
+
* @property {Function} clearError - Clear the subscription error and the underlying list instance error.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* The properties of a list subscription.
|
|
30
|
+
*
|
|
31
|
+
* @typedef {object} ListSubscriptionProperties
|
|
32
|
+
* @property {ListSubscriptionState} state - The reactive state of the list subscription.
|
|
33
|
+
* @property {import('./listInstance.js').ListInstance} listInstance - The list instance used by the subscription.
|
|
34
|
+
* @property {import('./cancellableIntent.js').CancellableIntent} listIntent - The `CancellableIntent` instance managing if the list should be (re)fetched.
|
|
35
|
+
* @property {import('./cancellableIntent.js').CancellableIntent} subscribeIntent - The `CancellableIntent` instance managing if the subscription should be (un)subscribed.
|
|
36
|
+
* @property {import('vue').EffectScope} effectScope - The effect scope of the list subscription.
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* An instance of a list subscription, returned by `useListSubscription`.
|
|
40
|
+
*
|
|
41
|
+
* @typedef {ListSubscriptionFunctions & ListSubscriptionProperties} ListSubscription
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* Defines the settings required to establish a list subscription, detailing how list instances should handle updates
|
|
45
|
+
* and subscriptions based on the given properties.
|
|
46
|
+
*
|
|
47
|
+
* @typedef {object & import("./listInstance.js").ListInstanceOptions} ListSubscriptionOptions
|
|
48
|
+
* @property {import("./listInstance.js").ListInstance} listInstance - A list instance to use instead of creating one.
|
|
49
|
+
* @property {boolean} clearListOnListIntentTriggered - If true, the list will be cleared when the list intent is triggered. Default is false.
|
|
50
|
+
* @property {boolean} keepOldPages - If true, pages will not be cleared when defaultPageCallback is called.
|
|
51
|
+
*/
|
|
52
|
+
/**
|
|
53
|
+
* A Vue composition function that creates multiple list subscriptions, and returns them as an object.
|
|
54
|
+
*
|
|
55
|
+
* @param {{[key: string]: ListSubscriptionOptions}} listSubscriptionArgs - Each desired list instance options, keyed by an instance name.
|
|
56
|
+
* @returns {{[key: string]: ListSubscription}} - Each list instance, keyed by the instance name.
|
|
57
|
+
*/
|
|
58
|
+
export function useListSubscriptions(listSubscriptionArgs: {
|
|
59
|
+
[key: string]: ListSubscriptionOptions;
|
|
60
|
+
}): {
|
|
61
|
+
[key: string]: ListSubscription;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* A composition function that creates a reactive object that manages a list of objects, as returned by
|
|
65
|
+
* `useListInstance`, causing the list to be re-fetched as needed and listening for updates to the list.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```vue
|
|
69
|
+
* <script setup>
|
|
70
|
+
* import { useListSubscription } from "@arrai-innovations/reactive-helpers";
|
|
71
|
+
* import { reactive, toRef } from "vue";
|
|
72
|
+
*
|
|
73
|
+
* const props = defineProps({
|
|
74
|
+
* // whatever props are required for your configured list instance
|
|
75
|
+
* someListFilter: {
|
|
76
|
+
* type: String,
|
|
77
|
+
* default: "",
|
|
78
|
+
* },
|
|
79
|
+
* });
|
|
80
|
+
*
|
|
81
|
+
* const listSubscriptionProps = reactive({
|
|
82
|
+
* crudArgs: {
|
|
83
|
+
* // whatever arguments are required for your configured list crud function to get the right endpoint
|
|
84
|
+
* },
|
|
85
|
+
* listArgs: {
|
|
86
|
+
* // whatever arguments are required for your configured list function to get the right list
|
|
87
|
+
* someListFilter: toRef(props, "someListFilter"),
|
|
88
|
+
* },
|
|
89
|
+
* retrieveArgs: {
|
|
90
|
+
* // whatever arguments are required for your configured list function to get items back looking as expected
|
|
91
|
+
* },
|
|
92
|
+
* intendToList: false,
|
|
93
|
+
* intendToSubscribe: false,
|
|
94
|
+
* });
|
|
95
|
+
* listSubscriptionProps.intendToList = listSubscriptionProps.intendToSubscribe = computed(()=> !!props.someListFilter);
|
|
96
|
+
* const listSubscription = useListSubscription({ props: listSubscriptionProps });
|
|
97
|
+
* </script>
|
|
98
|
+
* <template>
|
|
99
|
+
* <ul>
|
|
100
|
+
* <!-- reactive list of objects, responding to updates via configured subscription function. -->
|
|
101
|
+
* <li v-for="obj in listSubscription.state.objectsInOrder">
|
|
102
|
+
* {{ obj }}
|
|
103
|
+
* </li>
|
|
104
|
+
* </ul>
|
|
105
|
+
* </template>
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* @param {ListSubscriptionOptions} options - The options for the list subscription.
|
|
109
|
+
* @returns {ListSubscription} - Returns a robust list subscription object that manages a list instance with
|
|
110
|
+
* capabilities to subscribe and unsubscribe to data sources, alongside handling real-time data updates.
|
|
111
|
+
* @throws {ListSubscriptionError} - If both listInstance and props are passed, or if neither are
|
|
112
|
+
* passed. Also thrown if clearListOnListIntentTriggered is not passed or if neither listInstance
|
|
113
|
+
* nor keepOldPages are passed.
|
|
114
|
+
*/
|
|
115
|
+
export function useListSubscription({ listInstance, props, functions, keepOldPages, clearListOnListIntentTriggered }: ListSubscriptionOptions): ListSubscription;
|
|
116
|
+
/**
|
|
117
|
+
* A composable function for managing a list subscription.
|
|
118
|
+
*
|
|
119
|
+
* @module use/listSubscription.js
|
|
120
|
+
*/
|
|
121
|
+
/**
|
|
122
|
+
* Custom error class for list subscription errors.
|
|
123
|
+
*/
|
|
124
|
+
export class ListSubscriptionError extends Error {
|
|
125
|
+
/**
|
|
126
|
+
* Creates a new ListSubscriptionError.
|
|
127
|
+
*
|
|
128
|
+
* @param {string} message - The error message.
|
|
129
|
+
* @param {string} code - The error code.
|
|
130
|
+
*/
|
|
131
|
+
constructor(message: string, code: string);
|
|
132
|
+
code: string;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* The raw state of a list subscription.
|
|
136
|
+
*/
|
|
137
|
+
export type ListSubscriptionRawState = {
|
|
138
|
+
/**
|
|
139
|
+
* - Whether the subscription is loading.
|
|
140
|
+
*/
|
|
141
|
+
subscriptionLoading: Readonly<import("vue").Ref<boolean>>;
|
|
142
|
+
/**
|
|
143
|
+
* - Whether the subscription has errored.
|
|
144
|
+
*/
|
|
145
|
+
subscriptionErrored: Readonly<import("vue").Ref<boolean>>;
|
|
146
|
+
/**
|
|
147
|
+
* - The error that occurred.
|
|
148
|
+
*/
|
|
149
|
+
subscriptionError: Readonly<import("vue").Ref<Error>>;
|
|
150
|
+
/**
|
|
151
|
+
* - If this is true, the list should be fetched, or re-fetched if arguments change.
|
|
152
|
+
*/
|
|
153
|
+
intendToList: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* - If this is true, the subscription should start or restart if arguments change.
|
|
156
|
+
*/
|
|
157
|
+
intendToSubscribe: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* - Whether the subscription is active.
|
|
160
|
+
*/
|
|
161
|
+
subscribed: boolean;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* A reactive object that manages a list of objects, as returned by `useListInstance`.
|
|
165
|
+
*/
|
|
166
|
+
export type ListSubscriptionState = import("vue").UnwrapNestedRefs<ListSubscriptionRawState & import("./listInstance.js").ListInstanceRawState>;
|
|
167
|
+
/**
|
|
168
|
+
* The methods available on a list subscription.
|
|
169
|
+
*/
|
|
170
|
+
export type ListSubscriptionFunctions = {
|
|
171
|
+
/**
|
|
172
|
+
* - Trigger a subscription to the list.
|
|
173
|
+
*/
|
|
174
|
+
subscribe: Function;
|
|
175
|
+
/**
|
|
176
|
+
* - Unsubscribe from the list.
|
|
177
|
+
*/
|
|
178
|
+
unsubscribe: Function;
|
|
179
|
+
/**
|
|
180
|
+
* - Clear the subscription error and the underlying list instance error.
|
|
181
|
+
*/
|
|
182
|
+
clearError: Function;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* The properties of a list subscription.
|
|
186
|
+
*/
|
|
187
|
+
export type ListSubscriptionProperties = {
|
|
188
|
+
/**
|
|
189
|
+
* - The reactive state of the list subscription.
|
|
190
|
+
*/
|
|
191
|
+
state: ListSubscriptionState;
|
|
192
|
+
/**
|
|
193
|
+
* - The list instance used by the subscription.
|
|
194
|
+
*/
|
|
195
|
+
listInstance: import("./listInstance.js").ListInstance;
|
|
196
|
+
/**
|
|
197
|
+
* - The `CancellableIntent` instance managing if the list should be (re)fetched.
|
|
198
|
+
*/
|
|
199
|
+
listIntent: import("./cancellableIntent.js").CancellableIntent;
|
|
200
|
+
/**
|
|
201
|
+
* - The `CancellableIntent` instance managing if the subscription should be (un)subscribed.
|
|
202
|
+
*/
|
|
203
|
+
subscribeIntent: import("./cancellableIntent.js").CancellableIntent;
|
|
204
|
+
/**
|
|
205
|
+
* - The effect scope of the list subscription.
|
|
206
|
+
*/
|
|
207
|
+
effectScope: import("vue").EffectScope;
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* An instance of a list subscription, returned by `useListSubscription`.
|
|
211
|
+
*/
|
|
212
|
+
export type ListSubscription = ListSubscriptionFunctions & ListSubscriptionProperties;
|
|
213
|
+
/**
|
|
214
|
+
* Defines the settings required to establish a list subscription, detailing how list instances should handle updates
|
|
215
|
+
* and subscriptions based on the given properties.
|
|
216
|
+
*/
|
|
217
|
+
export type ListSubscriptionOptions = object & import("./listInstance.js").ListInstanceOptions;
|
|
218
|
+
//# sourceMappingURL=listSubscription.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listSubscription.d.ts","sourceRoot":"","sources":["../../use/listSubscription.js"],"names":[],"mappings":"AAkCA;;;;;;;;;;GAUG;AAEH;;;;;;;GAOG;AAEH;;;;;;;GAOG;AAEH;;;;;;;;;GASG;AAEH;;;;GAIG;AAEH;;;;;;;;GAQG;AAEH;;;;;GAKG;AACH,2DAHW;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,uBAAuB,CAAA;CAAC,GACtC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAA;CAAC,CAS7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,sHAPW,uBAAuB,GACrB,gBAAgB,CA+R5B;AA5aD;;;;GAIG;AAEH;;GAEG;AACH;IACI;;;;;OAKG;IACH,qBAHW,MAAM,QACN,MAAM,EAMhB;IADG,aAAgB;CAEvB;;;;;;;;yBAMa,QAAQ,CAAC,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;;;;yBACpC,QAAQ,CAAC,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;;;;uBACpC,QAAQ,CAAC,OAAO,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;;;;kBAClC,OAAO;;;;uBACP,OAAO;;;;gBACP,OAAO;;;;;oCAMR,OAAO,KAAK,EAAE,gBAAgB,CACpC,wBAAwB,GAC9B,OAAa,mBAAmB,EAAE,oBAAoB,CACnD;;;;;;;;;;;;;;;;;;;;;;;;;WAgBU,qBAAqB;;;;kBACrB,OAAO,mBAAmB,EAAE,YAAY;;;;gBACxC,OAAO,wBAAwB,EAAE,iBAAiB;;;;qBAClD,OAAO,wBAAwB,EAAE,iBAAiB;;;;iBAClD,OAAO,KAAK,EAAE,WAAW;;;;;+BAM1B,yBAAyB,GAAG,0BAA0B;;;;;sCAOtD,MAAM,GAAG,OAAO,mBAAmB,EAAE,mBAAmB"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module use/loadingError.js - A composable function for managing loading and error states.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {() => void} ClearErrorFn - Clear the error state.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* The common API for loading and error states.
|
|
9
|
+
*
|
|
10
|
+
* @typedef {object} LoadingErrorStatus
|
|
11
|
+
* @property {Readonly<import("vue").Ref<boolean|undefined>>} loading - Whether the component is loading.
|
|
12
|
+
* @property {Readonly<import("vue").Ref<Error|null>>} error - The error that occurred.
|
|
13
|
+
* @property {Readonly<import("vue").Ref<boolean>>} errored - Whether an error has occurred.
|
|
14
|
+
* @property {ClearErrorFn} clearError - Clear the error state.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* The writable API for loading and error states.
|
|
18
|
+
*
|
|
19
|
+
* @typedef {object} LoadingErrorMutations
|
|
20
|
+
* @property {() => void} setLoading - Set the loading state.
|
|
21
|
+
* @property {() => void} clearLoading - Clear the loading state.
|
|
22
|
+
* @property {(error: Error) => void} setError - Set the error state.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* The instance of useLoadingError.
|
|
26
|
+
*
|
|
27
|
+
* @typedef {LoadingErrorStatus & LoadingErrorMutations} LoadingError
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* A composable function for managing loading and error states.
|
|
31
|
+
*
|
|
32
|
+
* @returns {LoadingError} - An object containing reactive fields and actions for loading and error states.
|
|
33
|
+
*/
|
|
34
|
+
export function useLoadingError(): LoadingError;
|
|
35
|
+
/**
|
|
36
|
+
* - Clear the error state.
|
|
37
|
+
*/
|
|
38
|
+
export type ClearErrorFn = () => void;
|
|
39
|
+
/**
|
|
40
|
+
* The common API for loading and error states.
|
|
41
|
+
*/
|
|
42
|
+
export type LoadingErrorStatus = {
|
|
43
|
+
/**
|
|
44
|
+
* - Whether the component is loading.
|
|
45
|
+
*/
|
|
46
|
+
loading: Readonly<import("vue").Ref<boolean | undefined>>;
|
|
47
|
+
/**
|
|
48
|
+
* - The error that occurred.
|
|
49
|
+
*/
|
|
50
|
+
error: Readonly<import("vue").Ref<Error | null>>;
|
|
51
|
+
/**
|
|
52
|
+
* - Whether an error has occurred.
|
|
53
|
+
*/
|
|
54
|
+
errored: Readonly<import("vue").Ref<boolean>>;
|
|
55
|
+
/**
|
|
56
|
+
* - Clear the error state.
|
|
57
|
+
*/
|
|
58
|
+
clearError: ClearErrorFn;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* The writable API for loading and error states.
|
|
62
|
+
*/
|
|
63
|
+
export type LoadingErrorMutations = {
|
|
64
|
+
/**
|
|
65
|
+
* - Set the loading state.
|
|
66
|
+
*/
|
|
67
|
+
setLoading: () => void;
|
|
68
|
+
/**
|
|
69
|
+
* - Clear the loading state.
|
|
70
|
+
*/
|
|
71
|
+
clearLoading: () => void;
|
|
72
|
+
/**
|
|
73
|
+
* - Set the error state.
|
|
74
|
+
*/
|
|
75
|
+
setError: (error: Error) => void;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* The instance of useLoadingError.
|
|
79
|
+
*/
|
|
80
|
+
export type LoadingError = LoadingErrorStatus & LoadingErrorMutations;
|
|
81
|
+
//# sourceMappingURL=loadingError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadingError.d.ts","sourceRoot":"","sources":["../../use/loadingError.js"],"names":[],"mappings":"AAEA;;GAEG;AAEH;;GAEG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;GAOG;AAEH;;;;GAIG;AAEH;;;;GAIG;AACH,mCAFa,YAAY,CA6BxB;;;;2BA5DY,MAAM,IAAI;;;;;;;;aAOT,QAAQ,CAAC,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,GAAC,SAAS,CAAC,CAAC;;;;WAC9C,QAAQ,CAAC,OAAO,KAAK,EAAE,GAAG,CAAC,KAAK,GAAC,IAAI,CAAC,CAAC;;;;aACvC,QAAQ,CAAC,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;;;;gBACpC,YAAY;;;;;;;;;gBAOZ,MAAM,IAAI;;;;kBACV,MAAM,IAAI;;;;cACV,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI;;;;;2BAMvB,kBAAkB,GAAG,qBAAqB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export function useObjects(objectArgs: {
|
|
2
|
+
[key: string]: ObjectManagerOptions;
|
|
3
|
+
}): {
|
|
4
|
+
[key: string]: ObjectManager;
|
|
5
|
+
};
|
|
6
|
+
export function useObject({ props, functions }: ObjectManagerOptions): ObjectManager;
|
|
7
|
+
/**
|
|
8
|
+
* Defines the raw reactive properties that can be passed to an object instance.
|
|
9
|
+
*/
|
|
10
|
+
export type ObjectManagerRawProps = (import("./objectInstance.js").ObjectInstanceRawProps & import("./objectSubscription.js").ObjectSubscriptionRawProps & import("./objectRelated.js").ObjectRelatedRawProps & import("./objectCalculated.js").ObjectCalculatedRawProps);
|
|
11
|
+
/**
|
|
12
|
+
* Defines the reactive properties that can be passed to an object instance.
|
|
13
|
+
*/
|
|
14
|
+
export type ObjectManagerProps = import("vue").UnwrapNestedRefs<ObjectManagerRawProps>;
|
|
15
|
+
/**
|
|
16
|
+
* Defines the non-reactive functions that can be passed to an object instance.
|
|
17
|
+
*/
|
|
18
|
+
export type ObjectManagerOptions = {
|
|
19
|
+
/**
|
|
20
|
+
* - The reactive properties to be passed to the object instance.
|
|
21
|
+
*/
|
|
22
|
+
props: ObjectManagerProps;
|
|
23
|
+
/**
|
|
24
|
+
* - The non-reactive functions to be passed to the object instance.
|
|
25
|
+
*/
|
|
26
|
+
functions: import("../config/objectCrud.js").ObjectCrudFunctions;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Defines the raw state of the object manager.
|
|
30
|
+
*/
|
|
31
|
+
export type ObjectManagerRawState = (import("./objectInstance.js").ObjectInstanceRawState & import("./objectSubscription.js").ObjectSubscriptionRawState & import("./objectRelated.js").ObjectRelatedRawState & import("./objectCalculated.js").ObjectCalculatedRawState);
|
|
32
|
+
/**
|
|
33
|
+
* Defines the state of the object manager.
|
|
34
|
+
*/
|
|
35
|
+
export type ObjectManagerState = import("vue").UnwrapNestedRefs<ObjectManagerRawState>;
|
|
36
|
+
/**
|
|
37
|
+
* Defines the managed object, containing the managed object instance, subscription, related objects, and calculated objects.
|
|
38
|
+
*/
|
|
39
|
+
export type ObjectManaged = {
|
|
40
|
+
objectInstance: import("./objectInstance.js").ObjectInstance;
|
|
41
|
+
objectSubscription: import("./objectSubscription.js").ObjectSubscription;
|
|
42
|
+
objectRelated: import("./objectRelated.js").ObjectRelated;
|
|
43
|
+
objectCalculated: import("./objectCalculated.js").ObjectCalculated;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Defines the functions provided by the object manager.
|
|
47
|
+
*/
|
|
48
|
+
export type ObjectManagerFunctions = (import("./objectInstance.js").ObjectInstanceFunctions & import("./objectSubscription.js").ObjectSubscriptionFunctions);
|
|
49
|
+
/**
|
|
50
|
+
* Defines the properties available on an object manager.
|
|
51
|
+
*/
|
|
52
|
+
export type ObjectManagerProperties = {
|
|
53
|
+
/**
|
|
54
|
+
* - The managed object.
|
|
55
|
+
*/
|
|
56
|
+
managed: ObjectManaged;
|
|
57
|
+
/**
|
|
58
|
+
* - The state of the managed object.
|
|
59
|
+
*/
|
|
60
|
+
state: ObjectManagerState;
|
|
61
|
+
/**
|
|
62
|
+
* - The effect scope of the managed object.
|
|
63
|
+
*/
|
|
64
|
+
effectScope: import("vue").EffectScope;
|
|
65
|
+
};
|
|
66
|
+
export type ObjectManager = ObjectManagerProperties & ObjectManagerFunctions;
|
|
67
|
+
//# sourceMappingURL=object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../use/object.js"],"names":[],"mappings":"AA0GO,uCAPI;IACV,CAAO,GAAG,EAAE,MAAM,GAAG,oBAAoB,CAAC;CACvC,GACS;IACZ,CAAO,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC;CAChC,CASH;AAoGM,gDAHI,oBAAoB,GAClB,aAAa,CA4EzB;;;;oCA7QY,CACZ,OAAa,qBAAqB,EAAE,sBAAsB,GAC1D,OAAa,yBAAyB,EAAE,0BAA0B,GAClE,OAAa,oBAAoB,EAAE,qBAAqB,GACxD,OAAa,uBAAuB,EAAE,wBAAwB,CAC3D;;;;iCAMS,OAAO,KAAK,EAAE,gBAAgB,CAAC,qBAAqB,CAAC;;;;;;;;WAOpD,kBAAkB;;;;eAClB,OAAO,yBAAyB,EAAE,mBAAmB;;;;;oCAMtD,CACZ,OAAa,qBAAqB,EAAE,sBAAsB,GAC1D,OAAa,yBAAyB,EAAE,0BAA0B,GAClE,OAAa,oBAAoB,EAAE,qBAAqB,GACxD,OAAa,uBAAuB,EAAE,wBAAwB,CAC3D;;;;iCAMS,OAAO,KAAK,EAAE,gBAAgB,CAAC,qBAAqB,CAAC;;;;4BAMrD;IACN,cAAc,EAAE,OAAO,qBAAqB,EAAE,cAAc,CAAC;IAC7D,kBAAkB,EAAE,OAAO,yBAAyB,EAAE,kBAAkB,CAAC;IACzE,aAAa,EAAE,OAAO,oBAAoB,EAAE,aAAa,CAAC;IAC1D,gBAAgB,EAAE,OAAO,uBAAuB,EAAE,gBAAgB,CAAC;CACtE;;;;qCAMS,CACZ,OAAa,qBAAqB,EAAE,uBAAuB,GACnD,OAAO,yBAAyB,EAAE,2BAA2B,CAClE;;;;;;;;aAYU,aAAa;;;;WACb,kBAAkB;;;;iBAClB,OAAO,KAAK,EAAE,WAAW;;4BAK1B,uBAAuB,GAAG,sBAAsB"}
|