@vc-shell/framework 1.0.219 → 1.0.220
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 +14 -0
- package/core/types/index.ts +5 -0
- package/dist/core/types/index.d.ts +5 -0
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/framework.js +12015 -11760
- package/dist/index.css +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/locales/en.json +2 -1
- package/dist/shared/components/app-switcher/composables/useAppSwitcher/index.d.ts.map +1 -1
- package/dist/shared/components/blade-navigation/composables/useBladeNavigation/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Button.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Fieldset.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/InputCurrency.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/Table.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.d.ts +0 -12
- package/dist/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/composables/useTableTemplates/index.d.ts +1 -0
- package/dist/shared/modules/dynamic/composables/useTableTemplates/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/factories/types/index.d.ts +1 -1
- package/dist/shared/modules/dynamic/factories/types/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/types/index.d.ts +43 -17
- package/dist/shared/modules/dynamic/types/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/types/models.d.ts +1 -1
- package/dist/shared/modules/dynamic/types/models.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/components/atoms/index.d.ts +1 -0
- package/dist/ui/components/atoms/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-label/vc-label.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-status/vc-status.stories.d.ts +7 -7
- package/dist/ui/components/atoms/vc-status/vc-status.vue.d.ts +2 -2
- package/dist/ui/components/atoms/vc-status/vc-status.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-tooltip/index.d.ts +2 -0
- package/dist/ui/components/atoms/vc-tooltip/index.d.ts.map +1 -0
- package/dist/ui/components/atoms/vc-tooltip/vc-tooltip.vue.d.ts +41 -0
- package/dist/ui/components/atoms/vc-tooltip/vc-tooltip.vue.d.ts.map +1 -0
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.stories.d.ts +24 -16
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.stories.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts +32 -0
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.stories.d.ts +21 -21
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts +3 -3
- package/dist/ui/components/molecules/vc-select/vc-select.stories.d.ts +30 -30
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts +3 -3
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-add-new/vc-table-add-new.vue.d.ts +26 -0
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-add-new/vc-table-add-new.vue.d.ts.map +1 -0
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue.d.ts +2 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/vc-table.stories.d.ts +210 -15
- package/dist/ui/components/organisms/vc-table/vc-table.stories.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts +42 -3
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
- package/package.json +4 -4
- package/shared/components/app-switcher/composables/useAppSwitcher/index.ts +0 -2
- package/shared/components/blade-navigation/composables/useBladeNavigation/index.ts +1 -2
- package/shared/modules/dynamic/components/fields/Button.ts +5 -3
- package/shared/modules/dynamic/components/fields/Fieldset.ts +2 -19
- package/shared/modules/dynamic/components/fields/InputCurrency.ts +14 -1
- package/shared/modules/dynamic/components/fields/Table.ts +39 -6
- package/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.ts +1 -63
- package/shared/modules/dynamic/composables/useTableTemplates/index.ts +2 -0
- package/shared/modules/dynamic/factories/types/index.ts +1 -1
- package/shared/modules/dynamic/pages/dynamic-blade-form.vue +1 -1
- package/shared/modules/dynamic/types/index.ts +44 -17
- package/shared/modules/dynamic/types/models.ts +3 -1
- package/ui/components/atoms/index.ts +1 -0
- package/ui/components/atoms/vc-label/vc-label.vue +10 -29
- package/ui/components/atoms/vc-status/vc-status.vue +6 -3
- package/ui/components/atoms/vc-tooltip/index.ts +1 -0
- package/ui/components/atoms/vc-tooltip/vc-tooltip.vue +57 -0
- package/ui/components/molecules/vc-input-currency/vc-input-currency.vue +46 -1
- package/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +1 -0
- package/ui/components/organisms/vc-table/_internal/vc-table-add-new/vc-table-add-new.vue +46 -0
- package/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue +94 -21
- package/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue +6 -2
- package/ui/components/organisms/vc-table/vc-table.vue +153 -69
|
@@ -14,24 +14,16 @@
|
|
|
14
14
|
v-if="$slots['tooltip']"
|
|
15
15
|
class="tw-grow tw-basis-0 tw-ml-1 tw-relative"
|
|
16
16
|
>
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
></VcIcon>
|
|
25
|
-
<teleport to="body">
|
|
26
|
-
<span
|
|
27
|
-
v-if="tooltipVisible"
|
|
28
|
-
ref="tooltipRef"
|
|
29
|
-
:style="floatingStyles"
|
|
30
|
-
class="tw-absolute tw-z-[101] tw-bg-white tw-border tw-border-solid tw-border-[color:#eef0f2] tw-shadow-[1px_1px_8px_rgba(126,142,157,0.25)] tw-rounded-[3px] tw-text-[color:#8e9daa] tw-font-normal tw-py-1 tw-px-2 tw-ml-4"
|
|
31
|
-
>
|
|
17
|
+
<VcTooltip placement="top-start">
|
|
18
|
+
<VcIcon
|
|
19
|
+
class="tw-text-[color:var(--label-tooltip-color)]"
|
|
20
|
+
:icon="tooltipIcon"
|
|
21
|
+
size="s"
|
|
22
|
+
></VcIcon>
|
|
23
|
+
<template #tooltip>
|
|
32
24
|
<slot name="tooltip"></slot>
|
|
33
|
-
</
|
|
34
|
-
</
|
|
25
|
+
</template>
|
|
26
|
+
</VcTooltip>
|
|
35
27
|
</span>
|
|
36
28
|
|
|
37
29
|
<div
|
|
@@ -44,9 +36,7 @@
|
|
|
44
36
|
</template>
|
|
45
37
|
|
|
46
38
|
<script lang="ts" setup>
|
|
47
|
-
import { VcIcon } from "./../../../components";
|
|
48
|
-
import { ref } from "vue";
|
|
49
|
-
import { useFloating, shift } from "@floating-ui/vue";
|
|
39
|
+
import { VcIcon, VcTooltip } from "./../../../components";
|
|
50
40
|
|
|
51
41
|
export interface Props {
|
|
52
42
|
required?: boolean;
|
|
@@ -63,15 +53,6 @@ defineSlots<{
|
|
|
63
53
|
default: void;
|
|
64
54
|
tooltip?: void;
|
|
65
55
|
}>();
|
|
66
|
-
|
|
67
|
-
const tooltipVisible = ref(false);
|
|
68
|
-
const tooltipIconRef = ref<HTMLElement | null>(null);
|
|
69
|
-
const tooltipRef = ref<HTMLElement | null>(null);
|
|
70
|
-
|
|
71
|
-
const { floatingStyles } = useFloating(tooltipIconRef, tooltipRef, {
|
|
72
|
-
placement: "top-start",
|
|
73
|
-
middleware: [shift()],
|
|
74
|
-
});
|
|
75
56
|
</script>
|
|
76
57
|
|
|
77
58
|
<style lang="scss">
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<!-- eslint-disable @typescript-eslint/no-explicit-any -->
|
|
10
10
|
<script lang="ts" setup>
|
|
11
11
|
export interface Props {
|
|
12
|
-
variant?: "info" | "warning" | "danger" | "success" | "light-danger";
|
|
12
|
+
variant?: "info" | "warning" | "danger" | "success" | "light-danger" | "info-dark";
|
|
13
13
|
outline?: boolean;
|
|
14
14
|
extend?: boolean;
|
|
15
15
|
}
|
|
@@ -27,7 +27,7 @@ defineSlots<{
|
|
|
27
27
|
<style lang="scss">
|
|
28
28
|
:root {
|
|
29
29
|
--status-padding: 4px 14px;
|
|
30
|
-
--status-padding-extended:
|
|
30
|
+
--status-padding-extended: 8px;
|
|
31
31
|
|
|
32
32
|
--status-border-radius: 2px;
|
|
33
33
|
--status-border-radius-extended: 4px;
|
|
@@ -47,9 +47,12 @@ defineSlots<{
|
|
|
47
47
|
|
|
48
48
|
--status-light-danger-color: #333333;
|
|
49
49
|
--status-light-danger-main-color: #ffefef;
|
|
50
|
+
|
|
51
|
+
--status-info-dark-color: #ffffff;
|
|
52
|
+
--status-info-dark-main-color: #82a6bd;
|
|
50
53
|
}
|
|
51
54
|
|
|
52
|
-
$variants: info, warning, danger, success, light-danger;
|
|
55
|
+
$variants: info, warning, danger, success, light-danger, info-dark;
|
|
53
56
|
|
|
54
57
|
.vc-status {
|
|
55
58
|
@apply tw-inline-block tw-rounded-[var(--status-border-radius)] tw-py-1 tw-px-3.5 tw-text-base tw-font-normal tw-whitespace-nowrap;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as VcTooltip } from "./vc-tooltip.vue";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div
|
|
4
|
+
ref="tooltipCompRef"
|
|
5
|
+
class="tw-inline-flex"
|
|
6
|
+
@mouseenter="tooltipVisible = true"
|
|
7
|
+
@mouseleave="tooltipVisible = false"
|
|
8
|
+
>
|
|
9
|
+
<slot></slot>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<teleport to="body">
|
|
13
|
+
<span
|
|
14
|
+
v-if="tooltipVisible"
|
|
15
|
+
ref="tooltipRef"
|
|
16
|
+
:style="floatingStyles"
|
|
17
|
+
class="tw-absolute tw-z-[101] tw-bg-white tw-border tw-border-solid tw-border-[color:#eef0f2] tw-shadow-[1px_1px_8px_rgba(126,142,157,0.25)] tw-rounded-[3px] tw-text-[color:#8e9daa] tw-font-normal tw-py-1 tw-px-2 tw-ml-4"
|
|
18
|
+
>
|
|
19
|
+
<slot name="tooltip"></slot>
|
|
20
|
+
</span>
|
|
21
|
+
</teleport>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script lang="ts" setup>
|
|
26
|
+
import { useFloating, shift, Placement, offset } from "@floating-ui/vue";
|
|
27
|
+
import { ref } from "vue";
|
|
28
|
+
export interface Props {
|
|
29
|
+
placement?: Placement;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
33
|
+
placement: "bottom-end",
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
defineSlots<{
|
|
37
|
+
default: void;
|
|
38
|
+
tooltip?: void;
|
|
39
|
+
}>();
|
|
40
|
+
|
|
41
|
+
const tooltipVisible = ref(false);
|
|
42
|
+
const tooltipCompRef = ref<HTMLElement | null>(null);
|
|
43
|
+
const tooltipRef = ref<HTMLElement | null>(null);
|
|
44
|
+
|
|
45
|
+
const { floatingStyles } = useFloating(tooltipCompRef, tooltipRef, {
|
|
46
|
+
placement: props.placement,
|
|
47
|
+
middleware: [
|
|
48
|
+
offset({
|
|
49
|
+
crossAxis: 5,
|
|
50
|
+
mainAxis: 5,
|
|
51
|
+
}),
|
|
52
|
+
shift(),
|
|
53
|
+
],
|
|
54
|
+
});
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<style lang="scss" scoped></style>
|
|
@@ -45,6 +45,10 @@
|
|
|
45
45
|
</button>
|
|
46
46
|
</template>
|
|
47
47
|
</slot>
|
|
48
|
+
<slot
|
|
49
|
+
v-if="$slots['append-inner']"
|
|
50
|
+
name="append-inner"
|
|
51
|
+
></slot>
|
|
48
52
|
</template>
|
|
49
53
|
<template #control="{ placeholder: holder }">
|
|
50
54
|
<input
|
|
@@ -54,6 +58,24 @@
|
|
|
54
58
|
:placeholder="holder"
|
|
55
59
|
/>
|
|
56
60
|
</template>
|
|
61
|
+
<template
|
|
62
|
+
v-if="$slots['prepend-inner']"
|
|
63
|
+
#prepend-inner
|
|
64
|
+
>
|
|
65
|
+
<slot name="prepend-inner"></slot>
|
|
66
|
+
</template>
|
|
67
|
+
<template
|
|
68
|
+
v-if="$slots['append']"
|
|
69
|
+
#append
|
|
70
|
+
>
|
|
71
|
+
<slot name="append"></slot>
|
|
72
|
+
</template>
|
|
73
|
+
<template
|
|
74
|
+
v-if="$slots['prepend']"
|
|
75
|
+
#prepend
|
|
76
|
+
>
|
|
77
|
+
<slot name="prepend"></slot>
|
|
78
|
+
</template>
|
|
57
79
|
</VcInput>
|
|
58
80
|
</template>
|
|
59
81
|
</VcSelect>
|
|
@@ -188,11 +210,27 @@ defineSlots<{
|
|
|
188
210
|
toggleHandler: () => void;
|
|
189
211
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
190
212
|
}) => any;
|
|
213
|
+
/**
|
|
214
|
+
* Slot for custom append-inner content
|
|
215
|
+
*/
|
|
216
|
+
"append-inner": void;
|
|
217
|
+
/**
|
|
218
|
+
* Slot for custom prepend-inner content
|
|
219
|
+
*/
|
|
220
|
+
"prepend-inner": void;
|
|
221
|
+
/**
|
|
222
|
+
* Slot for custom append content
|
|
223
|
+
*/
|
|
224
|
+
append: void;
|
|
225
|
+
/**
|
|
226
|
+
* Slot for custom prepend content
|
|
227
|
+
*/
|
|
228
|
+
prepend: void;
|
|
191
229
|
}>();
|
|
192
230
|
|
|
193
231
|
const emit = defineEmits<Emits>();
|
|
194
232
|
|
|
195
|
-
const { inputRef, setOptions, numberValue } = useCurrencyInput(
|
|
233
|
+
const { inputRef, setOptions, numberValue, setValue } = useCurrencyInput(
|
|
196
234
|
{
|
|
197
235
|
locale: navigator.language,
|
|
198
236
|
currency: props.option || "USD",
|
|
@@ -216,6 +254,13 @@ watch(
|
|
|
216
254
|
},
|
|
217
255
|
);
|
|
218
256
|
|
|
257
|
+
watch(
|
|
258
|
+
() => props.modelValue,
|
|
259
|
+
(value) => {
|
|
260
|
+
setValue(value as number | null);
|
|
261
|
+
},
|
|
262
|
+
);
|
|
263
|
+
|
|
219
264
|
watch(numberValue, (value) => {
|
|
220
265
|
emit("update:model-value", value);
|
|
221
266
|
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
o
|
|
2
|
+
<template>
|
|
3
|
+
<tr v-if="editing && addNewRowButton">
|
|
4
|
+
<td>
|
|
5
|
+
<div class="tw-p-3">
|
|
6
|
+
<VcButton
|
|
7
|
+
v-if="addNewRowButton.show"
|
|
8
|
+
text
|
|
9
|
+
@click="$emit('onAddNewRow')"
|
|
10
|
+
>
|
|
11
|
+
<div class="tw-flex tw-flex-row tw-gap-2 tw-items-center">
|
|
12
|
+
<VcIcon
|
|
13
|
+
icon="fas fa-plus"
|
|
14
|
+
size="m"
|
|
15
|
+
class="tw-text-[#41afe6]"
|
|
16
|
+
/>
|
|
17
|
+
{{ unref(addNewRowButton.title) }}
|
|
18
|
+
</div>
|
|
19
|
+
</VcButton>
|
|
20
|
+
</div>
|
|
21
|
+
</td>
|
|
22
|
+
</tr>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script lang="ts" setup>
|
|
26
|
+
import { unref } from "vue";
|
|
27
|
+
export interface Props {
|
|
28
|
+
editing: boolean | undefined;
|
|
29
|
+
addNewRowButton:
|
|
30
|
+
| {
|
|
31
|
+
show: boolean;
|
|
32
|
+
title: string;
|
|
33
|
+
}
|
|
34
|
+
| undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface Emits {
|
|
38
|
+
(event: "onAddNewRow"): void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
defineProps<Props>();
|
|
42
|
+
|
|
43
|
+
defineEmits<Emits>();
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<style lang="scss" scoped></style>
|
|
@@ -7,21 +7,42 @@
|
|
|
7
7
|
class="tw-truncate"
|
|
8
8
|
:class="cell.class"
|
|
9
9
|
>
|
|
10
|
-
<template v-if="
|
|
11
|
-
<
|
|
10
|
+
<template v-if="isEditable">
|
|
11
|
+
<Field
|
|
12
|
+
v-slot="{ errors, errorMessage }"
|
|
13
|
+
:label="cell.title as string"
|
|
14
|
+
:name="`${cell.id}_${index}`"
|
|
12
15
|
:model-value="value"
|
|
13
|
-
:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
:rules="cell.rules"
|
|
17
|
+
>
|
|
18
|
+
<VcInputCurrency
|
|
19
|
+
:model-value="value"
|
|
20
|
+
:options="[]"
|
|
21
|
+
:option="(item[cell.currencyField || 'currency'] as string) || 'USD'"
|
|
22
|
+
currency-display="symbol"
|
|
23
|
+
class="tw-w-full"
|
|
24
|
+
:error="errors.length > 0"
|
|
25
|
+
@update:model-value="$emit('update', { field: cell.id, value: $event })"
|
|
26
|
+
>
|
|
27
|
+
<template
|
|
28
|
+
v-if="errors.length > 0"
|
|
29
|
+
#append-inner
|
|
30
|
+
>
|
|
31
|
+
<VcTooltip placement="bottom-end">
|
|
32
|
+
<VcIcon icon="fa fa-info-circle tw-text-[color:var(--error-color)]"></VcIcon>
|
|
33
|
+
<template #tooltip>
|
|
34
|
+
<div class="tw-text-[color:var(--error-color)]">{{ errorMessage }}</div>
|
|
35
|
+
</template>
|
|
36
|
+
</VcTooltip>
|
|
37
|
+
</template>
|
|
38
|
+
</VcInputCurrency>
|
|
39
|
+
</Field>
|
|
19
40
|
</template>
|
|
20
41
|
<template v-else>
|
|
21
42
|
<span class="tw-truncate">{{ intlMoney(Number(value)) }}</span>
|
|
22
43
|
</template>
|
|
23
44
|
</div>
|
|
24
|
-
<template v-else-if="!
|
|
45
|
+
<template v-else-if="!isEditable">
|
|
25
46
|
<div
|
|
26
47
|
class="tw-truncate"
|
|
27
48
|
:class="cell.class"
|
|
@@ -125,13 +146,34 @@
|
|
|
125
146
|
class="tw-text-right tw-truncate"
|
|
126
147
|
:class="cell.class"
|
|
127
148
|
>
|
|
128
|
-
<template v-if="
|
|
129
|
-
<
|
|
149
|
+
<template v-if="isEditable">
|
|
150
|
+
<Field
|
|
151
|
+
v-slot="{ errors, errorMessage }"
|
|
152
|
+
:label="cell.title as string"
|
|
153
|
+
:name="`${cell.id}_${index}`"
|
|
130
154
|
:model-value="value"
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
155
|
+
:rules="cell.rules"
|
|
156
|
+
>
|
|
157
|
+
<VcInput
|
|
158
|
+
:model-value="value"
|
|
159
|
+
class="tw-w-full"
|
|
160
|
+
type="number"
|
|
161
|
+
:error="errors.length > 0"
|
|
162
|
+
@update:model-value="$emit('update', { field: cell.id, value: $event })"
|
|
163
|
+
>
|
|
164
|
+
<template
|
|
165
|
+
v-if="errors.length > 0"
|
|
166
|
+
#append-inner
|
|
167
|
+
>
|
|
168
|
+
<VcTooltip placement="bottom-end">
|
|
169
|
+
<VcIcon icon="fa fa-info-circle tw-text-[color:var(--error-color)]"></VcIcon>
|
|
170
|
+
<template #tooltip>
|
|
171
|
+
<div class="tw-text-[color:var(--error-color)]">{{ errorMessage }}</div>
|
|
172
|
+
</template>
|
|
173
|
+
</VcTooltip>
|
|
174
|
+
</template>
|
|
175
|
+
</VcInput>
|
|
176
|
+
</Field>
|
|
135
177
|
</template>
|
|
136
178
|
<template v-else>
|
|
137
179
|
{{ typeof Number(value) === "number" && Number(value) >= 0 ? Number(value).toFixed(0) : "N/A" }}
|
|
@@ -162,12 +204,33 @@
|
|
|
162
204
|
class="tw-truncate"
|
|
163
205
|
:class="cell.class"
|
|
164
206
|
>
|
|
165
|
-
<template v-if="
|
|
166
|
-
<
|
|
207
|
+
<template v-if="isEditable">
|
|
208
|
+
<Field
|
|
209
|
+
v-slot="{ errors, errorMessage }"
|
|
210
|
+
:label="cell.title as string"
|
|
211
|
+
:name="`${cell.id}_${index}`"
|
|
167
212
|
:model-value="value"
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
213
|
+
:rules="cell.rules"
|
|
214
|
+
>
|
|
215
|
+
<VcInput
|
|
216
|
+
:model-value="value"
|
|
217
|
+
class="tw-w-full"
|
|
218
|
+
:error="errors.length > 0"
|
|
219
|
+
@update:model-value="$emit('update', { field: cell.id, value: $event })"
|
|
220
|
+
>
|
|
221
|
+
<template
|
|
222
|
+
v-if="errors.length > 0"
|
|
223
|
+
#append-inner
|
|
224
|
+
>
|
|
225
|
+
<VcTooltip placement="bottom-end">
|
|
226
|
+
<VcIcon icon="fa fa-info-circle tw-text-[color:var(--error-color)]"></VcIcon>
|
|
227
|
+
<template #tooltip>
|
|
228
|
+
<div class="tw-text-[color:var(--error-color)]">{{ errorMessage }}</div>
|
|
229
|
+
</template>
|
|
230
|
+
</VcTooltip>
|
|
231
|
+
</template></VcInput
|
|
232
|
+
>
|
|
233
|
+
</Field>
|
|
171
234
|
</template>
|
|
172
235
|
<template v-else>
|
|
173
236
|
{{ value }}
|
|
@@ -185,12 +248,14 @@ import htmlTruncate from "truncate-html";
|
|
|
185
248
|
import * as DOMPurify from "dompurify";
|
|
186
249
|
import VcInputCurrency from "../../../../molecules/vc-input-currency/vc-input-currency.vue";
|
|
187
250
|
import VcInput from "../../../../molecules/vc-input/vc-input.vue";
|
|
251
|
+
import { Field } from "vee-validate";
|
|
188
252
|
|
|
189
253
|
export interface Props {
|
|
190
254
|
cell: ITableColumns;
|
|
191
255
|
item: Record<string, unknown>;
|
|
192
256
|
width?: number;
|
|
193
|
-
|
|
257
|
+
editing?: boolean;
|
|
258
|
+
index?: number;
|
|
194
259
|
}
|
|
195
260
|
|
|
196
261
|
const props = defineProps<Props>();
|
|
@@ -204,6 +269,8 @@ const locale = window.navigator.language;
|
|
|
204
269
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
205
270
|
const value = computed((): any => _.get(props.item, props.cell.field || props.cell.id));
|
|
206
271
|
|
|
272
|
+
const isEditable = computed(() => props.cell.editable && props.editing);
|
|
273
|
+
|
|
207
274
|
const sanitizedHtml = computed(() => {
|
|
208
275
|
if (props.cell.type === "html") {
|
|
209
276
|
return DOMPurify.default.sanitize(value.value as string, { USE_PROFILES: { html: true } });
|
|
@@ -226,3 +293,9 @@ function intlMoney(value: number) {
|
|
|
226
293
|
}).format(value);
|
|
227
294
|
}
|
|
228
295
|
</script>
|
|
296
|
+
|
|
297
|
+
<style lang="scss">
|
|
298
|
+
:root {
|
|
299
|
+
--error-color: #f14e4e;
|
|
300
|
+
}
|
|
301
|
+
</style>
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
</template>
|
|
42
42
|
|
|
43
43
|
<script lang="ts" setup>
|
|
44
|
-
import { ref, computed,
|
|
44
|
+
import { ref, computed, watch } from "vue";
|
|
45
45
|
import { ITableColumns } from "./../../../../../../core/types";
|
|
46
46
|
import { vOnClickOutside } from "@vueuse/components";
|
|
47
47
|
import { useFloating, flip, shift, autoUpdate } from "@floating-ui/vue";
|
|
@@ -91,7 +91,11 @@ watch(
|
|
|
91
91
|
);
|
|
92
92
|
|
|
93
93
|
function selectItem(item: ITableColumns) {
|
|
94
|
-
|
|
94
|
+
const numberVisible = internalItems.value.filter((i: ITableColumns) => i.visible).length;
|
|
95
|
+
|
|
96
|
+
if (numberVisible > 1 || !item.visible) {
|
|
97
|
+
emit("change", toggleVisibility(item));
|
|
98
|
+
}
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
function toggleVisibility(item: ITableColumns) {
|