@vc-shell/framework 1.0.188 → 1.0.190
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 +26 -0
- package/core/plugins/moment/humanize.ts +6 -7
- package/core/types/index.ts +12 -1
- package/dist/core/plugins/moment/humanize.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.js +30782 -20187
- package/dist/index.css +1 -1
- package/dist/shared/components/error-interceptor/interceptor.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/ContentField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts +4 -1
- package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/ImageField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/InputField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/MultivalueField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/TextareaField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/VideoField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/storybook/Button.stories.d.ts +417 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/Button.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/Card.stories.d.ts +357 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/Card.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/Checkbox.stories.d.ts +398 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/Checkbox.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/ContentField.stories.d.ts +392 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/ContentField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/EditorField.stories.d.ts +407 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/EditorField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.d.ts +372 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/GalleryField.stories.d.ts +391 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/GalleryField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/ImageField.stories.d.ts +372 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/ImageField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/InputCurrency.stories.d.ts +439 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/InputCurrency.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/InputField.stories.d.ts +460 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/InputField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/MultivalueField.stories.d.ts +459 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/MultivalueField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/RatingField.stories.d.ts +359 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/RatingField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/SelectField.stories.d.ts +507 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/SelectField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/StatusField.stories.d.ts +392 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/StatusField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/SwitchField.stories.d.ts +14 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/SwitchField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/TextareaField.stories.d.ts +407 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/TextareaField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/VideoField.stories.d.ts +322 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/VideoField.stories.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/common/args.d.ts +113 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/common/args.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/common/templates.d.ts +3 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/common/templates.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts +235 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.d.ts +4 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.d.ts +3 -0
- package/dist/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.d.ts.map +1 -0
- package/dist/shared/modules/dynamic/factories/base/useDetailsFactory.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/factories/types/index.d.ts +1 -0
- package/dist/shared/modules/dynamic/factories/types/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/getters.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/types/index.d.ts +88 -38
- package/dist/shared/modules/dynamic/types/index.d.ts.map +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/vc-card/vc-card.stories.d.ts +16 -16
- package/dist/ui/components/atoms/vc-card/vc-card.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-switch/index.d.ts +1 -39
- package/dist/ui/components/atoms/vc-switch/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-switch/vc-switch.stories.d.ts +30 -11
- package/dist/ui/components/atoms/vc-switch/vc-switch.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-switch/vc-switch.vue.d.ts +22 -3
- package/dist/ui/components/atoms/vc-switch/vc-switch.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-video/index.d.ts +1 -35
- package/dist/ui/components/atoms/vc-video/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-video/vc-video.stories.d.ts +5 -27
- package/dist/ui/components/atoms/vc-video/vc-video.stories.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-video/vc-video.vue.d.ts +3 -18
- package/dist/ui/components/atoms/vc-video/vc-video.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-editor/vc-editor.stories.d.ts +16 -4
- package/dist/ui/components/molecules/vc-editor/vc-editor.stories.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts +2 -1
- package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-input/vc-input.stories.d.ts +30 -16
- package/dist/ui/components/molecules/vc-input/vc-input.stories.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.stories.d.ts +12 -12
- 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 +252 -42
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.stories.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts +36 -6
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-select/vc-select.stories.d.ts +96 -32
- package/dist/ui/components/molecules/vc-select/vc-select.stories.d.ts.map +1 -1
- 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/molecules/vc-textarea/vc-textarea.stories.d.ts +63 -63
- package/dist/ui/components/molecules/vc-textarea/vc-textarea.vue.d.ts +6 -6
- package/dist/ui/components/molecules/vc-textarea/vc-textarea.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue.d.ts +1 -0
- 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 +8 -2
- 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 +3 -1
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
- package/package.json +8 -4
- package/shared/components/error-interceptor/interceptor.ts +1 -1
- package/shared/modules/dynamic/components/fields/Button.ts +5 -2
- package/shared/modules/dynamic/components/fields/Card.ts +4 -4
- package/shared/modules/dynamic/components/fields/ContentField.ts +1 -0
- package/shared/modules/dynamic/components/fields/DynamicProperty.ts +5 -6
- package/shared/modules/dynamic/components/fields/EditorField.ts +5 -3
- package/shared/modules/dynamic/components/fields/Fieldset.ts +1 -1
- package/shared/modules/dynamic/components/fields/GalleryField.ts +6 -3
- package/shared/modules/dynamic/components/fields/ImageField.ts +0 -1
- package/shared/modules/dynamic/components/fields/InputCurrency.ts +1 -1
- package/shared/modules/dynamic/components/fields/InputField.ts +1 -0
- package/shared/modules/dynamic/components/fields/MultivalueField.ts +3 -2
- package/shared/modules/dynamic/components/fields/SelectField.ts +1 -0
- package/shared/modules/dynamic/components/fields/StatusField.ts +20 -10
- package/shared/modules/dynamic/components/fields/TextareaField.ts +1 -0
- package/shared/modules/dynamic/components/fields/VideoField.ts +0 -1
- package/shared/modules/dynamic/components/fields/storybook/Button.stories.ts +247 -0
- package/shared/modules/dynamic/components/fields/storybook/Card.stories.ts +166 -0
- package/shared/modules/dynamic/components/fields/storybook/Checkbox.stories.ts +185 -0
- package/shared/modules/dynamic/components/fields/storybook/ContentField.stories.ts +245 -0
- package/shared/modules/dynamic/components/fields/storybook/EditorField.stories.ts +192 -0
- package/shared/modules/dynamic/components/fields/storybook/Fieldset.stories.ts +409 -0
- package/shared/modules/dynamic/components/fields/storybook/GalleryField.stories.ts +239 -0
- package/shared/modules/dynamic/components/fields/storybook/ImageField.stories.ts +186 -0
- package/shared/modules/dynamic/components/fields/storybook/InputCurrency.stories.ts +267 -0
- package/shared/modules/dynamic/components/fields/storybook/InputField.stories.ts +298 -0
- package/shared/modules/dynamic/components/fields/storybook/MultivalueField.stories.ts +347 -0
- package/shared/modules/dynamic/components/fields/storybook/RatingField.stories.ts +131 -0
- package/shared/modules/dynamic/components/fields/storybook/SelectField.stories.ts +653 -0
- package/shared/modules/dynamic/components/fields/storybook/StatusField.stories.ts +202 -0
- package/shared/modules/dynamic/components/fields/storybook/SwitchField.stories.ts +178 -0
- package/shared/modules/dynamic/components/fields/storybook/TextareaField.stories.ts +203 -0
- package/shared/modules/dynamic/components/fields/storybook/VideoField.stories.ts +92 -0
- package/shared/modules/dynamic/components/fields/storybook/common/args.ts +130 -0
- package/shared/modules/dynamic/components/fields/storybook/common/templates.ts +8 -0
- package/shared/modules/dynamic/components/fields/storybook/pages/DynamicRender.ts +54 -0
- package/shared/modules/dynamic/components/fields/storybook/utils/sourceHighlighter.ts +16 -0
- package/shared/modules/dynamic/components/fields/storybook/utils/sourceTransform.ts +41 -0
- package/shared/modules/dynamic/factories/base/useDetailsFactory.ts +1 -0
- package/shared/modules/dynamic/factories/types/index.ts +2 -0
- package/shared/modules/dynamic/helpers/getters.ts +3 -0
- package/shared/modules/dynamic/helpers/nodeBuilder.ts +1 -1
- package/shared/modules/dynamic/helpers/setters.ts +1 -1
- package/shared/modules/dynamic/types/index.ts +93 -40
- package/shared/modules/dynamic/types/models.ts +8 -7
- package/shared/pages/LoginPage/components/login/Login.vue +1 -1
- package/ui/components/atoms/vc-card/vc-card.vue +12 -2
- package/ui/components/atoms/vc-switch/index.ts +1 -3
- package/ui/components/atoms/vc-switch/vc-switch.vue +10 -3
- package/ui/components/atoms/vc-video/index.ts +1 -3
- package/ui/components/atoms/vc-video/vc-video.stories.ts +1 -15
- package/ui/components/atoms/vc-video/vc-video.vue +4 -37
- package/ui/components/molecules/vc-editor/vc-editor.vue +47 -33
- package/ui/components/molecules/vc-field/_internal/vc-field-type/vc-field-type.vue +2 -2
- package/ui/components/molecules/vc-input/vc-input.stories.ts +14 -0
- package/ui/components/molecules/vc-input-currency/vc-input-currency.vue +8 -0
- package/ui/components/molecules/vc-multivalue/vc-multivalue.vue +21 -9
- package/ui/components/molecules/vc-select/vc-select.stories.ts +74 -3
- package/ui/components/molecules/vc-select/vc-select.vue +35 -38
- package/ui/components/molecules/vc-textarea/vc-textarea.stories.ts +1 -1
- package/ui/components/molecules/vc-textarea/vc-textarea.vue +5 -15
- package/ui/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue +1 -1
- package/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue +140 -108
- package/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue +20 -6
- package/ui/components/organisms/vc-table/vc-table.stories.ts +6 -2
- package/ui/components/organisms/vc-table/vc-table.vue +176 -124
|
@@ -73,45 +73,42 @@
|
|
|
73
73
|
<template v-else>{{ t("COMPONENTS.MOLECULES.VC_SELECT.CLICK_TO_SELECT") }}</template>
|
|
74
74
|
</div>
|
|
75
75
|
<template v-else-if="selectedScope && selectedScope.length && hasValue">
|
|
76
|
-
<
|
|
77
|
-
<
|
|
76
|
+
<div class="tw-flex tw-flex-wrap tw-gap-1 tw-py-1">
|
|
77
|
+
<div
|
|
78
78
|
v-for="(item, i) in selectedScope"
|
|
79
|
+
v-bind="item"
|
|
79
80
|
:key="i"
|
|
81
|
+
class="tw-flex tw-items-center"
|
|
80
82
|
>
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<div class="tw-flex tw-flex-wrap tw-gap-1 tw-py-1">
|
|
89
|
-
<div
|
|
90
|
-
v-for="(item, i) in selectedScope"
|
|
91
|
-
v-bind="item"
|
|
92
|
-
:key="i"
|
|
93
|
-
class="tw-flex tw-items-center"
|
|
94
|
-
>
|
|
95
|
-
<template v-if="multiple">
|
|
96
|
-
<div
|
|
97
|
-
class="tw-bg-[#fbfdfe] tw-border tw-border-solid tw-border-[color:#bdd1df] tw-rounded-[2px] tw-flex tw-items-center tw-h-[28px] tw-box-border tw-px-2"
|
|
83
|
+
<template v-if="multiple">
|
|
84
|
+
<div
|
|
85
|
+
class="tw-bg-[#fbfdfe] tw-border tw-border-solid tw-border-[color:#bdd1df] tw-rounded-[2px] tw-flex tw-items-center tw-h-[28px] tw-box-border tw-px-2"
|
|
86
|
+
>
|
|
87
|
+
<slot
|
|
88
|
+
name="selected-item"
|
|
89
|
+
v-bind="item"
|
|
98
90
|
>
|
|
99
91
|
<span>{{ getOptionLabel(item.opt) }}</span>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
</
|
|
109
|
-
|
|
92
|
+
</slot>
|
|
93
|
+
<VcIcon
|
|
94
|
+
v-if="!disabled"
|
|
95
|
+
class="tw-text-[#a9bfd2] tw-ml-2 tw-cursor-pointer hover:tw-text-[color:var(--select-clear-color-hover)]"
|
|
96
|
+
icon="fas fa-times"
|
|
97
|
+
size="s"
|
|
98
|
+
@click.stop="removeAtIndex(item.index)"
|
|
99
|
+
></VcIcon>
|
|
100
|
+
</div>
|
|
101
|
+
</template>
|
|
102
|
+
<template v-else-if="!multiple">
|
|
103
|
+
<slot
|
|
104
|
+
name="selected-item"
|
|
105
|
+
v-bind="item"
|
|
106
|
+
>
|
|
110
107
|
{{ getEmittingOptionValue(item.opt) }}
|
|
111
|
-
</
|
|
112
|
-
</
|
|
108
|
+
</slot>
|
|
109
|
+
</template>
|
|
113
110
|
</div>
|
|
114
|
-
</
|
|
111
|
+
</div>
|
|
115
112
|
</template>
|
|
116
113
|
</div>
|
|
117
114
|
<div
|
|
@@ -375,8 +372,8 @@ const props = withDefaults(
|
|
|
375
372
|
|
|
376
373
|
modelValue?: any;
|
|
377
374
|
/**
|
|
378
|
-
* Try to map labels of model from 'options' Array; If you are using emit-value you will probably need to use map-options to display the label text in the select field rather than the value
|
|
379
|
-
*
|
|
375
|
+
* Try to map labels of model from 'options' Array; If you are using emit-value you will probably need to use map-options to display the label text in the select field rather than the value.
|
|
376
|
+
* @default true
|
|
380
377
|
*/
|
|
381
378
|
mapOptions?: boolean;
|
|
382
379
|
/**
|
|
@@ -422,19 +419,19 @@ const props = withDefaults(
|
|
|
422
419
|
multiple?: boolean;
|
|
423
420
|
/**
|
|
424
421
|
* Available options that the user can select from.
|
|
425
|
-
*
|
|
422
|
+
* @default []
|
|
426
423
|
*/
|
|
427
424
|
options?: ((keyword?: string, skip?: number, ids?: string[]) => Promise<P>) | T[];
|
|
428
425
|
/**
|
|
429
426
|
* Property of option which holds the 'value'
|
|
430
|
-
*
|
|
427
|
+
* @default id
|
|
431
428
|
* @param option The current option being processed
|
|
432
429
|
* @returns Value of the current option
|
|
433
430
|
*/
|
|
434
431
|
optionValue?: OptionProp<Option>;
|
|
435
432
|
/**
|
|
436
433
|
* Property of option which holds the 'label'
|
|
437
|
-
*
|
|
434
|
+
* @default title
|
|
438
435
|
* @param option The current option being processed
|
|
439
436
|
* @returns Label of the current option
|
|
440
437
|
*/
|
|
@@ -445,7 +442,7 @@ const props = withDefaults(
|
|
|
445
442
|
emitValue?: boolean;
|
|
446
443
|
/**
|
|
447
444
|
* Debounce the search input update with an amount of milliseconds
|
|
448
|
-
*
|
|
445
|
+
* @default 500
|
|
449
446
|
*/
|
|
450
447
|
debounce?: number | string;
|
|
451
448
|
/**
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
:placeholder="placeholder"
|
|
31
31
|
:value="modelValue"
|
|
32
32
|
:disabled="disabled"
|
|
33
|
-
:maxlength="
|
|
33
|
+
:maxlength="maxlength"
|
|
34
34
|
@input="onInput"
|
|
35
35
|
></textarea>
|
|
36
36
|
</div>
|
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
</template>
|
|
48
48
|
|
|
49
49
|
<script lang="ts" setup>
|
|
50
|
-
import { watch } from "vue";
|
|
51
50
|
import { VcHint, VcLabel } from "./../../";
|
|
52
51
|
|
|
53
52
|
export interface Props {
|
|
@@ -58,7 +57,7 @@ export interface Props {
|
|
|
58
57
|
label?: string;
|
|
59
58
|
tooltip?: string;
|
|
60
59
|
name?: string;
|
|
61
|
-
|
|
60
|
+
maxlength?: string;
|
|
62
61
|
errorMessage?: string;
|
|
63
62
|
multilanguage?: boolean;
|
|
64
63
|
currentLanguage?: string;
|
|
@@ -69,25 +68,16 @@ export interface Emits {
|
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
defineSlots<{
|
|
72
|
-
|
|
73
|
-
error: (props: any) => any;
|
|
71
|
+
error: void;
|
|
74
72
|
}>();
|
|
75
73
|
|
|
76
|
-
|
|
74
|
+
withDefaults(defineProps<Props>(), {
|
|
77
75
|
name: "Field",
|
|
78
|
-
|
|
76
|
+
maxlength: "1024",
|
|
79
77
|
});
|
|
80
78
|
|
|
81
79
|
const emit = defineEmits<Emits>();
|
|
82
80
|
|
|
83
|
-
watch(
|
|
84
|
-
() => props.modelValue,
|
|
85
|
-
(value) => {
|
|
86
|
-
emit("update:modelValue", value);
|
|
87
|
-
},
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
// Handle input event to propertly validate value and emit changes
|
|
91
81
|
function onInput(e: Event) {
|
|
92
82
|
const newValue = (e.target as HTMLInputElement).value;
|
|
93
83
|
emit("update:modelValue", newValue);
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
<div class="tw-overflow-hidden tw-grow tw-basis-0">
|
|
16
16
|
<div
|
|
17
|
-
class="tw-text-[color:var(--blade-header-title-color)] tw-text-lg tw-truncate"
|
|
17
|
+
class="tw-text-[color:var(--blade-header-title-color)] tw-text-lg/[23px] tw-truncate"
|
|
18
18
|
:class="{
|
|
19
19
|
'!tw-text-[length:var(--blade-header-title-font-size)] tw-font-medium': !subtitle,
|
|
20
20
|
}"
|
|
@@ -1,124 +1,150 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<
|
|
5
|
-
v-if="typeof Number(value) === 'number' && Number(value) > 0"
|
|
6
|
-
class="tw-truncate"
|
|
7
|
-
>
|
|
8
|
-
<span class="tw-truncate">{{ Math.trunc(Number(value)) }}</span
|
|
9
|
-
><span class="tw-text-[#a5a5a5] tw-text-xs tw-truncate"
|
|
10
|
-
>.{{ `${(Number(value) * 100) % 100}`.padEnd(2, "0").slice(0, 2) }}</span
|
|
11
|
-
>
|
|
12
|
-
</div>
|
|
13
|
-
<template v-else>
|
|
14
|
-
<div class="tw-truncate">N/A</div>
|
|
15
|
-
</template>
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
<!-- Date ago cell -->
|
|
19
|
-
<span
|
|
20
|
-
v-else-if="cell.type === 'date-ago'"
|
|
21
|
-
class="tw-text-[#a5a5a5]"
|
|
22
|
-
:title="(value instanceof Date && value.toLocaleString(locale)) || ''"
|
|
23
|
-
>
|
|
24
|
-
<div
|
|
25
|
-
v-if="value"
|
|
26
|
-
class="tw-truncate"
|
|
27
|
-
>
|
|
28
|
-
{{ moment(value).fromNow() }}
|
|
29
|
-
</div>
|
|
30
|
-
<div
|
|
31
|
-
v-else
|
|
32
|
-
class="tw-truncate"
|
|
33
|
-
>
|
|
34
|
-
N/A
|
|
35
|
-
</div>
|
|
36
|
-
</span>
|
|
37
|
-
|
|
38
|
-
<!-- Date exact cell -->
|
|
39
|
-
<div
|
|
40
|
-
v-else-if="cell.type === 'date' || cell.type === 'time' || cell.type === 'date-time'"
|
|
41
|
-
class="tw-text-[#a5a5a5] tw-truncate"
|
|
42
|
-
>
|
|
43
|
-
<template v-if="value">
|
|
2
|
+
<div>
|
|
3
|
+
<!-- Money cell -->
|
|
4
|
+
<template v-if="cell.type === 'money'">
|
|
44
5
|
<div
|
|
45
|
-
v-if="
|
|
6
|
+
v-if="typeof Number(value) === 'number' && Number(value) > 0"
|
|
46
7
|
class="tw-truncate"
|
|
8
|
+
:class="cell.class"
|
|
47
9
|
>
|
|
48
|
-
{{
|
|
10
|
+
<span class="tw-truncate">{{ Math.trunc(Number(value)) }}</span
|
|
11
|
+
><span class="tw-text-[#a5a5a5] tw-text-xs tw-truncate"
|
|
12
|
+
>.{{ `${(Number(value) * 100) % 100}`.padEnd(2, "0").slice(0, 2) }}</span
|
|
13
|
+
>
|
|
49
14
|
</div>
|
|
50
15
|
<template v-else>
|
|
51
16
|
<div
|
|
52
|
-
v-if="cell.type === 'date'"
|
|
53
17
|
class="tw-truncate"
|
|
18
|
+
:class="cell.class"
|
|
54
19
|
>
|
|
55
|
-
|
|
20
|
+
N/A
|
|
56
21
|
</div>
|
|
22
|
+
</template>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<!-- Date ago cell -->
|
|
26
|
+
<span
|
|
27
|
+
v-else-if="cell.type === 'date-ago'"
|
|
28
|
+
class="tw-text-[#a5a5a5]"
|
|
29
|
+
:class="cell.class"
|
|
30
|
+
:title="(value instanceof Date && value.toLocaleString(locale)) || ''"
|
|
31
|
+
>
|
|
32
|
+
<div
|
|
33
|
+
v-if="value"
|
|
34
|
+
class="tw-truncate"
|
|
35
|
+
>
|
|
36
|
+
{{ moment(value).fromNow() }}
|
|
37
|
+
</div>
|
|
38
|
+
<div
|
|
39
|
+
v-else
|
|
40
|
+
class="tw-truncate"
|
|
41
|
+
>
|
|
42
|
+
N/A
|
|
43
|
+
</div>
|
|
44
|
+
</span>
|
|
45
|
+
|
|
46
|
+
<!-- Date exact cell -->
|
|
47
|
+
<div
|
|
48
|
+
v-else-if="cell.type === 'date' || cell.type === 'time' || cell.type === 'date-time'"
|
|
49
|
+
class="tw-text-[#a5a5a5] tw-truncate"
|
|
50
|
+
:class="cell.class"
|
|
51
|
+
>
|
|
52
|
+
<template v-if="value">
|
|
57
53
|
<div
|
|
58
|
-
v-if="cell.
|
|
54
|
+
v-if="cell.format"
|
|
59
55
|
class="tw-truncate"
|
|
60
56
|
>
|
|
61
|
-
{{ value
|
|
57
|
+
{{ moment(value).locale(locale).format(cell.format) }}
|
|
62
58
|
</div>
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
<template v-else>
|
|
60
|
+
<div
|
|
61
|
+
v-if="cell.type === 'date'"
|
|
62
|
+
class="tw-truncate"
|
|
63
|
+
>
|
|
64
|
+
{{ value instanceof Date && value.toLocaleDateString(locale) }}
|
|
65
|
+
</div>
|
|
66
|
+
<div
|
|
67
|
+
v-if="cell.type === 'time'"
|
|
68
|
+
class="tw-truncate"
|
|
69
|
+
>
|
|
70
|
+
{{ value instanceof Date && value.toLocaleTimeString(locale) }}
|
|
71
|
+
</div>
|
|
72
|
+
<p
|
|
73
|
+
v-if="cell.type === 'date-time'"
|
|
74
|
+
class="tw-truncate"
|
|
75
|
+
>
|
|
76
|
+
{{ value instanceof Date && value.toLocaleString(locale) }}
|
|
77
|
+
</p>
|
|
78
|
+
</template>
|
|
69
79
|
</template>
|
|
80
|
+
<div
|
|
81
|
+
v-else
|
|
82
|
+
class="tw-truncate"
|
|
83
|
+
>
|
|
84
|
+
N/A
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<!-- Image cell -->
|
|
89
|
+
<template v-else-if="cell.type === 'image'">
|
|
90
|
+
<VcImage
|
|
91
|
+
:bordered="true"
|
|
92
|
+
size="s"
|
|
93
|
+
aspect="1x1"
|
|
94
|
+
:src="value as string"
|
|
95
|
+
background="contain"
|
|
96
|
+
/>
|
|
97
|
+
</template>
|
|
98
|
+
|
|
99
|
+
<!-- Status cell -->
|
|
100
|
+
<template v-else-if="cell.type === 'status'">
|
|
101
|
+
<VcStatus>{{ value }}</VcStatus>
|
|
70
102
|
</template>
|
|
103
|
+
|
|
104
|
+
<!-- Status icon cell -->
|
|
71
105
|
<div
|
|
72
|
-
v-else
|
|
73
|
-
class="tw-
|
|
106
|
+
v-else-if="cell.type === 'status-icon'"
|
|
107
|
+
class="tw-flex tw-justify-center"
|
|
108
|
+
:class="cell.class"
|
|
74
109
|
>
|
|
75
|
-
|
|
110
|
+
<VcStatusIcon :status="value as boolean"></VcStatusIcon>
|
|
76
111
|
</div>
|
|
77
|
-
</div>
|
|
78
112
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
/>
|
|
88
|
-
</template>
|
|
89
|
-
|
|
90
|
-
<!-- Status cell -->
|
|
91
|
-
<template v-else-if="cell.type === 'status'">
|
|
92
|
-
<VcStatus>{{ value }}</VcStatus>
|
|
93
|
-
</template>
|
|
94
|
-
|
|
95
|
-
<!-- Status icon cell -->
|
|
96
|
-
<div
|
|
97
|
-
v-else-if="cell.type === 'status-icon'"
|
|
98
|
-
class="tw-flex tw-justify-center"
|
|
99
|
-
>
|
|
100
|
-
<VcStatusIcon :status="value as boolean"></VcStatusIcon>
|
|
101
|
-
</div>
|
|
113
|
+
<!-- Number cell -->
|
|
114
|
+
<div
|
|
115
|
+
v-else-if="cell.type === 'number'"
|
|
116
|
+
class="tw-text-right tw-truncate"
|
|
117
|
+
:class="cell.class"
|
|
118
|
+
>
|
|
119
|
+
{{ Number(value).toFixed(0) }}
|
|
120
|
+
</div>
|
|
102
121
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
122
|
+
<!-- Link cell -->
|
|
123
|
+
<template v-else-if="cell.type === 'link'">
|
|
124
|
+
<VcLink
|
|
125
|
+
class="tw-truncate"
|
|
126
|
+
:class="cell.class"
|
|
127
|
+
>{{ value }}</VcLink
|
|
128
|
+
>
|
|
129
|
+
</template>
|
|
130
|
+
|
|
131
|
+
<!-- HTML cell -->
|
|
132
|
+
<template v-else-if="cell.type === 'html'">
|
|
133
|
+
<div
|
|
134
|
+
class="tw-p-1"
|
|
135
|
+
:class="cell.class"
|
|
136
|
+
v-html="truncatedHtml"
|
|
137
|
+
/>
|
|
138
|
+
</template>
|
|
110
139
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
class="tw-truncate"
|
|
120
|
-
>
|
|
121
|
-
{{ value }}
|
|
140
|
+
<!-- Default cell -->
|
|
141
|
+
<div
|
|
142
|
+
v-else
|
|
143
|
+
class="tw-truncate"
|
|
144
|
+
:class="cell.class"
|
|
145
|
+
>
|
|
146
|
+
{{ value }}
|
|
147
|
+
</div>
|
|
122
148
|
</div>
|
|
123
149
|
</template>
|
|
124
150
|
|
|
@@ -126,24 +152,30 @@
|
|
|
126
152
|
import { computed } from "vue";
|
|
127
153
|
import moment from "moment";
|
|
128
154
|
import { ITableColumns } from "./../../../../../../core/types";
|
|
155
|
+
import * as _ from "lodash-es";
|
|
156
|
+
import htmlTruncate from "truncate-html";
|
|
157
|
+
import * as DOMPurify from "dompurify";
|
|
129
158
|
|
|
130
159
|
export interface Props {
|
|
131
160
|
cell: ITableColumns;
|
|
132
161
|
item: Record<string, unknown>;
|
|
162
|
+
width?: number;
|
|
133
163
|
}
|
|
134
164
|
|
|
135
165
|
const props = defineProps<Props>();
|
|
136
166
|
|
|
137
167
|
const locale = window.navigator.language;
|
|
138
168
|
|
|
139
|
-
const value = computed(()
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return val !== undefined ? val : null;
|
|
147
|
-
}, props.item);
|
|
169
|
+
const value = computed(() => _.get(props.item, props.cell.field || props.cell.id));
|
|
170
|
+
|
|
171
|
+
const sanitizedHtml = computed(() => {
|
|
172
|
+
if (props.cell.type === "html") {
|
|
173
|
+
return DOMPurify.default.sanitize(value.value as string, { USE_PROFILES: { html: true } });
|
|
174
|
+
}
|
|
175
|
+
return "";
|
|
148
176
|
});
|
|
177
|
+
|
|
178
|
+
const truncatedHtml = computed(() =>
|
|
179
|
+
htmlTruncate(sanitizedHtml.value, +(typeof props.width !== "undefined" ? Math.floor(props.width / 5) : 30)),
|
|
180
|
+
);
|
|
149
181
|
</script>
|
|
@@ -16,18 +16,22 @@
|
|
|
16
16
|
class="tw-flex tw-flex-col tw-box-border tw-max-h-[300px] tw-h-auto tw-z-10 tw-overflow-hidden tw-absolute tw-bg-white tw-border tw-border-solid tw-border-[#e5e7eb] tw-w-max tw-right-0"
|
|
17
17
|
>
|
|
18
18
|
<VcContainer
|
|
19
|
-
v-if="
|
|
19
|
+
v-if="internalItems && internalItems.length"
|
|
20
20
|
:no-padding="true"
|
|
21
21
|
>
|
|
22
22
|
<div class="tw-w-full tw-h-full tw-box-border tw-flex tw-flex-col">
|
|
23
23
|
<div
|
|
24
|
-
v-for="item in
|
|
24
|
+
v-for="item in internalItems"
|
|
25
25
|
:key="item.id"
|
|
26
26
|
class="tw-flex tw-items-center tw-min-h-[30px] tw-box-border tw-rounded-[3px] tw-px-2 tw-cursor-pointer hover:tw-bg-[#eff7fc] tw-border-b"
|
|
27
|
-
:class="{ 'tw-bg-[#eff7fc]': item.visible }"
|
|
28
27
|
@click="selectItem(item)"
|
|
29
28
|
>
|
|
30
|
-
|
|
29
|
+
<VcIcon
|
|
30
|
+
:icon="item.visible ? 'fas fa-check' : ''"
|
|
31
|
+
size="s"
|
|
32
|
+
class="tw-w-4"
|
|
33
|
+
/>
|
|
34
|
+
<p class="tw-ml-2">{{ item.title }}</p>
|
|
31
35
|
</div>
|
|
32
36
|
</div>
|
|
33
37
|
</VcContainer>
|
|
@@ -37,7 +41,7 @@
|
|
|
37
41
|
</template>
|
|
38
42
|
|
|
39
43
|
<script lang="ts" setup>
|
|
40
|
-
import { ref, computed } from "vue";
|
|
44
|
+
import { ref, computed, toRefs, watch } from "vue";
|
|
41
45
|
import { ITableColumns } from "./../../../../../../core/types";
|
|
42
46
|
import { vOnClickOutside } from "@vueuse/components";
|
|
43
47
|
import { useFloating, flip, shift, autoUpdate } from "@floating-ui/vue";
|
|
@@ -50,12 +54,13 @@ export interface Emits {
|
|
|
50
54
|
(event: "change", value: ITableColumns): void;
|
|
51
55
|
}
|
|
52
56
|
|
|
53
|
-
withDefaults(defineProps<Props>(), {});
|
|
57
|
+
const props = withDefaults(defineProps<Props>(), {});
|
|
54
58
|
const emit = defineEmits<Emits>();
|
|
55
59
|
|
|
56
60
|
const isActive = ref(false);
|
|
57
61
|
const referenceButton = ref(null);
|
|
58
62
|
const floatingDrop = ref(null);
|
|
63
|
+
const internalItems = ref();
|
|
59
64
|
const floater = useFloating(referenceButton, floatingDrop, {
|
|
60
65
|
placement: "bottom-end",
|
|
61
66
|
whileElementsMounted: autoUpdate,
|
|
@@ -69,12 +74,21 @@ const floatingDropStyle = computed(() => {
|
|
|
69
74
|
};
|
|
70
75
|
});
|
|
71
76
|
|
|
77
|
+
watch(
|
|
78
|
+
() => props.items,
|
|
79
|
+
(newVal) => {
|
|
80
|
+
internalItems.value = newVal;
|
|
81
|
+
},
|
|
82
|
+
{ immediate: true, deep: true },
|
|
83
|
+
);
|
|
84
|
+
|
|
72
85
|
function selectItem(item: ITableColumns) {
|
|
73
86
|
emit("change", toggleVisibility(item));
|
|
74
87
|
}
|
|
75
88
|
|
|
76
89
|
function toggleVisibility(item: ITableColumns) {
|
|
77
90
|
item.visible = !item.visible;
|
|
91
|
+
|
|
78
92
|
return item;
|
|
79
93
|
}
|
|
80
94
|
|
|
@@ -17,7 +17,7 @@ export default {
|
|
|
17
17
|
{
|
|
18
18
|
id: "img",
|
|
19
19
|
title: "Pic",
|
|
20
|
-
width:
|
|
20
|
+
width: "60px",
|
|
21
21
|
type: "image",
|
|
22
22
|
},
|
|
23
23
|
{
|
|
@@ -29,7 +29,11 @@ export default {
|
|
|
29
29
|
id: "sku",
|
|
30
30
|
title: "SKU",
|
|
31
31
|
sortable: true,
|
|
32
|
-
width:
|
|
32
|
+
width: "100px",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "id",
|
|
36
|
+
title: "ID",
|
|
33
37
|
},
|
|
34
38
|
],
|
|
35
39
|
|