@fangzhongya/fang-ui 0.1.38 → 0.1.40
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/common/css.d.ts +7 -0
- package/dist/components/common/list.d.ts +7 -0
- package/dist/components/common/urls.d.ts +6 -0
- package/dist/components/common/use.cjs +153 -125
- package/dist/components/common/use.d.ts +114 -8
- package/dist/components/common/use.js +154 -126
- package/dist/components/company-select/src/index2.cjs +1 -2
- package/dist/components/company-select/src/index2.js +1 -2
- package/dist/components/double/src/index2.cjs +2 -2
- package/dist/components/double/src/index2.js +2 -2
- package/dist/components/forms/index.css +18 -0
- package/dist/components/forms/src/index2.cjs +9 -6
- package/dist/components/forms/src/index2.js +9 -6
- package/dist/components/forms/src/setup.cjs +9 -12
- package/dist/components/forms/src/setup.d.ts +10 -0
- package/dist/components/forms/src/setup.js +9 -12
- package/dist/components/forms/src/util.cjs +8 -10
- package/dist/components/forms/src/util.d.ts +11 -6
- package/dist/components/forms/src/util.js +8 -10
- package/dist/components/forms-div/src/data.cjs +8 -5
- package/dist/components/forms-div/src/data.d.ts +21 -3
- package/dist/components/forms-div/src/data.js +8 -5
- package/dist/components/forms-div/src/index2.cjs +41 -70
- package/dist/components/forms-div/src/index2.js +43 -72
- package/dist/components/forms-item/src/data.cjs +6 -0
- package/dist/components/forms-item/src/data.d.ts +19 -0
- package/dist/components/forms-item/src/data.js +6 -0
- package/dist/components/forms-item/src/index2.cjs +11 -7
- package/dist/components/forms-item/src/index2.js +11 -7
- package/dist/components/forms-item/src/indexts.d.ts +40 -1
- package/dist/components/forms-item/src/label.cjs +7 -2
- package/dist/components/forms-item/src/label.d.ts +40 -1
- package/dist/components/forms-item/src/label.js +7 -2
- package/dist/components/forms-items/index.css +67 -0
- package/dist/components/forms-items/index.scss +21 -0
- package/dist/components/forms-items/src/data.cjs +9 -0
- package/dist/components/forms-items/src/data.d.ts +22 -0
- package/dist/components/forms-items/src/data.js +9 -0
- package/dist/components/forms-items/src/index2.cjs +22 -10
- package/dist/components/forms-items/src/index2.js +22 -10
- package/dist/components/forms-items/style/index2.scss +1 -0
- package/dist/components/icon/src/index2.cjs +1 -2
- package/dist/components/icon/src/index2.js +1 -2
- package/dist/components/input-history/src/index2.cjs +1 -1
- package/dist/components/input-history/src/index2.js +1 -1
- package/dist/components/input-select/src/index2.cjs +0 -2
- package/dist/components/input-select/src/index2.js +0 -2
- package/dist/components/inputs/src/index2.cjs +1 -1
- package/dist/components/inputs/src/index2.js +1 -1
- package/dist/components/list/src/index2.cjs +5 -19
- package/dist/components/list/src/index2.js +5 -19
- package/dist/components/list/src/util.cjs +9 -9
- package/dist/components/list/src/util.d.ts +30 -2
- package/dist/components/list/src/util.js +9 -9
- package/dist/components/lists/src/index2.cjs +1 -2
- package/dist/components/lists/src/index2.js +1 -2
- package/dist/components/menus/src/util.cjs +8 -24
- package/dist/components/menus/src/util.js +9 -25
- package/dist/components/page/index.css +18 -0
- package/dist/components/right-key/src/index2.cjs +3 -3
- package/dist/components/right-key/src/index2.js +3 -3
- package/dist/components/seamless-scroll/src/index2.cjs +1 -1
- package/dist/components/seamless-scroll/src/index2.js +1 -1
- package/dist/components/selects/src/index2.cjs +2 -2
- package/dist/components/selects/src/index2.js +2 -2
- package/dist/components/stick-edge/src/index2.cjs +2 -2
- package/dist/components/stick-edge/src/index2.js +2 -2
- package/dist/components/switchs/src/index2.cjs +1 -1
- package/dist/components/switchs/src/index2.js +1 -1
- package/dist/components/tables/common/com-color2.cjs +0 -3
- package/dist/components/tables/common/com-color2.js +0 -3
- package/dist/components/tables/common/com-lis2.cjs +0 -1
- package/dist/components/tables/common/com-lis2.js +0 -1
- package/dist/components/tables/common/pagin.d.ts +16 -0
- package/dist/components/tables/common/tooltip.cjs +1 -1
- package/dist/components/tables/common/tooltip.js +1 -1
- package/dist/components/tables/common/util.cjs +46 -8
- package/dist/components/tables/common/util.d.ts +13 -0
- package/dist/components/tables/common/util.js +47 -9
- package/dist/components/tables/src/column.cjs +11 -4
- package/dist/components/tables/src/column.d.ts +29 -0
- package/dist/components/tables/src/column.js +11 -4
- package/dist/components/tables/src/columns.d.ts +7 -0
- package/dist/components/tables/src/columns3.cjs +1 -7
- package/dist/components/tables/src/columns3.js +1 -7
- package/dist/components/tables/src/index2.cjs +3 -3
- package/dist/components/tables/src/index2.js +3 -3
- package/dist/components/tablesv/src/column.cjs +11 -4
- package/dist/components/tablesv/src/column.d.ts +25 -0
- package/dist/components/tablesv/src/column.js +11 -4
- package/dist/components/tablesv/src/columns.d.ts +7 -0
- package/dist/components/tablesv/src/columns3.cjs +1 -7
- package/dist/components/tablesv/src/columns3.js +1 -7
- package/dist/components/tablesv/src/index2.cjs +3 -3
- package/dist/components/tablesv/src/index2.js +3 -3
- package/dist/components/uploads/src/util.cjs +2 -3
- package/dist/components/uploads/src/util.d.ts +7 -0
- package/dist/components/uploads/src/util.js +2 -3
- package/dist/css/forms-items.css +67 -0
- package/dist/css/forms.css +18 -0
- package/dist/css/index.css +18 -0
- package/dist/css/page.css +18 -0
- package/dist/directives/adjust/index.cjs +4 -8
- package/dist/directives/adjust/index.js +4 -8
- package/dist/directives/drag/index.cjs +6 -1
- package/dist/directives/drag/index.js +6 -1
- package/dist/directives/expose/index.cjs +6 -0
- package/dist/directives/expose/index.js +6 -0
- package/dist/directives/inserted/index.cjs +5 -0
- package/dist/directives/inserted/index.js +5 -0
- package/dist/directives/locus/index.cjs +5 -0
- package/dist/directives/locus/index.js +5 -0
- package/dist/directives/scroll/index.cjs +10 -0
- package/dist/directives/scroll/index.d.ts +0 -5
- package/dist/directives/scroll/index.js +10 -0
- package/dist/directives/sortable/index.cjs +5 -0
- package/dist/directives/sortable/index.js +5 -0
- package/dist/directives/stick/index.cjs +13 -8
- package/dist/directives/stick/index.js +13 -8
- package/dist/hooks/attrs-default/index.d.ts +5 -3
- package/dist/hooks/compons/index.d.ts +13 -0
- package/dist/hooks/cssname/index.cjs +1 -1
- package/dist/hooks/cssname/index.d.ts +22 -1
- package/dist/hooks/cssname/index.js +1 -1
- package/dist/hooks/default-config/index.d.ts +10 -0
- package/dist/hooks/expose/index.cjs +2 -0
- package/dist/hooks/expose/index.d.ts +6 -0
- package/dist/hooks/expose/index.js +2 -0
- package/dist/hooks/full-screen/index.d.ts +6 -0
- package/dist/hooks/global-config/index.d.ts +16 -0
- package/dist/hooks/inherit/index.cjs +2 -0
- package/dist/hooks/inherit/index.d.ts +8 -0
- package/dist/hooks/inherit/index.js +2 -0
- package/dist/hooks/locale/index.d.ts +24 -0
- package/dist/hooks/props-default/index.d.ts +14 -5
- package/dist/icons/iconify.d.ts +7 -0
- package/dist/icons/iconifyCss.d.ts +6 -0
- package/dist/icons/index.json +1 -1
- package/dist/index.css +18 -0
- package/dist/locale/en.cjs +2 -1
- package/dist/locale/en.d.ts +1 -0
- package/dist/locale/en.js +2 -1
- package/dist/locale/zh-cn.cjs +2 -1
- package/dist/locale/zh-cn.d.ts +1 -0
- package/dist/locale/zh-cn.js +2 -1
- package/dist/type.d.ts +8 -0
- package/dist/utils/css.cjs +4 -0
- package/dist/utils/css.d.ts +1 -0
- package/dist/utils/css.js +4 -0
- package/dist/utils/local.cjs +12 -6
- package/dist/utils/local.js +12 -6
- package/dist/utils/util.cjs +7 -5
- package/dist/utils/util.js +7 -5
- package/package.json +1 -1
|
@@ -2,6 +2,16 @@ import { DataProps } from './data';
|
|
|
2
2
|
import { UseCssNameReturn } from '../../../hooks/cssname/index';
|
|
3
3
|
import { CSSProperties, Ref, WritableComputedRef, ComputedRef } from 'vue';
|
|
4
4
|
type Emit = (...args: any[]) => void;
|
|
5
|
+
/**
|
|
6
|
+
* 初始化表单相关配置与逻辑处理
|
|
7
|
+
*
|
|
8
|
+
* @param props 表单组件的属性对象,包含表单配置、列表项等信息
|
|
9
|
+
* @param emit 事件发射器,用于触发自定义事件(如 submit、cancel 等)
|
|
10
|
+
* @param cs CSS 类名管理工具返回值,用于动态设置样式类名
|
|
11
|
+
* @param refForm 表单引用对象,通常指向 el-form 或其他表单实例
|
|
12
|
+
* @param getLocale 国际化文本获取函数,根据 key 获取对应语言的内容
|
|
13
|
+
* @returns 返回一系列供模板或其他模块使用的响应式数据和方法
|
|
14
|
+
*/
|
|
5
15
|
export declare function setUp(props: DataProps, emit: Emit, cs: UseCssNameReturn, refForm: any, getLocale: Function): {
|
|
6
16
|
dataRules: Ref<ObjAny, ObjAny>;
|
|
7
17
|
dataForm: WritableComputedRef<Record<string, any> | undefined, Record<string, any> | undefined> | Ref<Record<string, any>, Record<string, any>>;
|
|
@@ -12,7 +12,7 @@ const Components = {
|
|
|
12
12
|
};
|
|
13
13
|
function setUp(props, emit, cs, refForm, getLocale) {
|
|
14
14
|
const buts = computed(() => {
|
|
15
|
-
if (
|
|
15
|
+
if (props.buts === void 0) {
|
|
16
16
|
return [
|
|
17
17
|
{
|
|
18
18
|
_id: "2",
|
|
@@ -136,12 +136,9 @@ function setUp(props, emit, cs, refForm, getLocale) {
|
|
|
136
136
|
return rules;
|
|
137
137
|
}
|
|
138
138
|
const dataRules = ref(getRules());
|
|
139
|
-
watch(
|
|
140
|
-
()
|
|
141
|
-
|
|
142
|
-
dataRules.value = getRules();
|
|
143
|
-
}
|
|
144
|
-
);
|
|
139
|
+
watch([() => props.list, () => props.list.length], () => {
|
|
140
|
+
dataRules.value = getRules();
|
|
141
|
+
});
|
|
145
142
|
function validate() {
|
|
146
143
|
return new Promise((resolve, reject) => {
|
|
147
144
|
if (refForm.value) {
|
|
@@ -164,18 +161,18 @@ function setUp(props, emit, cs, refForm, getLocale) {
|
|
|
164
161
|
if (callback) {
|
|
165
162
|
callback(list, true);
|
|
166
163
|
}
|
|
167
|
-
emit("submit", list);
|
|
168
|
-
}).catch((
|
|
164
|
+
emit("submit", list, true);
|
|
165
|
+
}).catch((error) => {
|
|
169
166
|
if (callback) {
|
|
170
|
-
callback(
|
|
167
|
+
callback(error, false);
|
|
171
168
|
}
|
|
172
|
-
emit("submit",
|
|
169
|
+
emit("submit", error, false);
|
|
173
170
|
});
|
|
174
171
|
} else {
|
|
175
172
|
if (callback) {
|
|
176
173
|
callback(obj);
|
|
177
174
|
}
|
|
178
|
-
emit("submit", obj);
|
|
175
|
+
emit("submit", obj, true, true);
|
|
179
176
|
}
|
|
180
177
|
}).catch(() => {
|
|
181
178
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const use = require("../../common/use.cjs");
|
|
4
3
|
const judge = require("@fangzhongya/utils/judge/judge");
|
|
5
4
|
const config = require("../common/config.cjs");
|
|
6
5
|
const lineToLargeHump = require("@fangzhongya/utils/name/lineToLargeHump");
|
|
6
|
+
const use = require("../../common/use.cjs");
|
|
7
7
|
function _interopNamespaceDefault(e) {
|
|
8
8
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
9
9
|
if (e) {
|
|
@@ -40,7 +40,7 @@ function getTrigger(trigger) {
|
|
|
40
40
|
}
|
|
41
41
|
function setPlaceholder(obj, triggerMap) {
|
|
42
42
|
var _a;
|
|
43
|
-
const name =
|
|
43
|
+
const name = use.getLabelText(obj);
|
|
44
44
|
let trigger = "blur";
|
|
45
45
|
if (typeof obj.compon == "string") {
|
|
46
46
|
if (config.changes.includes(lineToLargeHump.lineToLargeHump(obj.compon))) {
|
|
@@ -58,7 +58,7 @@ function getRule(obj, data, refForm, triggerMap) {
|
|
|
58
58
|
if (typeof multiple != "boolean") {
|
|
59
59
|
multiple = false;
|
|
60
60
|
}
|
|
61
|
-
const name =
|
|
61
|
+
const name = use.getLabelText(obj);
|
|
62
62
|
const param = {
|
|
63
63
|
name,
|
|
64
64
|
multiple,
|
|
@@ -125,14 +125,12 @@ function getLinkageJudge(jyjudgev, linkage) {
|
|
|
125
125
|
const v = judge2 == null ? void 0 : judge2(val, data);
|
|
126
126
|
if (v) {
|
|
127
127
|
callback(new Error(v));
|
|
128
|
-
} else {
|
|
129
|
-
|
|
130
|
-
refForm == null ? void 0 : refForm.validateField([prop], () => {
|
|
131
|
-
callback();
|
|
132
|
-
});
|
|
133
|
-
} else {
|
|
128
|
+
} else if (prop) {
|
|
129
|
+
refForm == null ? void 0 : refForm.validateField([prop], () => {
|
|
134
130
|
callback();
|
|
135
|
-
}
|
|
131
|
+
});
|
|
132
|
+
} else {
|
|
133
|
+
callback();
|
|
136
134
|
}
|
|
137
135
|
};
|
|
138
136
|
}
|
|
@@ -6,18 +6,23 @@ type Rule = {
|
|
|
6
6
|
export type Rules = {
|
|
7
7
|
[key: string]: Array<Rule> | Rule;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* 设置对象的占位符文本
|
|
11
|
+
* @param obj - 列表对象,包含配置信息和组件类型
|
|
12
|
+
* @param triggerMap - 触发器映射对象,用于根据触发类型获取对应的提示文本前缀
|
|
13
|
+
*/
|
|
9
14
|
export declare function setPlaceholder(obj: ListObj, triggerMap: ObjStr): void;
|
|
10
15
|
/**
|
|
11
16
|
* 后期要实现 v.rule 多匹配,
|
|
12
17
|
* 错误提示自定义
|
|
13
18
|
*/
|
|
14
19
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
* @returns
|
|
20
|
+
* 根据传入的对象和配置生成表单验证规则数组
|
|
21
|
+
* @param obj - 包含组件配置信息的对象,如是否多选、规则等
|
|
22
|
+
* @param data - 表单数据对象,用于规则判断时使用
|
|
23
|
+
* @param refForm - 表单引用对象,可能用于联动或自定义校验逻辑
|
|
24
|
+
* @param triggerMap - 触发器映射对象,包含验证提示语等信息
|
|
25
|
+
* @returns 返回一个由 Rule 类型组成的数组,表示该字段的所有验证规则
|
|
21
26
|
*/
|
|
22
27
|
export declare function getRule(obj: ListObj, data: any, refForm: any, triggerMap: ObjStr): Rule[];
|
|
23
28
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getLabelText, useHide } from "../../common/use.js";
|
|
2
1
|
import * as judge from "@fangzhongya/utils/judge/judge";
|
|
3
2
|
import { changes } from "../common/config.js";
|
|
4
3
|
import { lineToLargeHump } from "@fangzhongya/utils/name/lineToLargeHump";
|
|
4
|
+
import { getLabelText, useHide } from "../../common/use.js";
|
|
5
5
|
function isValue(value) {
|
|
6
6
|
if (value || value === 0 || value === false) {
|
|
7
7
|
return false;
|
|
@@ -21,7 +21,7 @@ function getTrigger(trigger) {
|
|
|
21
21
|
}
|
|
22
22
|
function setPlaceholder(obj, triggerMap) {
|
|
23
23
|
var _a;
|
|
24
|
-
const name =
|
|
24
|
+
const name = getLabelText(obj);
|
|
25
25
|
let trigger = "blur";
|
|
26
26
|
if (typeof obj.compon == "string") {
|
|
27
27
|
if (changes.includes(lineToLargeHump(obj.compon))) {
|
|
@@ -39,7 +39,7 @@ function getRule(obj, data, refForm, triggerMap) {
|
|
|
39
39
|
if (typeof multiple != "boolean") {
|
|
40
40
|
multiple = false;
|
|
41
41
|
}
|
|
42
|
-
const name =
|
|
42
|
+
const name = getLabelText(obj);
|
|
43
43
|
const param = {
|
|
44
44
|
name,
|
|
45
45
|
multiple,
|
|
@@ -106,14 +106,12 @@ function getLinkageJudge(jyjudgev, linkage) {
|
|
|
106
106
|
const v = judge2 == null ? void 0 : judge2(val, data);
|
|
107
107
|
if (v) {
|
|
108
108
|
callback(new Error(v));
|
|
109
|
-
} else {
|
|
110
|
-
|
|
111
|
-
refForm == null ? void 0 : refForm.validateField([prop], () => {
|
|
112
|
-
callback();
|
|
113
|
-
});
|
|
114
|
-
} else {
|
|
109
|
+
} else if (prop) {
|
|
110
|
+
refForm == null ? void 0 : refForm.validateField([prop], () => {
|
|
115
111
|
callback();
|
|
116
|
-
}
|
|
112
|
+
});
|
|
113
|
+
} else {
|
|
114
|
+
callback();
|
|
117
115
|
}
|
|
118
116
|
};
|
|
119
117
|
}
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const name = "forms-div";
|
|
4
4
|
const dataProps = {
|
|
5
|
+
index: {
|
|
6
|
+
type: Array,
|
|
7
|
+
default() {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
},
|
|
5
11
|
/**
|
|
6
12
|
* @props { Object<ObjAny>} options={}
|
|
7
13
|
* 选择数据集合
|
|
@@ -37,13 +43,10 @@ const dataProps = {
|
|
|
37
43
|
},
|
|
38
44
|
/**
|
|
39
45
|
* 传入值
|
|
40
|
-
* @props { Object } modelValue
|
|
46
|
+
* @props { Object } modelValue ( )
|
|
41
47
|
*/
|
|
42
48
|
modelValue: {
|
|
43
|
-
type:
|
|
44
|
-
default() {
|
|
45
|
-
return {};
|
|
46
|
-
}
|
|
49
|
+
type: null
|
|
47
50
|
},
|
|
48
51
|
/**
|
|
49
52
|
* @props { Object<ObjStr> } formvalue= ( )
|
|
@@ -4,6 +4,25 @@ import { ExtractPropTypes } from 'vue';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const name = "forms-div";
|
|
6
6
|
export declare const dataProps: {
|
|
7
|
+
index: {
|
|
8
|
+
type: {
|
|
9
|
+
(arrayLength: number): number[];
|
|
10
|
+
(...items: number[]): number[];
|
|
11
|
+
new (arrayLength: number): number[];
|
|
12
|
+
new (...items: number[]): number[];
|
|
13
|
+
isArray(arg: any): arg is any[];
|
|
14
|
+
readonly prototype: any[];
|
|
15
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
16
|
+
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
17
|
+
from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
|
|
18
|
+
from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
19
|
+
of<T>(...items: T[]): T[];
|
|
20
|
+
fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
|
|
21
|
+
fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
|
|
22
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
23
|
+
};
|
|
24
|
+
default(): never[];
|
|
25
|
+
};
|
|
7
26
|
/**
|
|
8
27
|
* @props { Object<ObjAny>} options={}
|
|
9
28
|
* 选择数据集合
|
|
@@ -35,11 +54,10 @@ export declare const dataProps: {
|
|
|
35
54
|
};
|
|
36
55
|
/**
|
|
37
56
|
* 传入值
|
|
38
|
-
* @props { Object } modelValue
|
|
57
|
+
* @props { Object } modelValue ( )
|
|
39
58
|
*/
|
|
40
59
|
modelValue: {
|
|
41
|
-
type:
|
|
42
|
-
default(): {};
|
|
60
|
+
type: null;
|
|
43
61
|
};
|
|
44
62
|
/**
|
|
45
63
|
* @props { Object<ObjStr> } formvalue= ( )
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
const name = "forms-div";
|
|
2
2
|
const dataProps = {
|
|
3
|
+
index: {
|
|
4
|
+
type: Array,
|
|
5
|
+
default() {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
},
|
|
3
9
|
/**
|
|
4
10
|
* @props { Object<ObjAny>} options={}
|
|
5
11
|
* 选择数据集合
|
|
@@ -35,13 +41,10 @@ const dataProps = {
|
|
|
35
41
|
},
|
|
36
42
|
/**
|
|
37
43
|
* 传入值
|
|
38
|
-
* @props { Object } modelValue
|
|
44
|
+
* @props { Object } modelValue ( )
|
|
39
45
|
*/
|
|
40
46
|
modelValue: {
|
|
41
|
-
type:
|
|
42
|
-
default() {
|
|
43
|
-
return {};
|
|
44
|
-
}
|
|
47
|
+
type: null
|
|
45
48
|
},
|
|
46
49
|
/**
|
|
47
50
|
* @props { Object<ObjStr> } formvalue= ( )
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const vue = require("vue");
|
|
4
4
|
const data = require("./data.cjs");
|
|
5
|
-
const lineToLargeHump = require("@fangzhongya/utils/name/lineToLargeHump");
|
|
6
5
|
const objValue = require("@fangzhongya/utils/basic/object/objValue");
|
|
7
6
|
const index = require("../../../hooks/cssname/index.cjs");
|
|
8
7
|
const use = require("../../common/use.cjs");
|
|
@@ -21,6 +20,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
21
20
|
const prs = index$1.usePropsDefault(data.name, p, data.dataProps);
|
|
22
21
|
const props = prs.listobj;
|
|
23
22
|
const compons = index$2.useComponsGet(config.provides.compons);
|
|
23
|
+
const form = vue.inject(config.provides.form, {});
|
|
24
24
|
const formvalue = vue.computed(() => {
|
|
25
25
|
const o = {};
|
|
26
26
|
if (typeof props.formvalue === "object") {
|
|
@@ -99,7 +99,7 @@ const _sfc_main = vue.defineComponent({
|
|
|
99
99
|
return result;
|
|
100
100
|
}
|
|
101
101
|
function getSourceObject() {
|
|
102
|
-
let source = prs.modelValue
|
|
102
|
+
let source = prs.modelValue;
|
|
103
103
|
if (props.orig) {
|
|
104
104
|
source = prs.valueobj ?? {};
|
|
105
105
|
}
|
|
@@ -136,10 +136,10 @@ const _sfc_main = vue.defineComponent({
|
|
|
136
136
|
if (props.computed) {
|
|
137
137
|
handleComputedSet(newValue, v);
|
|
138
138
|
}
|
|
139
|
-
if (!props.orig) {
|
|
140
|
-
emit("update:modelValue",
|
|
139
|
+
if (!props.orig && !prop) {
|
|
140
|
+
emit("update:modelValue", newValue);
|
|
141
141
|
}
|
|
142
|
-
if (
|
|
142
|
+
if (prop) {
|
|
143
143
|
emit("upform", newValue, props, v);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
@@ -167,78 +167,49 @@ const _sfc_main = vue.defineComponent({
|
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
if (typeof props.options === "string") {
|
|
173
|
-
const value2 = optionss[props.options];
|
|
174
|
-
if (typeof value2 == "function") {
|
|
175
|
-
return value2(optionss, value2.value, props) || [];
|
|
176
|
-
} else {
|
|
177
|
-
return value2 || [];
|
|
178
|
-
}
|
|
179
|
-
} else if (typeof props.options == "function") {
|
|
180
|
-
return props.options(optionss, value.value, props) || [];
|
|
181
|
-
} else {
|
|
182
|
-
return props.options || [];
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
const render = () => {
|
|
170
|
+
const setDom = () => {
|
|
171
|
+
var _a;
|
|
186
172
|
const compon = props.compon || prs.compon || "input";
|
|
187
173
|
const componValueName = prs.componValueName || "modelValue";
|
|
188
|
-
const
|
|
189
|
-
...
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
emit("upform", ...arr);
|
|
174
|
+
const obj = {
|
|
175
|
+
...props,
|
|
176
|
+
compon,
|
|
177
|
+
slots: props.slots ?? slots,
|
|
178
|
+
config: {
|
|
179
|
+
...binds.value,
|
|
180
|
+
index: prs.index,
|
|
181
|
+
class: [cs.z("com"), ((_a = props.config) == null ? void 0 : _a.class) ?? ""].join(
|
|
182
|
+
" "
|
|
183
|
+
),
|
|
184
|
+
[componValueName]: value.value,
|
|
185
|
+
["onUpdate:" + componValueName]: (v) => value.value = v,
|
|
186
|
+
["onUpform"]: (...arr) => {
|
|
187
|
+
if (props.prop) {
|
|
188
|
+
emit("upform", ...arr);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
206
191
|
}
|
|
207
192
|
};
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
const setSslot = () => {
|
|
224
|
-
const slotname = props.slot ?? props.prop;
|
|
225
|
-
if (slotname) {
|
|
226
|
-
const slot = slots[slotname];
|
|
227
|
-
if (slot) {
|
|
228
|
-
return slot({
|
|
229
|
-
row: prs.valueobj,
|
|
230
|
-
value,
|
|
231
|
-
column: props,
|
|
232
|
-
options: options.value,
|
|
233
|
-
multiple: props.multiple,
|
|
234
|
-
optionss: prs.optionss
|
|
235
|
-
});
|
|
193
|
+
return use.useVNodeComponDom(
|
|
194
|
+
obj,
|
|
195
|
+
prs.valueobj ?? value.value,
|
|
196
|
+
slots,
|
|
197
|
+
emit,
|
|
198
|
+
{
|
|
199
|
+
options: prs.optionss,
|
|
200
|
+
compons,
|
|
201
|
+
index: prs.index,
|
|
202
|
+
scope: {
|
|
203
|
+
$index: prs.index[0] || 0,
|
|
204
|
+
config: form,
|
|
205
|
+
options: prs.optionss,
|
|
206
|
+
value
|
|
207
|
+
}
|
|
236
208
|
}
|
|
237
|
-
|
|
238
|
-
return render();
|
|
209
|
+
);
|
|
239
210
|
};
|
|
240
211
|
return () => {
|
|
241
|
-
return props.compon ? vue.h("div", { class: cs.z() }, [
|
|
212
|
+
return props.compon ? vue.h("div", { class: cs.z() }, [setDom()]) : "";
|
|
242
213
|
};
|
|
243
214
|
}
|
|
244
215
|
});
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { defineComponent, computed, ref, h
|
|
1
|
+
import { defineComponent, inject, computed, ref, h } from "vue";
|
|
2
2
|
import { name, dataProps, dataEmits, dataExpose } from "./data.js";
|
|
3
|
-
import { lineToLargeHump } from "@fangzhongya/utils/name/lineToLargeHump";
|
|
4
3
|
import { setObjValue, getObjValue } from "@fangzhongya/utils/basic/object/objValue";
|
|
5
4
|
import { useCssName } from "../../../hooks/cssname/index.js";
|
|
6
|
-
import {
|
|
5
|
+
import { useVNodeComponDom } from "../../common/use.js";
|
|
7
6
|
import { isEqual } from "@fangzhongya/utils/basic/object/isEqual";
|
|
8
7
|
import { usePropsDefault, getProps } from "../../../hooks/props-default/index.js";
|
|
9
8
|
import { useComponsGet } from "../../../hooks/compons/index.js";
|
|
@@ -19,6 +18,7 @@ const _sfc_main = defineComponent({
|
|
|
19
18
|
const prs = usePropsDefault(name, p, dataProps);
|
|
20
19
|
const props = prs.listobj;
|
|
21
20
|
const compons = useComponsGet(provides.compons);
|
|
21
|
+
const form = inject(provides.form, {});
|
|
22
22
|
const formvalue = computed(() => {
|
|
23
23
|
const o = {};
|
|
24
24
|
if (typeof props.formvalue === "object") {
|
|
@@ -97,7 +97,7 @@ const _sfc_main = defineComponent({
|
|
|
97
97
|
return result;
|
|
98
98
|
}
|
|
99
99
|
function getSourceObject() {
|
|
100
|
-
let source = prs.modelValue
|
|
100
|
+
let source = prs.modelValue;
|
|
101
101
|
if (props.orig) {
|
|
102
102
|
source = prs.valueobj ?? {};
|
|
103
103
|
}
|
|
@@ -134,10 +134,10 @@ const _sfc_main = defineComponent({
|
|
|
134
134
|
if (props.computed) {
|
|
135
135
|
handleComputedSet(newValue, v);
|
|
136
136
|
}
|
|
137
|
-
if (!props.orig) {
|
|
138
|
-
emit("update:modelValue",
|
|
137
|
+
if (!props.orig && !prop) {
|
|
138
|
+
emit("update:modelValue", newValue);
|
|
139
139
|
}
|
|
140
|
-
if (
|
|
140
|
+
if (prop) {
|
|
141
141
|
emit("upform", newValue, props, v);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
@@ -165,78 +165,49 @@ const _sfc_main = defineComponent({
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
if (typeof props.options === "string") {
|
|
171
|
-
const value2 = optionss[props.options];
|
|
172
|
-
if (typeof value2 == "function") {
|
|
173
|
-
return value2(optionss, value2.value, props) || [];
|
|
174
|
-
} else {
|
|
175
|
-
return value2 || [];
|
|
176
|
-
}
|
|
177
|
-
} else if (typeof props.options == "function") {
|
|
178
|
-
return props.options(optionss, value.value, props) || [];
|
|
179
|
-
} else {
|
|
180
|
-
return props.options || [];
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
const render = () => {
|
|
168
|
+
const setDom = () => {
|
|
169
|
+
var _a;
|
|
184
170
|
const compon = props.compon || prs.compon || "input";
|
|
185
171
|
const componValueName = prs.componValueName || "modelValue";
|
|
186
|
-
const
|
|
187
|
-
...
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
emit("upform", ...arr);
|
|
172
|
+
const obj = {
|
|
173
|
+
...props,
|
|
174
|
+
compon,
|
|
175
|
+
slots: props.slots ?? slots,
|
|
176
|
+
config: {
|
|
177
|
+
...binds.value,
|
|
178
|
+
index: prs.index,
|
|
179
|
+
class: [cs.z("com"), ((_a = props.config) == null ? void 0 : _a.class) ?? ""].join(
|
|
180
|
+
" "
|
|
181
|
+
),
|
|
182
|
+
[componValueName]: value.value,
|
|
183
|
+
["onUpdate:" + componValueName]: (v) => value.value = v,
|
|
184
|
+
["onUpform"]: (...arr) => {
|
|
185
|
+
if (props.prop) {
|
|
186
|
+
emit("upform", ...arr);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
204
189
|
}
|
|
205
190
|
};
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
const setSslot = () => {
|
|
222
|
-
const slotname = props.slot ?? props.prop;
|
|
223
|
-
if (slotname) {
|
|
224
|
-
const slot = slots[slotname];
|
|
225
|
-
if (slot) {
|
|
226
|
-
return slot({
|
|
227
|
-
row: prs.valueobj,
|
|
228
|
-
value,
|
|
229
|
-
column: props,
|
|
230
|
-
options: options.value,
|
|
231
|
-
multiple: props.multiple,
|
|
232
|
-
optionss: prs.optionss
|
|
233
|
-
});
|
|
191
|
+
return useVNodeComponDom(
|
|
192
|
+
obj,
|
|
193
|
+
prs.valueobj ?? value.value,
|
|
194
|
+
slots,
|
|
195
|
+
emit,
|
|
196
|
+
{
|
|
197
|
+
options: prs.optionss,
|
|
198
|
+
compons,
|
|
199
|
+
index: prs.index,
|
|
200
|
+
scope: {
|
|
201
|
+
$index: prs.index[0] || 0,
|
|
202
|
+
config: form,
|
|
203
|
+
options: prs.optionss,
|
|
204
|
+
value
|
|
205
|
+
}
|
|
234
206
|
}
|
|
235
|
-
|
|
236
|
-
return render();
|
|
207
|
+
);
|
|
237
208
|
};
|
|
238
209
|
return () => {
|
|
239
|
-
return props.compon ? h("div", { class: cs.z() }, [
|
|
210
|
+
return props.compon ? h("div", { class: cs.z() }, [setDom()]) : "";
|
|
240
211
|
};
|
|
241
212
|
}
|
|
242
213
|
});
|
|
@@ -4,6 +4,25 @@ import { ExtractPropTypes } from 'vue';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const name = "forms-item";
|
|
6
6
|
export declare const dataProps: {
|
|
7
|
+
index: {
|
|
8
|
+
type: {
|
|
9
|
+
(arrayLength: number): number[];
|
|
10
|
+
(...items: number[]): number[];
|
|
11
|
+
new (arrayLength: number): number[];
|
|
12
|
+
new (...items: number[]): number[];
|
|
13
|
+
isArray(arg: any): arg is any[];
|
|
14
|
+
readonly prototype: any[];
|
|
15
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
16
|
+
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
17
|
+
from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
|
|
18
|
+
from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
19
|
+
of<T>(...items: T[]): T[];
|
|
20
|
+
fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
|
|
21
|
+
fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
|
|
22
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
23
|
+
};
|
|
24
|
+
default(): never[];
|
|
25
|
+
};
|
|
7
26
|
/**
|
|
8
27
|
* @props { Object<ObjAny>} options={}
|
|
9
28
|
* 选择数据集合
|