@airpower/web 0.2.5 → 0.2.7
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/components/dialog/index.d.ts +1 -0
- package/dist/curd/AbstractCurdService.d.ts +2 -8
- package/dist/enum/DisableEnum.d.ts +2 -2
- package/dist/hooks/detail/useDetail.d.ts +2 -2
- package/dist/hooks/editor/useEditor.d.ts +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/main.js +239 -229
- package/dist/shared/index.d.ts +4 -0
- package/dist/util/http/Http.d.ts +2 -2
- package/dist/util/validator/WebValidator.d.ts +1 -2
- package/dist/web.css +2 -2
- package/package.json +2 -2
- package/dist/type/index.d.ts +0 -1
|
@@ -2,6 +2,7 @@ import { ITransformerConstructor } from '@airpower/transformer';
|
|
|
2
2
|
import { RootEntity, AbstractService } from '../base';
|
|
3
3
|
import { QueryRequest, QueryResponsePage } from '../model';
|
|
4
4
|
import { WebValidateRule } from '../util';
|
|
5
|
+
import { CurdServiceConstructor } from './type';
|
|
5
6
|
/**
|
|
6
7
|
* # 实体 `API` 服务超类
|
|
7
8
|
* 包含了常用的增删改查等方法
|
|
@@ -53,10 +54,9 @@ export declare abstract class AbstractCurdService<E extends RootEntity> extends
|
|
|
53
54
|
protected urlDelete: string;
|
|
54
55
|
/**
|
|
55
56
|
* ### 创建验证器
|
|
56
|
-
* @param form 表单对象
|
|
57
57
|
* @param moreRule `可选` 更多的验证规则
|
|
58
58
|
*/
|
|
59
|
-
static createValidator<E extends RootEntity
|
|
59
|
+
static createValidator<E extends RootEntity, S extends AbstractCurdService<E>>(this: CurdServiceConstructor<E, S>, moreRule?: WebValidateRule<E>): WebValidateRule<E>;
|
|
60
60
|
/**
|
|
61
61
|
* ### 查询分页数据列表
|
|
62
62
|
* @param request 请求对象
|
|
@@ -124,12 +124,6 @@ export declare abstract class AbstractCurdService<E extends RootEntity> extends
|
|
|
124
124
|
* @param apiUrl `可选` 自定义请求URL
|
|
125
125
|
*/
|
|
126
126
|
enable(id: number, message?: string, apiUrl?: string): Promise<void>;
|
|
127
|
-
/**
|
|
128
|
-
* ### 创建验证器
|
|
129
|
-
* @param form 表单对象
|
|
130
|
-
* @param moreRule `可选` 更多的验证规则
|
|
131
|
-
*/
|
|
132
|
-
createValidator<E extends RootEntity>(form: E, moreRule?: WebValidateRule<E>): WebValidateRule<E>;
|
|
133
127
|
/**
|
|
134
128
|
* ### 创建一个实体的实例
|
|
135
129
|
* @param id `可选` `ID`
|
|
@@ -4,7 +4,7 @@ import { WebEnum } from './WebEnum';
|
|
|
4
4
|
*
|
|
5
5
|
* @author Hamm.cn
|
|
6
6
|
*/
|
|
7
|
-
export declare class DisableEnum extends WebEnum {
|
|
8
|
-
static ENABLE: DisableEnum;
|
|
7
|
+
export declare class DisableEnum extends WebEnum<boolean> {
|
|
9
8
|
static DISABLED: DisableEnum;
|
|
9
|
+
static ENABLE: DisableEnum;
|
|
10
10
|
}
|
|
@@ -6,8 +6,8 @@ import { IDetailResult } from './IDetailResult';
|
|
|
6
6
|
/**
|
|
7
7
|
* # 引入详情的`Hook`
|
|
8
8
|
* @param props `defineProps` 的返回值
|
|
9
|
-
* @param
|
|
9
|
+
* @param ServiceClass 详情使用的 `Service`
|
|
10
10
|
* @param option `可选` 更多的配置
|
|
11
11
|
* @author Hamm.cn
|
|
12
12
|
*/
|
|
13
|
-
export declare function useDetail<E extends RootEntity, S extends AbstractCurdService<E>>(props: IJson,
|
|
13
|
+
export declare function useDetail<E extends RootEntity, S extends AbstractCurdService<E>>(props: IJson, ServiceClass: CurdServiceConstructor<E, S>, option?: IDetailOption<E>): IDetailResult<E, S>;
|
|
@@ -6,8 +6,8 @@ import { IEditorResult } from './IEditorResult';
|
|
|
6
6
|
/**
|
|
7
7
|
* # 引入`Editor`的`Hook`
|
|
8
8
|
* @param props `defineProps`的返回值
|
|
9
|
-
* @param
|
|
9
|
+
* @param ServiceClass `Editor`使用的`Service`
|
|
10
10
|
* @param option `可选` 更多的配置
|
|
11
11
|
* @author Hamm.cn
|
|
12
12
|
*/
|
|
13
|
-
export declare function useEditor<E extends RootEntity, S extends AbstractCurdService<E>>(props: IJson,
|
|
13
|
+
export declare function useEditor<E extends RootEntity, S extends AbstractCurdService<E>>(props: IJson, ServiceClass: CurdServiceConstructor<E, S>, option?: IEditorOption<E>): IEditorResult<E, S>;
|
package/dist/index.d.ts
CHANGED
package/dist/main.js
CHANGED
|
@@ -2,10 +2,13 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import { Transformer, DecoratorUtil, Type } from "@airpower/transformer";
|
|
5
|
+
export * from "@airpower/transformer";
|
|
5
6
|
import ElementPlus, { ElMessage, ElMessageBox, ElButton, ElIcon, ElUpload, ElEmpty, ElFormItem, ElSubMenu, ElMenuItem, ElPagination, ElPopover, ElRadioGroup, ElRadioButton, ElInput, ElLink, ElTabPane, ElCheckTag, ElSelect, ElOption, ElTable, ElTableColumn } from "element-plus";
|
|
6
7
|
import axios from "axios";
|
|
7
8
|
import { ValidateUtil, DateTimeFormatter, DateTimeUtil, DesensitizeType, DesensitizeUtil, FileUtil } from "@airpower/util";
|
|
9
|
+
export * from "@airpower/util";
|
|
8
10
|
import { Enum } from "@airpower/enum";
|
|
11
|
+
export * from "@airpower/enum";
|
|
9
12
|
import { defineComponent, createElementBlock, openBlock, createElementVNode, computed, createBlock, unref, mergeProps, toHandlers, withCtx, renderSlot, createVNode, createTextVNode, toDisplayString, ref, withModifiers, normalizeClass, onMounted, watch, resolveComponent, resolveDirective, Transition, normalizeStyle, withDirectives, createCommentVNode, nextTick, Fragment, createApp, inject, renderList, vShow, useSlots, createSlots, h, onUpdated, mergeModels, useModel, provide, withKeys } from "vue";
|
|
10
13
|
var zhCn = {
|
|
11
14
|
name: "zh-cn",
|
|
@@ -392,6 +395,8 @@ class FeedbackUtil {
|
|
|
392
395
|
title,
|
|
393
396
|
{
|
|
394
397
|
confirmButtonText: WebI18n.get().Confirm,
|
|
398
|
+
cancelButtonText: WebI18n.get().Cancel,
|
|
399
|
+
showCancelButton: true,
|
|
395
400
|
type,
|
|
396
401
|
closeOnClickModal: false,
|
|
397
402
|
closeOnPressEscape: true,
|
|
@@ -628,8 +633,8 @@ const _Http = class _Http {
|
|
|
628
633
|
return this;
|
|
629
634
|
}
|
|
630
635
|
/**
|
|
631
|
-
* ### 设置请求`content-
|
|
632
|
-
* @param contentType `content-
|
|
636
|
+
* ### 设置请求`content-shared`
|
|
637
|
+
* @param contentType `content-shared`
|
|
633
638
|
*/
|
|
634
639
|
setContentType(contentType) {
|
|
635
640
|
return this.addHttpHeader(HttpHeader.CONTENT_TYPE, contentType);
|
|
@@ -780,14 +785,16 @@ function getFieldConfig(target, key) {
|
|
|
780
785
|
}
|
|
781
786
|
function getDictionary(target, key) {
|
|
782
787
|
var _a;
|
|
783
|
-
|
|
788
|
+
const result = (_a = getFieldConfig(target, key)) == null ? void 0 : _a.dictionary;
|
|
789
|
+
console.warn(`[Field] getDictionary() is deprecated, use getFieldConfig() instead.`, result, target, key);
|
|
790
|
+
return result;
|
|
784
791
|
}
|
|
785
792
|
function getFieldLabel(target, key) {
|
|
786
793
|
var _a;
|
|
787
794
|
return ((_a = getFieldConfig(target, key)) == null ? void 0 : _a.label) || key;
|
|
788
795
|
}
|
|
789
|
-
const KEY$3 = `${DecoratorUtil.DecoratorKeyPrefix}[
|
|
790
|
-
const LIST_KEY$2 = `${DecoratorUtil.DecoratorKeyPrefix}[
|
|
796
|
+
const KEY$3 = `${DecoratorUtil.DecoratorKeyPrefix}[Form]`;
|
|
797
|
+
const LIST_KEY$2 = `${DecoratorUtil.DecoratorKeyPrefix}[FormList]`;
|
|
791
798
|
function Form(config = {}) {
|
|
792
799
|
return (target, key) => {
|
|
793
800
|
config.key = key;
|
|
@@ -1694,8 +1701,8 @@ class WebEnum extends Enum {
|
|
|
1694
1701
|
}
|
|
1695
1702
|
const _DisableEnum = class _DisableEnum extends WebEnum {
|
|
1696
1703
|
};
|
|
1697
|
-
__publicField(_DisableEnum, "
|
|
1698
|
-
__publicField(_DisableEnum, "
|
|
1704
|
+
__publicField(_DisableEnum, "DISABLED", new _DisableEnum(true, "禁用").setColor(WebColor.DANGER));
|
|
1705
|
+
__publicField(_DisableEnum, "ENABLE", new _DisableEnum(false, "启用").setColor(WebColor.SUCCESS));
|
|
1699
1706
|
let DisableEnum = _DisableEnum;
|
|
1700
1707
|
class RootModel extends Transformer {
|
|
1701
1708
|
}
|
|
@@ -1739,7 +1746,8 @@ __decorateClass$3([
|
|
|
1739
1746
|
Table({
|
|
1740
1747
|
width: 80,
|
|
1741
1748
|
order: -100,
|
|
1742
|
-
force: true
|
|
1749
|
+
force: true,
|
|
1750
|
+
color: true
|
|
1743
1751
|
}),
|
|
1744
1752
|
Field({
|
|
1745
1753
|
label: "是否禁用",
|
|
@@ -3052,7 +3060,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
3052
3060
|
};
|
|
3053
3061
|
}
|
|
3054
3062
|
});
|
|
3055
|
-
const
|
|
3063
|
+
const ADesensitize = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-30bf4899"]]);
|
|
3056
3064
|
const _hoisted_1$g = ["id"];
|
|
3057
3065
|
const _hoisted_2$c = ["id"];
|
|
3058
3066
|
const _hoisted_3$a = { class: "title" };
|
|
@@ -3435,6 +3443,103 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
3435
3443
|
}
|
|
3436
3444
|
});
|
|
3437
3445
|
const ADialog = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-cbda0f6a"]]);
|
|
3446
|
+
class DialogProps {
|
|
3447
|
+
/**
|
|
3448
|
+
* ### 使用无参 `DialogProps` 配置
|
|
3449
|
+
*/
|
|
3450
|
+
static create() {
|
|
3451
|
+
return {
|
|
3452
|
+
/**
|
|
3453
|
+
* ### 弹窗的确认按钮被点击事件
|
|
3454
|
+
* 如果给 `ADialog` 传入了 `form` 表单的 `ref` 实体对象, 则校验通过之后才会回调此方法
|
|
3455
|
+
*/
|
|
3456
|
+
onConfirm: {
|
|
3457
|
+
type: Function,
|
|
3458
|
+
default: () => () => {
|
|
3459
|
+
}
|
|
3460
|
+
},
|
|
3461
|
+
/**
|
|
3462
|
+
* ### 弹窗的取消或关闭按钮被点击事件
|
|
3463
|
+
*/
|
|
3464
|
+
onCancel: {
|
|
3465
|
+
type: Function,
|
|
3466
|
+
default: () => () => {
|
|
3467
|
+
}
|
|
3468
|
+
},
|
|
3469
|
+
/**
|
|
3470
|
+
* ### 弹窗的回调事件,不关闭弹窗
|
|
3471
|
+
*/
|
|
3472
|
+
onCallback: {
|
|
3473
|
+
type: Function,
|
|
3474
|
+
default: () => () => {
|
|
3475
|
+
}
|
|
3476
|
+
}
|
|
3477
|
+
};
|
|
3478
|
+
}
|
|
3479
|
+
/**
|
|
3480
|
+
* ### 使用实体的 `DialogProps` 配置
|
|
3481
|
+
* - `P` Param的类型
|
|
3482
|
+
* @param value `可选` 默认参数
|
|
3483
|
+
*/
|
|
3484
|
+
static withParam(value = null) {
|
|
3485
|
+
return Object.assign(this.create(), {
|
|
3486
|
+
/**
|
|
3487
|
+
* ### 父窗体弹出当前窗体时传入的参数
|
|
3488
|
+
*/
|
|
3489
|
+
param: {
|
|
3490
|
+
type: Object,
|
|
3491
|
+
default: value
|
|
3492
|
+
}
|
|
3493
|
+
});
|
|
3494
|
+
}
|
|
3495
|
+
/**
|
|
3496
|
+
* ### 使用 `ID` 的 `DialogProps` 配置
|
|
3497
|
+
* 传入的 `param` 参数为 `Number` 类型的 `ID`
|
|
3498
|
+
*/
|
|
3499
|
+
static withId() {
|
|
3500
|
+
return this.withParam(0);
|
|
3501
|
+
}
|
|
3502
|
+
/**
|
|
3503
|
+
* ### 使用选择器的 `DialogProps` 配置
|
|
3504
|
+
* - `S`: `selectList` 参数的类型
|
|
3505
|
+
* - `P`: `param` 参数的类型(默认同 `selectList` 类型一致)
|
|
3506
|
+
*
|
|
3507
|
+
* @param param 选择器的参数
|
|
3508
|
+
*/
|
|
3509
|
+
static withSelector(param = null) {
|
|
3510
|
+
return Object.assign(this.withParam(param), {
|
|
3511
|
+
/**
|
|
3512
|
+
* ### 是否使用多选
|
|
3513
|
+
*/
|
|
3514
|
+
isMultiple: {
|
|
3515
|
+
type: Boolean,
|
|
3516
|
+
default: false
|
|
3517
|
+
},
|
|
3518
|
+
/**
|
|
3519
|
+
* ### 已经选择了的实体列表数组
|
|
3520
|
+
* ! 仅在 `isMultiple` 为true时会有值
|
|
3521
|
+
* 请放心使用ID属性, 其他的属性不一定有
|
|
3522
|
+
*/
|
|
3523
|
+
selectList: {
|
|
3524
|
+
type: Array,
|
|
3525
|
+
default: () => []
|
|
3526
|
+
},
|
|
3527
|
+
/**
|
|
3528
|
+
* ### 传入参数为一个实体
|
|
3529
|
+
*
|
|
3530
|
+
* 能保证的是, 确实是一个实体的基类, 可以调用一些 `AirModel` 的方法
|
|
3531
|
+
*
|
|
3532
|
+
* ```typescript
|
|
3533
|
+
* AirClassTransformer.parse(props.param.toSourceObject(), UserEntity)
|
|
3534
|
+
* ```
|
|
3535
|
+
*/
|
|
3536
|
+
param: {
|
|
3537
|
+
type: Object,
|
|
3538
|
+
default: param
|
|
3539
|
+
}
|
|
3540
|
+
});
|
|
3541
|
+
}
|
|
3542
|
+
}
|
|
3438
3543
|
class ExportModel extends Transformer {
|
|
3439
3544
|
constructor() {
|
|
3440
3545
|
super(...arguments);
|
|
@@ -3600,103 +3705,6 @@ class WebFileUtil {
|
|
|
3600
3705
|
return WebConfig.staticUrl + url;
|
|
3601
3706
|
}
|
|
3602
3707
|
}
|
|
3603
|
-
class DialogProps {
|
|
3604
|
-
/**
|
|
3605
|
-
* ### 使用无参 `DialogProps` 配置
|
|
3606
|
-
*/
|
|
3607
|
-
static create() {
|
|
3608
|
-
return {
|
|
3609
|
-
/**
|
|
3610
|
-
* ### 弹窗的确认按钮被点击事件
|
|
3611
|
-
* 如果给 `ADialog` 传入了 `form` 表单的 `ref` 实体对象, 则校验通过之后才会回调此方法
|
|
3612
|
-
*/
|
|
3613
|
-
onConfirm: {
|
|
3614
|
-
type: Function,
|
|
3615
|
-
default: () => () => {
|
|
3616
|
-
}
|
|
3617
|
-
},
|
|
3618
|
-
/**
|
|
3619
|
-
* ### 弹窗的取消或关闭按钮被点击事件
|
|
3620
|
-
*/
|
|
3621
|
-
onCancel: {
|
|
3622
|
-
type: Function,
|
|
3623
|
-
default: () => () => {
|
|
3624
|
-
}
|
|
3625
|
-
},
|
|
3626
|
-
/**
|
|
3627
|
-
* ### 弹窗的回调事件,不关闭弹窗
|
|
3628
|
-
*/
|
|
3629
|
-
onCallback: {
|
|
3630
|
-
type: Function,
|
|
3631
|
-
default: () => () => {
|
|
3632
|
-
}
|
|
3633
|
-
}
|
|
3634
|
-
};
|
|
3635
|
-
}
|
|
3636
|
-
/**
|
|
3637
|
-
* ### 使用实体的 `DialogProps` 配置
|
|
3638
|
-
* - `P` Param的类型
|
|
3639
|
-
* @param value `可选` 默认参数
|
|
3640
|
-
*/
|
|
3641
|
-
static withParam(value = null) {
|
|
3642
|
-
return Object.assign(this.create(), {
|
|
3643
|
-
/**
|
|
3644
|
-
* ### 父窗体弹出当前窗体时传入的参数
|
|
3645
|
-
*/
|
|
3646
|
-
param: {
|
|
3647
|
-
type: Object,
|
|
3648
|
-
default: value
|
|
3649
|
-
}
|
|
3650
|
-
});
|
|
3651
|
-
}
|
|
3652
|
-
/**
|
|
3653
|
-
* ### 使用 `ID` 的 `DialogProps` 配置
|
|
3654
|
-
* 传入的 `param` 参数为 `Number` 类型的 `ID`
|
|
3655
|
-
*/
|
|
3656
|
-
static withId() {
|
|
3657
|
-
return this.withParam(0);
|
|
3658
|
-
}
|
|
3659
|
-
/**
|
|
3660
|
-
* ### 使用选择器的 `DialogProps` 配置
|
|
3661
|
-
* - `S`: `selectList` 参数的类型
|
|
3662
|
-
* - `P`: `param` 参数的类型(默认同 `selectList` 类型一致)
|
|
3663
|
-
*
|
|
3664
|
-
* @param param 选择器的参数
|
|
3665
|
-
*/
|
|
3666
|
-
static withSelector(param = null) {
|
|
3667
|
-
return Object.assign(this.withParam(param), {
|
|
3668
|
-
/**
|
|
3669
|
-
* ### 是否使用多选
|
|
3670
|
-
*/
|
|
3671
|
-
isMultiple: {
|
|
3672
|
-
type: Boolean,
|
|
3673
|
-
default: false
|
|
3674
|
-
},
|
|
3675
|
-
/**
|
|
3676
|
-
* ### 已经选择了的实体列表数组
|
|
3677
|
-
* ! 仅在 `isMultiple` 为true时会有值
|
|
3678
|
-
* 请放心使用ID属性, 其他的属性不一定有
|
|
3679
|
-
*/
|
|
3680
|
-
selectList: {
|
|
3681
|
-
type: Array,
|
|
3682
|
-
default: () => []
|
|
3683
|
-
},
|
|
3684
|
-
/**
|
|
3685
|
-
* ### 传入参数为一个实体
|
|
3686
|
-
*
|
|
3687
|
-
* 能保证的是, 确实是一个实体的基类, 可以调用一些 `AirModel` 的方法
|
|
3688
|
-
*
|
|
3689
|
-
* ```typescript
|
|
3690
|
-
* AirClassTransformer.parse(props.param.toSourceObject(), UserEntity)
|
|
3691
|
-
* ```
|
|
3692
|
-
*/
|
|
3693
|
-
param: {
|
|
3694
|
-
type: Object,
|
|
3695
|
-
default: param
|
|
3696
|
-
}
|
|
3697
|
-
});
|
|
3698
|
-
}
|
|
3699
|
-
}
|
|
3700
3708
|
const _hoisted_1$f = { class: "tips" };
|
|
3701
3709
|
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
3702
3710
|
__name: "Export",
|
|
@@ -4212,11 +4220,11 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
4212
4220
|
const injectFormData = inject("formData");
|
|
4213
4221
|
const formData = props.modelValue ? ref(props.modelValue) : injectFormData;
|
|
4214
4222
|
if (!formData) {
|
|
4215
|
-
throw new Error("请手动为AFormField绑定v-model或使用
|
|
4223
|
+
throw new Error("请手动为AFormField绑定v-model或使用 useEditor 创建表单对象(推荐)!!!");
|
|
4216
4224
|
}
|
|
4217
4225
|
const entityClass = inject("entityClass") || props.entity;
|
|
4218
4226
|
if (!entityClass) {
|
|
4219
|
-
throw new Error("请手动传入到AFormField的entity属性或使用
|
|
4227
|
+
throw new Error("请手动传入到AFormField的entity属性或使用 useEditor 创建表单对象(推荐)!!!");
|
|
4220
4228
|
}
|
|
4221
4229
|
const entityInstance = computed(() => Transformer.newInstance(entityClass));
|
|
4222
4230
|
function onChange(val) {
|
|
@@ -4966,7 +4974,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
4966
4974
|
setup(__props, { emit: __emit }) {
|
|
4967
4975
|
const props = __props;
|
|
4968
4976
|
const emits = __emit;
|
|
4969
|
-
const entityInstance = props.entity ? Transformer.parse({}, props.entity) : void 0;
|
|
4977
|
+
const entityInstance = ref(props.entity ? Transformer.parse({}, props.entity) : void 0);
|
|
4970
4978
|
const value = ref(props.modelValue);
|
|
4971
4979
|
function emitChange() {
|
|
4972
4980
|
emits("change", value.value);
|
|
@@ -4979,10 +4987,10 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
4979
4987
|
}
|
|
4980
4988
|
const isClearButtonShow = ref(props.showClear);
|
|
4981
4989
|
const placeholderRef = ref(props.placeholder);
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4990
|
+
const formConfig = ref(void 0);
|
|
4991
|
+
const fieldConfig = ref(void 0);
|
|
4992
|
+
const fieldName = ref("");
|
|
4993
|
+
const dictionary = ref(void 0);
|
|
4986
4994
|
function onPropsValueUpdated(newProps) {
|
|
4987
4995
|
if (newProps) {
|
|
4988
4996
|
if (newProps.disabled) {
|
|
@@ -4995,8 +5003,9 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
4995
5003
|
}
|
|
4996
5004
|
}
|
|
4997
5005
|
const getShowFormatter = computed(() => {
|
|
4998
|
-
|
|
4999
|
-
|
|
5006
|
+
var _a;
|
|
5007
|
+
if (formConfig.value) {
|
|
5008
|
+
switch ((_a = formConfig.value) == null ? void 0 : _a.dateType) {
|
|
5000
5009
|
case DateTimeType.DATE:
|
|
5001
5010
|
return DateTimeFormatter.FULL_DATE;
|
|
5002
5011
|
case DateTimeType.WEEK:
|
|
@@ -5012,21 +5021,22 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
5012
5021
|
return DateTimeFormatter.FULL_DATE_TIME;
|
|
5013
5022
|
});
|
|
5014
5023
|
function getSwitchColor(status) {
|
|
5015
|
-
var _a;
|
|
5016
|
-
return ((_a = dictionary == null ? void 0 :
|
|
5024
|
+
var _a, _b;
|
|
5025
|
+
return ((_b = (_a = dictionary.value) == null ? void 0 : _a.find((item) => !!item.key === status)) == null ? void 0 : _b.color) || "";
|
|
5017
5026
|
}
|
|
5018
5027
|
function getSwitchLabel(status) {
|
|
5019
|
-
var _a;
|
|
5020
|
-
return ((_a = dictionary == null ? void 0 :
|
|
5028
|
+
var _a, _b;
|
|
5029
|
+
return ((_b = (_a = dictionary.value) == null ? void 0 : _a.find((item) => !!item.key === status)) == null ? void 0 : _b.label) || "";
|
|
5021
5030
|
}
|
|
5022
5031
|
const getInputType = computed(() => {
|
|
5023
|
-
|
|
5032
|
+
var _a, _b, _c;
|
|
5033
|
+
if ((_a = formConfig.value) == null ? void 0 : _a.textarea) {
|
|
5024
5034
|
return "textarea";
|
|
5025
5035
|
}
|
|
5026
|
-
if (formConfig == null ? void 0 :
|
|
5036
|
+
if ((_b = formConfig.value) == null ? void 0 : _b.password) {
|
|
5027
5037
|
return "password";
|
|
5028
5038
|
}
|
|
5029
|
-
if (formConfig == null ? void 0 :
|
|
5039
|
+
if ((_c = formConfig.value) == null ? void 0 : _c.number) {
|
|
5030
5040
|
return "number";
|
|
5031
5041
|
}
|
|
5032
5042
|
return "text";
|
|
@@ -5036,20 +5046,20 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
5036
5046
|
onPropsValueUpdated(newProps);
|
|
5037
5047
|
});
|
|
5038
5048
|
function checkNumberValue() {
|
|
5039
|
-
var _a, _b;
|
|
5040
|
-
if (formConfig == null ? void 0 :
|
|
5049
|
+
var _a, _b, _c;
|
|
5050
|
+
if ((_a = formConfig.value) == null ? void 0 : _a.number) {
|
|
5041
5051
|
let tempValue = value.value;
|
|
5042
|
-
const max = Math.min(formConfig.max ?? WebConfig.maxNumber, Number.MAX_SAFE_INTEGER);
|
|
5043
|
-
const min = Math.max(formConfig.min ?? WebConfig.minNumber, Number.MIN_SAFE_INTEGER);
|
|
5052
|
+
const max = Math.min(formConfig.value.max ?? WebConfig.maxNumber, Number.MAX_SAFE_INTEGER);
|
|
5053
|
+
const min = Math.max(formConfig.value.min ?? WebConfig.minNumber, Number.MIN_SAFE_INTEGER);
|
|
5044
5054
|
if (tempValue !== "" && tempValue !== void 0 && tempValue !== null && ValidateUtil.isNumber(tempValue.toString())) {
|
|
5045
5055
|
tempValue = Number.parseFloat(tempValue.toString());
|
|
5046
5056
|
tempValue = Math.max(tempValue, min);
|
|
5047
5057
|
tempValue = Math.min(tempValue, max);
|
|
5048
|
-
tempValue = Number.parseFloat(tempValue.toFixed(formConfig.precision ?? WebConfig.numberPrecision));
|
|
5058
|
+
tempValue = Number.parseFloat(tempValue.toFixed(formConfig.value.precision ?? WebConfig.numberPrecision));
|
|
5049
5059
|
value.value = tempValue;
|
|
5050
|
-
value.value = Number.parseFloat(((
|
|
5060
|
+
value.value = Number.parseFloat(((_b = value.value) == null ? void 0 : _b.toString()) || "0");
|
|
5051
5061
|
}
|
|
5052
|
-
value.value = Number.parseFloat(((
|
|
5062
|
+
value.value = Number.parseFloat(((_c = value.value) == null ? void 0 : _c.toString()) || "0");
|
|
5053
5063
|
}
|
|
5054
5064
|
}
|
|
5055
5065
|
function onClear() {
|
|
@@ -5057,8 +5067,8 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
5057
5067
|
emitChange();
|
|
5058
5068
|
}
|
|
5059
5069
|
function emitValue() {
|
|
5060
|
-
if (formConfig && value.value) {
|
|
5061
|
-
switch (formConfig.trim) {
|
|
5070
|
+
if (formConfig.value && value.value) {
|
|
5071
|
+
switch (formConfig.value.trim) {
|
|
5062
5072
|
case FormTrim.ALL:
|
|
5063
5073
|
value.value = value.value.toString().trim();
|
|
5064
5074
|
break;
|
|
@@ -5074,14 +5084,15 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
5074
5084
|
emitChange();
|
|
5075
5085
|
}
|
|
5076
5086
|
function onKeyDown(event) {
|
|
5087
|
+
var _a, _b;
|
|
5077
5088
|
switch (event.code) {
|
|
5078
5089
|
case "KeyE":
|
|
5079
|
-
if (formConfig == null ? void 0 :
|
|
5090
|
+
if ((_a = formConfig.value) == null ? void 0 : _a.number) {
|
|
5080
5091
|
event.preventDefault();
|
|
5081
5092
|
}
|
|
5082
5093
|
break;
|
|
5083
5094
|
case "Escape":
|
|
5084
|
-
if ((formConfig == null ? void 0 :
|
|
5095
|
+
if (((_b = formConfig.value) == null ? void 0 : _b.clearable) !== false) {
|
|
5085
5096
|
value.value = void 0;
|
|
5086
5097
|
emitValue();
|
|
5087
5098
|
}
|
|
@@ -5098,37 +5109,38 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
5098
5109
|
});
|
|
5099
5110
|
function initFieldName() {
|
|
5100
5111
|
if (props.modifier) {
|
|
5101
|
-
fieldName = props.modifier;
|
|
5112
|
+
fieldName.value = props.modifier;
|
|
5102
5113
|
} else {
|
|
5103
5114
|
for (const key in props.modelModifiers) {
|
|
5104
|
-
fieldName = key;
|
|
5115
|
+
fieldName.value = key;
|
|
5105
5116
|
}
|
|
5106
5117
|
}
|
|
5107
5118
|
}
|
|
5108
5119
|
function init() {
|
|
5120
|
+
var _a, _b;
|
|
5109
5121
|
initFieldName();
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5122
|
+
console.warn(props.entity, fieldName.value, entityInstance.value);
|
|
5123
|
+
if (props.entity && fieldName.value && entityInstance.value) {
|
|
5124
|
+
formConfig.value = getFormConfig(entityInstance.value, fieldName.value);
|
|
5125
|
+
fieldConfig.value = getFieldConfig(entityInstance.value, fieldName.value);
|
|
5113
5126
|
if (!placeholderRef.value) {
|
|
5114
|
-
const field = fieldConfig.label || getFieldConfig(entityInstance, fieldName).label || fieldName;
|
|
5127
|
+
const field = fieldConfig.value.label || getFieldConfig(entityInstance.value, fieldName.value).label || fieldName;
|
|
5115
5128
|
placeholderRef.value = `请输入${field}...`;
|
|
5116
|
-
if (formConfig) {
|
|
5117
|
-
if (dictionary || fieldConfig.dictionary || props.list || props.tree || formConfig.dateType !== void 0) {
|
|
5129
|
+
if (formConfig.value) {
|
|
5130
|
+
if (dictionary.value || fieldConfig.value.dictionary || props.list || props.tree || formConfig.value.dateType !== void 0) {
|
|
5118
5131
|
placeholderRef.value = WebI18n.get().SelectPlease;
|
|
5119
5132
|
}
|
|
5120
|
-
if (formConfig.placeholder) {
|
|
5121
|
-
placeholderRef.value = formConfig.placeholder;
|
|
5133
|
+
if (formConfig.value.placeholder) {
|
|
5134
|
+
placeholderRef.value = formConfig.value.placeholder;
|
|
5122
5135
|
}
|
|
5123
5136
|
}
|
|
5124
5137
|
}
|
|
5125
5138
|
}
|
|
5126
|
-
|
|
5127
|
-
|
|
5139
|
+
dictionary.value = props.list ? props.list : formConfig.value && ((_a = fieldConfig.value) == null ? void 0 : _a.dictionary) ? fieldConfig.value.dictionary.toArray() : void 0;
|
|
5140
|
+
if (props.modelValue === void 0 && ((_b = formConfig.value) == null ? void 0 : _b.defaultValue) !== void 0) {
|
|
5141
|
+
value.value = formConfig.value.defaultValue;
|
|
5128
5142
|
emitValue();
|
|
5129
|
-
return;
|
|
5130
5143
|
}
|
|
5131
|
-
dictionary = props.list ? props.list : formConfig && (fieldConfig == null ? void 0 : fieldConfig.dictionary) ? fieldConfig.dictionary.toArray() : void 0;
|
|
5132
5144
|
onPropsValueUpdated(props);
|
|
5133
5145
|
}
|
|
5134
5146
|
const slots = useSlots();
|
|
@@ -5147,20 +5159,20 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
5147
5159
|
const _component_el_icon = resolveComponent("el-icon");
|
|
5148
5160
|
const _component_el_input = resolveComponent("el-input");
|
|
5149
5161
|
return openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
5150
|
-
|
|
5151
|
-
|
|
5162
|
+
formConfig.value && formConfig.value.dateType !== void 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
5163
|
+
formConfig.value.dateType !== unref(DateTimeType).DATE ? (openBlock(), createBlock(_component_el_date_picker, {
|
|
5152
5164
|
key: 0,
|
|
5153
5165
|
modelValue: value.value,
|
|
5154
5166
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
|
|
5155
|
-
clearable: (_a =
|
|
5167
|
+
clearable: ((_a = formConfig.value) == null ? void 0 : _a.clearable) !== false,
|
|
5156
5168
|
disabled: __props.disabled,
|
|
5157
|
-
format:
|
|
5169
|
+
format: formConfig.value.dateShowFormatter || getShowFormatter.value,
|
|
5158
5170
|
placeholder: placeholderRef.value,
|
|
5159
|
-
"prefix-icon": (_b =
|
|
5171
|
+
"prefix-icon": (_b = formConfig.value) == null ? void 0 : _b.prefixIcon,
|
|
5160
5172
|
readonly: __props.readonly,
|
|
5161
|
-
"suffix-icon": (_c =
|
|
5162
|
-
type:
|
|
5163
|
-
"value-format":
|
|
5173
|
+
"suffix-icon": (_c = formConfig.value) == null ? void 0 : _c.suffixIcon,
|
|
5174
|
+
type: formConfig.value.dateType,
|
|
5175
|
+
"value-format": formConfig.value.dateFormatter,
|
|
5164
5176
|
style: { "width": "100%" },
|
|
5165
5177
|
onClear,
|
|
5166
5178
|
onFocus: _cache[1] || (_cache[1] = ($event) => emits("focus")),
|
|
@@ -5169,21 +5181,21 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
5169
5181
|
key: 1,
|
|
5170
5182
|
modelValue: value.value,
|
|
5171
5183
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => value.value = $event),
|
|
5172
|
-
clearable: (_d =
|
|
5184
|
+
clearable: ((_d = formConfig.value) == null ? void 0 : _d.clearable) !== false,
|
|
5173
5185
|
disabled: __props.disabled,
|
|
5174
|
-
format:
|
|
5186
|
+
format: formConfig.value.dateShowFormatter || unref(DateTimeFormatter).FULL_TIME,
|
|
5175
5187
|
placeholder: placeholderRef.value,
|
|
5176
|
-
"prefix-icon": (_e =
|
|
5188
|
+
"prefix-icon": (_e = formConfig.value) == null ? void 0 : _e.prefixIcon,
|
|
5177
5189
|
readonly: __props.readonly,
|
|
5178
|
-
"suffix-icon": (_f =
|
|
5179
|
-
"value-format":
|
|
5190
|
+
"suffix-icon": (_f = formConfig.value) == null ? void 0 : _f.suffixIcon,
|
|
5191
|
+
"value-format": formConfig.value.dateFormatter,
|
|
5180
5192
|
style: { "width": "100%" },
|
|
5181
5193
|
onClear,
|
|
5182
5194
|
onFocus: _cache[3] || (_cache[3] = ($event) => emits("focus")),
|
|
5183
5195
|
onKeydown: onKeyDown
|
|
5184
5196
|
}, null, 8, ["modelValue", "clearable", "disabled", "format", "placeholder", "prefix-icon", "readonly", "suffix-icon", "value-format"]))
|
|
5185
|
-
], 64)) : __props.list ||
|
|
5186
|
-
((_g =
|
|
5197
|
+
], 64)) : __props.list || dictionary.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
5198
|
+
((_g = formConfig.value) == null ? void 0 : _g.switch) ? (openBlock(), createBlock(_component_el_switch, {
|
|
5187
5199
|
key: 0,
|
|
5188
5200
|
modelValue: value.value,
|
|
5189
5201
|
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => value.value = $event),
|
|
@@ -5194,14 +5206,14 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
5194
5206
|
"--el-switch-on-color": getSwitchColor(true),
|
|
5195
5207
|
"--el-switch-off-color": getSwitchColor(false)
|
|
5196
5208
|
})
|
|
5197
|
-
}, null, 8, ["modelValue", "active-text", "inactive-text", "readonly", "style"])) : ((_h =
|
|
5209
|
+
}, null, 8, ["modelValue", "active-text", "inactive-text", "readonly", "style"])) : ((_h = formConfig.value) == null ? void 0 : _h.radioButton) ? (openBlock(), createBlock(_component_el_radio_group, {
|
|
5198
5210
|
key: 1,
|
|
5199
5211
|
modelValue: value.value,
|
|
5200
5212
|
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => value.value = $event),
|
|
5201
5213
|
readonly: __props.readonly
|
|
5202
5214
|
}, {
|
|
5203
5215
|
default: withCtx(() => [
|
|
5204
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
5216
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(dictionary.value, (item) => {
|
|
5205
5217
|
return openBlock(), createBlock(_component_el_radio_button, {
|
|
5206
5218
|
key: item.key,
|
|
5207
5219
|
value: item.key
|
|
@@ -5214,14 +5226,14 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
5214
5226
|
}), 128))
|
|
5215
5227
|
]),
|
|
5216
5228
|
_: 1
|
|
5217
|
-
}, 8, ["modelValue", "readonly"])) : ((_i =
|
|
5229
|
+
}, 8, ["modelValue", "readonly"])) : ((_i = formConfig.value) == null ? void 0 : _i.radio) ? (openBlock(), createBlock(_component_el_radio_group, {
|
|
5218
5230
|
key: 2,
|
|
5219
5231
|
modelValue: value.value,
|
|
5220
5232
|
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => value.value = $event),
|
|
5221
5233
|
readonly: __props.readonly
|
|
5222
5234
|
}, {
|
|
5223
5235
|
default: withCtx(() => [
|
|
5224
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
5236
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(dictionary.value, (item) => {
|
|
5225
5237
|
return openBlock(), createBlock(_component_el_radio, {
|
|
5226
5238
|
key: item.key,
|
|
5227
5239
|
value: item.key
|
|
@@ -5238,18 +5250,18 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
5238
5250
|
key: 3,
|
|
5239
5251
|
modelValue: value.value,
|
|
5240
5252
|
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => value.value = $event),
|
|
5241
|
-
clearable: (_j =
|
|
5242
|
-
"collapse-tags": (_k =
|
|
5253
|
+
clearable: ((_j = formConfig.value) == null ? void 0 : _j.clearable) !== false,
|
|
5254
|
+
"collapse-tags": (_k = formConfig.value) == null ? void 0 : _k.collapseTags,
|
|
5243
5255
|
disabled: __props.disabled,
|
|
5244
|
-
filterable: (_l =
|
|
5245
|
-
multiple: (_m =
|
|
5246
|
-
"multiple-limit": (_n =
|
|
5256
|
+
filterable: (_l = formConfig.value) == null ? void 0 : _l.filterable,
|
|
5257
|
+
multiple: (_m = formConfig.value) == null ? void 0 : _m.multiple,
|
|
5258
|
+
"multiple-limit": (_n = formConfig.value) == null ? void 0 : _n.multipleLimit,
|
|
5247
5259
|
placeholder: placeholderRef.value,
|
|
5248
|
-
"prefix-icon": (_o =
|
|
5260
|
+
"prefix-icon": (_o = formConfig.value) == null ? void 0 : _o.prefixIcon,
|
|
5249
5261
|
readonly: __props.readonly,
|
|
5250
5262
|
remote: !!__props.onSearch,
|
|
5251
5263
|
"remote-method": __props.onSearch,
|
|
5252
|
-
"suffix-icon": (_p =
|
|
5264
|
+
"suffix-icon": (_p = formConfig.value) == null ? void 0 : _p.suffixIcon,
|
|
5253
5265
|
"collapse-tags-tooltip": "",
|
|
5254
5266
|
"fit-input-width": "",
|
|
5255
5267
|
onClear,
|
|
@@ -5257,7 +5269,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
5257
5269
|
onKeydown: onKeyDown
|
|
5258
5270
|
}, {
|
|
5259
5271
|
default: withCtx(() => [
|
|
5260
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
5272
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(dictionary.value, (item) => {
|
|
5261
5273
|
return openBlock(), createBlock(_component_el_option, {
|
|
5262
5274
|
key: item.key.toString(),
|
|
5263
5275
|
disabled: item.disabled,
|
|
@@ -5267,7 +5279,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
5267
5279
|
default: withCtx(() => {
|
|
5268
5280
|
var _a2;
|
|
5269
5281
|
return [
|
|
5270
|
-
((_a2 =
|
|
5282
|
+
((_a2 = formConfig.value) == null ? void 0 : _a2.color) ? (openBlock(), createElementBlock("div", _hoisted_2$7, [
|
|
5271
5283
|
createElementVNode("span", _hoisted_3$6, toDisplayString(item.label), 1),
|
|
5272
5284
|
createElementVNode("span", {
|
|
5273
5285
|
style: normalizeStyle({ backgroundColor: item.color || unref(WebColor).NORMAL }),
|
|
@@ -5282,24 +5294,24 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
5282
5294
|
]),
|
|
5283
5295
|
_: 1
|
|
5284
5296
|
}, 8, ["modelValue", "clearable", "collapse-tags", "disabled", "filterable", "multiple", "multiple-limit", "placeholder", "prefix-icon", "readonly", "remote", "remote-method", "suffix-icon"]))
|
|
5285
|
-
], 64)) :
|
|
5297
|
+
], 64)) : formConfig.value && __props.tree ? (openBlock(), createBlock(_component_el_cascader, {
|
|
5286
5298
|
key: 2,
|
|
5287
5299
|
modelValue: value.value,
|
|
5288
5300
|
"onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => value.value = $event),
|
|
5289
|
-
clearable: (_q =
|
|
5290
|
-
"collapse-tags": (_r =
|
|
5301
|
+
clearable: ((_q = formConfig.value) == null ? void 0 : _q.clearable) !== false,
|
|
5302
|
+
"collapse-tags": (_r = formConfig.value) == null ? void 0 : _r.collapseTags,
|
|
5291
5303
|
disabled: __props.disabled,
|
|
5292
5304
|
options: __props.tree,
|
|
5293
5305
|
placeholder: placeholderRef.value,
|
|
5294
5306
|
props: {
|
|
5295
5307
|
value: "id",
|
|
5296
5308
|
label: "name",
|
|
5297
|
-
multiple: (_s =
|
|
5298
|
-
emitPath: (_t =
|
|
5299
|
-
checkStrictly: (_u =
|
|
5309
|
+
multiple: (_s = formConfig.value) == null ? void 0 : _s.multiple,
|
|
5310
|
+
emitPath: (_t = formConfig.value) == null ? void 0 : _t.emitPath,
|
|
5311
|
+
checkStrictly: (_u = formConfig.value) == null ? void 0 : _u.checkStrictly
|
|
5300
5312
|
},
|
|
5301
5313
|
readonly: __props.readonly,
|
|
5302
|
-
"show-all-levels": (_v =
|
|
5314
|
+
"show-all-levels": (_v = formConfig.value) == null ? void 0 : _v.showAllLevels,
|
|
5303
5315
|
class: "a-input-cascader",
|
|
5304
5316
|
"collapse-tags-tooltip": "",
|
|
5305
5317
|
"popper-class": "a-input-cascader-popper",
|
|
@@ -5310,18 +5322,18 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
5310
5322
|
key: 3,
|
|
5311
5323
|
modelValue: value.value,
|
|
5312
5324
|
"onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => value.value = $event),
|
|
5313
|
-
autosize: ((_w =
|
|
5314
|
-
clearable: (_x =
|
|
5325
|
+
autosize: ((_w = formConfig.value) == null ? void 0 : _w.autoSize) ? { minRows: formConfig.value.minRows, maxRows: formConfig.value.maxRows } : false,
|
|
5326
|
+
clearable: ((_x = formConfig.value) == null ? void 0 : _x.clearable) !== false,
|
|
5315
5327
|
disabled: __props.disabled,
|
|
5316
|
-
max: (_y =
|
|
5317
|
-
maxlength: ((_z =
|
|
5318
|
-
min: ((_B =
|
|
5328
|
+
max: (_y = formConfig.value) == null ? void 0 : _y.max,
|
|
5329
|
+
maxlength: ((_z = formConfig.value) == null ? void 0 : _z.maxLength) || (((_A = formConfig.value) == null ? void 0 : _A.textarea) ? unref(WebConfig).maxTextAreaLength : unref(WebConfig).maxTextLength),
|
|
5330
|
+
min: ((_B = formConfig.value) == null ? void 0 : _B.min) ?? 0,
|
|
5319
5331
|
placeholder: placeholderRef.value,
|
|
5320
|
-
"prefix-icon": (_C =
|
|
5332
|
+
"prefix-icon": (_C = formConfig.value) == null ? void 0 : _C.prefixIcon,
|
|
5321
5333
|
readonly: __props.readonly,
|
|
5322
|
-
rows: ((_D =
|
|
5323
|
-
"show-word-limit": ((_E =
|
|
5324
|
-
"suffix-icon": (_F =
|
|
5334
|
+
rows: ((_D = formConfig.value) == null ? void 0 : _D.textarea) ? unref(WebConfig).textareaMinRows : 0,
|
|
5335
|
+
"show-word-limit": ((_E = formConfig.value) == null ? void 0 : _E.showLimit) !== false,
|
|
5336
|
+
"suffix-icon": (_F = formConfig.value) == null ? void 0 : _F.suffixIcon,
|
|
5325
5337
|
type: getInputType.value,
|
|
5326
5338
|
onBlur,
|
|
5327
5339
|
onChange: checkNumberValue,
|
|
@@ -5337,7 +5349,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
5337
5349
|
var _a2;
|
|
5338
5350
|
return [
|
|
5339
5351
|
name === "append" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
5340
|
-
createTextVNode(toDisplayString((_a2 =
|
|
5352
|
+
createTextVNode(toDisplayString((_a2 = formConfig.value) == null ? void 0 : _a2.suffixText), 1)
|
|
5341
5353
|
], 64)) : createCommentVNode("", true),
|
|
5342
5354
|
name === "suffix" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
5343
5355
|
isClearButtonShow.value ? (openBlock(), createBlock(_component_el_icon, {
|
|
@@ -5355,10 +5367,10 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
5355
5367
|
])
|
|
5356
5368
|
};
|
|
5357
5369
|
}),
|
|
5358
|
-
!_ctx.$slots.append && ((_G =
|
|
5370
|
+
!_ctx.$slots.append && ((_G = formConfig.value) == null ? void 0 : _G.suffixText) ? {
|
|
5359
5371
|
name: "append",
|
|
5360
5372
|
fn: withCtx(() => [
|
|
5361
|
-
createTextVNode(toDisplayString(
|
|
5373
|
+
createTextVNode(toDisplayString(formConfig.value.suffixText), 1)
|
|
5362
5374
|
]),
|
|
5363
5375
|
key: "0"
|
|
5364
5376
|
} : void 0
|
|
@@ -7063,9 +7075,9 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
7063
7075
|
};
|
|
7064
7076
|
}
|
|
7065
7077
|
});
|
|
7066
|
-
function useDetail(props,
|
|
7078
|
+
function useDetail(props, ServiceClass, option = {}) {
|
|
7067
7079
|
const isLoading = ref(false);
|
|
7068
|
-
const service = Transformer.newInstance(
|
|
7080
|
+
const service = Transformer.newInstance(ServiceClass);
|
|
7069
7081
|
service.loading = isLoading;
|
|
7070
7082
|
const formData = ref(props.param ? props.param.copy() : Transformer.newInstance(service.entityClass));
|
|
7071
7083
|
const title = ref(WebI18n.get().Detail);
|
|
@@ -7091,10 +7103,10 @@ function useDetail(props, serviceClass, option = {}) {
|
|
|
7091
7103
|
getDetail
|
|
7092
7104
|
};
|
|
7093
7105
|
}
|
|
7094
|
-
function useEditor(props,
|
|
7095
|
-
const result = useDetail(props,
|
|
7106
|
+
function useEditor(props, ServiceClass, option = {}) {
|
|
7107
|
+
const result = useDetail(props, ServiceClass, option);
|
|
7096
7108
|
const title = computed(() => result.formData.value.id ? WebI18n.get().Update : WebI18n.get().Add);
|
|
7097
|
-
const rules =
|
|
7109
|
+
const rules = WebValidator.createRules(new ServiceClass(), option.customRules || {});
|
|
7098
7110
|
const formRef = ref();
|
|
7099
7111
|
async function onSubmit() {
|
|
7100
7112
|
let postData = result.formData.value.copy();
|
|
@@ -7181,7 +7193,7 @@ function useBaseTable(serviceClass, option = {}) {
|
|
|
7181
7193
|
}
|
|
7182
7194
|
async function onAdd() {
|
|
7183
7195
|
if (!option.editView) {
|
|
7184
|
-
FeedbackUtil.toastError("请为
|
|
7196
|
+
FeedbackUtil.toastError("请为 useTable 的 option 传入 editView");
|
|
7185
7197
|
return;
|
|
7186
7198
|
}
|
|
7187
7199
|
try {
|
|
@@ -7192,7 +7204,7 @@ function useBaseTable(serviceClass, option = {}) {
|
|
|
7192
7204
|
}
|
|
7193
7205
|
async function onDetail(row) {
|
|
7194
7206
|
if (!option.detailView) {
|
|
7195
|
-
FeedbackUtil.toastError("请为
|
|
7207
|
+
FeedbackUtil.toastError("请为 useTable 的 option 传入 detailView");
|
|
7196
7208
|
return;
|
|
7197
7209
|
}
|
|
7198
7210
|
try {
|
|
@@ -7236,7 +7248,7 @@ function useTable(serviceClass, option = {}) {
|
|
|
7236
7248
|
const result = useBaseTable(serviceClass, option);
|
|
7237
7249
|
async function onEdit(row) {
|
|
7238
7250
|
if (!option.editView) {
|
|
7239
|
-
await FeedbackUtil.toastError("请为
|
|
7251
|
+
await FeedbackUtil.toastError("请为 useTable 的 option 传入 editor");
|
|
7240
7252
|
return;
|
|
7241
7253
|
}
|
|
7242
7254
|
try {
|
|
@@ -7283,7 +7295,7 @@ function useTableTree(serviceClass, option = {}) {
|
|
|
7283
7295
|
const result = useTable(serviceClass, option);
|
|
7284
7296
|
async function onAddRow(row) {
|
|
7285
7297
|
if (!option.editView) {
|
|
7286
|
-
FeedbackUtil.toastError("请为
|
|
7298
|
+
FeedbackUtil.toastError("请为 useTable 的 option 传入 editor");
|
|
7287
7299
|
return;
|
|
7288
7300
|
}
|
|
7289
7301
|
try {
|
|
@@ -7582,11 +7594,11 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
7582
7594
|
setup(__props) {
|
|
7583
7595
|
const props = __props;
|
|
7584
7596
|
const key = props.column.key;
|
|
7585
|
-
const value = (props.data[key] || "").toString() || props.column.emptyValue || "-";
|
|
7597
|
+
const value = computed(() => (props.data[key] || "").toString() || props.column.emptyValue || "-");
|
|
7586
7598
|
return (_ctx, _cache) => {
|
|
7587
|
-
return openBlock(), createBlock(unref(ACopy), { content:
|
|
7599
|
+
return openBlock(), createBlock(unref(ACopy), { content: value.value }, {
|
|
7588
7600
|
default: withCtx(() => [
|
|
7589
|
-
createTextVNode(toDisplayString(
|
|
7601
|
+
createTextVNode(toDisplayString(value.value), 1)
|
|
7590
7602
|
]),
|
|
7591
7603
|
_: 1
|
|
7592
7604
|
}, 8, ["content"]);
|
|
@@ -7604,23 +7616,23 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
7604
7616
|
setup(__props) {
|
|
7605
7617
|
const props = __props;
|
|
7606
7618
|
const key = props.column.key;
|
|
7607
|
-
const value = props.data[key];
|
|
7619
|
+
const value = computed(() => props.data[key]);
|
|
7608
7620
|
return (_ctx, _cache) => {
|
|
7609
7621
|
var _a;
|
|
7610
7622
|
return openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
7611
7623
|
_ctx.column.color ? (openBlock(), createElementBlock("span", {
|
|
7612
7624
|
key: 0,
|
|
7613
7625
|
style: normalizeStyle({
|
|
7614
|
-
backgroundColor: ((_a = _ctx.dictionary.get(
|
|
7626
|
+
backgroundColor: ((_a = _ctx.dictionary.get(value.value)) == null ? void 0 : _a.color) || unref(WebColor).NORMAL
|
|
7615
7627
|
}),
|
|
7616
7628
|
class: "light"
|
|
7617
7629
|
}, null, 4)) : createCommentVNode("", true),
|
|
7618
|
-
createTextVNode(" " + toDisplayString(_ctx.dictionary.getLabel(
|
|
7630
|
+
createTextVNode(" " + toDisplayString(_ctx.dictionary.getLabel(value.value, _ctx.column.emptyValue)), 1)
|
|
7619
7631
|
]);
|
|
7620
7632
|
};
|
|
7621
7633
|
}
|
|
7622
7634
|
});
|
|
7623
|
-
const EnumColumn = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
|
7635
|
+
const EnumColumn = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-96a9c313"]]);
|
|
7624
7636
|
function useTableButton(params) {
|
|
7625
7637
|
const {
|
|
7626
7638
|
entityClass,
|
|
@@ -7770,7 +7782,7 @@ const _hoisted_4$1 = {
|
|
|
7770
7782
|
style: { "color": "#aaa", "margin-right": "3px" }
|
|
7771
7783
|
};
|
|
7772
7784
|
const _hoisted_5$1 = {
|
|
7773
|
-
key:
|
|
7785
|
+
key: 6,
|
|
7774
7786
|
style: { "color": "#aaa" }
|
|
7775
7787
|
};
|
|
7776
7788
|
const _hoisted_6 = { class: "custom-header" };
|
|
@@ -8275,7 +8287,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
8275
8287
|
() => {
|
|
8276
8288
|
nextTick(() => {
|
|
8277
8289
|
toggleSelection();
|
|
8278
|
-
const table = document.
|
|
8290
|
+
const table = document.getElementById(tableId);
|
|
8279
8291
|
const bodyWrap = table == null ? void 0 : table.querySelector(".el-scrollbar__wrap");
|
|
8280
8292
|
bodyWrap.scrollTop = 0;
|
|
8281
8293
|
});
|
|
@@ -8535,10 +8547,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
8535
8547
|
width: item.width || "auto"
|
|
8536
8548
|
}, {
|
|
8537
8549
|
default: withCtx((scope) => [
|
|
8538
|
-
scope
|
|
8550
|
+
scope.$index >= 0 ? renderSlot(_ctx.$slots, item.key, {
|
|
8539
8551
|
key: 0,
|
|
8540
8552
|
data: getRowEntity(scope),
|
|
8541
|
-
index: scope
|
|
8553
|
+
index: scope.$index
|
|
8542
8554
|
}, () => [
|
|
8543
8555
|
item.prefixText ? (openBlock(), createElementBlock("span", _hoisted_4$1, toDisplayString(item.prefixText), 1)) : createCommentVNode("", true),
|
|
8544
8556
|
unref(getDictionary)(unref(entityInstance), item.key) ? (openBlock(), createBlock(unref(EnumColumn), {
|
|
@@ -8546,16 +8558,20 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
8546
8558
|
column: item,
|
|
8547
8559
|
data: scope.row,
|
|
8548
8560
|
dictionary: unref(getDictionary)(unref(entityInstance), item.key)
|
|
8549
|
-
}, null, 8, ["column", "data", "dictionary"])) : item.
|
|
8561
|
+
}, null, 8, ["column", "data", "dictionary"])) : item.desensitize ? (openBlock(), createBlock(unref(ADesensitize), {
|
|
8550
8562
|
key: 2,
|
|
8563
|
+
content: getValue(scope, item.key),
|
|
8564
|
+
type: item.desensitize
|
|
8565
|
+
}, null, 8, ["content", "type"])) : item.datetime ? (openBlock(), createBlock(unref(ADateTime), {
|
|
8566
|
+
key: 3,
|
|
8551
8567
|
formatter: item.datetime === true ? unref(DateTimeFormatter).FULL_DATE_TIME : item.datetime,
|
|
8552
8568
|
time: getValue(scope, item.key)
|
|
8553
8569
|
}, null, 8, ["formatter", "time"])) : item.copy ? (openBlock(), createBlock(unref(_sfc_main$4), {
|
|
8554
|
-
key:
|
|
8570
|
+
key: 4,
|
|
8555
8571
|
column: item,
|
|
8556
8572
|
data: scope.row
|
|
8557
8573
|
}, null, 8, ["column", "data"])) : (openBlock(), createElementBlock("div", {
|
|
8558
|
-
key:
|
|
8574
|
+
key: 5,
|
|
8559
8575
|
class: normalizeClass([item.nowrap ? "nowrap" : "", "a-table-column"])
|
|
8560
8576
|
}, toDisplayString(getStringValue(getValue(scope, item.key)) ?? item.emptyValue), 3)),
|
|
8561
8577
|
item.suffixText ? (openBlock(), createElementBlock("span", _hoisted_5$1, toDisplayString(item.suffixText), 1)) : createCommentVNode("", true)
|
|
@@ -9008,11 +9024,10 @@ class AbstractCurdService extends AbstractService {
|
|
|
9008
9024
|
}
|
|
9009
9025
|
/**
|
|
9010
9026
|
* ### 创建验证器
|
|
9011
|
-
* @param form 表单对象
|
|
9012
9027
|
* @param moreRule `可选` 更多的验证规则
|
|
9013
9028
|
*/
|
|
9014
|
-
static createValidator(
|
|
9015
|
-
return
|
|
9029
|
+
static createValidator(moreRule = {}) {
|
|
9030
|
+
return WebValidator.createRules(new this(), moreRule);
|
|
9016
9031
|
}
|
|
9017
9032
|
/**
|
|
9018
9033
|
* ### 查询分页数据列表
|
|
@@ -9127,14 +9142,6 @@ class AbstractCurdService extends AbstractService {
|
|
|
9127
9142
|
FeedbackUtil.toastError(err.message);
|
|
9128
9143
|
}
|
|
9129
9144
|
}
|
|
9130
|
-
/**
|
|
9131
|
-
* ### 创建验证器
|
|
9132
|
-
* @param form 表单对象
|
|
9133
|
-
* @param moreRule `可选` 更多的验证规则
|
|
9134
|
-
*/
|
|
9135
|
-
createValidator(form, moreRule = {}) {
|
|
9136
|
-
return AirValidator.createRules(form, this, moreRule);
|
|
9137
|
-
}
|
|
9138
9145
|
/**
|
|
9139
9146
|
* ### 创建一个实体的实例
|
|
9140
9147
|
* @param id `可选` `ID`
|
|
@@ -9152,7 +9159,7 @@ export {
|
|
|
9152
9159
|
ACall,
|
|
9153
9160
|
ACopy,
|
|
9154
9161
|
ADateTime,
|
|
9155
|
-
|
|
9162
|
+
ADesensitize,
|
|
9156
9163
|
ADialog,
|
|
9157
9164
|
Empty as AEmpty,
|
|
9158
9165
|
_sfc_main$n as AFormField,
|
|
@@ -9177,6 +9184,7 @@ export {
|
|
|
9177
9184
|
User as AUser,
|
|
9178
9185
|
AbstractCurdService,
|
|
9179
9186
|
AbstractService,
|
|
9187
|
+
DialogProps,
|
|
9180
9188
|
DialogUtil,
|
|
9181
9189
|
DisableEnum,
|
|
9182
9190
|
ExportModel,
|
|
@@ -9190,6 +9198,8 @@ export {
|
|
|
9190
9198
|
HttpMethod,
|
|
9191
9199
|
HttpResponse,
|
|
9192
9200
|
HttpStatus,
|
|
9201
|
+
I18n,
|
|
9202
|
+
Language,
|
|
9193
9203
|
Model,
|
|
9194
9204
|
PermissionAction,
|
|
9195
9205
|
PermissionUtil,
|
package/dist/util/http/Http.d.ts
CHANGED
|
@@ -84,8 +84,8 @@ export declare class Http {
|
|
|
84
84
|
*/
|
|
85
85
|
setMethod(method: HttpMethod): this;
|
|
86
86
|
/**
|
|
87
|
-
* ### 设置请求`content-
|
|
88
|
-
* @param contentType `content-
|
|
87
|
+
* ### 设置请求`content-shared`
|
|
88
|
+
* @param contentType `content-shared`
|
|
89
89
|
*/
|
|
90
90
|
setContentType(contentType: HttpContentType): this;
|
|
91
91
|
/**
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { RootEntity } from '../../base';
|
|
2
2
|
import { AbstractCurdService } from '../../curd';
|
|
3
|
-
import { ClassConstructor } from '../../type';
|
|
4
3
|
import { WebValidateRule, WebValidatorCallback, WebValidatorTarget, WebValidatorTrigger, WebValidatorType } from './type';
|
|
5
4
|
/**
|
|
6
5
|
* # 表单验证
|
|
@@ -47,7 +46,7 @@ export declare class WebValidator {
|
|
|
47
46
|
* @param service 接口服务对象
|
|
48
47
|
* @param rules `可选` 表单验证规则
|
|
49
48
|
*/
|
|
50
|
-
static createRules<E extends RootEntity, S extends AbstractCurdService<E
|
|
49
|
+
static createRules<E extends RootEntity, S extends AbstractCurdService<E>>(service: S, rules?: WebValidateRule<E>): WebValidateRule<E>;
|
|
51
50
|
/**
|
|
52
51
|
* ### 获取一个验证器
|
|
53
52
|
* @param configValue 验证器配置的值
|
package/dist/web.css
CHANGED
|
@@ -1281,13 +1281,13 @@ textarea {
|
|
|
1281
1281
|
flex: 1;
|
|
1282
1282
|
height: 0;
|
|
1283
1283
|
align-content: flex-start;
|
|
1284
|
-
}.a-enum-column[data-v-
|
|
1284
|
+
}.a-enum-column[data-v-96a9c313] {
|
|
1285
1285
|
display: flex;
|
|
1286
1286
|
flex-direction: row;
|
|
1287
1287
|
justify-content: flex-start;
|
|
1288
1288
|
align-items: center;
|
|
1289
1289
|
}
|
|
1290
|
-
.a-enum-column .light[data-v-
|
|
1290
|
+
.a-enum-column .light[data-v-96a9c313] {
|
|
1291
1291
|
width: 8px;
|
|
1292
1292
|
height: 8px;
|
|
1293
1293
|
border-radius: 100%;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airpower/web",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.7",
|
|
5
5
|
"description": "AirPower-Web",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Hamm",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@airpower/enum": "^0.0.10",
|
|
43
43
|
"@airpower/i18n": "^0.0.4",
|
|
44
44
|
"@airpower/transformer": "^0.1.0",
|
|
45
|
-
"@airpower/util": "^0.1.
|
|
45
|
+
"@airpower/util": "^0.1.3",
|
|
46
46
|
"@element-plus/icons-vue": "^2.3.1",
|
|
47
47
|
"axios": "^1.8.4",
|
|
48
48
|
"element-plus": "^2.9.7",
|
package/dist/type/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type ClassConstructor<T> = new (...args: unknown[]) => T;
|