@aerogel/core 0.0.0-next.926bde19326fe7b6b24b277666936862b64d8295 → 0.0.0-next.b85327579d32f21c6a9fa21142f0165cdd320d7e
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/aerogel-core.cjs.js +1 -1
- package/dist/aerogel-core.d.ts +213 -53
- package/dist/aerogel-core.esm.js +1 -1
- package/package.json +2 -1
- package/src/bootstrap/index.ts +4 -1
- package/src/components/basic/AGMarkdown.vue +3 -3
- package/src/components/forms/AGButton.vue +21 -8
- package/src/components/forms/AGCheckbox.vue +35 -0
- package/src/components/forms/AGInput.vue +8 -4
- package/src/components/forms/index.ts +2 -1
- package/src/components/headless/forms/AGHeadlessButton.vue +3 -4
- package/src/components/headless/forms/AGHeadlessInput.ts +2 -2
- package/src/components/headless/forms/AGHeadlessInput.vue +3 -3
- package/src/components/headless/forms/AGHeadlessInputError.vue +1 -1
- package/src/components/headless/forms/AGHeadlessInputInput.vue +15 -3
- package/src/components/headless/modals/AGHeadlessModalPanel.vue +5 -1
- package/src/components/modals/AGLoadingModal.vue +19 -0
- package/src/components/modals/AGModal.vue +20 -2
- package/src/components/modals/index.ts +2 -1
- package/src/errors/Errors.state.ts +31 -0
- package/src/errors/Errors.ts +132 -0
- package/src/errors/index.ts +21 -0
- package/src/forms/Form.ts +12 -9
- package/src/forms/utils.ts +17 -0
- package/src/lang/Lang.ts +11 -3
- package/src/lang/index.ts +3 -5
- package/src/lang/utils.ts +4 -0
- package/src/main.ts +1 -0
- package/src/services/App.state.ts +3 -0
- package/src/services/App.ts +11 -1
- package/src/services/Service.ts +126 -44
- package/src/services/index.ts +18 -4
- package/src/services/store.ts +27 -0
- package/src/ui/UI.state.ts +1 -0
- package/src/ui/UI.ts +15 -0
- package/src/ui/index.ts +3 -1
- package/src/utils/composition/forms.ts +11 -0
- package/src/utils/index.ts +1 -0
package/src/ui/UI.ts
CHANGED
|
@@ -21,6 +21,7 @@ type ModalResult<TComponent> = TComponent extends ModalComponent<Record<string,
|
|
|
21
21
|
export const UIComponents = {
|
|
22
22
|
AlertModal: 'alert-modal',
|
|
23
23
|
ConfirmModal: 'confirm-modal',
|
|
24
|
+
LoadingModal: 'loading-modal',
|
|
24
25
|
} as const;
|
|
25
26
|
|
|
26
27
|
export type UIComponent = ObjectValues<typeof UIComponents>;
|
|
@@ -51,6 +52,20 @@ export class UIService extends Service {
|
|
|
51
52
|
return result ?? false;
|
|
52
53
|
}
|
|
53
54
|
|
|
55
|
+
public async loading<T>(operation: Promise<T>): Promise<T>;
|
|
56
|
+
public async loading<T>(message: string, operation: Promise<T>): Promise<T>;
|
|
57
|
+
public async loading<T>(messageOrOperation: string | Promise<T>, operation?: Promise<T>): Promise<T> {
|
|
58
|
+
operation = typeof messageOrOperation === 'string' ? (operation as Promise<T>) : messageOrOperation;
|
|
59
|
+
|
|
60
|
+
const message = typeof messageOrOperation === 'string' ? messageOrOperation : undefined;
|
|
61
|
+
const modal = await this.openModal(this.requireComponent(UIComponents.LoadingModal), { message });
|
|
62
|
+
const result = await operation;
|
|
63
|
+
|
|
64
|
+
await this.closeModal(modal.id);
|
|
65
|
+
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
|
|
54
69
|
public registerComponent(name: UIComponent, component: Component): void {
|
|
55
70
|
this.components[name] = component;
|
|
56
71
|
}
|
package/src/ui/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { definePlugin } from '@/plugins';
|
|
|
6
6
|
import UI, { UIComponents } from './UI';
|
|
7
7
|
import AGAlertModal from '../components/modals/AGAlertModal.vue';
|
|
8
8
|
import AGConfirmModal from '../components/modals/AGConfirmModal.vue';
|
|
9
|
+
import AGLoadingModal from '../components/modals/AGLoadingModal.vue';
|
|
9
10
|
import type { UIComponent } from './UI';
|
|
10
11
|
|
|
11
12
|
export { UI, UIComponents, UIComponent };
|
|
@@ -19,6 +20,7 @@ export default definePlugin({
|
|
|
19
20
|
const defaultComponents = {
|
|
20
21
|
[UIComponents.AlertModal]: AGAlertModal,
|
|
21
22
|
[UIComponents.ConfirmModal]: AGConfirmModal,
|
|
23
|
+
[UIComponents.LoadingModal]: AGLoadingModal,
|
|
22
24
|
};
|
|
23
25
|
|
|
24
26
|
Object.entries({
|
|
@@ -37,5 +39,5 @@ declare module '@/bootstrap/options' {
|
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
declare module '@/services' {
|
|
40
|
-
interface Services extends UIServices {}
|
|
42
|
+
export interface Services extends UIServices {}
|
|
41
43
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { objectWithout } from '@noeldemartin/utils';
|
|
2
|
+
import { computed, useAttrs } from 'vue';
|
|
3
|
+
import type { ComputedRef } from 'vue';
|
|
4
|
+
|
|
5
|
+
export function useInputAttrs(): [ComputedRef<{}>, ComputedRef<unknown>] {
|
|
6
|
+
const attrs = useAttrs();
|
|
7
|
+
const className = computed(() => attrs.class);
|
|
8
|
+
const inputAttrs = computed(() => objectWithout(attrs, 'class'));
|
|
9
|
+
|
|
10
|
+
return [inputAttrs, className];
|
|
11
|
+
}
|
package/src/utils/index.ts
CHANGED