@vc-shell/framework 1.0.116 → 1.0.117
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/CHANGELOG.md +9 -0
- package/core/composables/useApiClient/index.ts +2 -2
- package/core/plugins/modularity/index.ts +1 -0
- package/core/plugins/signalR/index.ts +13 -8
- package/core/plugins/validation/rules.ts +3 -3
- package/core/types/index.ts +1 -1
- package/dist/core/composables/useApiClient/index.d.ts +2 -2
- package/dist/core/composables/useApiClient/index.d.ts.map +1 -1
- package/dist/core/plugins/modularity/index.d.ts.map +1 -1
- package/dist/core/plugins/signalR/index.d.ts.map +1 -1
- package/dist/core/types/index.d.ts +1 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/framework.mjs +3343 -3385
- package/dist/shared/components/blade-navigation/components/vc-blade-navigation/index.d.ts +1 -0
- package/dist/shared/components/blade-navigation/components/vc-blade-navigation/index.d.ts.map +1 -1
- package/dist/shared/components/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue.d.ts +1 -0
- package/dist/shared/components/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue.d.ts.map +1 -1
- package/dist/shared/components/blade-navigation/types/index.d.ts +3 -1
- package/dist/shared/components/blade-navigation/types/index.d.ts.map +1 -1
- package/dist/shared/components/notifications/composables/useContainer/index.d.ts.map +1 -1
- package/dist/shared/components/popup-handler/composables/usePopup/index.d.ts +2 -2
- package/dist/shared/components/popup-handler/composables/usePopup/index.d.ts.map +1 -1
- package/dist/shared/components/popup-handler/plugin.d.ts +2 -1
- package/dist/shared/components/popup-handler/plugin.d.ts.map +1 -1
- package/dist/shared/components/popup-handler/types/index.d.ts +11 -10
- package/dist/shared/components/popup-handler/types/index.d.ts.map +1 -1
- package/dist/shared/modules/assets-manager/components/assets-manager/assets-manager.vue.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/FIELD_MAP.d.ts +5 -2202
- package/dist/shared/modules/dynamic/components/FIELD_MAP.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/SchemaRender.d.ts +4 -4
- package/dist/shared/modules/dynamic/components/fields/Button.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/Card.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/Checkbox.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts +4 -2
- package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/Fieldset.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts +2 -2
- package/dist/shared/modules/dynamic/components/fields/InputCurrency.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/InputField.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts +3 -3
- package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/props.d.ts +1 -1
- package/dist/shared/modules/dynamic/composables/useFilterBuilder/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/nodeBuilder.d.ts +2 -2
- package/dist/shared/modules/dynamic/helpers/nodeBuilder.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/override.d.ts +2 -2
- package/dist/shared/modules/dynamic/helpers/override.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/toolbarReducer.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/unrefNested.d.ts +1 -1
- package/dist/shared/modules/dynamic/helpers/unrefNested.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/types/models.d.ts +5 -3
- package/dist/shared/modules/dynamic/types/models.d.ts.map +1 -1
- package/dist/shared/pages/LoginPage/components/login/Login.vue.d.ts +4 -3
- package/dist/shared/pages/LoginPage/components/login/Login.vue.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-select/index.d.ts +1 -177
- package/dist/ui/components/molecules/vc-select/index.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts +9 -6
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts +9 -9
- package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts +3 -0
- package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts +40 -46
- package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts +6 -6
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
- package/package.json +7 -6
- package/shared/components/blade-navigation/types/index.ts +3 -1
- package/shared/components/notifications/composables/useContainer/index.ts +4 -2
- package/shared/components/popup-handler/composables/usePopup/index.ts +36 -18
- package/shared/components/popup-handler/plugin.ts +3 -3
- package/shared/components/popup-handler/types/index.ts +17 -8
- package/shared/modules/assets-manager/components/assets-manager/assets-manager.vue +7 -6
- package/shared/modules/dynamic/components/FIELD_MAP.ts +6 -1
- package/shared/modules/dynamic/components/SchemaRender.ts +3 -3
- package/shared/modules/dynamic/components/factories.ts +1 -1
- package/shared/modules/dynamic/components/fields/Card.ts +2 -2
- package/shared/modules/dynamic/components/fields/DynamicProperty.ts +31 -11
- package/shared/modules/dynamic/components/fields/GalleryField.ts +1 -1
- package/shared/modules/dynamic/components/fields/SelectField.ts +9 -3
- package/shared/modules/dynamic/components/fields/ValidationField.ts +3 -3
- package/shared/modules/dynamic/composables/useFilterBuilder/index.ts +21 -15
- package/shared/modules/dynamic/helpers/nodeBuilder.ts +4 -4
- package/shared/modules/dynamic/helpers/override.ts +4 -4
- package/shared/modules/dynamic/helpers/setters.ts +1 -1
- package/shared/modules/dynamic/helpers/toolbarReducer.ts +3 -1
- package/shared/modules/dynamic/helpers/unrefNested.ts +2 -2
- package/shared/modules/dynamic/index.ts +2 -1
- package/shared/modules/dynamic/pages/dynamic-blade-form.vue +4 -1
- package/shared/modules/dynamic/pages/dynamic-blade-list.vue +12 -7
- package/shared/modules/dynamic/types/models.ts +4 -3
- package/shared/pages/LoginPage/components/login/Login.vue +4 -2
- package/ui/components/molecules/vc-input/vc-input.vue +1 -1
- package/ui/components/molecules/vc-multivalue/vc-multivalue.vue +8 -8
- package/ui/components/molecules/vc-select/index.ts +1 -3
- package/ui/components/molecules/vc-select/vc-select.vue +17 -14
- package/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +4 -4
- package/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue +4 -3
- package/ui/components/organisms/vc-popup/vc-popup.vue +23 -25
- package/ui/components/organisms/vc-table/vc-table.vue +49 -31
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { VcPopup } from "./../../../../../ui/components";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
markRaw,
|
|
4
|
+
getCurrentInstance,
|
|
5
|
+
inject,
|
|
6
|
+
reactive,
|
|
7
|
+
shallowRef,
|
|
8
|
+
nextTick,
|
|
9
|
+
Ref,
|
|
10
|
+
watch,
|
|
11
|
+
MaybeRef,
|
|
12
|
+
unref,
|
|
13
|
+
DefineComponent,
|
|
14
|
+
} from "vue";
|
|
15
|
+
import { ComponentPublicInstanceConstructor, PopupPlugin, UsePopupInternal, UsePopupProps } from "./../../types";
|
|
4
16
|
import { popupPluginInstance } from "./../../plugin";
|
|
5
17
|
import { useI18n } from "vue-i18n";
|
|
6
18
|
|
|
@@ -11,21 +23,23 @@ interface IUsePopup {
|
|
|
11
23
|
showError(message: string | Ref<string>): void;
|
|
12
24
|
}
|
|
13
25
|
|
|
14
|
-
export function usePopup<T =
|
|
26
|
+
export function usePopup<T extends ComponentPublicInstanceConstructor<any> = typeof VcPopup>(
|
|
27
|
+
options?: MaybeRef<UsePopupProps<T>>
|
|
28
|
+
): IUsePopup {
|
|
15
29
|
const { t } = useI18n({ useScope: "global" });
|
|
16
30
|
const instance = getCurrentInstance();
|
|
17
|
-
const popupInstance = (instance && inject("popupPlugin")) || popupPluginInstance;
|
|
18
|
-
let rawPopup = createInstance(unref(
|
|
31
|
+
const popupInstance: PopupPlugin = (instance && inject("popupPlugin")) || popupPluginInstance;
|
|
32
|
+
let rawPopup = createInstance(unref(options));
|
|
19
33
|
|
|
20
34
|
watch(
|
|
21
|
-
() =>
|
|
35
|
+
() => options,
|
|
22
36
|
(newVal) => {
|
|
23
37
|
rawPopup = createInstance(unref(newVal));
|
|
24
38
|
},
|
|
25
39
|
{ deep: true }
|
|
26
40
|
);
|
|
27
41
|
|
|
28
|
-
async function open(customInstance?: UsePopupProps<
|
|
42
|
+
async function open(customInstance?: UsePopupProps<DefineComponent>) {
|
|
29
43
|
let activeInstance;
|
|
30
44
|
await nextTick();
|
|
31
45
|
if (popupInstance) {
|
|
@@ -35,7 +49,7 @@ export function usePopup<T = InstanceType<typeof VcPopup>["$props"]>(props?: May
|
|
|
35
49
|
activeInstance.popups.push(rawPopup || customInstance);
|
|
36
50
|
}
|
|
37
51
|
|
|
38
|
-
function close(customInstance?: UsePopupProps<
|
|
52
|
+
function close(customInstance?: UsePopupProps<DefineComponent>) {
|
|
39
53
|
let activeInstance;
|
|
40
54
|
if (popupInstance) {
|
|
41
55
|
activeInstance = popupInstance;
|
|
@@ -45,7 +59,7 @@ export function usePopup<T = InstanceType<typeof VcPopup>["$props"]>(props?: May
|
|
|
45
59
|
}
|
|
46
60
|
|
|
47
61
|
async function showConfirmation(message: string | Ref<string>): Promise<boolean> {
|
|
48
|
-
let resolvePromise;
|
|
62
|
+
let resolvePromise: (value: boolean | PromiseLike<boolean>) => void;
|
|
49
63
|
const confirmation = createInstance({
|
|
50
64
|
component: VcPopup,
|
|
51
65
|
props: {
|
|
@@ -96,15 +110,17 @@ export function usePopup<T = InstanceType<typeof VcPopup>["$props"]>(props?: May
|
|
|
96
110
|
popupInstance.popups.push(confirmation);
|
|
97
111
|
}
|
|
98
112
|
|
|
99
|
-
function createInstance<T
|
|
113
|
+
function createInstance<T extends ComponentPublicInstanceConstructor<any> = typeof VcPopup>(
|
|
114
|
+
options: UsePopupProps<T>
|
|
115
|
+
) {
|
|
100
116
|
return (
|
|
101
|
-
|
|
117
|
+
options &&
|
|
102
118
|
(reactive({
|
|
103
119
|
id: Symbol("usePopup"),
|
|
104
|
-
...createComponent(
|
|
120
|
+
...createComponent(options),
|
|
105
121
|
close: close,
|
|
106
122
|
open: open,
|
|
107
|
-
}) as UsePopupProps<
|
|
123
|
+
}) as UsePopupProps<DefineComponent> & UsePopupInternal)
|
|
108
124
|
);
|
|
109
125
|
}
|
|
110
126
|
|
|
@@ -116,12 +132,14 @@ export function usePopup<T = InstanceType<typeof VcPopup>["$props"]>(props?: May
|
|
|
116
132
|
};
|
|
117
133
|
}
|
|
118
134
|
|
|
119
|
-
function createComponent<T
|
|
135
|
+
function createComponent<T extends ComponentPublicInstanceConstructor<any> = typeof VcPopup>(
|
|
136
|
+
options: UsePopupProps<T>
|
|
137
|
+
) {
|
|
120
138
|
const slots =
|
|
121
|
-
typeof
|
|
139
|
+
typeof options.slots === "undefined"
|
|
122
140
|
? {}
|
|
123
141
|
: Object.fromEntries(
|
|
124
|
-
Object.entries(
|
|
142
|
+
Object.entries(options.slots).map(([slotName, slotContent]) => {
|
|
125
143
|
if (typeof slotContent === "string") {
|
|
126
144
|
return [slotName, slotContent];
|
|
127
145
|
}
|
|
@@ -130,8 +148,8 @@ function createComponent<T>(props: UsePopupProps<T>) {
|
|
|
130
148
|
);
|
|
131
149
|
|
|
132
150
|
return {
|
|
133
|
-
...
|
|
151
|
+
...options,
|
|
134
152
|
slots,
|
|
135
|
-
component: markRaw(shallowRef(
|
|
153
|
+
component: markRaw(shallowRef(options.component)),
|
|
136
154
|
};
|
|
137
155
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { App, shallowReactive } from "vue";
|
|
1
|
+
import { App, shallowReactive, DefineComponent } from "vue";
|
|
2
2
|
import * as components from "./components";
|
|
3
3
|
import { PopupPlugin, UsePopupProps, UsePopupInternal } from "./types";
|
|
4
4
|
import { createModule } from "./../../../core/plugins";
|
|
5
5
|
|
|
6
|
-
export let popupPluginInstance;
|
|
6
|
+
export let popupPluginInstance: PopupPlugin;
|
|
7
7
|
|
|
8
8
|
export const VcPopupHandler = {
|
|
9
9
|
install(app: App) {
|
|
@@ -11,7 +11,7 @@ export const VcPopupHandler = {
|
|
|
11
11
|
createModule(components).install(app);
|
|
12
12
|
|
|
13
13
|
// Plugin
|
|
14
|
-
const popups = shallowReactive<(UsePopupProps<
|
|
14
|
+
const popups = shallowReactive<(UsePopupProps<DefineComponent> & UsePopupInternal)[]>([]);
|
|
15
15
|
|
|
16
16
|
const popupPlugin: PopupPlugin = {
|
|
17
17
|
popups,
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { Component, Slot as VueSlot } from "vue";
|
|
1
|
+
import { Component, ComponentPublicInstance, DefineComponent, Slot as VueSlot } from "vue";
|
|
2
2
|
|
|
3
|
-
export type RawProps<T
|
|
4
|
-
|
|
3
|
+
export type RawProps<T extends ComponentPublicInstanceConstructor<any>> = Omit<
|
|
4
|
+
InstanceType<T>["$props"],
|
|
5
|
+
`on${string}`
|
|
6
|
+
>;
|
|
7
|
+
export type RawEmits<T extends ComponentPublicInstanceConstructor<any>> = Pick<
|
|
8
|
+
InstanceType<T>["$props"],
|
|
9
|
+
Extract<keyof InstanceType<T>["$props"], `on${string}`>
|
|
10
|
+
>;
|
|
5
11
|
export type Slot = string | Component | VueSlot;
|
|
6
12
|
|
|
7
13
|
export interface UsePopupInternal {
|
|
@@ -11,15 +17,18 @@ export interface UsePopupInternal {
|
|
|
11
17
|
}
|
|
12
18
|
|
|
13
19
|
export interface PopupPlugin {
|
|
14
|
-
popups:
|
|
20
|
+
popups: Partial<UsePopupProps<DefineComponent> & UsePopupInternal>[];
|
|
15
21
|
}
|
|
16
22
|
|
|
17
|
-
export interface ComponentPublicInstanceConstructor<T
|
|
18
|
-
|
|
23
|
+
export interface ComponentPublicInstanceConstructor<T extends ComponentPublicInstance> {
|
|
24
|
+
__isFragment?: never;
|
|
25
|
+
__isTeleport?: never;
|
|
26
|
+
__isSuspense?: never;
|
|
27
|
+
new (...args: unknown[]): T;
|
|
19
28
|
}
|
|
20
29
|
|
|
21
|
-
export interface UsePopupProps<T
|
|
22
|
-
component:
|
|
30
|
+
export interface UsePopupProps<T extends ComponentPublicInstanceConstructor<any>> {
|
|
31
|
+
component: T;
|
|
23
32
|
emits?: RawEmits<T>;
|
|
24
33
|
props?: RawProps<T>;
|
|
25
34
|
slots?: {
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
|
|
144
144
|
<script setup lang="ts">
|
|
145
145
|
import { Asset, IActionBuilderResult, IBladeToolbar, ITableColumns } from "../../../../../core/types";
|
|
146
|
-
import { ref, computed, onMounted, unref, watch, markRaw } from "vue";
|
|
146
|
+
import { ref, computed, onMounted, unref, watch, markRaw, UnwrapNestedRefs } from "vue";
|
|
147
147
|
import { useI18n } from "vue-i18n";
|
|
148
148
|
import moment from "moment";
|
|
149
149
|
import Assets from "./../../../assets/components/assets-details/assets-details.vue";
|
|
@@ -187,7 +187,7 @@ const uploader = ref();
|
|
|
187
187
|
const loading = ref(false);
|
|
188
188
|
const selectedItems = ref([]);
|
|
189
189
|
const readonly = computed(() => props.options.disabled);
|
|
190
|
-
let assetsCopy;
|
|
190
|
+
let assetsCopy: Asset[];
|
|
191
191
|
const modified = ref(false);
|
|
192
192
|
|
|
193
193
|
const { openBlade } = useBladeNavigation();
|
|
@@ -271,7 +271,7 @@ onMounted(() => {
|
|
|
271
271
|
assetsCopy = _.cloneDeep(props.options?.assets);
|
|
272
272
|
});
|
|
273
273
|
|
|
274
|
-
function sortAssets(event: { dragIndex: number; dropIndex: number; value: Asset[] }) {
|
|
274
|
+
async function sortAssets(event: { dragIndex: number; dropIndex: number; value: Asset[] }) {
|
|
275
275
|
if (
|
|
276
276
|
props.options.assetsEditHandler &&
|
|
277
277
|
typeof props.options.assetsEditHandler === "function" &&
|
|
@@ -282,7 +282,7 @@ function sortAssets(event: { dragIndex: number; dropIndex: number; value: Asset[
|
|
|
282
282
|
return item;
|
|
283
283
|
});
|
|
284
284
|
|
|
285
|
-
defaultAssets.value = props.options.assetsEditHandler(sorted);
|
|
285
|
+
defaultAssets.value = await props.options.assetsEditHandler(sorted);
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
|
|
@@ -363,12 +363,13 @@ const onSelectionChanged = (items: Asset[]) => {
|
|
|
363
363
|
selectedItems.value = items;
|
|
364
364
|
};
|
|
365
365
|
|
|
366
|
-
const actionBuilder = (): IActionBuilderResult[] => {
|
|
367
|
-
const result = [];
|
|
366
|
+
const actionBuilder = (): IActionBuilderResult<Asset>[] => {
|
|
367
|
+
const result: IActionBuilderResult<Asset>[] = [];
|
|
368
368
|
|
|
369
369
|
result.push({
|
|
370
370
|
icon: "fas fa-edit",
|
|
371
371
|
title: computed(() => t("ASSETS_MANAGER.TABLE.ACTIONS.EDIT")),
|
|
372
|
+
variant: "success",
|
|
372
373
|
clickHandler(item: Asset) {
|
|
373
374
|
onItemClick(item);
|
|
374
375
|
},
|
|
@@ -9,8 +9,13 @@ import EditorField from "./fields/EditorField";
|
|
|
9
9
|
import GalleryField from "./fields/GalleryField";
|
|
10
10
|
import Button from "./fields/Button";
|
|
11
11
|
import StatusField from "./fields/StatusField";
|
|
12
|
+
import { ControlSchema } from "../types";
|
|
13
|
+
import { ConcreteComponent } from "vue";
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
type AvailableComponents = Exclude<ControlSchema["component"], "vc-widgets">;
|
|
16
|
+
type TFieldMap = Record<AvailableComponents, ConcreteComponent>;
|
|
17
|
+
|
|
18
|
+
const FIELD_MAP: TFieldMap = {
|
|
14
19
|
"vc-select": SelectField,
|
|
15
20
|
"vc-card": Card,
|
|
16
21
|
"vc-input": InputField,
|
|
@@ -18,11 +18,11 @@ const schemeRenderProps = {
|
|
|
18
18
|
uiSchema: {
|
|
19
19
|
type: Array as PropType<ControlSchema[]>,
|
|
20
20
|
required: true,
|
|
21
|
-
default: () => [],
|
|
21
|
+
default: (): ControlSchema[] => [],
|
|
22
22
|
},
|
|
23
23
|
currentLocale: {
|
|
24
24
|
type: String,
|
|
25
|
-
default:
|
|
25
|
+
default: "",
|
|
26
26
|
},
|
|
27
27
|
};
|
|
28
28
|
|
|
@@ -54,7 +54,7 @@ export default defineComponent({
|
|
|
54
54
|
{ deep: true }
|
|
55
55
|
);
|
|
56
56
|
|
|
57
|
-
function emitChange(newVal) {
|
|
57
|
+
function emitChange(newVal: unknown) {
|
|
58
58
|
ctx.emit("update:modelValue", newVal);
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -105,7 +105,7 @@ export const CardCollection = ({ props, options, slots }: Partial<ICardCollectio
|
|
|
105
105
|
});
|
|
106
106
|
|
|
107
107
|
export const DynamicProperties = ({ props, options }: Partial<IDynamicProperties>): IDynamicProperties => ({
|
|
108
|
-
component: markRaw(VcDynamicProperty)
|
|
108
|
+
component: markRaw(VcDynamicProperty),
|
|
109
109
|
props: {
|
|
110
110
|
...props,
|
|
111
111
|
...ControlBaseProps(props),
|
|
@@ -12,7 +12,7 @@ export default {
|
|
|
12
12
|
setup(props: ExtractPropTypes<typeof componentProps> & { element: CardSchema }) {
|
|
13
13
|
const isMounted = useMounted();
|
|
14
14
|
|
|
15
|
-
const commentRecursiveNodeCheck = (node: VNodeChild | VNodeNormalizedChildren) => {
|
|
15
|
+
const commentRecursiveNodeCheck = (node: VNodeChild | VNodeNormalizedChildren): boolean => {
|
|
16
16
|
return _.every(Array.isArray(node) ? node : [node], (nodeItem) => {
|
|
17
17
|
if (typeof nodeItem === "object") {
|
|
18
18
|
if (
|
|
@@ -52,7 +52,7 @@ export default {
|
|
|
52
52
|
header: props.element.label,
|
|
53
53
|
isCollapsable: props.element.collapsible,
|
|
54
54
|
isCollapsed: restoreCollapsed(props.element.id),
|
|
55
|
-
"onState:collapsed": (e) => handleCollapsed(props.element.id, e),
|
|
55
|
+
"onState:collapsed": (e: boolean) => handleCollapsed(props.element.id, e),
|
|
56
56
|
},
|
|
57
57
|
options: props.baseOptions,
|
|
58
58
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { ExtractPropTypes, computed, h,
|
|
2
|
+
import { ExtractPropTypes, computed, h, ref, toValue, watch, UnwrapNestedRefs } from "vue";
|
|
3
3
|
import { DynamicProperties } from "../factories";
|
|
4
4
|
import componentProps from "./props";
|
|
5
5
|
import { unrefNested } from "../../helpers/unrefNested";
|
|
@@ -7,6 +7,24 @@ import { reactify, reactiveComputed } from "@vueuse/core";
|
|
|
7
7
|
import * as _ from "lodash-es";
|
|
8
8
|
import { DynamicPropertiesSchema } from "../../types";
|
|
9
9
|
import { setModel } from "../../helpers/setters";
|
|
10
|
+
import { IDynamicProperties } from "../../types/models";
|
|
11
|
+
|
|
12
|
+
interface IProperty {
|
|
13
|
+
[x: string]: unknown;
|
|
14
|
+
type: string;
|
|
15
|
+
required: boolean;
|
|
16
|
+
multivalue?: boolean;
|
|
17
|
+
multilanguage?: boolean;
|
|
18
|
+
valueType: string;
|
|
19
|
+
dictionary?: boolean;
|
|
20
|
+
name: string;
|
|
21
|
+
displayNames: { name?: string; languageCode?: string }[];
|
|
22
|
+
validationRule?: {
|
|
23
|
+
charCountMin: number;
|
|
24
|
+
charCountMax: number;
|
|
25
|
+
regExp: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
10
28
|
|
|
11
29
|
export default {
|
|
12
30
|
name: "DynamicProperty",
|
|
@@ -35,23 +53,25 @@ export default {
|
|
|
35
53
|
{ deep: true, immediate: true }
|
|
36
54
|
);
|
|
37
55
|
|
|
38
|
-
const filteredProps = reactify(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
56
|
+
const filteredProps = reactify(
|
|
57
|
+
(prop: IProperty[], { include, exclude }: { include: string[]; exclude: string[] }) => {
|
|
58
|
+
if (prop) {
|
|
59
|
+
return prop.filter((x) => {
|
|
60
|
+
if (include) return include?.includes(x.type);
|
|
61
|
+
if (exclude) return !exclude?.includes(x.type);
|
|
62
|
+
else return true;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
45
66
|
}
|
|
46
|
-
|
|
47
|
-
});
|
|
67
|
+
);
|
|
48
68
|
|
|
49
69
|
const dynamicProps = filteredProps(internalModel, {
|
|
50
70
|
include: props.element?.include,
|
|
51
71
|
exclude: props.element?.exclude,
|
|
52
72
|
});
|
|
53
73
|
|
|
54
|
-
const properties = reactiveComputed(() => {
|
|
74
|
+
const properties: UnwrapNestedRefs<IDynamicProperties[]> = reactiveComputed(() => {
|
|
55
75
|
return (dynamicProps.value || [])?.map((prop) =>
|
|
56
76
|
DynamicProperties({
|
|
57
77
|
props: {
|
|
@@ -13,7 +13,7 @@ import { setModel } from "../../helpers/setters";
|
|
|
13
13
|
export default {
|
|
14
14
|
name: "GalleryField",
|
|
15
15
|
props: componentProps,
|
|
16
|
-
setup(props: ExtractPropTypes<typeof componentProps> & { element: GallerySchema }
|
|
16
|
+
setup(props: ExtractPropTypes<typeof componentProps> & { element: GallerySchema }) {
|
|
17
17
|
if (!_.has(props.bladeContext.scope, "assetsHandler.images")) {
|
|
18
18
|
throw new Error(
|
|
19
19
|
`There is no assetsHandler.images config provided in blade scope: ${JSON.stringify(
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { h, resolveComponent, ExtractPropTypes, Component } from "vue";
|
|
1
|
+
import { h, resolveComponent, ExtractPropTypes, Component, VNode } from "vue";
|
|
2
2
|
import { SelectField } from "../factories";
|
|
3
3
|
import componentProps from "./props";
|
|
4
4
|
import ValidationField from "./ValidationField";
|
|
5
5
|
import { SelectSchema } from "../../types";
|
|
6
|
+
import { VcSelect } from "../../../../../ui/components";
|
|
7
|
+
import type { ComponentSlots } from "vue-component-type-helpers";
|
|
8
|
+
|
|
9
|
+
type TScope =
|
|
10
|
+
| Parameters<ComponentSlots<typeof VcSelect>["option"]>["0"]
|
|
11
|
+
| Parameters<ComponentSlots<typeof VcSelect>["selected-item"]>["0"];
|
|
6
12
|
|
|
7
13
|
export default {
|
|
8
14
|
name: "SelectField",
|
|
@@ -25,10 +31,10 @@ export default {
|
|
|
25
31
|
slots:
|
|
26
32
|
props.element.customTemplate &&
|
|
27
33
|
["selected-item", "option"].reduce((obj, slot) => {
|
|
28
|
-
obj[slot] = (scope) =>
|
|
34
|
+
obj[slot] = (scope: TScope) =>
|
|
29
35
|
h(resolveComponent(props.element.customTemplate.component), { context: scope, slotName: slot });
|
|
30
36
|
return obj;
|
|
31
|
-
}, {}),
|
|
37
|
+
}, {} as Record<string, (scope: TScope) => VNode>),
|
|
32
38
|
});
|
|
33
39
|
|
|
34
40
|
const render = h(field.component as unknown as Component, field.props, field.slots);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, h, unref, useSlots, defineComponent } from "vue";
|
|
1
|
+
import { computed, h, unref, useSlots, defineComponent, ComputedRef } from "vue";
|
|
2
2
|
import { unrefNested } from "../../helpers/unrefNested";
|
|
3
3
|
import { Field } from "vee-validate";
|
|
4
4
|
import { reactify } from "@vueuse/core";
|
|
@@ -20,7 +20,7 @@ export default defineComponent({
|
|
|
20
20
|
: String(props.props.key)
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
const fieldNameLang = reactify((name) => {
|
|
23
|
+
const fieldNameLang = reactify((name: string) => {
|
|
24
24
|
return props.props.multilanguage ? name + "_" + props.props.currentLanguage : name;
|
|
25
25
|
});
|
|
26
26
|
|
|
@@ -37,7 +37,7 @@ export default defineComponent({
|
|
|
37
37
|
).value,
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
|
-
default: ({ errorMessage, errors }) => {
|
|
40
|
+
default: ({ errorMessage, errors }: { errorMessage: ComputedRef<string | undefined>; errors: string[] }) => {
|
|
41
41
|
return slots.default().map((slot) =>
|
|
42
42
|
h(slot, {
|
|
43
43
|
...props.props,
|
|
@@ -60,7 +60,7 @@ export default <Query>(args: { data: Data; query: MaybeRef<Query>; load: AsyncAc
|
|
|
60
60
|
const _data = args.data;
|
|
61
61
|
|
|
62
62
|
const isFilterVisible = ref(true);
|
|
63
|
-
const filter = reactive({});
|
|
63
|
+
const filter: Record<string, unknown> = reactive({});
|
|
64
64
|
|
|
65
65
|
const controls = ref<Control[]>([]);
|
|
66
66
|
|
|
@@ -74,21 +74,27 @@ export default <Query>(args: { data: Data; query: MaybeRef<Query>; load: AsyncAc
|
|
|
74
74
|
onMounted(() => createFilterControls());
|
|
75
75
|
|
|
76
76
|
function isItemSelected(value: string, field: string) {
|
|
77
|
-
|
|
77
|
+
const item = filter[field];
|
|
78
|
+
if (Array.isArray(item) && typeof item !== "string") {
|
|
79
|
+
return item.some((x) => x === value);
|
|
80
|
+
}
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
function selectFilterItem(e: boolean, value: string, field: string) {
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
const item = filter[field];
|
|
85
|
+
let isSelected = false;
|
|
86
|
+
|
|
87
|
+
if (Array.isArray(item)) {
|
|
88
|
+
isSelected = item.includes(value);
|
|
89
|
+
|
|
90
|
+
if (e && !isSelected) {
|
|
91
|
+
item.push(value);
|
|
92
|
+
} else if (!e && isSelected) {
|
|
93
|
+
filter[field] = item.filter((x) => x !== value);
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
84
96
|
filter[field] = [];
|
|
85
97
|
}
|
|
86
|
-
|
|
87
|
-
if (e && !isSelected) {
|
|
88
|
-
filter[field]?.push(value);
|
|
89
|
-
} else if (!e && isSelected) {
|
|
90
|
-
filter[field] = filter[field].filter((x) => x !== value);
|
|
91
|
-
}
|
|
92
98
|
}
|
|
93
99
|
|
|
94
100
|
function createFilterControls() {
|
|
@@ -109,7 +115,7 @@ export default <Query>(args: { data: Data; query: MaybeRef<Query>; load: AsyncAc
|
|
|
109
115
|
}
|
|
110
116
|
|
|
111
117
|
return obj;
|
|
112
|
-
}, {});
|
|
118
|
+
}, {} as Record<string, ReturnType<typeof Checkbox> | ReturnType<typeof InputField>>);
|
|
113
119
|
|
|
114
120
|
return {
|
|
115
121
|
title: item.title,
|
|
@@ -125,7 +131,7 @@ export default <Query>(args: { data: Data; query: MaybeRef<Query>; load: AsyncAc
|
|
|
125
131
|
props: {
|
|
126
132
|
classNames: "tw-mb-2",
|
|
127
133
|
modelValue: computed(() => isItemSelected(currC.value, control.field)),
|
|
128
|
-
"onUpdate:modelValue": (e) => selectFilterItem(e, currC.value, control.field),
|
|
134
|
+
"onUpdate:modelValue": (e: boolean) => selectFilterItem(e, currC.value, control.field),
|
|
129
135
|
},
|
|
130
136
|
slots: {
|
|
131
137
|
default: () => currC.displayName,
|
|
@@ -136,7 +142,7 @@ export default <Query>(args: { data: Data; query: MaybeRef<Query>; load: AsyncAc
|
|
|
136
142
|
});
|
|
137
143
|
|
|
138
144
|
return obj;
|
|
139
|
-
}, {});
|
|
145
|
+
}, {} as Record<string, ReturnType<typeof Checkbox>>);
|
|
140
146
|
}
|
|
141
147
|
|
|
142
148
|
function createInput(control: RawControl) {
|
|
@@ -146,7 +152,7 @@ export default <Query>(args: { data: Data; query: MaybeRef<Query>; load: AsyncAc
|
|
|
146
152
|
classNames: "tw-mb-3",
|
|
147
153
|
label: control.label,
|
|
148
154
|
modelValue: computed(() => filter[control.field]),
|
|
149
|
-
"onUpdate:modelValue": (e) => (filter[control.field] = e),
|
|
155
|
+
"onUpdate:modelValue": (e: unknown) => (filter[control.field] = e),
|
|
150
156
|
},
|
|
151
157
|
options: {
|
|
152
158
|
visibility: computed(() => true),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unref, computed, toValue, h, UnwrapNestedRefs, MaybeRef, reactive } from "vue";
|
|
1
|
+
import { unref, computed, toValue, h, UnwrapNestedRefs, MaybeRef, reactive, VNode } from "vue";
|
|
2
2
|
import FIELD_MAP from "../components/FIELD_MAP";
|
|
3
3
|
import { ControlSchema } from "../types";
|
|
4
4
|
import { IControlBaseProps, IControlBaseOptions } from "../types/models";
|
|
@@ -26,7 +26,7 @@ function nodeBuilder<Context, BContext extends UnwrapNestedRefs<DetailsBladeCont
|
|
|
26
26
|
bladeContext: BContext;
|
|
27
27
|
currentLocale: MaybeRef<string>;
|
|
28
28
|
formData: FormData;
|
|
29
|
-
}) {
|
|
29
|
+
}): VNode | false {
|
|
30
30
|
const { controlSchema, parentId, internalContext, bladeContext, currentLocale, formData } = args;
|
|
31
31
|
if (!controlSchema) return false;
|
|
32
32
|
|
|
@@ -61,14 +61,14 @@ function nodeBuilder<Context, BContext extends UnwrapNestedRefs<DetailsBladeCont
|
|
|
61
61
|
),
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
-
const component = FIELD_MAP[controlSchema.component];
|
|
64
|
+
const component = FIELD_MAP[controlSchema.component as keyof typeof FIELD_MAP];
|
|
65
65
|
|
|
66
66
|
const fieldsHandler = computed(() => {
|
|
67
67
|
if (!("fields" in controlSchema)) return null;
|
|
68
68
|
const fieldsModel = getModel(controlSchema.property, internalContext);
|
|
69
69
|
|
|
70
70
|
if (toValue(fieldsModel) && Array.isArray(toValue(fieldsModel))) {
|
|
71
|
-
return toValue(fieldsModel).map((model) =>
|
|
71
|
+
return toValue(fieldsModel).map((model: { [x: string]: unknown; id: string }) =>
|
|
72
72
|
controlSchema.fields.map((fieldItem) =>
|
|
73
73
|
nodeBuilder({
|
|
74
74
|
controlSchema: fieldItem,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _ from "lodash-es";
|
|
2
2
|
import { DynamicSchema, OverridesSchema, OverridesUpsert } from "../types";
|
|
3
3
|
|
|
4
|
-
export const handleOverrides = (overrides, schemaCopy: { [key: string]: DynamicSchema }) => {
|
|
4
|
+
export const handleOverrides = (overrides: OverridesSchema, schemaCopy: { [key: string]: DynamicSchema }) => {
|
|
5
5
|
let schema = _.cloneDeep(schemaCopy);
|
|
6
6
|
|
|
7
7
|
// REMOVE
|
|
@@ -49,10 +49,10 @@ const upsertHelper = (overrides: OverridesSchema, schemaCopy: { [key: string]: D
|
|
|
49
49
|
);
|
|
50
50
|
obj[name] = clonedSchema;
|
|
51
51
|
return obj;
|
|
52
|
-
}, {});
|
|
52
|
+
}, {} as Record<string, DynamicSchema>);
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
const removeHelper = (overrides, schemaCopy: { [key: string]: DynamicSchema }) => {
|
|
55
|
+
const removeHelper = (overrides: OverridesSchema, schemaCopy: { [key: string]: DynamicSchema }) => {
|
|
56
56
|
return Object.entries(schemaCopy).reduce((obj, [name, schema]) => {
|
|
57
57
|
const clonedSchema = _.cloneDeep(schema);
|
|
58
58
|
overrides.remove
|
|
@@ -66,5 +66,5 @@ const removeHelper = (overrides, schemaCopy: { [key: string]: DynamicSchema }) =
|
|
|
66
66
|
}, {});
|
|
67
67
|
obj[name] = clonedSchema;
|
|
68
68
|
return obj;
|
|
69
|
-
}, {});
|
|
69
|
+
}, {} as Record<string, DynamicSchema>);
|
|
70
70
|
};
|
|
@@ -9,7 +9,7 @@ function setModel(args: {
|
|
|
9
9
|
}) {
|
|
10
10
|
const { property, value, option, context } = args;
|
|
11
11
|
|
|
12
|
-
_.set(context, property, option ? value[option] : value);
|
|
12
|
+
_.set(context, property, option ? value[option as keyof typeof value] : value);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export { setModel };
|
|
@@ -15,7 +15,9 @@ export const toolbarReducer = (args: {
|
|
|
15
15
|
const toolbarMethodsMerge = _.merge(ref({}), ref(args.defaultToolbarBindings), ref(args.customToolbarConfig));
|
|
16
16
|
return computed(() =>
|
|
17
17
|
args.defaultToolbarSchema.reduce((acc, curr) => {
|
|
18
|
-
const toolbarItemCtx = toolbarMethodsMerge.value[
|
|
18
|
+
const toolbarItemCtx = toolbarMethodsMerge.value[
|
|
19
|
+
curr.method as keyof typeof toolbarMethodsMerge.value
|
|
20
|
+
] as IBladeToolbar;
|
|
19
21
|
if (toolbarItemCtx) {
|
|
20
22
|
const context =
|
|
21
23
|
typeof toolbarItemCtx === "function"
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { unref } from "vue";
|
|
2
2
|
|
|
3
|
-
export function unrefNested<T
|
|
3
|
+
export function unrefNested<T extends Record<string, unknown>>(field: T) {
|
|
4
4
|
const unreffedProps = {} as T;
|
|
5
5
|
|
|
6
6
|
if (field) {
|
|
7
|
-
Object.keys(field).forEach((key) => {
|
|
7
|
+
Object.keys(field).forEach((key: keyof T) => {
|
|
8
8
|
unreffedProps[key] = unref(field[key]);
|
|
9
9
|
});
|
|
10
10
|
|
|
@@ -66,6 +66,7 @@ const register = (
|
|
|
66
66
|
const defineBladeComponent = defineComponent({
|
|
67
67
|
...bladeComponent,
|
|
68
68
|
name: bladeName,
|
|
69
|
+
isWorkspace: "isWorkspace" in json.settings && json.settings.isWorkspace,
|
|
69
70
|
setup: (props, ctx) =>
|
|
70
71
|
(bladeComponent as DefineComponent).setup(
|
|
71
72
|
reactiveComputed(() => ({
|
|
@@ -139,7 +140,7 @@ export const createDynamicAppModule = <T extends BladeMenu>(args: {
|
|
|
139
140
|
const blade = register(
|
|
140
141
|
{
|
|
141
142
|
app,
|
|
142
|
-
component: bladePages[JsonSchema.settings.component],
|
|
143
|
+
component: bladePages[JsonSchema.settings.component as keyof typeof bladePages],
|
|
143
144
|
composables: { ...args.composables },
|
|
144
145
|
json: JsonSchema,
|
|
145
146
|
options,
|
|
@@ -190,7 +190,10 @@ const bladeMultilanguage = reactiveComputed(() => {
|
|
|
190
190
|
});
|
|
191
191
|
|
|
192
192
|
const bladeWidgets = computed(() => {
|
|
193
|
-
return widgets.value?.children?.map((x) =>
|
|
193
|
+
return widgets.value?.children?.map((x) => {
|
|
194
|
+
if (typeof x === "string") return resolveComponent(x);
|
|
195
|
+
else throw new Error(`Component is required in widget: ${x}`);
|
|
196
|
+
});
|
|
194
197
|
});
|
|
195
198
|
|
|
196
199
|
const bladeOptions = reactive({
|