@flyanra/vue-core 0.4.0 → 1.0.0
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/dist/types/components/basic/fly-button/FlyButton.types.d.ts +2 -3
- package/dist/types/components/form/form.utils.d.ts +3 -2
- package/dist/types/components/form/index.d.ts +5 -1
- package/dist/types/components/form/input-renderers/boolean/FlyBoolean.vue.d.ts +2 -2
- package/dist/types/components/form/input-renderers/date-time/FlyDateTime.vue.d.ts +4 -4
- package/dist/types/components/form/input-renderers/form-item-renderer/FlyFormItemRenderer.vue.d.ts +4 -4
- package/dist/types/components/form/input-renderers/form-item-renderer/index.d.ts +3 -0
- package/dist/types/components/form/input-renderers/form-schema-renderer/FlyFormSchemaRenderer.utils.d.ts +8 -10
- package/dist/types/components/form/input-renderers/input-renderer/FlyInputRenderer.vue.d.ts +5 -5
- package/dist/types/components/form/input-renderers/input-renderer/index.d.ts +3 -0
- package/dist/types/components/form/input-renderers/input-renderer.utils.d.ts +1 -1
- package/dist/types/components/form/input-renderers/number/FlyNumber.vue.d.ts +4 -4
- package/dist/types/components/form/input-renderers/select/FlySelect.vue.d.ts +4 -4
- package/dist/types/components/form/input-renderers/text/FlyText.vue.d.ts +4 -4
- package/dist/types/components/form/input-renderers/value-unit/FlyValueUnit.vue.d.ts +4 -4
- package/dist/types/components/form/input-validators.d.ts +5 -6
- package/dist/types/components/general/fly-icon-v2/FlyIconV2.types.d.ts +5 -0
- package/dist/types/components/general/fly-icon-v2/FlyIconV2.vue.d.ts +4 -0
- package/dist/types/components/general/fly-icon-v2/index.d.ts +4 -0
- package/dist/types/components/general/index.d.ts +2 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/navigation/menu/fly-mini-sidebar/FlyMiniSidebar.types.d.ts +2 -2
- package/dist/types/components/navigation/menu/fly-sidebar/FlySidebar.types.d.ts +2 -2
- package/dist/types/composables/UseLocaleInjector.d.ts +2 -0
- package/dist/types/composables/index.d.ts +1 -0
- package/dist/types/utils/validators.d.ts +2 -3
- package/package.json +12 -4
- package/src/components/basic/fly-button/FlyButton.types.ts +2 -3
- package/src/components/basic/fly-button/FlyButton.vue +4 -6
- package/src/components/feedback/tooltip/FlyInfoTooltip.vue +1 -0
- package/src/components/form/form.utils.ts +20 -5
- package/src/components/form/index.ts +6 -0
- package/src/components/form/input-renderers/boolean/FlyBoolean.vue +16 -3
- package/src/components/form/input-renderers/form-item-renderer/index.ts +4 -0
- package/src/components/form/input-renderers/form-schema-renderer/FlyFormSchemaRenderer.utils.ts +12 -37
- package/src/components/form/input-renderers/form-schema-renderer/UseFormSchemaRenderer.ts +2 -2
- package/src/components/form/input-renderers/input-renderer/FlyInputRenderer.vue +1 -1
- package/src/components/form/input-renderers/input-renderer/index.ts +4 -0
- package/src/components/form/input-renderers/input-renderer.utils.ts +4 -4
- package/src/components/form/input-renderers/number/FlyNumber.vue +17 -1
- package/src/components/form/input-renderers/select/FlySelect.utils.ts +1 -1
- package/src/components/form/input-renderers/text/FlyText.vue +15 -1
- package/src/components/form/input-renderers/value-unit/FlyValueUnit.vue +4 -3
- package/src/components/form/input-validators.ts +15 -37
- package/src/components/general/fly-icon-v2/FlyIconV2.types.ts +6 -0
- package/src/components/general/fly-icon-v2/FlyIconV2.vue +17 -0
- package/src/components/general/fly-icon-v2/index.ts +6 -0
- package/src/components/general/index.ts +3 -0
- package/src/components/index.ts +2 -0
- package/src/components/navigation/menu/fly-mini-sidebar/FlyMiniSidebar.types.ts +2 -2
- package/src/components/navigation/menu/fly-mini-sidebar/FlyMiniSidebarItem.vue +2 -2
- package/src/components/navigation/menu/fly-sidebar/FlySidebar.types.ts +2 -2
- package/src/components/navigation/menu/fly-sidebar/FlySidebar.vue +5 -4
- package/src/components/navigation/menu/fly-sidebar/FlySidebarNode.vue +3 -3
- package/src/styles/element/overrides/form.scss +17 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ButtonType, ElButton, UseTooltipProps } from 'element-plus';
|
|
2
|
-
import type {
|
|
2
|
+
import type { T_FlyIconV2Props } from '../../general';
|
|
3
3
|
export type FlyButtonIconPosition = 'left' | 'right';
|
|
4
4
|
export type FlyButtonSizes = InstanceType<typeof ElButton>['$props']['size'];
|
|
5
5
|
export type FlyButtonTypes = ButtonType;
|
|
@@ -12,9 +12,8 @@ export type FlyButtonProps = {
|
|
|
12
12
|
*/
|
|
13
13
|
clipRound?: boolean;
|
|
14
14
|
full?: boolean;
|
|
15
|
-
icon?:
|
|
15
|
+
icon?: T_FlyIconV2Props['icon'];
|
|
16
16
|
iconPosition?: FlyButtonIconPosition;
|
|
17
|
-
iconType?: T_FlyIconTypes;
|
|
18
17
|
imageUrl?: string;
|
|
19
18
|
label?: string;
|
|
20
19
|
size?: FlyButtonSizes;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FormInstance } from 'element-plus';
|
|
2
2
|
export type ValidateFieldsError = {
|
|
3
3
|
[K: string]: {
|
|
4
4
|
message?: string;
|
|
@@ -7,4 +7,5 @@ export type ValidateFieldsError = {
|
|
|
7
7
|
/**
|
|
8
8
|
* @returns Translated error message based on active locale
|
|
9
9
|
*/
|
|
10
|
-
export declare function formFieldErrorMessageFormatter(errors: ValidateFieldsError
|
|
10
|
+
export declare function formFieldErrorMessageFormatter(errors: ValidateFieldsError): string;
|
|
11
|
+
export declare function genericFormValidator(formRef: FormInstance): Promise<true>;
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './input-renderers/form-item-renderer';
|
|
2
|
+
export * from './input-renderers/input-renderer';
|
|
3
|
+
export type { T_InputRendererBase } from './input-renderers/input-renderer.types';
|
|
4
|
+
export * from './input-validators';
|
|
5
|
+
export * from './form.utils';
|
|
@@ -5,11 +5,11 @@ type __VLS_Props = {
|
|
|
5
5
|
input?: T_InputBoolean;
|
|
6
6
|
};
|
|
7
7
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
|
-
change: (v: T_InputBooleanValues) => any;
|
|
9
8
|
"update:modelValue": (v: T_InputBooleanValues) => any;
|
|
9
|
+
change: (v: T_InputBooleanValues) => any;
|
|
10
10
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
11
|
-
onChange?: ((v: T_InputBooleanValues) => any) | undefined;
|
|
12
11
|
"onUpdate:modelValue"?: ((v: T_InputBooleanValues) => any) | undefined;
|
|
12
|
+
onChange?: ((v: T_InputBooleanValues) => any) | undefined;
|
|
13
13
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
14
|
declare const _default: typeof __VLS_export;
|
|
15
15
|
export default _default;
|
|
@@ -6,14 +6,14 @@ type __VLS_Props = {
|
|
|
6
6
|
};
|
|
7
7
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
8
|
focus: () => any;
|
|
9
|
-
blur: () => any;
|
|
10
|
-
change: (v: T_DateTimeValues) => any;
|
|
11
9
|
"update:modelValue": (v: T_DateTimeValues) => any;
|
|
10
|
+
change: (v: T_DateTimeValues) => any;
|
|
11
|
+
blur: () => any;
|
|
12
12
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
13
|
onFocus?: (() => any) | undefined;
|
|
14
|
-
onBlur?: (() => any) | undefined;
|
|
15
|
-
onChange?: ((v: T_DateTimeValues) => any) | undefined;
|
|
16
14
|
"onUpdate:modelValue"?: ((v: T_DateTimeValues) => any) | undefined;
|
|
15
|
+
onChange?: ((v: T_DateTimeValues) => any) | undefined;
|
|
16
|
+
onBlur?: (() => any) | undefined;
|
|
17
17
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
18
|
declare const _default: typeof __VLS_export;
|
|
19
19
|
export default _default;
|
package/dist/types/components/form/input-renderers/form-item-renderer/FlyFormItemRenderer.vue.d.ts
CHANGED
|
@@ -6,14 +6,14 @@ type __VLS_Props = {
|
|
|
6
6
|
};
|
|
7
7
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
8
|
focus: () => any;
|
|
9
|
-
blur: () => any;
|
|
10
|
-
change: (value: unknown) => any;
|
|
11
9
|
"update:modelValue": (value: unknown) => any;
|
|
10
|
+
change: (value: unknown) => any;
|
|
11
|
+
blur: () => any;
|
|
12
12
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
13
|
onFocus?: (() => any) | undefined;
|
|
14
|
-
onBlur?: (() => any) | undefined;
|
|
15
|
-
onChange?: ((value: unknown) => any) | undefined;
|
|
16
14
|
"onUpdate:modelValue"?: ((value: unknown) => any) | undefined;
|
|
15
|
+
onChange?: ((value: unknown) => any) | undefined;
|
|
16
|
+
onBlur?: (() => any) | undefined;
|
|
17
17
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
18
|
declare const _default: typeof __VLS_export;
|
|
19
19
|
export default _default;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Composer } from 'vue-i18n';
|
|
1
|
+
import type { FormItemRule } from 'element-plus';
|
|
3
2
|
import type { T_FormSchemaLookupData, T_InputSchema, T_InputSchemaSelect, T_InputSchemaValueUnit } from '../form-schema.types';
|
|
4
3
|
import type { T_InputRendererBase } from '../input-renderer.types';
|
|
5
4
|
import type { T_InputSelectOption } from '../select/FlySelect.types';
|
|
6
5
|
export declare function getValidatorsFromInputFields(fields: T_InputRendererBase[]): Record<string, FormItemRule[]>;
|
|
7
|
-
export declare function
|
|
8
|
-
|
|
6
|
+
export declare function generateInputFromFormSchema(field: T_InputSchema, lookupData?: T_FormSchemaLookupData): (import("../input-renderer.types").T_DynamicInputPropsBase & import("../boolean/FlyBoolean.types").T_InputBoolean & {
|
|
7
|
+
type: "boolean";
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
}) | (import("../input-renderer.types").T_DynamicInputPropsBase & import("../date-time/FlyDateTime.types").T_InputDateTime & {
|
|
10
|
+
type: "dateTime";
|
|
11
|
+
}) | (import("../input-renderer.types").T_DynamicInputPropsBase & import("../number/FlyNumber.types").T_InputNumber & {
|
|
9
12
|
type: "number";
|
|
10
13
|
}) | (import("../input-renderer.types").T_DynamicInputPropsBase & import("../select/FlySelect.types").T_InputSelect & {
|
|
11
14
|
type: "select";
|
|
@@ -13,11 +16,6 @@ export declare function generateInputFromFormSchema(field: T_InputSchema, lookup
|
|
|
13
16
|
type: "text" | "textarea";
|
|
14
17
|
}) | (import("../input-renderer.types").T_DynamicInputPropsBase & import("../value-unit/FlyValueUnit.types").T_InputValueUnit & {
|
|
15
18
|
type: "valueUnit";
|
|
16
|
-
}) | (import("../input-renderer.types").T_DynamicInputPropsBase & import("../date-time/FlyDateTime.types").T_InputDateTime & {
|
|
17
|
-
type: "dateTime";
|
|
18
|
-
}) | (import("../input-renderer.types").T_DynamicInputPropsBase & import("../boolean/FlyBoolean.types").T_InputBoolean & {
|
|
19
|
-
type: "boolean";
|
|
20
|
-
placeholder?: string;
|
|
21
19
|
}) | undefined;
|
|
22
|
-
export declare function generateFormRule(field: T_InputSchema
|
|
20
|
+
export declare function generateFormRule(field: T_InputSchema): FormItemRule[];
|
|
23
21
|
export declare function generateSelectOptionsFromSchema(field: T_InputSchemaSelect | T_InputSchemaValueUnit, lookupData?: T_FormSchemaLookupData): T_InputSelectOption[];
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type { T_InputRendererBase } from '../input-renderer.types';
|
|
2
2
|
type __VLS_Props = {
|
|
3
|
-
modelValue
|
|
3
|
+
modelValue?: unknown;
|
|
4
4
|
input: T_InputRendererBase;
|
|
5
5
|
};
|
|
6
6
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
7
7
|
focus: () => any;
|
|
8
|
-
blur: () => any;
|
|
9
|
-
change: (v: unknown) => any;
|
|
10
8
|
"update:modelValue": (v: unknown) => any;
|
|
9
|
+
change: (v: unknown) => any;
|
|
10
|
+
blur: () => any;
|
|
11
11
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
12
|
onFocus?: (() => any) | undefined;
|
|
13
|
-
onBlur?: (() => any) | undefined;
|
|
14
|
-
onChange?: ((v: unknown) => any) | undefined;
|
|
15
13
|
"onUpdate:modelValue"?: ((v: unknown) => any) | undefined;
|
|
14
|
+
onChange?: ((v: unknown) => any) | undefined;
|
|
15
|
+
onBlur?: (() => any) | undefined;
|
|
16
16
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
17
|
declare const _default: typeof __VLS_export;
|
|
18
18
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { T_InputTypes } from './input-renderer.types';
|
|
2
|
-
export declare function getInputDisplayValue(v: unknown, inputType: T_InputTypes): string;
|
|
2
|
+
export declare function getInputDisplayValue(v: unknown, inputType: T_InputTypes): string | number;
|
|
@@ -6,14 +6,14 @@ type __VLS_Props = {
|
|
|
6
6
|
};
|
|
7
7
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
8
|
focus: () => any;
|
|
9
|
-
blur: () => any;
|
|
10
|
-
change: (v: T_InputTextValues) => any;
|
|
11
9
|
"update:modelValue": (v: T_InputTextValues) => any;
|
|
10
|
+
change: (v: T_InputTextValues) => any;
|
|
11
|
+
blur: () => any;
|
|
12
12
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
13
|
onFocus?: (() => any) | undefined;
|
|
14
|
-
onBlur?: (() => any) | undefined;
|
|
15
|
-
onChange?: ((v: T_InputTextValues) => any) | undefined;
|
|
16
14
|
"onUpdate:modelValue"?: ((v: T_InputTextValues) => any) | undefined;
|
|
15
|
+
onChange?: ((v: T_InputTextValues) => any) | undefined;
|
|
16
|
+
onBlur?: (() => any) | undefined;
|
|
17
17
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
18
|
declare const _default: typeof __VLS_export;
|
|
19
19
|
export default _default;
|
|
@@ -6,14 +6,14 @@ type __VLS_Props = {
|
|
|
6
6
|
};
|
|
7
7
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
8
|
focus: () => any;
|
|
9
|
-
blur: () => any;
|
|
10
|
-
change: (v: T_InputSelectValue) => any;
|
|
11
9
|
"update:modelValue": (v: T_InputSelectValue) => any;
|
|
10
|
+
change: (v: T_InputSelectValue) => any;
|
|
11
|
+
blur: () => any;
|
|
12
12
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
13
|
onFocus?: (() => any) | undefined;
|
|
14
|
-
onBlur?: (() => any) | undefined;
|
|
15
|
-
onChange?: ((v: T_InputSelectValue) => any) | undefined;
|
|
16
14
|
"onUpdate:modelValue"?: ((v: T_InputSelectValue) => any) | undefined;
|
|
15
|
+
onChange?: ((v: T_InputSelectValue) => any) | undefined;
|
|
16
|
+
onBlur?: (() => any) | undefined;
|
|
17
17
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
18
|
declare const _default: typeof __VLS_export;
|
|
19
19
|
export default _default;
|
|
@@ -6,14 +6,14 @@ type __VLS_Props = {
|
|
|
6
6
|
};
|
|
7
7
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
8
|
focus: () => any;
|
|
9
|
-
blur: () => any;
|
|
10
|
-
change: (v: T_InputTextValues) => any;
|
|
11
9
|
"update:modelValue": (v: T_InputTextValues) => any;
|
|
10
|
+
change: (v: T_InputTextValues) => any;
|
|
11
|
+
blur: () => any;
|
|
12
12
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
13
|
onFocus?: (() => any) | undefined;
|
|
14
|
-
onBlur?: (() => any) | undefined;
|
|
15
|
-
onChange?: ((v: T_InputTextValues) => any) | undefined;
|
|
16
14
|
"onUpdate:modelValue"?: ((v: T_InputTextValues) => any) | undefined;
|
|
15
|
+
onChange?: ((v: T_InputTextValues) => any) | undefined;
|
|
16
|
+
onBlur?: (() => any) | undefined;
|
|
17
17
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
18
|
declare const _default: typeof __VLS_export;
|
|
19
19
|
export default _default;
|
|
@@ -6,14 +6,14 @@ type __VLS_Props = {
|
|
|
6
6
|
};
|
|
7
7
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
8
|
focus: () => any;
|
|
9
|
-
blur: () => any;
|
|
10
|
-
change: (v: T_ValueUnitValue) => any;
|
|
11
9
|
"update:modelValue": (v: T_ValueUnitValue) => any;
|
|
10
|
+
change: (v: T_ValueUnitValue) => any;
|
|
11
|
+
blur: () => any;
|
|
12
12
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
13
|
onFocus?: (() => any) | undefined;
|
|
14
|
-
onBlur?: (() => any) | undefined;
|
|
15
|
-
onChange?: ((v: T_ValueUnitValue) => any) | undefined;
|
|
16
14
|
"onUpdate:modelValue"?: ((v: T_ValueUnitValue) => any) | undefined;
|
|
15
|
+
onChange?: ((v: T_ValueUnitValue) => any) | undefined;
|
|
16
|
+
onBlur?: (() => any) | undefined;
|
|
17
17
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
18
|
declare const _default: typeof __VLS_export;
|
|
19
19
|
export default _default;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { FormItemRule } from 'element-plus';
|
|
2
|
-
import type { Composer } from 'vue-i18n';
|
|
3
2
|
import { type checkInputRange } from '../../utils/validators';
|
|
4
3
|
type InputTriggers = 'blur' | 'change';
|
|
5
|
-
export declare const requiredField: (fieldLabel?: string, trigger?: InputTriggers, useRequiredMessage?: boolean
|
|
4
|
+
export declare const requiredField: (fieldLabel?: string, trigger?: InputTriggers, useRequiredMessage?: boolean) => FormItemRule;
|
|
6
5
|
export declare const checkInputRangeValidator: (validator: ReturnType<typeof checkInputRange>, trigger?: InputTriggers) => FormItemRule;
|
|
7
|
-
export declare const requiredFieldNumber: (languageKey?: string, trigger?: InputTriggers
|
|
8
|
-
export declare const requiredFieldNumberSelect: (label?: string, trigger?: InputTriggers, useRequiredMessage?: boolean
|
|
6
|
+
export declare const requiredFieldNumber: (languageKey?: string, trigger?: InputTriggers) => FormItemRule;
|
|
7
|
+
export declare const requiredFieldNumberSelect: (label?: string, trigger?: InputTriggers, useRequiredMessage?: boolean) => FormItemRule;
|
|
9
8
|
export declare const requiredFieldValueUnit: (label: string | undefined, trigger: InputTriggers | undefined, useRequiredMessage: boolean | undefined, required: boolean | undefined, options: {
|
|
10
9
|
valueType?: "text" | "number";
|
|
11
|
-
}
|
|
12
|
-
export declare const requiredFieldArray: (label?: string, trigger?: InputTriggers, useRequiredMessage?: boolean
|
|
10
|
+
}) => FormItemRule;
|
|
11
|
+
export declare const requiredFieldArray: (label?: string, trigger?: InputTriggers, useRequiredMessage?: boolean) => FormItemRule;
|
|
13
12
|
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { T_FlyIconV2Props } from './FlyIconV2.types';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<T_FlyIconV2Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<T_FlyIconV2Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { T_FlyIconV2Props } from '../../../general/fly-icon-v2/FlyIconV2.types';
|
|
2
2
|
export type T_FlyMiniSidebarItem = {
|
|
3
3
|
key: string | number;
|
|
4
4
|
label: string;
|
|
5
5
|
path: string;
|
|
6
|
-
icon:
|
|
6
|
+
icon: T_FlyIconV2Props['icon'];
|
|
7
7
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { T_FlyIconV2Props } from '../../../general';
|
|
2
2
|
export type T_FlySidebarBase = {
|
|
3
3
|
index: string;
|
|
4
4
|
label?: string;
|
|
5
|
-
icon?:
|
|
5
|
+
icon?: T_FlyIconV2Props['icon'];
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
};
|
|
8
8
|
export type T_FlySidebarItem = T_FlySidebarBase & {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { Locale } from '@flyanra/js-utils/locales';
|
|
1
2
|
import type { ComposerTranslation } from 'vue-i18n';
|
|
2
3
|
type T_LocaleInjector = {
|
|
3
4
|
t: ComposerTranslation;
|
|
5
|
+
locale: Locale;
|
|
4
6
|
};
|
|
5
7
|
export declare function UseLocaleInjector(): T_LocaleInjector;
|
|
6
8
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { FormItemRule } from 'element-plus';
|
|
2
|
-
|
|
3
|
-
export declare const isRequiredError: (languageKey: string, composer?: Composer) => string;
|
|
2
|
+
export declare const isRequiredError: (languageKey: string) => string;
|
|
4
3
|
type RangeObject = {
|
|
5
4
|
min?: number;
|
|
6
5
|
max?: number;
|
|
7
6
|
};
|
|
8
|
-
export declare const checkInputRange: (languageKey: string | undefined, range: RangeObject, valueTypeLanguageKey?: string, errorMessage?: string
|
|
7
|
+
export declare const checkInputRange: (languageKey: string | undefined, range: RangeObject, valueTypeLanguageKey?: string, errorMessage?: string) => FormItemRule["validator"];
|
|
9
8
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flyanra/vue-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Source-distributed Vue component library for Vite and Nuxt consumers.",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -30,6 +30,14 @@
|
|
|
30
30
|
"types": "./dist/types/components/*/index.d.ts",
|
|
31
31
|
"import": "./src/components/*/index.ts"
|
|
32
32
|
},
|
|
33
|
+
"./composables": {
|
|
34
|
+
"types": "./dist/types/composables/index.d.ts",
|
|
35
|
+
"import": "./src/composables/index.ts"
|
|
36
|
+
},
|
|
37
|
+
"./composables/*": {
|
|
38
|
+
"types": "./dist/types/composables/*/index.d.ts",
|
|
39
|
+
"import": "./src/composables/*/index.ts"
|
|
40
|
+
},
|
|
33
41
|
"./package.json": "./package.json"
|
|
34
42
|
},
|
|
35
43
|
"types": "./dist/types/index.d.ts",
|
|
@@ -76,11 +84,11 @@
|
|
|
76
84
|
"eslint --fix"
|
|
77
85
|
]
|
|
78
86
|
},
|
|
79
|
-
"dependencies": {},
|
|
80
87
|
"devDependencies": {
|
|
81
88
|
"@changesets/cli": "^2.30.0",
|
|
82
89
|
"@eslint/js": "^10.0.1",
|
|
83
90
|
"@flyanra/js-utils": "^1.3.2",
|
|
91
|
+
"@iconify-json/ri": "^1.2.10",
|
|
84
92
|
"@jamescoyle/vue-icon": "^0.1.2",
|
|
85
93
|
"@mdi/js": "^7.4.47",
|
|
86
94
|
"@remixicon/vue": "^4.9.0",
|
|
@@ -104,7 +112,7 @@
|
|
|
104
112
|
"globals": "^17.5.0",
|
|
105
113
|
"husky": "^9.1.7",
|
|
106
114
|
"lint-staged": "^16.4.0",
|
|
107
|
-
"lodash": "^4.18.1",
|
|
115
|
+
"lodash-es": "^4.18.1",
|
|
108
116
|
"maska": "^3.2.0",
|
|
109
117
|
"playwright": "^1.59.1",
|
|
110
118
|
"prettier": "^3.8.3",
|
|
@@ -115,6 +123,7 @@
|
|
|
115
123
|
"tailwindcss": "^4.2.2",
|
|
116
124
|
"typescript": "~6.0.2",
|
|
117
125
|
"typescript-eslint": "^8.58.2",
|
|
126
|
+
"unplugin-icons": "^23.0.1",
|
|
118
127
|
"vite": "^8.0.4",
|
|
119
128
|
"vitest": "^4.1.4",
|
|
120
129
|
"vue": "^3.5.32",
|
|
@@ -126,7 +135,6 @@
|
|
|
126
135
|
"@flyanra/js-utils": "^1.3.2",
|
|
127
136
|
"@jamescoyle/vue-icon": "^0.1.2",
|
|
128
137
|
"element-plus": "^2.13.7",
|
|
129
|
-
"lodash": "^4.18.1",
|
|
130
138
|
"maska": "^3.2.0",
|
|
131
139
|
"vue": "^3.5.32",
|
|
132
140
|
"vue-i18n": "^11.4.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ButtonType, ElButton, UseTooltipProps } from 'element-plus'
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { T_FlyIconV2Props } from '../../general'
|
|
4
4
|
|
|
5
5
|
export type FlyButtonIconPosition = 'left' | 'right'
|
|
6
6
|
|
|
@@ -16,9 +16,8 @@ export type FlyButtonProps = {
|
|
|
16
16
|
*/
|
|
17
17
|
clipRound?: boolean
|
|
18
18
|
full?: boolean
|
|
19
|
-
icon?:
|
|
19
|
+
icon?: T_FlyIconV2Props['icon']
|
|
20
20
|
iconPosition?: FlyButtonIconPosition
|
|
21
|
-
iconType?: T_FlyIconTypes
|
|
22
21
|
imageUrl?: string
|
|
23
22
|
label?: string
|
|
24
23
|
size?: FlyButtonSizes
|
|
@@ -13,18 +13,16 @@
|
|
|
13
13
|
:class="[{ active, 'aspect-1': aspect1 }]"
|
|
14
14
|
@click="handleClick"
|
|
15
15
|
>
|
|
16
|
-
<
|
|
16
|
+
<FlyIconV2
|
|
17
17
|
v-if="icon && resolvedIconPosition === 'left'"
|
|
18
|
-
:type="iconType"
|
|
19
18
|
:icon="icon"
|
|
20
19
|
:class="[{ 'left-icon': slots.default }]"
|
|
21
20
|
/>
|
|
22
21
|
|
|
23
22
|
<slot></slot>
|
|
24
23
|
|
|
25
|
-
<
|
|
24
|
+
<FlyIconV2
|
|
26
25
|
v-if="icon && resolvedIconPosition === 'right'"
|
|
27
|
-
:type="iconType"
|
|
28
26
|
:icon="icon"
|
|
29
27
|
:class="[{ 'right-icon': slots.default }]"
|
|
30
28
|
/>
|
|
@@ -42,10 +40,10 @@ import { computed, useAttrs, useSlots } from 'vue'
|
|
|
42
40
|
|
|
43
41
|
import { ElButton } from 'element-plus'
|
|
44
42
|
|
|
45
|
-
import { isEmpty } from 'lodash'
|
|
43
|
+
import { isEmpty } from 'lodash-es'
|
|
46
44
|
|
|
47
45
|
import FlyTooltip from '../../feedback/tooltip/FlyTooltip.vue'
|
|
48
|
-
import
|
|
46
|
+
import FlyIconV2 from '../../general/fly-icon-v2/FlyIconV2.vue'
|
|
49
47
|
|
|
50
48
|
import './FlyButton.element.scss'
|
|
51
49
|
import type { FlyButtonIconPosition, FlyButtonProps } from './FlyButton.types'
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
<FlyIcon class="tw-cursor-pointer" :icon="mdiInformationSlabBoxOutline" />
|
|
11
11
|
</slot>
|
|
12
12
|
<template #content>
|
|
13
|
+
<!-- eslint-disable-next-line vue/no-v-html -->
|
|
13
14
|
<div v-if="html" v-html="DOMPurify.sanitize(content)"></div>
|
|
14
15
|
<slot v-else></slot>
|
|
15
16
|
</template>
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FormInstance } from 'element-plus'
|
|
2
|
+
|
|
3
|
+
import { UseLocaleInjector } from '../../composables/UseLocaleInjector'
|
|
2
4
|
|
|
3
5
|
export type ValidateFieldsError = { [K: string]: { message?: string }[] }
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* @returns Translated error message based on active locale
|
|
7
9
|
*/
|
|
8
|
-
export function formFieldErrorMessageFormatter(errors: ValidateFieldsError
|
|
10
|
+
export function formFieldErrorMessageFormatter(errors: ValidateFieldsError) {
|
|
11
|
+
const { t, locale } = UseLocaleInjector()
|
|
9
12
|
const keys = Object.keys(errors)
|
|
10
13
|
|
|
11
|
-
const t = composer?.t
|
|
12
|
-
|
|
13
14
|
if (keys.length) {
|
|
14
15
|
const requiredFieldNames: (string | undefined)[] = []
|
|
15
16
|
const otherErrors: (string | undefined)[] = []
|
|
@@ -30,7 +31,7 @@ export function formFieldErrorMessageFormatter(errors: ValidateFieldsError, comp
|
|
|
30
31
|
const otherErrorsLength = otherErrors.length
|
|
31
32
|
|
|
32
33
|
if (requiredFieldsLength >= 1) {
|
|
33
|
-
const joinedList = new Intl.ListFormat(
|
|
34
|
+
const joinedList = new Intl.ListFormat(locale, {
|
|
34
35
|
style: 'long',
|
|
35
36
|
type: 'conjunction'
|
|
36
37
|
}).format(requiredFieldNames.filter((item): item is string => Boolean(item)))
|
|
@@ -55,3 +56,17 @@ export function formFieldErrorMessageFormatter(errors: ValidateFieldsError, comp
|
|
|
55
56
|
|
|
56
57
|
return t ? t('validation.someInputsInvalid') : 'validation.someInputsInvalid'
|
|
57
58
|
}
|
|
59
|
+
|
|
60
|
+
export async function genericFormValidator(formRef: FormInstance): Promise<true> {
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
62
|
+
formRef.validate((valid, errors) => {
|
|
63
|
+
if (!valid) {
|
|
64
|
+
if (errors) {
|
|
65
|
+
return reject(formFieldErrorMessageFormatter(errors))
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
return resolve(true)
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
</template>
|
|
8
8
|
|
|
9
9
|
<script setup lang="ts">
|
|
10
|
-
import { computed } from 'vue'
|
|
10
|
+
import { computed, watch } from 'vue'
|
|
11
11
|
|
|
12
12
|
import { ElSwitch } from 'element-plus'
|
|
13
13
|
|
|
@@ -26,10 +26,23 @@ const props = defineProps<{
|
|
|
26
26
|
|
|
27
27
|
const inputProxy = computed({
|
|
28
28
|
get: () => {
|
|
29
|
-
return props.modelValue
|
|
29
|
+
return Boolean(props.modelValue)
|
|
30
30
|
},
|
|
31
31
|
set: (v) => {
|
|
32
|
-
emit('update:modelValue', v)
|
|
32
|
+
emit('update:modelValue', Boolean(v))
|
|
33
33
|
}
|
|
34
34
|
})
|
|
35
|
+
|
|
36
|
+
watch(
|
|
37
|
+
() => props.modelValue,
|
|
38
|
+
() => {
|
|
39
|
+
const parsed = Boolean(props.modelValue)
|
|
40
|
+
if (parsed !== props.modelValue) {
|
|
41
|
+
emit('update:modelValue', parsed)
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
immediate: true
|
|
46
|
+
}
|
|
47
|
+
)
|
|
35
48
|
</script>
|
package/src/components/form/input-renderers/form-schema-renderer/FlyFormSchemaRenderer.utils.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
import type { Composer } from 'vue-i18n'
|
|
1
|
+
import type { FormItemRule } from 'element-plus'
|
|
4
2
|
|
|
5
3
|
import { checkInputRange } from '../../../../utils/validators'
|
|
6
|
-
import { formFieldErrorMessageFormatter } from '../../form.utils'
|
|
7
4
|
import {
|
|
8
5
|
checkInputRangeValidator,
|
|
9
6
|
requiredField,
|
|
@@ -35,20 +32,6 @@ export function getValidatorsFromInputFields(fields: T_InputRendererBase[]) {
|
|
|
35
32
|
return validators
|
|
36
33
|
}
|
|
37
34
|
|
|
38
|
-
export async function genericFormValidator(formRef: FormInstance): Promise<true> {
|
|
39
|
-
return new Promise((resolve, reject) => {
|
|
40
|
-
formRef.validate((valid, errors) => {
|
|
41
|
-
if (!valid) {
|
|
42
|
-
if (errors) {
|
|
43
|
-
return reject(formFieldErrorMessageFormatter(errors))
|
|
44
|
-
}
|
|
45
|
-
} else {
|
|
46
|
-
return resolve(true)
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
|
-
|
|
52
35
|
export function generateInputFromFormSchema(
|
|
53
36
|
field: T_InputSchema,
|
|
54
37
|
lookupData?: T_FormSchemaLookupData
|
|
@@ -156,14 +139,14 @@ export function generateInputFromFormSchema(
|
|
|
156
139
|
}
|
|
157
140
|
}
|
|
158
141
|
|
|
159
|
-
export function generateFormRule(field: T_InputSchema
|
|
142
|
+
export function generateFormRule(field: T_InputSchema): FormItemRule[] {
|
|
160
143
|
const validations = field.validation
|
|
161
144
|
const rules: FormItemRule[] = []
|
|
162
145
|
|
|
163
146
|
if (validations?.required) {
|
|
164
147
|
switch (field.type) {
|
|
165
148
|
case 'text': {
|
|
166
|
-
rules.push(requiredField(field.label, 'blur', true
|
|
149
|
+
rules.push(requiredField(field.label, 'blur', true))
|
|
167
150
|
|
|
168
151
|
if (field.validation?.minLength || field.validation?.maxLength) {
|
|
169
152
|
rules.push(
|
|
@@ -175,8 +158,7 @@ export function generateFormRule(field: T_InputSchema, composer?: Composer): For
|
|
|
175
158
|
max: field.validation?.maxLength
|
|
176
159
|
},
|
|
177
160
|
undefined,
|
|
178
|
-
undefined
|
|
179
|
-
composer
|
|
161
|
+
undefined
|
|
180
162
|
),
|
|
181
163
|
'blur'
|
|
182
164
|
)
|
|
@@ -187,20 +169,20 @@ export function generateFormRule(field: T_InputSchema, composer?: Composer): For
|
|
|
187
169
|
}
|
|
188
170
|
|
|
189
171
|
case 'dateTime': {
|
|
190
|
-
rules.push(requiredField(field.label, 'blur', true
|
|
172
|
+
rules.push(requiredField(field.label, 'blur', true))
|
|
191
173
|
break
|
|
192
174
|
}
|
|
193
175
|
|
|
194
176
|
case 'number': {
|
|
195
|
-
rules.push(requiredFieldNumber(field.label, 'change'
|
|
177
|
+
rules.push(requiredFieldNumber(field.label, 'change'))
|
|
196
178
|
break
|
|
197
179
|
}
|
|
198
180
|
|
|
199
181
|
case 'select': {
|
|
200
182
|
if (field.config.multiple) {
|
|
201
|
-
rules.push(requiredFieldArray(field.label, 'change', true
|
|
183
|
+
rules.push(requiredFieldArray(field.label, 'change', true))
|
|
202
184
|
} else {
|
|
203
|
-
rules.push(requiredField(field.label, 'change', true
|
|
185
|
+
rules.push(requiredField(field.label, 'change', true))
|
|
204
186
|
}
|
|
205
187
|
break
|
|
206
188
|
}
|
|
@@ -208,19 +190,12 @@ export function generateFormRule(field: T_InputSchema, composer?: Composer): For
|
|
|
208
190
|
case 'valueUnit': {
|
|
209
191
|
if (field.config.valueType === 'text') {
|
|
210
192
|
rules.push(
|
|
211
|
-
requiredFieldValueUnit(
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
undefined,
|
|
215
|
-
undefined,
|
|
216
|
-
{
|
|
217
|
-
valueType: 'text'
|
|
218
|
-
},
|
|
219
|
-
composer
|
|
220
|
-
)
|
|
193
|
+
requiredFieldValueUnit(field.label, 'change', undefined, undefined, {
|
|
194
|
+
valueType: 'text'
|
|
195
|
+
})
|
|
221
196
|
)
|
|
222
197
|
} else {
|
|
223
|
-
rules.push(requiredFieldNumberSelect(field.label, 'change', true
|
|
198
|
+
rules.push(requiredFieldNumberSelect(field.label, 'change', true))
|
|
224
199
|
}
|
|
225
200
|
}
|
|
226
201
|
}
|
|
@@ -2,14 +2,14 @@ import { type Ref, computed, ref, watch } from 'vue'
|
|
|
2
2
|
|
|
3
3
|
import type { FormInstance } from 'element-plus'
|
|
4
4
|
|
|
5
|
-
import { defaultsDeep } from 'lodash'
|
|
5
|
+
import { defaultsDeep } from 'lodash-es'
|
|
6
6
|
|
|
7
|
+
import { genericFormValidator } from '../../form.utils'
|
|
7
8
|
import type { T_FormSchemaLookupData, T_InputSchema } from '../form-schema.types'
|
|
8
9
|
import type { T_FormSchemaRendererConfig, T_InputRendererBase } from '../input-renderer.types'
|
|
9
10
|
|
|
10
11
|
import {
|
|
11
12
|
generateInputFromFormSchema,
|
|
12
|
-
genericFormValidator,
|
|
13
13
|
getValidatorsFromInputFields
|
|
14
14
|
} from './FlyFormSchemaRenderer.utils'
|
|
15
15
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { isNil } from 'lodash'
|
|
1
|
+
import { isNil } from 'lodash-es'
|
|
2
2
|
|
|
3
3
|
import type { T_InputTypes } from './input-renderer.types'
|
|
4
4
|
|
|
5
5
|
export function getInputDisplayValue(v: unknown, inputType: T_InputTypes) {
|
|
6
6
|
switch (inputType) {
|
|
7
7
|
case 'number':
|
|
8
|
-
if (v
|
|
9
|
-
return
|
|
8
|
+
if (isNil(v)) return ''
|
|
9
|
+
return Number(v)
|
|
10
10
|
|
|
11
11
|
case 'text':
|
|
12
12
|
default:
|
|
13
13
|
if (isNil(v)) {
|
|
14
14
|
return ''
|
|
15
15
|
}
|
|
16
|
-
return
|
|
16
|
+
return String(v)
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
15
|
<script setup lang="ts">
|
|
16
|
-
import { computed } from 'vue'
|
|
16
|
+
import { computed, watch } from 'vue'
|
|
17
17
|
|
|
18
18
|
import { ElInput } from 'element-plus'
|
|
19
19
|
|
|
@@ -41,8 +41,24 @@ const inputProxy = computed({
|
|
|
41
41
|
},
|
|
42
42
|
set: (v) => {
|
|
43
43
|
const parsed = displayToNumber(v)
|
|
44
|
+
|
|
44
45
|
emit('update:modelValue', parsed)
|
|
45
46
|
emit('change', parsed)
|
|
46
47
|
}
|
|
47
48
|
})
|
|
49
|
+
|
|
50
|
+
watch(
|
|
51
|
+
() => props.modelValue,
|
|
52
|
+
() => {
|
|
53
|
+
const parsed = displayToNumber(props.modelValue)
|
|
54
|
+
|
|
55
|
+
if (parsed !== props.modelValue) {
|
|
56
|
+
emit('update:modelValue', parsed)
|
|
57
|
+
emit('change', parsed)
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
immediate: true
|
|
62
|
+
}
|
|
63
|
+
)
|
|
48
64
|
</script>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</template>
|
|
16
16
|
|
|
17
17
|
<script setup lang="ts">
|
|
18
|
-
import { computed } from 'vue'
|
|
18
|
+
import { computed, watch } from 'vue'
|
|
19
19
|
|
|
20
20
|
import { ElInput } from 'element-plus'
|
|
21
21
|
|
|
@@ -53,4 +53,18 @@ const inputProxy = computed({
|
|
|
53
53
|
function castValue(v: unknown) {
|
|
54
54
|
return v ? String(v) : ''
|
|
55
55
|
}
|
|
56
|
+
|
|
57
|
+
watch(
|
|
58
|
+
() => props.modelValue,
|
|
59
|
+
() => {
|
|
60
|
+
const parsed = castValue(props.modelValue)
|
|
61
|
+
|
|
62
|
+
if (parsed !== props.modelValue) {
|
|
63
|
+
emit('update:modelValue', parsed)
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
immediate: true
|
|
68
|
+
}
|
|
69
|
+
)
|
|
56
70
|
</script>
|
|
@@ -59,12 +59,13 @@ const options = computed(() => normalizeSelectOptionsToDict(props.input?.config?
|
|
|
59
59
|
|
|
60
60
|
const valueTypeIsString = computed(() => props.input?.config?.valueType === 'text')
|
|
61
61
|
|
|
62
|
-
const valueProxy = computed
|
|
62
|
+
const valueProxy = computed({
|
|
63
63
|
get: () => {
|
|
64
|
-
|
|
64
|
+
const v = getInputDisplayValue(
|
|
65
65
|
props.modelValue?.value,
|
|
66
66
|
valueTypeIsString.value ? 'text' : 'number'
|
|
67
67
|
)
|
|
68
|
+
return v
|
|
68
69
|
},
|
|
69
70
|
set: (v) => {
|
|
70
71
|
emit('update:modelValue', getValue(v))
|
|
@@ -85,7 +86,7 @@ function ensure(): NonNullable<T_ValueUnitValue> {
|
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
function getValue(v: string) {
|
|
89
|
+
function getValue(v: string | number) {
|
|
89
90
|
const base = ensure()
|
|
90
91
|
const parsed = valueTypeIsString.value ? v : displayToNumber(v)
|
|
91
92
|
|
|
@@ -1,35 +1,23 @@
|
|
|
1
1
|
import type { FormItemRule } from 'element-plus'
|
|
2
2
|
|
|
3
|
-
import { isNil } from 'lodash'
|
|
4
|
-
import type { Composer } from 'vue-i18n'
|
|
3
|
+
import { isNil } from 'lodash-es'
|
|
5
4
|
|
|
5
|
+
import { UseLocaleInjector } from '../../composables/UseLocaleInjector'
|
|
6
6
|
import { type checkInputRange, isRequiredError } from '../../utils/validators'
|
|
7
7
|
|
|
8
8
|
import type { T_ValueUnitValue } from './input-renderers/value-unit/FlyValueUnit.types'
|
|
9
9
|
|
|
10
10
|
type InputTriggers = 'blur' | 'change'
|
|
11
11
|
|
|
12
|
-
// type Validator = (
|
|
13
|
-
// languageKey?: string,
|
|
14
|
-
// trigger?: InputTriggers,
|
|
15
|
-
// useRequiredMessage?: boolean,
|
|
16
|
-
// required?: boolean,
|
|
17
|
-
// options?: {
|
|
18
|
-
// valueType?: 'text' | 'number'
|
|
19
|
-
// },
|
|
20
|
-
// composer?: Composer
|
|
21
|
-
// ) => FormItemRule
|
|
22
|
-
|
|
23
12
|
export const requiredField = (
|
|
24
13
|
fieldLabel = 'validation.field',
|
|
25
14
|
trigger: InputTriggers = 'blur',
|
|
26
|
-
useRequiredMessage = true
|
|
27
|
-
composer?: Composer
|
|
15
|
+
useRequiredMessage = true
|
|
28
16
|
): FormItemRule => {
|
|
29
17
|
return {
|
|
30
18
|
required: true,
|
|
31
19
|
trigger: trigger,
|
|
32
|
-
message: useRequiredMessage ? isRequiredError(fieldLabel
|
|
20
|
+
message: useRequiredMessage ? isRequiredError(fieldLabel) : fieldLabel
|
|
33
21
|
}
|
|
34
22
|
}
|
|
35
23
|
|
|
@@ -43,10 +31,10 @@ export const checkInputRangeValidator = (
|
|
|
43
31
|
|
|
44
32
|
export const requiredFieldNumber = (
|
|
45
33
|
languageKey = 'validation.field',
|
|
46
|
-
trigger: InputTriggers = 'change'
|
|
47
|
-
composer?: Composer
|
|
34
|
+
trigger: InputTriggers = 'change'
|
|
48
35
|
): FormItemRule => {
|
|
49
|
-
const t =
|
|
36
|
+
const { t } = UseLocaleInjector()
|
|
37
|
+
|
|
50
38
|
return {
|
|
51
39
|
type: 'number',
|
|
52
40
|
required: true,
|
|
@@ -62,19 +50,11 @@ export const requiredFieldNumber = (
|
|
|
62
50
|
export const requiredFieldNumberSelect = (
|
|
63
51
|
label = 'validation.field',
|
|
64
52
|
trigger: InputTriggers = 'blur',
|
|
65
|
-
useRequiredMessage = true
|
|
66
|
-
composer?: Composer
|
|
53
|
+
useRequiredMessage = true
|
|
67
54
|
): FormItemRule =>
|
|
68
|
-
requiredFieldValueUnit(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
useRequiredMessage,
|
|
72
|
-
true,
|
|
73
|
-
{
|
|
74
|
-
valueType: 'number'
|
|
75
|
-
},
|
|
76
|
-
composer
|
|
77
|
-
)
|
|
55
|
+
requiredFieldValueUnit(label, trigger, useRequiredMessage, true, {
|
|
56
|
+
valueType: 'number'
|
|
57
|
+
})
|
|
78
58
|
|
|
79
59
|
export const requiredFieldValueUnit = (
|
|
80
60
|
label = 'validation.field',
|
|
@@ -83,8 +63,7 @@ export const requiredFieldValueUnit = (
|
|
|
83
63
|
required = true,
|
|
84
64
|
options: {
|
|
85
65
|
valueType?: 'text' | 'number'
|
|
86
|
-
}
|
|
87
|
-
composer?: Composer
|
|
66
|
+
}
|
|
88
67
|
): FormItemRule => ({
|
|
89
68
|
required: required,
|
|
90
69
|
trigger: trigger,
|
|
@@ -101,7 +80,7 @@ export const requiredFieldValueUnit = (
|
|
|
101
80
|
)) ||
|
|
102
81
|
!value
|
|
103
82
|
) {
|
|
104
|
-
return callback(new Error(useRequiredMessage ? isRequiredError(label
|
|
83
|
+
return callback(new Error(useRequiredMessage ? isRequiredError(label) : label))
|
|
105
84
|
}
|
|
106
85
|
|
|
107
86
|
return callback()
|
|
@@ -111,11 +90,10 @@ export const requiredFieldValueUnit = (
|
|
|
111
90
|
export const requiredFieldArray = (
|
|
112
91
|
label = 'validation.field',
|
|
113
92
|
trigger: InputTriggers = 'change',
|
|
114
|
-
useRequiredMessage = true
|
|
115
|
-
composer?: Composer
|
|
93
|
+
useRequiredMessage = true
|
|
116
94
|
): FormItemRule => ({
|
|
117
95
|
type: 'array',
|
|
118
96
|
required: true,
|
|
119
97
|
trigger: trigger,
|
|
120
|
-
message: useRequiredMessage ? isRequiredError(label
|
|
98
|
+
message: useRequiredMessage ? isRequiredError(label) : label
|
|
121
99
|
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="icon"
|
|
4
|
+
class="fly-icon"
|
|
5
|
+
:style="{
|
|
6
|
+
fontSize: typeof size === 'number' ? `${size}px` : size
|
|
7
|
+
}"
|
|
8
|
+
/>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
import type { T_FlyIconV2Props } from './FlyIconV2.types'
|
|
13
|
+
|
|
14
|
+
defineProps<T_FlyIconV2Props>()
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<style lang="scss" scoped></style>
|
package/src/components/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { T_FlyIconV2Props } from '../../../general/fly-icon-v2/FlyIconV2.types'
|
|
2
2
|
|
|
3
3
|
export type T_FlyMiniSidebarItem = {
|
|
4
4
|
key: string | number
|
|
5
5
|
label: string
|
|
6
6
|
path: string
|
|
7
|
-
icon:
|
|
7
|
+
icon: T_FlyIconV2Props['icon']
|
|
8
8
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<router-link :to="menu.path" class="anra-sidebar-item" active-class="anra-sidebar-item--active">
|
|
3
3
|
<span class="anra-sidebar-item__icon">
|
|
4
|
-
<
|
|
4
|
+
<FlyIconV2 :icon="menu.icon" />
|
|
5
5
|
</span>
|
|
6
6
|
|
|
7
7
|
<span class="anra-sidebar-item__label">{{ menu.label }}</span>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<script setup lang="ts">
|
|
12
|
-
import
|
|
12
|
+
import FlyIconV2 from '../../../general/fly-icon-v2/FlyIconV2.vue'
|
|
13
13
|
|
|
14
14
|
import type { T_FlyMiniSidebarItem } from './FlyMiniSidebar.types'
|
|
15
15
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { T_FlyIconV2Props } from '../../../general'
|
|
2
2
|
|
|
3
3
|
export type T_FlySidebarBase = {
|
|
4
4
|
index: string
|
|
5
5
|
label?: string
|
|
6
|
-
icon?:
|
|
6
|
+
icon?: T_FlyIconV2Props['icon']
|
|
7
7
|
disabled?: boolean
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -12,19 +12,20 @@
|
|
|
12
12
|
</el-scrollbar>
|
|
13
13
|
|
|
14
14
|
<div class="fly_sidebar__collapse-trigger" role="button" @click="toggleCollapse">
|
|
15
|
-
<
|
|
15
|
+
<FlyIconV2 :icon="isCollapsed ? IconMdiChevronRight : IconMdiChevronLeft" />
|
|
16
16
|
</div>
|
|
17
17
|
</div>
|
|
18
18
|
</template>
|
|
19
19
|
|
|
20
20
|
<script lang="ts" setup>
|
|
21
|
+
import IconMdiChevronLeft from '~icons/mdi/chevron-left'
|
|
22
|
+
import IconMdiChevronRight from '~icons/mdi/chevron-right'
|
|
23
|
+
|
|
21
24
|
import { ref } from 'vue'
|
|
22
25
|
|
|
23
26
|
import { ElMenu, ElScrollbar } from 'element-plus'
|
|
24
27
|
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
import FlyIcon from '../../../general/fly-icon/FlyIcon.vue'
|
|
28
|
+
import FlyIconV2 from '../../../general/fly-icon-v2/FlyIconV2.vue'
|
|
28
29
|
|
|
29
30
|
import './FlySidebar.element.scss'
|
|
30
31
|
import type { T_FlySidebarProps } from './FlySidebar.types'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<el-menu-item v-if="node.type === 'item'" :index="node.index" :disabled="node.disabled">
|
|
3
3
|
<template v-if="node.icon">
|
|
4
4
|
<i class="el-icon">
|
|
5
|
-
<
|
|
5
|
+
<FlyIconV2 :icon="node.icon" />
|
|
6
6
|
</i>
|
|
7
7
|
</template>
|
|
8
8
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<template #title>
|
|
16
16
|
<template v-if="node.icon">
|
|
17
17
|
<i class="el-icon">
|
|
18
|
-
<
|
|
18
|
+
<FlyIconV2 :icon="node.icon" />
|
|
19
19
|
</i>
|
|
20
20
|
</template>
|
|
21
21
|
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
<script lang="ts" setup>
|
|
38
38
|
import { ElMenuItem, ElMenuItemGroup, ElSubMenu } from 'element-plus'
|
|
39
39
|
|
|
40
|
-
import
|
|
40
|
+
import FlyIconV2 from '../../../general/fly-icon-v2/FlyIconV2.vue'
|
|
41
41
|
|
|
42
42
|
import type { T_FlySidebarNode } from './FlySidebar.types'
|
|
43
43
|
|
|
@@ -2,11 +2,28 @@
|
|
|
2
2
|
@use 'element-plus/theme-chalk/src/form-item.scss';
|
|
3
3
|
@use 'element-plus/theme-chalk/src/input.scss';
|
|
4
4
|
@use 'element-plus/theme-chalk/src/input-number.scss';
|
|
5
|
+
@use 'element-plus/theme-chalk/src/input-tag.scss';
|
|
5
6
|
@use './select.scss';
|
|
6
7
|
@use './radio.scss';
|
|
7
8
|
@use 'element-plus/theme-chalk/src/checkbox.scss';
|
|
8
9
|
@use './date-time.scss';
|
|
9
10
|
@use 'element-plus/theme-chalk/src/switch.scss';
|
|
11
|
+
@use 'element-plus/theme-chalk/src/icon.scss';
|
|
12
|
+
|
|
13
|
+
:root {
|
|
14
|
+
.el-input,
|
|
15
|
+
.el-textarea,
|
|
16
|
+
.el-date-editor {
|
|
17
|
+
--el-input-border-color: var(--anra-form-input-border);
|
|
18
|
+
}
|
|
19
|
+
.el-input-tag,
|
|
20
|
+
.el-select {
|
|
21
|
+
--el-border-color: var(--anra-form-input-border);
|
|
22
|
+
}
|
|
23
|
+
.el-switch__core {
|
|
24
|
+
--el-switch-border-color: var(--anra-form-input-border);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
10
27
|
|
|
11
28
|
.el-form-item {
|
|
12
29
|
&__error,
|
|
@@ -62,7 +79,6 @@
|
|
|
62
79
|
|
|
63
80
|
.el-select__wrapper {
|
|
64
81
|
--el-fill-color-blank: var(--anra-bg-20);
|
|
65
|
-
--el-border-color: var(--anra-form-input-border);
|
|
66
82
|
|
|
67
83
|
&.is-disabled {
|
|
68
84
|
background-color: var(--anra-disabled-bg);
|