@vc-shell/framework 1.0.121 → 1.0.123
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 +21 -0
- package/core/composables/index.ts +1 -0
- package/core/composables/useAssets/index.ts +100 -0
- package/core/types/index.ts +5 -13
- package/dist/core/composables/index.d.ts +1 -0
- package/dist/core/composables/index.d.ts.map +1 -1
- package/dist/core/composables/useAssets/index.d.ts +10 -0
- package/dist/core/composables/useAssets/index.d.ts.map +1 -0
- package/dist/core/types/index.d.ts +5 -12
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/framework.mjs +14885 -14344
- package/dist/shared/modules/assets/components/assets-details/assets-details.vue.d.ts +4 -4
- package/dist/shared/modules/assets/components/assets-details/assets-details.vue.d.ts.map +1 -1
- package/dist/shared/modules/assets-manager/components/assets-manager/assets-manager.vue.d.ts +7 -5
- package/dist/shared/modules/assets-manager/components/assets-manager/assets-manager.vue.d.ts.map +1 -1
- package/dist/shared/modules/assets-manager/components/assets-manager/index.d.ts +10 -8
- package/dist/shared/modules/assets-manager/components/assets-manager/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/SchemaRender.d.ts +18 -30
- package/dist/shared/modules/dynamic/components/SchemaRender.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Button.d.ts +6 -10
- package/dist/shared/modules/dynamic/components/fields/Button.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Card.d.ts +10 -14
- package/dist/shared/modules/dynamic/components/fields/Card.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Checkbox.d.ts +6 -10
- package/dist/shared/modules/dynamic/components/fields/Checkbox.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/ContentField.d.ts +6 -10
- package/dist/shared/modules/dynamic/components/fields/ContentField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts +6 -10
- package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts +6 -10
- package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Fieldset.d.ts +6 -10
- package/dist/shared/modules/dynamic/components/fields/Fieldset.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts +7 -11
- package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/ImageField.d.ts +6 -10
- package/dist/shared/modules/dynamic/components/fields/ImageField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/InputCurrency.d.ts +6 -10
- package/dist/shared/modules/dynamic/components/fields/InputCurrency.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/InputField.d.ts +6 -10
- package/dist/shared/modules/dynamic/components/fields/InputField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts +6 -10
- package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts +6 -10
- package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/TextareaField.d.ts +6 -10
- package/dist/shared/modules/dynamic/components/fields/TextareaField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/VideoField.d.ts +6 -10
- package/dist/shared/modules/dynamic/components/fields/VideoField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/props.d.ts +6 -10
- package/dist/shared/modules/dynamic/components/fields/props.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/factories/types/index.d.ts +3 -3
- package/dist/shared/modules/dynamic/factories/types/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/nodeBuilder.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/override.d.ts +1 -0
- package/dist/shared/modules/dynamic/helpers/override.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/toolbarReducer.d.ts +2 -2
- package/dist/shared/modules/dynamic/helpers/toolbarReducer.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts +6 -10
- 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 +25 -2
- package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/types/index.d.ts +28 -14
- package/dist/shared/modules/dynamic/types/index.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts +6 -8
- 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-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue.d.ts +3 -3
- package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-gallery/index.d.ts +17 -14
- package/dist/ui/components/organisms/vc-gallery/index.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts +16 -17
- package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts +3 -3
- package/package.json +6 -5
- package/shared/modules/assets/components/assets-details/assets-details.vue +5 -5
- package/shared/modules/assets-manager/components/assets-manager/assets-manager.vue +25 -34
- package/shared/modules/dynamic/components/fields/Card.ts +27 -42
- package/shared/modules/dynamic/components/fields/GalleryField.ts +25 -28
- package/shared/modules/dynamic/factories/types/index.ts +3 -3
- package/shared/modules/dynamic/helpers/nodeBuilder.ts +2 -4
- package/shared/modules/dynamic/helpers/override.ts +1 -0
- package/shared/modules/dynamic/helpers/toolbarReducer.ts +2 -2
- package/shared/modules/dynamic/pages/dynamic-blade-list.vue +151 -112
- package/shared/modules/dynamic/types/index.ts +30 -15
- package/ui/components/atoms/vc-card/vc-card.vue +1 -1
- package/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue +8 -11
- package/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue +2 -2
- package/ui/components/organisms/vc-gallery/vc-gallery.vue +18 -13
- package/ui/components/organisms/vc-table/vc-table.vue +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Component, ExtractPropTypes, computed, h, markRaw,
|
|
1
|
+
import { Component, ExtractPropTypes, computed, h, markRaw, ref, toRefs, watch } from "vue";
|
|
2
2
|
import { Gallery } from "../factories";
|
|
3
3
|
import componentProps from "./props";
|
|
4
|
-
import {
|
|
4
|
+
import { ICommonAsset } from "../../../../../core/types";
|
|
5
5
|
import { useBladeNavigation, usePopup } from "./../../../../components";
|
|
6
6
|
import { useI18n } from "vue-i18n";
|
|
7
7
|
import { default as AssetsDetails } from "../../../assets/components/assets-details/assets-details.vue";
|
|
@@ -52,31 +52,31 @@ export default {
|
|
|
52
52
|
|
|
53
53
|
return () => {
|
|
54
54
|
const imageHandlers = {
|
|
55
|
-
loading: imagesHandler.loading,
|
|
56
|
-
async edit(image:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
);
|
|
61
|
-
await editImages(internalModel.value[props.element.property]);
|
|
55
|
+
loading: imagesHandler.loading ?? false,
|
|
56
|
+
async edit(image: ICommonAsset) {
|
|
57
|
+
if (!imagesHandler.edit?.value) throw new Error("Edit handler is not provided");
|
|
58
|
+
const edited = await imagesHandler.edit?.value?.([image]);
|
|
59
|
+
|
|
60
|
+
await editImages(edited);
|
|
62
61
|
},
|
|
63
|
-
async upload(files: FileList | null) {
|
|
62
|
+
async upload(files: FileList | null, lastSortOrder?: number) {
|
|
63
|
+
if (!imagesHandler.upload?.value) throw new Error("Upload handler is not provided");
|
|
64
64
|
if (files) {
|
|
65
|
-
|
|
66
|
-
files,
|
|
67
|
-
unref(props.formData)[props.element.property] as IImage[],
|
|
68
|
-
(unref(props.formData).id as string) || (unref(props.formData).categoryId as string),
|
|
69
|
-
props.element.uploadFolder
|
|
70
|
-
);
|
|
65
|
+
const uploaded = await imagesHandler.upload?.value?.(files, lastSortOrder);
|
|
71
66
|
|
|
67
|
+
let addToExisting: ICommonAsset[];
|
|
68
|
+
if (Array.isArray(uploaded) && Array.isArray(internalModel.value[props.element.property])) {
|
|
69
|
+
addToExisting = internalModel.value[props.element.property].concat(uploaded);
|
|
70
|
+
} else {
|
|
71
|
+
addToExisting = uploaded;
|
|
72
|
+
}
|
|
72
73
|
files = null;
|
|
73
74
|
|
|
74
|
-
await editImages(
|
|
75
|
-
|
|
76
|
-
return internalModel.value[props.element.property];
|
|
75
|
+
await editImages(addToExisting);
|
|
77
76
|
}
|
|
78
77
|
},
|
|
79
|
-
async remove(image:
|
|
78
|
+
async remove(image: ICommonAsset) {
|
|
79
|
+
if (!imagesHandler.remove?.value) throw new Error("Remove handler is not provided");
|
|
80
80
|
if (
|
|
81
81
|
await showConfirmation(
|
|
82
82
|
computed(() =>
|
|
@@ -88,17 +88,13 @@ export default {
|
|
|
88
88
|
)
|
|
89
89
|
)
|
|
90
90
|
) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
image
|
|
94
|
-
);
|
|
95
|
-
await editImages(internalModel.value[props.element.property]);
|
|
91
|
+
const edited = await imagesHandler.remove?.value?.([image]);
|
|
92
|
+
await editImages(edited);
|
|
96
93
|
}
|
|
97
|
-
return internalModel.value[props.element.property];
|
|
98
94
|
},
|
|
99
95
|
};
|
|
100
96
|
|
|
101
|
-
function onGalleryItemEdit(item:
|
|
97
|
+
function onGalleryItemEdit(item: ICommonAsset) {
|
|
102
98
|
openBlade({
|
|
103
99
|
blade: markRaw(AssetsDetails),
|
|
104
100
|
options: {
|
|
@@ -109,7 +105,7 @@ export default {
|
|
|
109
105
|
});
|
|
110
106
|
}
|
|
111
107
|
|
|
112
|
-
async function editImages(args:
|
|
108
|
+
async function editImages(args: ICommonAsset[]) {
|
|
113
109
|
if (props.fieldContext) {
|
|
114
110
|
internalModel.value[props.element.property] = args;
|
|
115
111
|
setModel({
|
|
@@ -134,6 +130,7 @@ export default {
|
|
|
134
130
|
onRemove: imageHandlers.remove,
|
|
135
131
|
onEdit: onGalleryItemEdit,
|
|
136
132
|
onSort: editImages,
|
|
133
|
+
hideAfterUpload: props.element.hideAfterUpload,
|
|
137
134
|
},
|
|
138
135
|
options: props.baseOptions,
|
|
139
136
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { ComputedRef, MaybeRef, Ref, UnwrapNestedRefs } from "vue";
|
|
3
3
|
import { AsyncAction } from "../../../../../core/composables";
|
|
4
4
|
import { SettingsSchema } from "../../types";
|
|
5
|
-
import {
|
|
5
|
+
import { AssetsHandler, IBladeToolbar, ICommonAsset } from "../../../../../core/types";
|
|
6
6
|
import { useBladeNavigation } from "../../../../components";
|
|
7
7
|
import { FormContext } from "vee-validate";
|
|
8
8
|
|
|
@@ -91,8 +91,8 @@ export interface DetailsBaseBladeScope extends BaseBladeScope {
|
|
|
91
91
|
}) => void;
|
|
92
92
|
};
|
|
93
93
|
assetsHandler?: {
|
|
94
|
-
assets?: AssetsHandler<
|
|
95
|
-
images?: AssetsHandler<
|
|
94
|
+
assets?: AssetsHandler<ICommonAsset>;
|
|
95
|
+
images?: AssetsHandler<ICommonAsset>;
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unref, computed, toValue, h, UnwrapNestedRefs, MaybeRef, reactive, VNode } from "vue";
|
|
1
|
+
import { unref, computed, toValue, h, UnwrapNestedRefs, MaybeRef, reactive, VNode, ref } 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";
|
|
@@ -50,17 +50,15 @@ function nodeBuilder<
|
|
|
50
50
|
const contextProperty =
|
|
51
51
|
safeIn("property", controlSchema) &&
|
|
52
52
|
controlSchema.property &&
|
|
53
|
-
_.has(toValue(internalContext), controlSchema.property) &&
|
|
54
53
|
getModel(controlSchema.property, toValue(internalContext));
|
|
55
54
|
|
|
56
55
|
const scopedProperty =
|
|
57
56
|
safeIn("property", controlSchema) &&
|
|
58
57
|
controlSchema.property &&
|
|
59
58
|
bladeContext.scope &&
|
|
60
|
-
_.has(bladeContext.scope, controlSchema.property) &&
|
|
61
59
|
bladeContext.scope[controlSchema.property];
|
|
62
60
|
|
|
63
|
-
const modelValue =
|
|
61
|
+
const modelValue = scopedProperty || contextProperty || undefined;
|
|
64
62
|
|
|
65
63
|
const tooltip = (safeIn("tooltip", controlSchema) && controlSchema.tooltip) || undefined;
|
|
66
64
|
const multilanguage = safeIn("multilanguage", controlSchema) && controlSchema.multilanguage;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _ from "lodash-es";
|
|
2
2
|
import { DynamicSchema, OverridesSchema } from "../types";
|
|
3
|
+
import "core-js/actual/array/to-spliced";
|
|
3
4
|
|
|
4
5
|
export const handleOverrides = (overrides: OverridesSchema, schemaCopy: { [key: string]: DynamicSchema }) => {
|
|
5
6
|
let schema = _.cloneDeep(schemaCopy);
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { IBladeToolbar } from "../../../../core/types";
|
|
3
3
|
import * as _ from "lodash-es";
|
|
4
4
|
import { UnwrapNestedRefs, computed, ref, ComputedRef } from "vue";
|
|
5
|
-
import {
|
|
5
|
+
import { SettingsSchema } from "../types";
|
|
6
6
|
import { BaseBladeScope, DetailsBladeContext, ListBladeContext } from "../factories/types";
|
|
7
7
|
|
|
8
8
|
export const toolbarReducer = (args: {
|
|
9
|
-
defaultToolbarSchema:
|
|
9
|
+
defaultToolbarSchema: SettingsSchema["toolbar"];
|
|
10
10
|
defaultToolbarBindings: BaseBladeScope["toolbarOverrides"];
|
|
11
11
|
customToolbarConfig: BaseBladeScope["toolbarOverrides"];
|
|
12
12
|
context: UnwrapNestedRefs<DetailsBladeContext> | UnwrapNestedRefs<ListBladeContext>;
|
|
@@ -1,112 +1,129 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<component
|
|
3
|
+
:is="isWidgetView ? 'template' : 'VcBlade'"
|
|
3
4
|
:expanded="expanded"
|
|
4
5
|
:closable="closable"
|
|
5
6
|
width="50%"
|
|
6
7
|
:toolbar-items="toolbarComputed"
|
|
7
8
|
:title="title"
|
|
9
|
+
:class="{
|
|
10
|
+
'tw-flex tw-flex-auto': isWidgetView,
|
|
11
|
+
}"
|
|
8
12
|
@close="$emit('close:blade')"
|
|
9
13
|
@expand="$emit('expand:blade')"
|
|
10
14
|
@collapse="$emit('collapse:blade')"
|
|
11
15
|
>
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
:state-key="(tableData?.id as string)"
|
|
18
|
-
:items="(itemsProxy as Record<string, any>[])"
|
|
19
|
-
:multiselect="tableData?.multiselect"
|
|
20
|
-
:header="tableData?.header"
|
|
21
|
-
:sort="sort"
|
|
22
|
-
:pages="pagination?.pages"
|
|
23
|
-
:current-page="pagination?.currentPage"
|
|
24
|
-
:search-value="searchValue"
|
|
25
|
-
:selected-item-id="selectedItemId"
|
|
26
|
-
:total-label="$t(`${settings?.localizationPrefix.trim().toUpperCase()}.PAGES.LIST.TABLE.TOTALS`)"
|
|
27
|
-
:total-count="pagination?.totalCount"
|
|
28
|
-
:active-filter-count="activeFilterCount"
|
|
29
|
-
:reorderable-rows="tableData?.reorderableRows"
|
|
30
|
-
@item-click="onItemClick"
|
|
31
|
-
@pagination-click="onPaginationClick"
|
|
32
|
-
@selection-changed="onSelectionChanged"
|
|
33
|
-
@header-click="onHeaderClick"
|
|
34
|
-
@load:change="onSearchList"
|
|
35
|
-
@scroll:ptr="reload"
|
|
36
|
-
@search:change="onSearchList"
|
|
37
|
-
@row:reorder="sortRows"
|
|
38
|
-
>
|
|
39
|
-
<template
|
|
40
|
-
v-if="isFilterVisible"
|
|
41
|
-
#filters="{ closePanel }"
|
|
16
|
+
<template v-if="isWidgetView && $isMobile.value">
|
|
17
|
+
<slot
|
|
18
|
+
name="widget-mobile"
|
|
19
|
+
:total-count="pagination.totalCount"
|
|
20
|
+
:loading="loading"
|
|
42
21
|
>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
22
|
+
{{ pagination.totalCount }}</slot
|
|
23
|
+
>
|
|
24
|
+
</template>
|
|
25
|
+
<template v-else>
|
|
26
|
+
<VcTable
|
|
27
|
+
class="tw-grow tw-basis-0"
|
|
28
|
+
:loading="loading"
|
|
29
|
+
:expanded="expanded"
|
|
30
|
+
:columns="(tableData?.columns as ITableColumns[])"
|
|
31
|
+
:state-key="stateKey"
|
|
32
|
+
:items="(itemsProxy as Record<string, any>[])"
|
|
33
|
+
:multiselect="isWidgetView ? false : tableData?.multiselect"
|
|
34
|
+
:header="isWidgetView ? false : tableData?.header"
|
|
35
|
+
:footer="!isWidgetView"
|
|
36
|
+
:sort="sort"
|
|
37
|
+
:pages="pagination?.pages"
|
|
38
|
+
:current-page="pagination?.currentPage"
|
|
39
|
+
:search-value="searchValue"
|
|
40
|
+
:selected-item-id="selectedItemId"
|
|
41
|
+
:total-label="$t(`${settings?.localizationPrefix.trim().toUpperCase()}.PAGES.LIST.TABLE.TOTALS`)"
|
|
42
|
+
:total-count="pagination?.totalCount"
|
|
43
|
+
:active-filter-count="activeFilterCount"
|
|
44
|
+
:reorderable-rows="isWidgetView ? false : tableData?.reorderableRows"
|
|
45
|
+
:pull-to-reload="true"
|
|
46
|
+
@item-click="onItemClick"
|
|
47
|
+
@pagination-click="onPaginationClick"
|
|
48
|
+
@selection-changed="onSelectionChanged"
|
|
49
|
+
@header-click="onHeaderClick"
|
|
50
|
+
@load:change="onSearchList"
|
|
51
|
+
@scroll:ptr="reload"
|
|
52
|
+
@search:change="onSearchList"
|
|
53
|
+
@row:reorder="sortRows"
|
|
54
|
+
>
|
|
55
|
+
<template
|
|
56
|
+
v-if="isFilterVisible"
|
|
57
|
+
#filters="{ closePanel }"
|
|
58
|
+
>
|
|
59
|
+
<filterComponent :close="closePanel" />
|
|
53
60
|
</template>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
|
|
62
|
+
<!-- Not found template -->
|
|
63
|
+
<template #notfound>
|
|
64
|
+
<template v-if="bladeOptions.notFound">
|
|
65
|
+
<component
|
|
66
|
+
:is="bladeOptions.notFound"
|
|
67
|
+
@reset="resetSearch"
|
|
68
|
+
></component>
|
|
69
|
+
</template>
|
|
70
|
+
<template v-else>
|
|
71
|
+
<div class="tw-w-full tw-h-full tw-box-border tw-flex tw-flex-col tw-items-center tw-justify-center">
|
|
72
|
+
<div class="tw-m-4 tw-text-xl tw-font-medium">
|
|
73
|
+
{{ $t(`${settings?.localizationPrefix.trim().toUpperCase()}.PAGES.LIST.NOT_FOUND.EMPTY`) }}
|
|
74
|
+
</div>
|
|
75
|
+
<VcButton
|
|
76
|
+
v-if="isFilterVisible"
|
|
77
|
+
@click="resetSearch"
|
|
78
|
+
>{{ $t(`${settings?.localizationPrefix.trim().toUpperCase()}.PAGES.LIST.NOT_FOUND.RESET`) }}</VcButton
|
|
79
|
+
>
|
|
58
80
|
</div>
|
|
59
|
-
|
|
60
|
-
v-if="isFilterVisible"
|
|
61
|
-
@click="resetSearch"
|
|
62
|
-
>{{ $t(`${settings?.localizationPrefix.trim().toUpperCase()}.PAGES.LIST.NOT_FOUND.RESET`) }}</VcButton
|
|
63
|
-
>
|
|
64
|
-
</div>
|
|
81
|
+
</template>
|
|
65
82
|
</template>
|
|
66
|
-
</template>
|
|
67
83
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
<!-- Empty template -->
|
|
85
|
+
<template #empty>
|
|
86
|
+
<template v-if="bladeOptions.empty">
|
|
87
|
+
<component
|
|
88
|
+
:is="bladeOptions.empty"
|
|
89
|
+
@add="openDetailsBlade"
|
|
90
|
+
></component>
|
|
91
|
+
</template>
|
|
92
|
+
<template v-else>
|
|
93
|
+
<div class="tw-w-full tw-h-full tw-box-border tw-flex tw-flex-col tw-items-center tw-justify-center">
|
|
94
|
+
<div class="tw-m-4 tw-text-xl tw-font-medium">
|
|
95
|
+
{{ $t(`${settings?.localizationPrefix.trim().toUpperCase()}.PAGES.LIST.EMPTY.NO_ITEMS`) }}
|
|
96
|
+
</div>
|
|
80
97
|
</div>
|
|
81
|
-
</
|
|
98
|
+
</template>
|
|
82
99
|
</template>
|
|
83
|
-
</template>
|
|
84
100
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
101
|
+
<!-- Override table templates-->
|
|
102
|
+
<template
|
|
103
|
+
v-for="(component, key, index) in bladeOptions?.templateOverrideComponents"
|
|
104
|
+
#[`item_${key}`]="itemData"
|
|
105
|
+
:key="`template_override_${index}`"
|
|
106
|
+
>
|
|
107
|
+
<component
|
|
108
|
+
:is="component"
|
|
109
|
+
:context="itemData"
|
|
110
|
+
/>
|
|
111
|
+
</template>
|
|
96
112
|
|
|
97
|
-
|
|
113
|
+
<!-- Override table mobile view -->
|
|
98
114
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
115
|
+
<template
|
|
116
|
+
v-if="bladeOptions.mobileView"
|
|
117
|
+
#mobile-item="itemData"
|
|
118
|
+
>
|
|
119
|
+
<component
|
|
120
|
+
:is="bladeOptions.mobileView"
|
|
121
|
+
:context="itemData"
|
|
122
|
+
></component>
|
|
123
|
+
</template>
|
|
124
|
+
</VcTable>
|
|
125
|
+
</template>
|
|
126
|
+
</component>
|
|
110
127
|
</template>
|
|
111
128
|
<script setup lang="ts">
|
|
112
129
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
@@ -147,6 +164,7 @@ export interface Props {
|
|
|
147
164
|
options?: unknown;
|
|
148
165
|
model?: DynamicGridSchema;
|
|
149
166
|
composables?: Record<string, (...args: any[]) => Record<string, any>>;
|
|
167
|
+
isWidgetView?: boolean;
|
|
150
168
|
}
|
|
151
169
|
|
|
152
170
|
export interface Emits {
|
|
@@ -155,6 +173,8 @@ export interface Emits {
|
|
|
155
173
|
(event: "collapse:blade"): void;
|
|
156
174
|
(event: "expand:blade"): void;
|
|
157
175
|
(event: "close:children"): void;
|
|
176
|
+
(event: "item-click", args: { param: string | undefined }): void;
|
|
177
|
+
(event: "add"): void;
|
|
158
178
|
}
|
|
159
179
|
|
|
160
180
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -203,6 +223,13 @@ watch(
|
|
|
203
223
|
);
|
|
204
224
|
|
|
205
225
|
const tableData = computed(() => props.model?.content.find((type: ListContentSchema) => type.component === "vc-table"));
|
|
226
|
+
const stateKey = computed(() => {
|
|
227
|
+
if (tableData.value?.id) {
|
|
228
|
+
return tableData.value?.id + props.isWidgetView ? "_dashboard" : "";
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
throw new Error('Table id is not defined. Please provide "id" property in table schema');
|
|
232
|
+
});
|
|
206
233
|
const table = computed(() => {
|
|
207
234
|
const tableScope = {
|
|
208
235
|
columns: tableData.value?.columns,
|
|
@@ -228,6 +255,10 @@ const { load, remove, items, loading, pagination, query, scope } = props.composa
|
|
|
228
255
|
mounted: useMounted(),
|
|
229
256
|
}) as UseList<Record<string, any>[], Record<string, any>, ListBaseBladeScope>;
|
|
230
257
|
|
|
258
|
+
if (props.isWidgetView) {
|
|
259
|
+
query.value.take = 5;
|
|
260
|
+
}
|
|
261
|
+
|
|
231
262
|
const {
|
|
232
263
|
filterComponent,
|
|
233
264
|
activeFilterCount,
|
|
@@ -269,7 +300,7 @@ const toolbarComputed = toolbarReducer({
|
|
|
269
300
|
typeof toValue(scope).openDetailsBlade === "function"
|
|
270
301
|
) {
|
|
271
302
|
toValue(scope).openDetailsBlade();
|
|
272
|
-
}
|
|
303
|
+
} else throw new Error("openDetailsBlade method is not defined in scope");
|
|
273
304
|
},
|
|
274
305
|
},
|
|
275
306
|
refresh: {
|
|
@@ -335,32 +366,40 @@ watch(
|
|
|
335
366
|
);
|
|
336
367
|
|
|
337
368
|
const openDetailsBlade = () => {
|
|
338
|
-
if (
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
369
|
+
if (!props.isWidgetView) {
|
|
370
|
+
if (
|
|
371
|
+
scope &&
|
|
372
|
+
"openDetailsBlade" in toValue(scope) &&
|
|
373
|
+
toValue(scope).openDetailsBlade &&
|
|
374
|
+
typeof toValue(scope).openDetailsBlade === "function"
|
|
375
|
+
) {
|
|
376
|
+
toValue(scope).openDetailsBlade();
|
|
377
|
+
}
|
|
378
|
+
} else {
|
|
379
|
+
emit("add");
|
|
345
380
|
}
|
|
346
381
|
};
|
|
347
382
|
|
|
348
383
|
const onItemClick = (item: { [x: string]: any; id?: string }) => {
|
|
349
|
-
if (
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
384
|
+
if (!props.isWidgetView) {
|
|
385
|
+
if (
|
|
386
|
+
scope &&
|
|
387
|
+
"openDetailsBlade" in toValue(scope) &&
|
|
388
|
+
toValue(scope).openDetailsBlade &&
|
|
389
|
+
typeof toValue(scope).openDetailsBlade === "function"
|
|
390
|
+
) {
|
|
391
|
+
toValue(scope).openDetailsBlade({
|
|
392
|
+
param: item.id,
|
|
393
|
+
onOpen() {
|
|
394
|
+
selectedItemId.value = item.id;
|
|
395
|
+
},
|
|
396
|
+
onClose() {
|
|
397
|
+
selectedItemId.value = undefined;
|
|
398
|
+
},
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
} else {
|
|
402
|
+
emit("item-click", { param: item.id });
|
|
364
403
|
}
|
|
365
404
|
};
|
|
366
405
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VcField, VcGallery, VcIcon, VcImage, VcInput, VcStatus, VcVideo } from "./../../../../ui/components";
|
|
2
2
|
import { ITableColumns, IValidationRules } from "../../../../core/types";
|
|
3
|
-
import type { ComponentProps
|
|
3
|
+
import type { ComponentProps } from "./../../../utilities/vueUtils";
|
|
4
4
|
|
|
5
5
|
export type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
6
6
|
|
|
@@ -14,7 +14,7 @@ export interface DynamicGridSchema {
|
|
|
14
14
|
/**
|
|
15
15
|
* @description Blade settings
|
|
16
16
|
*/
|
|
17
|
-
settings:
|
|
17
|
+
settings: SettingsGrid;
|
|
18
18
|
content: [ListContentSchema];
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -22,25 +22,28 @@ export interface DynamicDetailsSchema {
|
|
|
22
22
|
/**
|
|
23
23
|
* @description Blade settings
|
|
24
24
|
*/
|
|
25
|
-
settings:
|
|
25
|
+
settings: SettingsDetails;
|
|
26
26
|
/**
|
|
27
27
|
* @description Blade content
|
|
28
28
|
*/
|
|
29
29
|
content: [FormContentSchema, WidgetsSchema?];
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export type SettingsSchema =
|
|
32
|
+
export type SettingsSchema = SettingsGrid | SettingsDetails;
|
|
33
33
|
|
|
34
|
-
export interface
|
|
35
|
-
|
|
34
|
+
export interface SettingsGrid extends SettingsBase {
|
|
35
|
+
component: "DynamicBladeList";
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export interface SettingsDetails extends SettingsBase {
|
|
39
|
+
component: "DynamicBladeForm";
|
|
39
40
|
status?: {
|
|
40
41
|
component: string;
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
44
|
|
|
45
|
+
export type IViewComponentName = "DynamicBladeForm" | "DynamicBladeList";
|
|
46
|
+
|
|
44
47
|
export interface SettingsBase {
|
|
45
48
|
/**
|
|
46
49
|
* Blade url
|
|
@@ -64,8 +67,12 @@ export interface SettingsBase {
|
|
|
64
67
|
composable: string;
|
|
65
68
|
/**
|
|
66
69
|
* Toolbar items array
|
|
67
|
-
*
|
|
68
|
-
*
|
|
70
|
+
*
|
|
71
|
+
* Defaults:
|
|
72
|
+
*
|
|
73
|
+
* [`saveChanges`, `remove`] methods in `DynamicBladeForm`
|
|
74
|
+
*
|
|
75
|
+
* [`openAddBlade`, `refresh`, `removeItems`, `save`] methods in `DynamicBladeList`
|
|
69
76
|
*/
|
|
70
77
|
toolbar: {
|
|
71
78
|
id: string;
|
|
@@ -76,12 +83,20 @@ export interface SettingsBase {
|
|
|
76
83
|
/**
|
|
77
84
|
* Blade component
|
|
78
85
|
*/
|
|
79
|
-
component:
|
|
86
|
+
component: IViewComponentName;
|
|
80
87
|
/**
|
|
81
88
|
* Blade permissions
|
|
82
89
|
*/
|
|
83
90
|
permissions?: string | string[];
|
|
91
|
+
/**
|
|
92
|
+
* The push notification types associated with the view.
|
|
93
|
+
*/
|
|
84
94
|
pushNotificationType?: string | string[];
|
|
95
|
+
/**
|
|
96
|
+
* Indicates whether the view is a workspace.
|
|
97
|
+
* This option is used to determine which view should be the default view.
|
|
98
|
+
*/
|
|
99
|
+
isWorkspace?: boolean;
|
|
85
100
|
}
|
|
86
101
|
|
|
87
102
|
export interface ListContentSchema {
|
|
@@ -508,11 +523,6 @@ export interface GallerySchema extends Omit<SchemaBase, "placeholder" | "multila
|
|
|
508
523
|
* @type {"vc-gallery"}
|
|
509
524
|
*/
|
|
510
525
|
component: "vc-gallery";
|
|
511
|
-
/**
|
|
512
|
-
* Folder name for files upload.
|
|
513
|
-
* @type {string}
|
|
514
|
-
*/
|
|
515
|
-
uploadFolder: string;
|
|
516
526
|
/**
|
|
517
527
|
* Gallery type
|
|
518
528
|
* @type {"gallery" | "file-upload"}
|
|
@@ -532,6 +542,11 @@ export interface GallerySchema extends Omit<SchemaBase, "placeholder" | "multila
|
|
|
532
542
|
}}
|
|
533
543
|
*/
|
|
534
544
|
actions?: ComponentProps<typeof VcGallery>["itemActions"];
|
|
545
|
+
/**
|
|
546
|
+
* Whether the upload is hides after upload or not.
|
|
547
|
+
* @type {boolean}
|
|
548
|
+
*/
|
|
549
|
+
hideAfterUpload?: boolean;
|
|
535
550
|
}
|
|
536
551
|
|
|
537
552
|
/**
|
|
@@ -70,26 +70,23 @@
|
|
|
70
70
|
<script lang="ts" setup>
|
|
71
71
|
import { ref } from "vue";
|
|
72
72
|
import { vOnClickOutside } from "@vueuse/components";
|
|
73
|
-
import {
|
|
73
|
+
import { ICommonAsset } from "./../../../../../../core/types";
|
|
74
74
|
import { VcImage, VcIcon } from "./../../../../";
|
|
75
75
|
import { useI18n } from "vue-i18n";
|
|
76
76
|
|
|
77
77
|
export interface Props {
|
|
78
|
-
image:
|
|
78
|
+
image: ICommonAsset;
|
|
79
79
|
readonly?: boolean | undefined;
|
|
80
|
-
actions?:
|
|
81
|
-
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
remove: boolean | undefined;
|
|
86
|
-
}
|
|
87
|
-
| undefined;
|
|
80
|
+
actions?: {
|
|
81
|
+
preview: boolean | undefined;
|
|
82
|
+
edit: boolean | undefined;
|
|
83
|
+
remove: boolean | undefined;
|
|
84
|
+
};
|
|
88
85
|
disableDrag?: boolean | undefined;
|
|
89
86
|
}
|
|
90
87
|
|
|
91
88
|
withDefaults(defineProps<Props>(), {
|
|
92
|
-
image: () => ({} as
|
|
89
|
+
image: () => ({} as ICommonAsset),
|
|
93
90
|
readonly: false,
|
|
94
91
|
actions: () => ({
|
|
95
92
|
name: undefined,
|
package/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue
CHANGED
|
@@ -66,11 +66,11 @@
|
|
|
66
66
|
<script lang="ts" setup>
|
|
67
67
|
import { computed, ref } from "vue";
|
|
68
68
|
import { VcPopup, VcLink, VcIcon, VcImage } from "../../../../";
|
|
69
|
-
import {
|
|
69
|
+
import { ICommonAsset } from "./../../../../../../core/types";
|
|
70
70
|
import { useI18n } from "vue-i18n";
|
|
71
71
|
|
|
72
72
|
export interface Props {
|
|
73
|
-
images?:
|
|
73
|
+
images?: ICommonAsset[];
|
|
74
74
|
index: number;
|
|
75
75
|
}
|
|
76
76
|
|