@vc-shell/framework 1.0.115 → 1.0.117
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1943 -0
- package/core/composables/useApiClient/index.ts +2 -2
- package/core/plugins/modularity/index.ts +1 -0
- package/core/plugins/signalR/index.ts +13 -8
- package/core/plugins/validation/rules.ts +3 -3
- package/core/types/index.ts +1 -1
- package/dist/core/composables/useApiClient/index.d.ts +2 -2
- package/dist/core/composables/useApiClient/index.d.ts.map +1 -1
- package/dist/core/plugins/modularity/index.d.ts.map +1 -1
- package/dist/core/plugins/signalR/index.d.ts.map +1 -1
- package/dist/core/types/index.d.ts +1 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/framework.mjs +3343 -3385
- package/dist/shared/components/blade-navigation/components/vc-blade-navigation/index.d.ts +1 -0
- package/dist/shared/components/blade-navigation/components/vc-blade-navigation/index.d.ts.map +1 -1
- package/dist/shared/components/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue.d.ts +1 -0
- package/dist/shared/components/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue.d.ts.map +1 -1
- package/dist/shared/components/blade-navigation/types/index.d.ts +3 -1
- package/dist/shared/components/blade-navigation/types/index.d.ts.map +1 -1
- package/dist/shared/components/notifications/composables/useContainer/index.d.ts.map +1 -1
- package/dist/shared/components/popup-handler/composables/usePopup/index.d.ts +2 -2
- package/dist/shared/components/popup-handler/composables/usePopup/index.d.ts.map +1 -1
- package/dist/shared/components/popup-handler/plugin.d.ts +2 -1
- package/dist/shared/components/popup-handler/plugin.d.ts.map +1 -1
- package/dist/shared/components/popup-handler/types/index.d.ts +11 -10
- package/dist/shared/components/popup-handler/types/index.d.ts.map +1 -1
- package/dist/shared/modules/assets-manager/components/assets-manager/assets-manager.vue.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/FIELD_MAP.d.ts +5 -2202
- package/dist/shared/modules/dynamic/components/FIELD_MAP.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/SchemaRender.d.ts +4 -4
- package/dist/shared/modules/dynamic/components/fields/Button.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/Card.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/Checkbox.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts +4 -2
- package/dist/shared/modules/dynamic/components/fields/DynamicProperty.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/EditorField.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/Fieldset.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/GalleryField.d.ts +2 -2
- package/dist/shared/modules/dynamic/components/fields/InputCurrency.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/InputField.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts +3 -3
- package/dist/shared/modules/dynamic/components/fields/SelectField.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/StatusField.d.ts +1 -1
- package/dist/shared/modules/dynamic/components/fields/props.d.ts +1 -1
- package/dist/shared/modules/dynamic/composables/useFilterBuilder/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/nodeBuilder.d.ts +2 -2
- package/dist/shared/modules/dynamic/helpers/nodeBuilder.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/override.d.ts +2 -2
- package/dist/shared/modules/dynamic/helpers/override.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/toolbarReducer.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/helpers/unrefNested.d.ts +1 -1
- package/dist/shared/modules/dynamic/helpers/unrefNested.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/types/models.d.ts +5 -3
- package/dist/shared/modules/dynamic/types/models.d.ts.map +1 -1
- package/dist/shared/pages/LoginPage/components/login/Login.vue.d.ts +4 -3
- package/dist/shared/pages/LoginPage/components/login/Login.vue.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-select/index.d.ts +1 -177
- package/dist/ui/components/molecules/vc-select/index.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts +9 -6
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts +9 -9
- package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts +3 -0
- package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts +40 -46
- package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts +6 -6
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
- package/package.json +7 -6
- package/shared/components/blade-navigation/types/index.ts +3 -1
- package/shared/components/notifications/composables/useContainer/index.ts +4 -2
- package/shared/components/popup-handler/composables/usePopup/index.ts +36 -18
- package/shared/components/popup-handler/plugin.ts +3 -3
- package/shared/components/popup-handler/types/index.ts +17 -8
- package/shared/modules/assets-manager/components/assets-manager/assets-manager.vue +7 -6
- package/shared/modules/dynamic/components/FIELD_MAP.ts +6 -1
- package/shared/modules/dynamic/components/SchemaRender.ts +3 -3
- package/shared/modules/dynamic/components/factories.ts +1 -1
- package/shared/modules/dynamic/components/fields/Card.ts +2 -2
- package/shared/modules/dynamic/components/fields/DynamicProperty.ts +31 -11
- package/shared/modules/dynamic/components/fields/GalleryField.ts +1 -1
- package/shared/modules/dynamic/components/fields/SelectField.ts +9 -3
- package/shared/modules/dynamic/components/fields/ValidationField.ts +3 -3
- package/shared/modules/dynamic/composables/useFilterBuilder/index.ts +21 -15
- package/shared/modules/dynamic/helpers/nodeBuilder.ts +4 -4
- package/shared/modules/dynamic/helpers/override.ts +4 -4
- package/shared/modules/dynamic/helpers/setters.ts +1 -1
- package/shared/modules/dynamic/helpers/toolbarReducer.ts +3 -1
- package/shared/modules/dynamic/helpers/unrefNested.ts +2 -2
- package/shared/modules/dynamic/index.ts +2 -1
- package/shared/modules/dynamic/pages/dynamic-blade-form.vue +4 -1
- package/shared/modules/dynamic/pages/dynamic-blade-list.vue +12 -7
- package/shared/modules/dynamic/types/models.ts +4 -3
- package/shared/pages/LoginPage/components/login/Login.vue +4 -2
- package/ui/components/molecules/vc-input/vc-input.vue +1 -1
- package/ui/components/molecules/vc-multivalue/vc-multivalue.vue +8 -8
- package/ui/components/molecules/vc-select/index.ts +1 -3
- package/ui/components/molecules/vc-select/vc-select.vue +17 -14
- package/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +4 -4
- package/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue +4 -3
- package/ui/components/organisms/vc-popup/vc-popup.vue +23 -25
- package/ui/components/organisms/vc-table/vc-table.vue +49 -31
|
@@ -122,6 +122,8 @@ import {
|
|
|
122
122
|
unref,
|
|
123
123
|
watch,
|
|
124
124
|
UnwrapRef,
|
|
125
|
+
ShallowRef,
|
|
126
|
+
ConcreteComponent,
|
|
125
127
|
} from "vue";
|
|
126
128
|
import { useI18n } from "vue-i18n";
|
|
127
129
|
import { DynamicGridSchema, ListContentSchema } from "../types";
|
|
@@ -429,7 +431,7 @@ async function resetSearch() {
|
|
|
429
431
|
});
|
|
430
432
|
}
|
|
431
433
|
|
|
432
|
-
function templateOverrideComponents(): Record<string,
|
|
434
|
+
function templateOverrideComponents(): Record<string, ShallowRef<ConcreteComponent>> {
|
|
433
435
|
return {
|
|
434
436
|
...table.value.columns?.reduce((acc, curr) => {
|
|
435
437
|
if ("customTemplate" in curr) {
|
|
@@ -446,17 +448,20 @@ function templateOverrideComponents(): Record<string, VNode> {
|
|
|
446
448
|
}
|
|
447
449
|
}
|
|
448
450
|
return acc;
|
|
449
|
-
}, {}),
|
|
451
|
+
}, {} as Record<string, ShallowRef<ConcreteComponent>>),
|
|
450
452
|
};
|
|
451
453
|
}
|
|
452
454
|
|
|
453
|
-
function resolveTemplateComponent(name:
|
|
455
|
+
function resolveTemplateComponent(name: keyof ListContentSchema) {
|
|
454
456
|
if (!tableData.value) return;
|
|
455
|
-
const
|
|
456
|
-
if (
|
|
457
|
-
const
|
|
457
|
+
const value = tableData.value[name];
|
|
458
|
+
if (value && typeof value === "object" && "component" in value) {
|
|
459
|
+
const componentName = value.component;
|
|
460
|
+
if (componentName) {
|
|
461
|
+
const component = resolveComponent(componentName);
|
|
458
462
|
|
|
459
|
-
|
|
463
|
+
if (component && typeof component !== "string") return shallowRef(component);
|
|
464
|
+
}
|
|
460
465
|
}
|
|
461
466
|
}
|
|
462
467
|
|
|
@@ -54,7 +54,7 @@ export type ControlTypeCtr = Extract<ControlType, ISelectField | IInputField | I
|
|
|
54
54
|
|
|
55
55
|
export interface IControlBaseProps {
|
|
56
56
|
key?: string | number | symbol;
|
|
57
|
-
rules?:
|
|
57
|
+
rules?: Record<string, unknown>;
|
|
58
58
|
label?: string;
|
|
59
59
|
placeholder?: string;
|
|
60
60
|
disabled?: boolean;
|
|
@@ -112,7 +112,8 @@ export type ICheckbox = {
|
|
|
112
112
|
export type IDynamicProperties = {
|
|
113
113
|
props:
|
|
114
114
|
| (ComponentProps<typeof VcDynamicProperty> & FromGenericEventsToProps<ComponentEmit<typeof VcDynamicProperty>>)
|
|
115
|
-
|
|
|
115
|
+
| (ComponentProps<typeof VcDynamicProperty> &
|
|
116
|
+
Omit<IControlBaseProps, keyof ComponentProps<typeof VcDynamicProperty> | "onUpdate:modelValue" | "rules">);
|
|
116
117
|
options: IControlBaseOptions;
|
|
117
118
|
} & FieldOpts<typeof VcDynamicProperty>;
|
|
118
119
|
|
|
@@ -122,7 +123,7 @@ export type IEditorField = {
|
|
|
122
123
|
} & FieldOpts<typeof VcEditor>;
|
|
123
124
|
|
|
124
125
|
export type IGallery = {
|
|
125
|
-
props: ComponentProps<typeof VcGallery> | IControlBaseProps;
|
|
126
|
+
props: (ComponentProps<typeof VcGallery> & { rules: Record<string, unknown> }) | IControlBaseProps;
|
|
126
127
|
options: IControlBaseOptions;
|
|
127
128
|
} & FieldOpts<typeof VcGallery>;
|
|
128
129
|
|
|
@@ -185,11 +185,13 @@ import AzureAdIcon from "./../../../../../assets/img/AzureAd.svg";
|
|
|
185
185
|
import { ExternalSignInProviderInfo } from "./../../../../../core/api/platform";
|
|
186
186
|
import { useI18n } from "vue-i18n";
|
|
187
187
|
|
|
188
|
+
type ForgotPasswordFunc = (args: { loginOrEmail: string }) => Promise<void>;
|
|
189
|
+
|
|
188
190
|
export interface Props {
|
|
189
191
|
logo: string;
|
|
190
192
|
background: string;
|
|
191
193
|
title: string;
|
|
192
|
-
composable?: () => { forgotPassword:
|
|
194
|
+
composable?: () => { forgotPassword: ForgotPasswordFunc };
|
|
193
195
|
}
|
|
194
196
|
|
|
195
197
|
const props = defineProps<Props>();
|
|
@@ -210,7 +212,7 @@ const isDirty = useIsFormDirty();
|
|
|
210
212
|
const customizationLoading = ref(false);
|
|
211
213
|
const loadingForgotPassword = ref(false);
|
|
212
214
|
const loginProviders = ref<ExternalSignInProviderInfo[]>();
|
|
213
|
-
let forgotPassword;
|
|
215
|
+
let forgotPassword: ForgotPasswordFunc;
|
|
214
216
|
|
|
215
217
|
if (props.composable && typeof props.composable === "function") {
|
|
216
218
|
useLogin = props.composable;
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
class="vc-multivalue__field-value"
|
|
42
42
|
>
|
|
43
43
|
<span class="tw-truncate">{{
|
|
44
|
-
type === "number" ? Number(item[props.emitLabel]).toFixed(3) : item[props.emitLabel]
|
|
44
|
+
type === "number" ? Number(item[props.emitLabel as keyof T]).toFixed(3) : item[props.emitLabel as keyof T]
|
|
45
45
|
}}</span>
|
|
46
46
|
<VcIcon
|
|
47
47
|
v-if="!disabled"
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
<slot
|
|
88
88
|
name="item"
|
|
89
89
|
:item="item"
|
|
90
|
-
>{{ item[optionLabel] }}</slot
|
|
90
|
+
>{{ item[optionLabel as keyof T] }}</slot
|
|
91
91
|
>
|
|
92
92
|
</div>
|
|
93
93
|
</VcContainer>
|
|
@@ -118,10 +118,10 @@
|
|
|
118
118
|
</div>
|
|
119
119
|
</template>
|
|
120
120
|
|
|
121
|
-
<script lang="ts" setup generic="T extends {id?: string; alias?: string, languageCode?: string, value?:string}">
|
|
121
|
+
<script lang="ts" setup generic="T extends {id?: string; alias?: string, languageCode?: string, value?: string}">
|
|
122
122
|
import { unref, nextTick, ref, computed } from "vue";
|
|
123
123
|
import { vOnClickOutside } from "@vueuse/components";
|
|
124
|
-
import { useFloating, UseFloatingReturn, offset, flip, shift, autoUpdate } from "@floating-ui/vue";
|
|
124
|
+
import { useFloating, UseFloatingReturn, offset, flip, shift, autoUpdate, MiddlewareState } from "@floating-ui/vue";
|
|
125
125
|
import { generateId } from "../../../../core/utilities";
|
|
126
126
|
|
|
127
127
|
export interface Props<T> {
|
|
@@ -203,7 +203,7 @@ const dropdownStyle = computed(() => {
|
|
|
203
203
|
|
|
204
204
|
const slicedDictionary = computed(() => {
|
|
205
205
|
return props.options?.filter((x) => {
|
|
206
|
-
return !props.modelValue?.find((item) => item[props.emitValue] === x[props.optionValue]);
|
|
206
|
+
return !props.modelValue?.find((item) => item[props.emitValue as keyof T] === x[props.optionValue as keyof T]);
|
|
207
207
|
});
|
|
208
208
|
});
|
|
209
209
|
|
|
@@ -220,8 +220,8 @@ function onInput(e: KeyboardEvent) {
|
|
|
220
220
|
function onItemSelect(item: T) {
|
|
221
221
|
emit("update:model-value", [
|
|
222
222
|
...props.modelValue,
|
|
223
|
-
{ [props.emitValue]: item[props.optionValue], [props.emitLabel]: item[props.optionLabel
|
|
224
|
-
]);
|
|
223
|
+
{ [props.emitValue]: item[props.optionValue as keyof T], [props.emitLabel]: item[props.optionLabel as keyof T] },
|
|
224
|
+
] as T[]);
|
|
225
225
|
emit("close");
|
|
226
226
|
closeDropdown();
|
|
227
227
|
}
|
|
@@ -236,7 +236,7 @@ function onDelete(i: number) {
|
|
|
236
236
|
function sameWidthChangeBorders() {
|
|
237
237
|
return {
|
|
238
238
|
name: "sameWidthChangeBorders",
|
|
239
|
-
fn: ({ rects, placement, x, y }) => {
|
|
239
|
+
fn: ({ rects, placement, x, y }: MiddlewareState) => {
|
|
240
240
|
let borderTop;
|
|
241
241
|
let borderBottom;
|
|
242
242
|
let borderRadius;
|
|
@@ -262,12 +262,12 @@ import { ref, computed, watch, nextTick, Ref, toRefs, MaybeRef, unref } from "vu
|
|
|
262
262
|
import { vOnClickOutside } from "@vueuse/components";
|
|
263
263
|
import * as _ from "lodash-es";
|
|
264
264
|
import { useIntersectionObserver } from "@vueuse/core";
|
|
265
|
-
import { useFloating, UseFloatingReturn, offset, flip, shift, autoUpdate } from "@floating-ui/vue";
|
|
265
|
+
import { useFloating, UseFloatingReturn, offset, flip, shift, autoUpdate, MiddlewareState } from "@floating-ui/vue";
|
|
266
266
|
import { VcLabel, VcContainer, VcHint, VcIcon } from "./../../";
|
|
267
267
|
import { useI18n } from "vue-i18n";
|
|
268
268
|
|
|
269
269
|
export type OptionProp<T> = ((option: T) => string) | string | undefined;
|
|
270
|
-
|
|
270
|
+
type MaybeArray<T> = T | T[];
|
|
271
271
|
type FloatingInstanceType = UseFloatingReturn & {
|
|
272
272
|
middlewareData: {
|
|
273
273
|
sameWidthChangeBorders: {
|
|
@@ -360,6 +360,7 @@ defineSlots<{
|
|
|
360
360
|
*/
|
|
361
361
|
toggleOption: (opt: any) => void;
|
|
362
362
|
}) => any;
|
|
363
|
+
"no-options": (props: any) => any;
|
|
363
364
|
}>();
|
|
364
365
|
|
|
365
366
|
const props = withDefaults(
|
|
@@ -474,7 +475,7 @@ const props = withDefaults(
|
|
|
474
475
|
name: "Field",
|
|
475
476
|
emitValue: true,
|
|
476
477
|
mapOptions: true,
|
|
477
|
-
options: () => [],
|
|
478
|
+
options: (): T[] => [],
|
|
478
479
|
}
|
|
479
480
|
);
|
|
480
481
|
|
|
@@ -483,7 +484,9 @@ const emit = defineEmits<{
|
|
|
483
484
|
* Emitted when the component needs to change the model; Is also used by v-model
|
|
484
485
|
*/
|
|
485
486
|
|
|
486
|
-
"update:modelValue": [
|
|
487
|
+
"update:modelValue": [
|
|
488
|
+
inputValue: MaybeArray<string | Option | (T & P["results"][number] & object)[keyof T | keyof P["results"][number]]>
|
|
489
|
+
];
|
|
487
490
|
/**
|
|
488
491
|
* Emitted when user wants to filter a value
|
|
489
492
|
*/
|
|
@@ -518,7 +521,7 @@ const optionsTemp = ref<Option[]>([]) as Ref<Option[]>;
|
|
|
518
521
|
const totalItems = ref();
|
|
519
522
|
|
|
520
523
|
let emitValueFn;
|
|
521
|
-
let emitTimer;
|
|
524
|
+
let emitTimer: NodeJS.Timeout;
|
|
522
525
|
let innerValueCache: Option[];
|
|
523
526
|
|
|
524
527
|
useIntersectionObserver(
|
|
@@ -552,7 +555,7 @@ watch(
|
|
|
552
555
|
} else if (props.modelValue && typeof props.modelValue === "object") {
|
|
553
556
|
return optionsList.value.includes(props.modelValue);
|
|
554
557
|
} else {
|
|
555
|
-
return x[props.optionLabel as
|
|
558
|
+
return x[props.optionLabel as keyof Option] === props.modelValue;
|
|
556
559
|
}
|
|
557
560
|
});
|
|
558
561
|
|
|
@@ -565,9 +568,9 @@ watch(
|
|
|
565
568
|
undefined,
|
|
566
569
|
Array.isArray(props.modelValue) ? props.modelValue : [props.modelValue]
|
|
567
570
|
);
|
|
568
|
-
defaultValue.value = data.results?.filter((x) => x[props.optionValue as
|
|
571
|
+
defaultValue.value = data.results?.filter((x) => x[props.optionValue as keyof T] === props.modelValue);
|
|
569
572
|
} else if (props.options && Array.isArray(props.options)) {
|
|
570
|
-
defaultValue.value = props.options.filter((x) => x[props.optionValue as
|
|
573
|
+
defaultValue.value = props.options.filter((x) => x[props.optionValue as keyof T] === props.modelValue);
|
|
571
574
|
}
|
|
572
575
|
}
|
|
573
576
|
}
|
|
@@ -702,16 +705,16 @@ const dropdownStyle = computed(() => {
|
|
|
702
705
|
};
|
|
703
706
|
});
|
|
704
707
|
|
|
705
|
-
function getPropValueFn(propValue: OptionProp<Option>, defaultVal: OptionProp<Option>)
|
|
708
|
+
function getPropValueFn(propValue: OptionProp<Option>, defaultVal: OptionProp<Option>) {
|
|
706
709
|
const val = propValue !== undefined ? propValue : defaultVal;
|
|
707
710
|
|
|
708
711
|
return typeof val === "function"
|
|
709
712
|
? val
|
|
710
|
-
: (opt: Option) => (opt !== null && typeof opt === "object" && val in opt ? opt[val] : opt);
|
|
713
|
+
: (opt: Option) => (opt !== null && typeof opt === "object" && val in opt ? opt[val as keyof Option] : opt);
|
|
711
714
|
}
|
|
712
715
|
|
|
713
716
|
function getOption(value: Option, valueCache: Option[]) {
|
|
714
|
-
const fn = (opt) => _.isEqual(getOptionValue.value(opt), value);
|
|
717
|
+
const fn = (opt: Option) => _.isEqual(getOptionValue.value(opt), value);
|
|
715
718
|
return defaultValue.value.find(fn) || optionsList.value.find(fn) || valueCache.find(fn) || value;
|
|
716
719
|
}
|
|
717
720
|
|
|
@@ -775,7 +778,7 @@ async function toggleDropdown() {
|
|
|
775
778
|
function sameWidthChangeBorders() {
|
|
776
779
|
return {
|
|
777
780
|
name: "sameWidthChangeBorders",
|
|
778
|
-
fn: ({ rects, placement, x, y }) => {
|
|
781
|
+
fn: ({ rects, placement, x, y }: MiddlewareState) => {
|
|
779
782
|
let borderTop;
|
|
780
783
|
let borderBottom;
|
|
781
784
|
let borderRadius;
|
|
@@ -853,8 +856,8 @@ async function onSearch(value: string) {
|
|
|
853
856
|
listLoading.value = false;
|
|
854
857
|
}
|
|
855
858
|
} else {
|
|
856
|
-
optionsTemp.value = optionsList.value.filter((x) => {
|
|
857
|
-
return x[props.optionLabel as string
|
|
859
|
+
optionsTemp.value = optionsList.value.filter((x: Option) => {
|
|
860
|
+
return (x[props.optionLabel as keyof Option] as string).toLowerCase().includes(filterString.value.toLowerCase());
|
|
858
861
|
});
|
|
859
862
|
}
|
|
860
863
|
}
|
|
@@ -222,9 +222,9 @@ const props = withDefaults(
|
|
|
222
222
|
languageCode?: string;
|
|
223
223
|
}[];
|
|
224
224
|
rules?: {
|
|
225
|
-
min
|
|
226
|
-
max
|
|
227
|
-
regex
|
|
225
|
+
min?: number;
|
|
226
|
+
max?: number;
|
|
227
|
+
regex?: string;
|
|
228
228
|
};
|
|
229
229
|
disabled?: boolean;
|
|
230
230
|
placeholder?: string;
|
|
@@ -305,7 +305,7 @@ onMounted(async () => {
|
|
|
305
305
|
await getOptions();
|
|
306
306
|
});
|
|
307
307
|
|
|
308
|
-
async function getOptions(keyword = null) {
|
|
308
|
+
async function getOptions(keyword: string = null) {
|
|
309
309
|
if (props.optionsGetter) {
|
|
310
310
|
try {
|
|
311
311
|
loading.value = true;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
>
|
|
11
11
|
<VcImage
|
|
12
12
|
aspect="1x1"
|
|
13
|
-
:src="image
|
|
13
|
+
:src="image.url"
|
|
14
14
|
background="contain"
|
|
15
15
|
></VcImage>
|
|
16
16
|
<div class="vc-gallery-item__overlay">
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
></VcIcon>
|
|
24
24
|
<div
|
|
25
25
|
class="tw-truncate"
|
|
26
|
-
:title="image
|
|
26
|
+
:title="image.name"
|
|
27
27
|
>
|
|
28
|
-
{{ image
|
|
28
|
+
{{ image.name }}
|
|
29
29
|
</div>
|
|
30
30
|
</div>
|
|
31
31
|
<div class="tw-flex tw-grow tw-basis-0 tw-items-center tw-justify-around">
|
|
@@ -89,6 +89,7 @@ export interface Props {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
withDefaults(defineProps<Props>(), {
|
|
92
|
+
image: () => ({} as IImage),
|
|
92
93
|
readonly: false,
|
|
93
94
|
actions: () => ({
|
|
94
95
|
name: undefined,
|
|
@@ -40,35 +40,33 @@
|
|
|
40
40
|
</div>
|
|
41
41
|
</template>
|
|
42
42
|
|
|
43
|
-
<script lang="ts"
|
|
43
|
+
<script lang="ts">
|
|
44
44
|
import { VcIcon } from "./../../";
|
|
45
45
|
import VcPopupWarning from "./_internal/vc-popup-warning/vc-popup-warning.vue";
|
|
46
46
|
import VcPopupError from "./_internal/vc-popup-error/vc-popup-error.vue";
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
47
|
+
import { defineComponent, PropType } from "vue";
|
|
48
|
+
|
|
49
|
+
export default defineComponent({
|
|
50
|
+
props: {
|
|
51
|
+
title: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: "",
|
|
54
|
+
},
|
|
55
|
+
closable: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: true,
|
|
58
|
+
},
|
|
59
|
+
variant: {
|
|
60
|
+
type: String as PropType<"small" | "medium" | "fullscreen">,
|
|
61
|
+
default: "fullscreen",
|
|
62
|
+
},
|
|
63
|
+
type: {
|
|
64
|
+
type: String as PropType<"default" | "error" | "warning" | "success">,
|
|
65
|
+
default: "default",
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
emits: ["close", "confirm"],
|
|
64
69
|
});
|
|
65
|
-
|
|
66
|
-
defineEmits<Emits>();
|
|
67
|
-
|
|
68
|
-
defineSlots<{
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
-
default: (props: any) => any;
|
|
71
|
-
}>();
|
|
72
70
|
</script>
|
|
73
71
|
|
|
74
72
|
<style lang="scss">
|
|
@@ -529,8 +529,8 @@ interface ITableItemRef {
|
|
|
529
529
|
const emit = defineEmits<{
|
|
530
530
|
paginationClick: [page: number];
|
|
531
531
|
selectionChanged: [values: T[]];
|
|
532
|
-
"search:change": [value: string | number | Date];
|
|
533
|
-
headerClick;
|
|
532
|
+
"search:change": [value: string | number | Date | null];
|
|
533
|
+
headerClick: [item: ITableColumns];
|
|
534
534
|
value: [Record<string, unknown>];
|
|
535
535
|
itemClick: [item: T];
|
|
536
536
|
"scroll:ptr": [];
|
|
@@ -547,8 +547,8 @@ const reorderRef = ref<HTMLElement | null>();
|
|
|
547
547
|
const tableRef = ref<HTMLElement | null>();
|
|
548
548
|
|
|
549
549
|
// event listeners
|
|
550
|
-
let columnResizeListener = null;
|
|
551
|
-
let columnResizeEndListener = null;
|
|
550
|
+
let columnResizeListener: (...args: any[]) => any = null;
|
|
551
|
+
let columnResizeEndListener: (...args: any[]) => any = null;
|
|
552
552
|
|
|
553
553
|
const selection = ref<T[]>([]) as Ref<T[]>;
|
|
554
554
|
const allSelected = ref(false);
|
|
@@ -558,7 +558,7 @@ const tooltip = ref<ComputePositionReturn>();
|
|
|
558
558
|
const scrollContainer = ref<typeof VcContainer>();
|
|
559
559
|
const actionToggleRefs = ref<ITableItemRef[]>([]);
|
|
560
560
|
|
|
561
|
-
const itemActions
|
|
561
|
+
const itemActions: Ref<IActionBuilderResult[][]> = ref([]);
|
|
562
562
|
const mobileSwipeItem = ref<string>();
|
|
563
563
|
const columnResizing = ref(false);
|
|
564
564
|
const resizeColumnElement = ref<ITableColumns>();
|
|
@@ -629,7 +629,7 @@ const headerCheckbox = computed({
|
|
|
629
629
|
return props.items ? selection.value.length === props.items.length : false;
|
|
630
630
|
},
|
|
631
631
|
set(checked: boolean) {
|
|
632
|
-
let _selected = [];
|
|
632
|
+
let _selected: T[] = [];
|
|
633
633
|
|
|
634
634
|
if (checked) {
|
|
635
635
|
_selected = props.items;
|
|
@@ -829,7 +829,7 @@ function bindColumnResizeEvents() {
|
|
|
829
829
|
if (columnResizing.value) {
|
|
830
830
|
onColumnResize(event);
|
|
831
831
|
}
|
|
832
|
-
});
|
|
832
|
+
}) as unknown as typeof document.addEventListener;
|
|
833
833
|
}
|
|
834
834
|
if (!columnResizeEndListener) {
|
|
835
835
|
columnResizeEndListener = document.addEventListener("mouseup", () => {
|
|
@@ -837,7 +837,7 @@ function bindColumnResizeEvents() {
|
|
|
837
837
|
columnResizing.value = false;
|
|
838
838
|
onColumnResizeEnd();
|
|
839
839
|
}
|
|
840
|
-
});
|
|
840
|
+
}) as unknown as typeof document.addEventListener;
|
|
841
841
|
}
|
|
842
842
|
}
|
|
843
843
|
|
|
@@ -883,13 +883,13 @@ function onColumnResizeEnd() {
|
|
|
883
883
|
|
|
884
884
|
const minWidth = 15;
|
|
885
885
|
|
|
886
|
-
if (columnWidth + delta > parseInt(minWidth.toString(), 10)) {
|
|
886
|
+
if (columnWidth + delta > parseInt(minWidth.toString(), 10) && resizeColumnElement.value) {
|
|
887
887
|
nextColumn.value = filteredCols.value[filteredCols.value.indexOf(resizeColumnElement.value) + 1];
|
|
888
888
|
|
|
889
889
|
if (nextColumn.value) {
|
|
890
|
-
const nextColElement
|
|
890
|
+
const nextColElement = table.value.querySelector(`#${nextColumn.value.id}`);
|
|
891
891
|
|
|
892
|
-
const nextColumnWidth = nextColElement.offsetWidth - delta;
|
|
892
|
+
const nextColumnWidth = (nextColElement as HTMLElement).offsetWidth - delta;
|
|
893
893
|
if (newColumnWidth > 15 && nextColumnWidth > 15) {
|
|
894
894
|
resizeTableCells(newColumnWidth, nextColumnWidth);
|
|
895
895
|
}
|
|
@@ -907,8 +907,12 @@ function onColumnResizeEnd() {
|
|
|
907
907
|
}
|
|
908
908
|
|
|
909
909
|
function resizeTableCells(newColumnWidth: number, nextColumnWidth: number) {
|
|
910
|
-
resizeColumnElement.value
|
|
911
|
-
|
|
910
|
+
if (resizeColumnElement.value) {
|
|
911
|
+
resizeColumnElement.value.width = newColumnWidth + "px";
|
|
912
|
+
}
|
|
913
|
+
if (nextColumn.value) {
|
|
914
|
+
nextColumn.value.width = nextColumnWidth + "px";
|
|
915
|
+
}
|
|
912
916
|
}
|
|
913
917
|
|
|
914
918
|
function onColumnHeaderDragStart(event: DragEvent, item: ITableColumns) {
|
|
@@ -919,7 +923,9 @@ function onColumnHeaderDragStart(event: DragEvent, item: ITableColumns) {
|
|
|
919
923
|
|
|
920
924
|
draggedColumn.value = item;
|
|
921
925
|
draggedElement.value = event.target as HTMLElement;
|
|
922
|
-
event.dataTransfer
|
|
926
|
+
if (event.dataTransfer) {
|
|
927
|
+
event.dataTransfer.setData("text", "reorder");
|
|
928
|
+
}
|
|
923
929
|
}
|
|
924
930
|
|
|
925
931
|
function findParentHeader(element: HTMLElement) {
|
|
@@ -928,7 +934,7 @@ function findParentHeader(element: HTMLElement) {
|
|
|
928
934
|
} else {
|
|
929
935
|
let parent = element.parentElement;
|
|
930
936
|
|
|
931
|
-
while (parent.nodeName !== "TH") {
|
|
937
|
+
while (parent && parent.nodeName !== "TH") {
|
|
932
938
|
parent = parent.parentElement;
|
|
933
939
|
if (!parent) break;
|
|
934
940
|
}
|
|
@@ -945,7 +951,7 @@ function onColumnHeaderDragOver(event: DragEvent) {
|
|
|
945
951
|
const containerOffset = getOffset(table.value as HTMLElement);
|
|
946
952
|
const dropHeaderOffset = getOffset(dropHeader);
|
|
947
953
|
|
|
948
|
-
if (draggedElement.value !== dropHeader) {
|
|
954
|
+
if (draggedElement.value !== dropHeader && reorderRef.value && tableRef.value) {
|
|
949
955
|
const targetLeft = dropHeaderOffset.left - containerOffset.left;
|
|
950
956
|
const columnCenter = dropHeaderOffset.left + dropHeader.offsetWidth / 2;
|
|
951
957
|
|
|
@@ -969,7 +975,9 @@ function onColumnHeaderDragLeave(event: DragEvent) {
|
|
|
969
975
|
if (props.reorderableColumns && draggedColumn.value) {
|
|
970
976
|
event.preventDefault();
|
|
971
977
|
|
|
972
|
-
reorderRef.value
|
|
978
|
+
if (reorderRef.value != undefined) {
|
|
979
|
+
reorderRef.value.style.display = "none";
|
|
980
|
+
}
|
|
973
981
|
}
|
|
974
982
|
}
|
|
975
983
|
|
|
@@ -998,8 +1006,12 @@ function onColumnHeaderDrop(event: DragEvent, item: ITableColumns) {
|
|
|
998
1006
|
}
|
|
999
1007
|
}
|
|
1000
1008
|
|
|
1001
|
-
reorderRef.value
|
|
1002
|
-
|
|
1009
|
+
if (reorderRef.value) {
|
|
1010
|
+
reorderRef.value.style.display = "none";
|
|
1011
|
+
}
|
|
1012
|
+
if (draggedElement.value) {
|
|
1013
|
+
draggedElement.value.draggable = false;
|
|
1014
|
+
}
|
|
1003
1015
|
draggedColumn.value = null;
|
|
1004
1016
|
dropPosition.value = null;
|
|
1005
1017
|
}
|
|
@@ -1019,10 +1031,14 @@ function restoreState() {
|
|
|
1019
1031
|
console.debug("[@vc-shell/framewok#vc-table.vue] - Restore state");
|
|
1020
1032
|
if (Object.keys(state.value).length) {
|
|
1021
1033
|
defaultColumns.value = state.value.map((item) => {
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1034
|
+
const column = defaultColumns.value.find((x) => x.id === item.id);
|
|
1035
|
+
if (column) {
|
|
1036
|
+
return {
|
|
1037
|
+
...item,
|
|
1038
|
+
title: column.title,
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
return item;
|
|
1026
1042
|
});
|
|
1027
1043
|
}
|
|
1028
1044
|
}
|
|
@@ -1038,9 +1054,9 @@ function reorderArray(value: unknown[], from: number, to: number) {
|
|
|
1038
1054
|
}
|
|
1039
1055
|
}
|
|
1040
1056
|
|
|
1041
|
-
function onColumnHeaderMouseDown(event: MouseEvent
|
|
1057
|
+
function onColumnHeaderMouseDown(event: MouseEvent) {
|
|
1042
1058
|
if (props.reorderableColumns) {
|
|
1043
|
-
event.currentTarget.draggable = true;
|
|
1059
|
+
(event.currentTarget as HTMLElement).draggable = true;
|
|
1044
1060
|
}
|
|
1045
1061
|
}
|
|
1046
1062
|
|
|
@@ -1059,9 +1075,9 @@ function toggleColumn(item: ITableColumns) {
|
|
|
1059
1075
|
}
|
|
1060
1076
|
}
|
|
1061
1077
|
|
|
1062
|
-
function onRowMouseDown(event: MouseEvent
|
|
1078
|
+
function onRowMouseDown(event: MouseEvent) {
|
|
1063
1079
|
if (props.reorderableRows) {
|
|
1064
|
-
event.currentTarget.draggable = true;
|
|
1080
|
+
(event.currentTarget as HTMLElement).draggable = true;
|
|
1065
1081
|
}
|
|
1066
1082
|
}
|
|
1067
1083
|
|
|
@@ -1072,7 +1088,9 @@ function onRowDragStart(event: DragEvent, item: T) {
|
|
|
1072
1088
|
rowDragged.value = true;
|
|
1073
1089
|
draggedRow.value = item;
|
|
1074
1090
|
draggedRowIndex.value = props.items.indexOf(item);
|
|
1075
|
-
event.dataTransfer
|
|
1091
|
+
if (event.dataTransfer) {
|
|
1092
|
+
event.dataTransfer.setData("text", "row-reorder");
|
|
1093
|
+
}
|
|
1076
1094
|
}
|
|
1077
1095
|
|
|
1078
1096
|
function onRowDragOver(event: DragEvent, item: T) {
|
|
@@ -1127,13 +1145,13 @@ function onRowDragLeave(event: DragEvent) {
|
|
|
1127
1145
|
|
|
1128
1146
|
function onRowDragEnd(event: DragEvent & { currentTarget?: { draggable: boolean } }) {
|
|
1129
1147
|
rowDragged.value = false;
|
|
1130
|
-
draggedRowIndex.value =
|
|
1131
|
-
droppedRowIndex.value =
|
|
1148
|
+
draggedRowIndex.value = undefined;
|
|
1149
|
+
droppedRowIndex.value = undefined;
|
|
1132
1150
|
event.currentTarget.draggable = false;
|
|
1133
1151
|
}
|
|
1134
1152
|
|
|
1135
1153
|
function onRowDrop(event: DragEvent) {
|
|
1136
|
-
if (droppedRowIndex.value
|
|
1154
|
+
if (droppedRowIndex.value !== undefined && draggedRowIndex.value !== undefined) {
|
|
1137
1155
|
const dropIndex =
|
|
1138
1156
|
draggedRowIndex.value > droppedRowIndex.value
|
|
1139
1157
|
? droppedRowIndex.value
|