@vc-shell/framework 1.0.156 → 1.0.158
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 +18 -0
- package/core/types/index.ts +1 -2
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/framework.js +7299 -7239
- package/dist/shared/components/blade-navigation/types/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/SchemaRender.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/factories.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/factories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Button.d.ts +4 -25
- package/dist/shared/modules/dynamic/components/fields/Button.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Card.d.ts +4 -25
- package/dist/shared/modules/dynamic/components/fields/Card.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Checkbox.d.ts +4 -25
- package/dist/shared/modules/dynamic/components/fields/Checkbox.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/ContentField.d.ts +4 -25
- package/dist/shared/modules/dynamic/components/fields/ContentField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/CustomComponent.d.ts +4 -25
- package/dist/shared/modules/dynamic/components/fields/CustomComponent.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts +4 -25
- package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts +4 -25
- package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Fieldset.d.ts +4 -25
- package/dist/shared/modules/dynamic/components/fields/Fieldset.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts +4 -25
- package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/ImageField.d.ts +4 -25
- package/dist/shared/modules/dynamic/components/fields/ImageField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/InputCurrency.d.ts +4 -25
- package/dist/shared/modules/dynamic/components/fields/InputCurrency.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/InputField.d.ts +4 -25
- package/dist/shared/modules/dynamic/components/fields/InputField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/MultivalueField.d.ts +4 -25
- package/dist/shared/modules/dynamic/components/fields/MultivalueField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/RatingField.d.ts +4 -25
- package/dist/shared/modules/dynamic/components/fields/RatingField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts +4 -25
- package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts +4 -25
- package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/SwitchField.d.ts +4 -25
- package/dist/shared/modules/dynamic/components/fields/SwitchField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Table.d.ts +4 -25
- package/dist/shared/modules/dynamic/components/fields/Table.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/TextareaField.d.ts +4 -25
- package/dist/shared/modules/dynamic/components/fields/TextareaField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/VideoField.d.ts +4 -25
- package/dist/shared/modules/dynamic/components/fields/VideoField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/props.d.ts +5 -26
- package/dist/shared/modules/dynamic/components/fields/props.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/composables/useFilterBuilder/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/getters.d.ts +1 -1
- package/dist/shared/modules/dynamic/helpers/getters.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/nodeBuilder.d.ts +5 -4
- package/dist/shared/modules/dynamic/helpers/nodeBuilder.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/setters.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/unrefNested.d.ts +2 -1
- package/dist/shared/modules/dynamic/helpers/unrefNested.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/unwrapInterpolation.d.ts +1 -1
- package/dist/shared/modules/dynamic/helpers/unwrapInterpolation.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/types/models.d.ts +0 -1
- package/dist/shared/modules/dynamic/types/models.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/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue.d.ts.map +1 -1
- package/package.json +4 -4
- package/shared/components/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue +1 -1
- package/shared/components/blade-navigation/types/index.ts +1 -1
- package/shared/modules/dynamic/components/SchemaRender.ts +21 -16
- package/shared/modules/dynamic/components/factories.ts +0 -2
- package/shared/modules/dynamic/components/fields/Button.ts +13 -9
- package/shared/modules/dynamic/components/fields/Card.ts +29 -15
- package/shared/modules/dynamic/components/fields/Checkbox.ts +14 -7
- package/shared/modules/dynamic/components/fields/ContentField.ts +10 -6
- package/shared/modules/dynamic/components/fields/DynamicProperty.ts +2 -2
- package/shared/modules/dynamic/components/fields/EditorField.ts +9 -5
- package/shared/modules/dynamic/components/fields/GalleryField.ts +16 -13
- package/shared/modules/dynamic/components/fields/ImageField.ts +14 -10
- package/shared/modules/dynamic/components/fields/InputCurrency.ts +20 -15
- package/shared/modules/dynamic/components/fields/InputField.ts +10 -6
- package/shared/modules/dynamic/components/fields/MultivalueField.ts +13 -9
- package/shared/modules/dynamic/components/fields/RatingField.ts +8 -4
- package/shared/modules/dynamic/components/fields/SelectField.ts +14 -10
- package/shared/modules/dynamic/components/fields/StatusField.ts +9 -6
- package/shared/modules/dynamic/components/fields/SwitchField.ts +9 -5
- package/shared/modules/dynamic/components/fields/Table.ts +15 -11
- package/shared/modules/dynamic/components/fields/TextareaField.ts +9 -5
- package/shared/modules/dynamic/components/fields/VideoField.ts +9 -5
- package/shared/modules/dynamic/components/fields/props.ts +5 -13
- package/shared/modules/dynamic/composables/useFilterBuilder/index.ts +5 -4
- package/shared/modules/dynamic/helpers/getters.ts +2 -3
- package/shared/modules/dynamic/helpers/nodeBuilder.ts +26 -20
- package/shared/modules/dynamic/helpers/setters.ts +2 -1
- package/shared/modules/dynamic/helpers/unrefNested.ts +4 -4
- package/shared/modules/dynamic/pages/dynamic-blade-form.vue +0 -3
- package/shared/modules/dynamic/types/models.ts +0 -1
- package/ui/components/molecules/vc-multivalue/vc-multivalue.vue +0 -1
- package/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue +2 -2
- package/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue +1 -1
- package/ui/components/organisms/vc-table/vc-table.vue +1 -1
|
@@ -3,6 +3,7 @@ import componentProps from "./props";
|
|
|
3
3
|
import { StatusSchema } from "../../types";
|
|
4
4
|
import { StatusField } from "../factories";
|
|
5
5
|
import { VcIcon } from "../../../../../ui/components";
|
|
6
|
+
import { unrefNested } from "../../helpers/unrefNested";
|
|
6
7
|
|
|
7
8
|
export default {
|
|
8
9
|
name: "StatusField",
|
|
@@ -25,12 +26,14 @@ export default {
|
|
|
25
26
|
});
|
|
26
27
|
|
|
27
28
|
const field = StatusField({
|
|
28
|
-
props:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
props: Object.assign(
|
|
30
|
+
{
|
|
31
|
+
variant: props.element.variant,
|
|
32
|
+
outline: props.element.outline,
|
|
33
|
+
extend: props.element.extend,
|
|
34
|
+
},
|
|
35
|
+
unrefNested(props.baseProps),
|
|
36
|
+
),
|
|
34
37
|
slots: {
|
|
35
38
|
default: () => {
|
|
36
39
|
return h("div", { class: "tw-flex tw-flex-row tw-items-center" }, [
|
|
@@ -2,6 +2,7 @@ import { Component, ExtractPropTypes, h } from "vue";
|
|
|
2
2
|
import { Switch } from "../factories";
|
|
3
3
|
import componentProps from "./props";
|
|
4
4
|
import { SwitchSchema } from "../../types";
|
|
5
|
+
import { unrefNested } from "../../helpers/unrefNested";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
name: "SwitchEl",
|
|
@@ -9,11 +10,14 @@ export default {
|
|
|
9
10
|
setup(props: ExtractPropTypes<typeof componentProps> & { element: SwitchSchema }) {
|
|
10
11
|
return () => {
|
|
11
12
|
const field = Switch({
|
|
12
|
-
props:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
props: Object.assign(
|
|
14
|
+
{},
|
|
15
|
+
{
|
|
16
|
+
trueValue: props.element.trueValue,
|
|
17
|
+
falseValue: props.element.falseValue,
|
|
18
|
+
},
|
|
19
|
+
unrefNested(props.baseProps),
|
|
20
|
+
),
|
|
17
21
|
});
|
|
18
22
|
|
|
19
23
|
return h(field.component as Component, field.props);
|
|
@@ -5,6 +5,7 @@ import { Table } from "../factories";
|
|
|
5
5
|
import componentProps from "./props";
|
|
6
6
|
import { TableSchema } from "../../types";
|
|
7
7
|
import { useI18n } from "vue-i18n";
|
|
8
|
+
import { unrefNested } from "../../helpers/unrefNested";
|
|
8
9
|
|
|
9
10
|
type TableItemData = Record<string, any>;
|
|
10
11
|
|
|
@@ -17,18 +18,21 @@ export default {
|
|
|
17
18
|
|
|
18
19
|
return () => {
|
|
19
20
|
const field = Table({
|
|
20
|
-
props:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
props: Object.assign(
|
|
22
|
+
{},
|
|
23
|
+
{
|
|
24
|
+
header: !!props.element.header,
|
|
25
|
+
footer: !!props.element.footer,
|
|
26
|
+
multiselect: !!props.element.multiselect,
|
|
27
|
+
columns: props.element.columns?.map((col) => ({ ...col, title: computed(() => t(col.title)) })),
|
|
28
|
+
items: unrefNested(props.baseProps).modelValue ?? [],
|
|
29
|
+
stateKey: props.element.id,
|
|
30
|
+
class: {
|
|
31
|
+
"!tw-flex-auto": true,
|
|
32
|
+
},
|
|
30
33
|
},
|
|
31
|
-
|
|
34
|
+
unrefNested(props.baseProps),
|
|
35
|
+
),
|
|
32
36
|
slots: {
|
|
33
37
|
...Object.entries(tableTemplates.templateOverrideComponents).reduce(
|
|
34
38
|
(obj, [key, value], index) => {
|
|
@@ -3,6 +3,7 @@ import { TextareaSchema } from "./../../types/index";
|
|
|
3
3
|
import { ExtractPropTypes, h, Component } from "vue";
|
|
4
4
|
import componentProps from "./props";
|
|
5
5
|
import ValidationField from "./ValidationField";
|
|
6
|
+
import { unrefNested } from "../../helpers/unrefNested";
|
|
6
7
|
|
|
7
8
|
export default {
|
|
8
9
|
name: "TextareaField",
|
|
@@ -10,11 +11,14 @@ export default {
|
|
|
10
11
|
setup(props: ExtractPropTypes<typeof componentProps> & { element: TextareaSchema }) {
|
|
11
12
|
return () => {
|
|
12
13
|
const field = TextareaField({
|
|
13
|
-
props:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
props: Object.assign(
|
|
15
|
+
{},
|
|
16
|
+
{
|
|
17
|
+
currentLanguage: props.currentLocale,
|
|
18
|
+
clearable: props.element.clearable || false,
|
|
19
|
+
},
|
|
20
|
+
unrefNested(props.baseProps),
|
|
21
|
+
),
|
|
18
22
|
});
|
|
19
23
|
|
|
20
24
|
const render = h(field.component as Component, field.props);
|
|
@@ -2,6 +2,7 @@ import { Component, ExtractPropTypes, h } from "vue";
|
|
|
2
2
|
import { VideoField } from "../factories";
|
|
3
3
|
import componentProps from "./props";
|
|
4
4
|
import { VideoSchema } from "../../types";
|
|
5
|
+
import { unrefNested } from "../../helpers/unrefNested";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
name: "VideoField",
|
|
@@ -9,11 +10,14 @@ export default {
|
|
|
9
10
|
setup(props: ExtractPropTypes<typeof componentProps> & { element: VideoSchema }) {
|
|
10
11
|
return () => {
|
|
11
12
|
const field = VideoField({
|
|
12
|
-
props:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
props: Object.assign(
|
|
14
|
+
{},
|
|
15
|
+
{
|
|
16
|
+
source: props.baseProps.modelValue,
|
|
17
|
+
size: props.element.size,
|
|
18
|
+
},
|
|
19
|
+
unrefNested(props.baseProps),
|
|
20
|
+
),
|
|
17
21
|
});
|
|
18
22
|
|
|
19
23
|
const render = h(field.component as Component, field.props);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ComputedRef,
|
|
1
|
+
import { ComputedRef, PropType, ToRefs, UnwrapNestedRefs, VNode } from "vue";
|
|
2
2
|
import { DetailsBladeContext } from "../../factories";
|
|
3
3
|
import { IControlBaseProps } from "../../types/models";
|
|
4
4
|
import { ControlSchema } from "../../types";
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
baseProps: {
|
|
8
|
-
type: Object as PropType<
|
|
9
|
-
default: () => ({}) as IControlBaseProps
|
|
8
|
+
type: Object as PropType<ToRefs<IControlBaseProps>>,
|
|
9
|
+
default: () => ({}) as ToRefs<IControlBaseProps>,
|
|
10
10
|
},
|
|
11
11
|
element: {
|
|
12
12
|
type: Object as PropType<ControlSchema>,
|
|
@@ -21,16 +21,12 @@ export default {
|
|
|
21
21
|
default: () => ({}) as ComputedRef<VNode[][]>,
|
|
22
22
|
},
|
|
23
23
|
formData: {
|
|
24
|
-
type: Object as PropType<
|
|
25
|
-
default: () => ({}) as
|
|
24
|
+
type: Object as PropType<ToRefs<Record<string, unknown>>>,
|
|
25
|
+
default: () => ({}) as ToRefs<Record<string, unknown>>,
|
|
26
26
|
},
|
|
27
27
|
fieldContext: {
|
|
28
28
|
type: Object,
|
|
29
29
|
},
|
|
30
|
-
nodeBuilder: {
|
|
31
|
-
type: Function,
|
|
32
|
-
default: () => ({}),
|
|
33
|
-
},
|
|
34
30
|
currentLocale: {
|
|
35
31
|
type: String,
|
|
36
32
|
},
|
|
@@ -40,8 +36,4 @@ export default {
|
|
|
40
36
|
rows: {
|
|
41
37
|
type: Number,
|
|
42
38
|
},
|
|
43
|
-
onSetModelData: {
|
|
44
|
-
type: Function,
|
|
45
|
-
default: () => ({}),
|
|
46
|
-
},
|
|
47
39
|
};
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
VNode,
|
|
13
13
|
ComputedRef,
|
|
14
14
|
readonly,
|
|
15
|
+
toValue,
|
|
15
16
|
} from "vue";
|
|
16
17
|
import * as _ from "lodash-es";
|
|
17
18
|
import { Checkbox, InputField } from "../../components/factories";
|
|
@@ -143,7 +144,7 @@ export default <Query>(args: {
|
|
|
143
144
|
(obj, currC) => {
|
|
144
145
|
obj[currC.value] = Checkbox({
|
|
145
146
|
props: {
|
|
146
|
-
|
|
147
|
+
class: "tw-mb-2",
|
|
147
148
|
modelValue: computed(() => isItemSelected(currC.value, control.field)),
|
|
148
149
|
"onUpdate:modelValue": (e: boolean) => selectFilterItem(e, currC.value, control.field, control.multiple),
|
|
149
150
|
},
|
|
@@ -162,8 +163,8 @@ export default <Query>(args: {
|
|
|
162
163
|
return InputField({
|
|
163
164
|
props: {
|
|
164
165
|
type: "date",
|
|
165
|
-
|
|
166
|
-
label: control.label,
|
|
166
|
+
class: "tw-mb-3",
|
|
167
|
+
label: toValue(computed(() => t(control.label ?? ""))),
|
|
167
168
|
modelValue: computed(() => filter[control.field]),
|
|
168
169
|
"onUpdate:modelValue": (e: unknown) => (filter[control.field] = e),
|
|
169
170
|
},
|
|
@@ -207,7 +208,7 @@ export default <Query>(args: {
|
|
|
207
208
|
if ("component" in item && item.component) {
|
|
208
209
|
return h(
|
|
209
210
|
item.component as Component,
|
|
210
|
-
{ ...item.props, class: item.props.
|
|
211
|
+
{ ...item.props, class: item.props.class },
|
|
211
212
|
"slots" in item && item.slots ? { ...item.slots } : {},
|
|
212
213
|
);
|
|
213
214
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { reactify } from "@vueuse/core";
|
|
2
1
|
import * as _ from "lodash-es";
|
|
3
2
|
|
|
4
3
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
|
-
export const getModel =
|
|
4
|
+
export const getModel = (property: string, context: Record<string, any>) => {
|
|
6
5
|
if (property && context) {
|
|
7
6
|
return _.get(context, property);
|
|
8
7
|
}
|
|
9
8
|
return null;
|
|
10
|
-
}
|
|
9
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { unref, computed, toValue, h, UnwrapNestedRefs, MaybeRef, reactive, VNode } from "vue";
|
|
2
|
+
import { unref, computed, toValue, h, UnwrapNestedRefs, MaybeRef, reactive, VNode, ToRefs } from "vue";
|
|
3
3
|
import FIELD_MAP from "../components/FIELD_MAP";
|
|
4
4
|
import { ControlSchema } from "../types";
|
|
5
5
|
import { IControlBaseProps } from "../types/models";
|
|
@@ -10,6 +10,8 @@ import { DetailsBladeContext } from "../factories";
|
|
|
10
10
|
import { safeIn } from "./safeIn";
|
|
11
11
|
import { i18n } from "./../../../../core/plugins/i18n";
|
|
12
12
|
import { visibilityHandler } from "./visibilityHandler";
|
|
13
|
+
import { toRefs } from "@vueuse/core";
|
|
14
|
+
import { unrefNested } from "./unrefNested";
|
|
13
15
|
|
|
14
16
|
function disabledHandler(
|
|
15
17
|
disabled: { method?: string } | boolean,
|
|
@@ -34,13 +36,15 @@ function nodeBuilder<
|
|
|
34
36
|
bladeContext,
|
|
35
37
|
currentLocale,
|
|
36
38
|
formData,
|
|
39
|
+
updateFormData,
|
|
37
40
|
}: {
|
|
38
41
|
controlSchema: ControlSchema;
|
|
39
42
|
parentId: string | number;
|
|
40
|
-
internalContext:
|
|
43
|
+
internalContext: ToRefs<Context>;
|
|
41
44
|
bladeContext: BContext;
|
|
42
45
|
currentLocale: MaybeRef<string>;
|
|
43
|
-
formData: FormData
|
|
46
|
+
formData: ToRefs<FormData>;
|
|
47
|
+
updateFormData?: (newVal: ToRefs<unknown>) => void;
|
|
44
48
|
}): VNode {
|
|
45
49
|
if (!controlSchema) throw new Error("There is no controlSchema provided");
|
|
46
50
|
|
|
@@ -60,14 +64,14 @@ function nodeBuilder<
|
|
|
60
64
|
bladeContext.scope &&
|
|
61
65
|
bladeContext.scope[controlSchema.property];
|
|
62
66
|
|
|
63
|
-
const modelValue = scopedProperty
|
|
67
|
+
const modelValue = scopedProperty ?? contextProperty ?? undefined;
|
|
64
68
|
|
|
65
69
|
const tooltip = (safeIn("tooltip", controlSchema) && controlSchema.tooltip) || undefined;
|
|
66
70
|
const multilanguage = safeIn("multilanguage", controlSchema) && controlSchema.multilanguage;
|
|
67
71
|
|
|
68
72
|
const label =
|
|
69
73
|
safeIn("label", controlSchema) && controlSchema.label
|
|
70
|
-
? unref(unwrapInterpolation(controlSchema.label,
|
|
74
|
+
? unref(unwrapInterpolation(controlSchema.label, internalContext))
|
|
71
75
|
: undefined;
|
|
72
76
|
|
|
73
77
|
const disabled =
|
|
@@ -82,10 +86,12 @@ function nodeBuilder<
|
|
|
82
86
|
setModel({
|
|
83
87
|
property: controlSchema.property,
|
|
84
88
|
value: e,
|
|
85
|
-
context:
|
|
89
|
+
context: internalContext,
|
|
86
90
|
scope: bladeContext.scope,
|
|
87
91
|
});
|
|
88
92
|
|
|
93
|
+
updateFormData?.(formData);
|
|
94
|
+
|
|
89
95
|
if (
|
|
90
96
|
safeIn("update", controlSchema) &&
|
|
91
97
|
controlSchema.update &&
|
|
@@ -94,7 +100,7 @@ function nodeBuilder<
|
|
|
94
100
|
) {
|
|
95
101
|
const updateMethod = controlSchema.update.method;
|
|
96
102
|
if (safeIn(updateMethod, bladeContext.scope) && typeof bladeContext.scope[updateMethod] === "function") {
|
|
97
|
-
await bladeContext.scope[updateMethod](e, controlSchema.property,
|
|
103
|
+
await bladeContext.scope[updateMethod](e, controlSchema.property, unrefNested(internalContext));
|
|
98
104
|
}
|
|
99
105
|
}
|
|
100
106
|
}
|
|
@@ -124,24 +130,22 @@ function nodeBuilder<
|
|
|
124
130
|
if (!("fields" in controlSchema)) return null;
|
|
125
131
|
|
|
126
132
|
const contextFieldModel =
|
|
127
|
-
safeIn("property", controlSchema) &&
|
|
128
|
-
controlSchema.property &&
|
|
129
|
-
getModel(controlSchema.property, toValue(internalContext));
|
|
133
|
+
safeIn("property", controlSchema) && controlSchema.property && getModel(controlSchema.property, internalContext);
|
|
130
134
|
|
|
131
135
|
const scopedFieldModel =
|
|
132
136
|
safeIn("property", controlSchema) &&
|
|
133
137
|
controlSchema.property &&
|
|
134
138
|
getModel(controlSchema.property, toValue(bladeContext.scope ?? {}));
|
|
135
139
|
|
|
136
|
-
const model =
|
|
140
|
+
const model = scopedFieldModel || contextFieldModel;
|
|
137
141
|
|
|
138
|
-
if (model && Array.isArray(model)) {
|
|
139
|
-
return model.map((modelItem: { [x: string]: unknown; id: string }) =>
|
|
140
|
-
controlSchema.fields.reduce((arr, fieldItem) => {
|
|
142
|
+
if (toValue(model) && Array.isArray(toValue(model))) {
|
|
143
|
+
return toValue(model).map((modelItem: ToRefs<{ [x: string]: unknown; id: string }>) => {
|
|
144
|
+
return controlSchema.fields.reduce((arr, fieldItem) => {
|
|
141
145
|
if (
|
|
142
146
|
safeIn("visibility", fieldItem) &&
|
|
143
147
|
fieldItem.visibility?.method &&
|
|
144
|
-
!visibilityHandler(bladeContext.scope?.[fieldItem.visibility?.method],
|
|
148
|
+
!visibilityHandler(bladeContext.scope?.[fieldItem.visibility?.method], modelItem, fieldItem)
|
|
145
149
|
) {
|
|
146
150
|
return arr;
|
|
147
151
|
}
|
|
@@ -154,10 +158,11 @@ function nodeBuilder<
|
|
|
154
158
|
bladeContext,
|
|
155
159
|
currentLocale,
|
|
156
160
|
formData,
|
|
161
|
+
updateFormData,
|
|
157
162
|
}),
|
|
158
163
|
];
|
|
159
|
-
}, [] as VNode[])
|
|
160
|
-
);
|
|
164
|
+
}, [] as VNode[]);
|
|
165
|
+
});
|
|
161
166
|
}
|
|
162
167
|
|
|
163
168
|
return [
|
|
@@ -165,7 +170,7 @@ function nodeBuilder<
|
|
|
165
170
|
if (
|
|
166
171
|
safeIn("visibility", field) &&
|
|
167
172
|
field.visibility?.method &&
|
|
168
|
-
!visibilityHandler(bladeContext.scope?.[field.visibility?.method],
|
|
173
|
+
!visibilityHandler(bladeContext.scope?.[field.visibility?.method], internalContext, field)
|
|
169
174
|
) {
|
|
170
175
|
return arr;
|
|
171
176
|
}
|
|
@@ -179,6 +184,7 @@ function nodeBuilder<
|
|
|
179
184
|
bladeContext,
|
|
180
185
|
currentLocale,
|
|
181
186
|
formData,
|
|
187
|
+
updateFormData,
|
|
182
188
|
}),
|
|
183
189
|
];
|
|
184
190
|
}, [] as VNode[]),
|
|
@@ -186,13 +192,13 @@ function nodeBuilder<
|
|
|
186
192
|
});
|
|
187
193
|
|
|
188
194
|
const elProps = {
|
|
189
|
-
baseProps,
|
|
195
|
+
baseProps: toRefs(baseProps),
|
|
190
196
|
bladeContext,
|
|
191
197
|
element: controlSchema,
|
|
192
198
|
currentLocale: unref(currentLocale),
|
|
193
199
|
fields: fieldsHandler,
|
|
194
200
|
formData,
|
|
195
|
-
fieldContext:
|
|
201
|
+
fieldContext: internalContext,
|
|
196
202
|
};
|
|
197
203
|
|
|
198
204
|
return h(component, elProps);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
import * as _ from "lodash-es";
|
|
3
|
+
import { unrefNested } from "./unrefNested";
|
|
3
4
|
|
|
4
5
|
function setModel(args: {
|
|
5
6
|
property: string;
|
|
@@ -10,7 +11,7 @@ function setModel(args: {
|
|
|
10
11
|
}) {
|
|
11
12
|
const { property, value, option, context, scope } = args;
|
|
12
13
|
|
|
13
|
-
if (_.has(context, property)) {
|
|
14
|
+
if (_.has(unrefNested(context), property)) {
|
|
14
15
|
_.set(context, property, option ? value[option as keyof typeof value] : value);
|
|
15
16
|
} else if (scope && _.has(scope, property)) {
|
|
16
17
|
if (typeof scope[property] === "function") {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { unref } from "vue";
|
|
1
|
+
import { ToRefs, unref, UnwrapRef } from "vue";
|
|
2
2
|
|
|
3
|
-
export function unrefNested<T extends Record<string, unknown
|
|
4
|
-
const unreffedProps = {} as T;
|
|
3
|
+
export function unrefNested<T extends ToRefs<Record<string, unknown>>>(field: T) {
|
|
4
|
+
const unreffedProps = {} as { [K in keyof T]: UnwrapRef<T[K]> };
|
|
5
5
|
|
|
6
6
|
if (field) {
|
|
7
7
|
Object.keys(field).forEach((key: keyof T) => {
|
|
8
|
-
unreffedProps[key] = unref(field[key])
|
|
8
|
+
unreffedProps[key] = unref(field[key]) as UnwrapRef<T[typeof key]>;
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
return unreffedProps;
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
<div class="item-details__content">
|
|
34
34
|
<VcForm class="tw-grow tw-p-4">
|
|
35
35
|
<SchemaRender
|
|
36
|
-
:key="`${loading}`"
|
|
37
36
|
v-model="item"
|
|
38
37
|
:ui-schema="form.children"
|
|
39
38
|
:context="bladeContext"
|
|
@@ -79,7 +78,6 @@ import {
|
|
|
79
78
|
ComputedRef,
|
|
80
79
|
type Component,
|
|
81
80
|
ConcreteComponent,
|
|
82
|
-
toRefs,
|
|
83
81
|
} from "vue";
|
|
84
82
|
import { DynamicDetailsSchema, FormContentSchema, SettingsSchema } from "../types";
|
|
85
83
|
import { reactiveComputed, useMounted, useTemplateRefsList } from "@vueuse/core";
|
|
@@ -98,7 +96,6 @@ import { useToolbarReducer } from "../composables/useToolbarReducer";
|
|
|
98
96
|
import { useBeforeUnload } from "../../../../core/composables/useBeforeUnload";
|
|
99
97
|
import * as _ from "lodash-es";
|
|
100
98
|
import { IBladeToolbar } from "../../../../core/types";
|
|
101
|
-
import { toRef } from "vue";
|
|
102
99
|
|
|
103
100
|
interface Props {
|
|
104
101
|
expanded?: boolean;
|
|
@@ -126,7 +126,6 @@ import { unref, nextTick, ref, computed } from "vue";
|
|
|
126
126
|
import { vOnClickOutside } from "@vueuse/components";
|
|
127
127
|
import { useFloating, UseFloatingReturn, offset, flip, shift, autoUpdate, MiddlewareState } from "@floating-ui/vue";
|
|
128
128
|
import { generateId } from "../../../../core/utilities";
|
|
129
|
-
import * as _ from "lodash-es";
|
|
130
129
|
|
|
131
130
|
export interface Props<T> {
|
|
132
131
|
placeholder?: string;
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
</span>
|
|
36
36
|
|
|
37
37
|
<!-- Date exact cell -->
|
|
38
|
-
<
|
|
38
|
+
<div
|
|
39
39
|
v-else-if="cell.type === 'date' || cell.type === 'time' || cell.type === 'date-time'"
|
|
40
40
|
class="tw-text-[#a5a5a5] tw-truncate"
|
|
41
41
|
>
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
>
|
|
74
74
|
N/A
|
|
75
75
|
</div>
|
|
76
|
-
</
|
|
76
|
+
</div>
|
|
77
77
|
|
|
78
78
|
<!-- Image cell -->
|
|
79
79
|
<template v-else-if="cell.type === 'image'">
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
</template>
|
|
38
38
|
|
|
39
39
|
<script lang="ts" setup>
|
|
40
|
-
import { ref, computed
|
|
40
|
+
import { ref, computed } from "vue";
|
|
41
41
|
import { ITableColumns } from "./../../../../../../core/types";
|
|
42
42
|
import { vOnClickOutside } from "@vueuse/components";
|
|
43
43
|
import { useFloating, flip, shift, autoUpdate } from "@floating-ui/vue";
|