@qin-ui/antd-vue-pro 1.1.21 → 1.1.23
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/README.md +0 -7
- package/es/form/{index-ef98f1fd.js → index-1cdda7ac.js} +50 -445
- package/es/form/index.js +5 -13
- package/es/index.d.ts +33 -287
- package/es/index.js +6 -14
- package/es/style.css +5 -5
- package/es/table/index.js +13 -14
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { inject, ref, h as h$1, getCurrentInstance, nextTick, reactive, defineComponent, createVNode, shallowRef, watch, unref, provide, watchEffect, onBeforeUnmount, computed, triggerRef, Fragment, Comment, Text, isVNode, onMounted, cloneVNode, Transition, withDirectives, resolveDirective, onUpdated, onUnmounted, toRef, withModifiers, vShow, onBeforeMount, Teleport, TransitionGroup, toRaw, resolveComponent, openBlock, createBlock, mergeProps, withCtx, createElementBlock, renderList, createSlots, createTextVNode, createCommentVNode, shallowReadonly, useAttrs, resolveDynamicComponent, normalizeProps, renderSlot, toDisplayString, shallowReactive } from "vue";
|
|
2
|
-
import { Input, Textarea, InputSearch, InputPassword, InputNumber, Select, Cascader, DatePicker as DatePicker$1, RangePicker, TimePicker as TimePicker$1, CheckboxGroup, RadioGroup, Switch, Slider, TreeSelect, Transfer, Row as Row$1, Col as Col$1, FormItem as FormItem$1,
|
|
2
|
+
import { Input, Textarea, InputSearch, InputPassword, InputNumber, Select, Cascader, DatePicker as DatePicker$1, RangePicker, TimePicker as TimePicker$1, CheckboxGroup, RadioGroup, Switch, Slider, TreeSelect, Transfer, Row as Row$1, Col as Col$1, FormItem as FormItem$1, Form as Form$2 } from "ant-design-vue";
|
|
3
3
|
import { INIT_PROPS_MAP, useInjectProps, INJECT_KEYS } from "../component-provider/index.js";
|
|
4
4
|
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
5
5
|
const freeGlobal$1 = freeGlobal;
|
|
@@ -818,20 +818,6 @@ function baseSlice(array4, start, end) {
|
|
|
818
818
|
}
|
|
819
819
|
return result;
|
|
820
820
|
}
|
|
821
|
-
var nativeIsFinite = root$1.isFinite, nativeMin$2 = Math.min;
|
|
822
|
-
function createRound(methodName) {
|
|
823
|
-
var func = Math[methodName];
|
|
824
|
-
return function(number4, precision) {
|
|
825
|
-
number4 = toNumber(number4);
|
|
826
|
-
precision = precision == null ? 0 : nativeMin$2(toInteger(precision), 292);
|
|
827
|
-
if (precision && nativeIsFinite(number4)) {
|
|
828
|
-
var pair = (toString(number4) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
|
|
829
|
-
pair = (toString(value) + "e").split("e");
|
|
830
|
-
return +(pair[0] + "e" + (+pair[1] - precision));
|
|
831
|
-
}
|
|
832
|
-
return func(number4);
|
|
833
|
-
};
|
|
834
|
-
}
|
|
835
821
|
function stackClear() {
|
|
836
822
|
this.__data__ = new ListCache();
|
|
837
823
|
this.size = 0;
|
|
@@ -1759,8 +1745,6 @@ var pick = flatRest(function(object4, paths) {
|
|
|
1759
1745
|
return object4 == null ? {} : basePick(object4, paths);
|
|
1760
1746
|
});
|
|
1761
1747
|
const pick$1 = pick;
|
|
1762
|
-
var round = createRound("round");
|
|
1763
|
-
const round$1 = round;
|
|
1764
1748
|
function set$1(object4, path, value) {
|
|
1765
1749
|
return object4 == null ? object4 : baseSet(object4, path, value);
|
|
1766
1750
|
}
|
|
@@ -2275,29 +2259,29 @@ function classNames() {
|
|
|
2275
2259
|
return classes.join(" ");
|
|
2276
2260
|
}
|
|
2277
2261
|
let warned = {};
|
|
2278
|
-
function warning$4(valid,
|
|
2262
|
+
function warning$4(valid, message) {
|
|
2279
2263
|
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
2280
|
-
console.error(`Warning: ${
|
|
2264
|
+
console.error(`Warning: ${message}`);
|
|
2281
2265
|
}
|
|
2282
2266
|
}
|
|
2283
2267
|
function resetWarned() {
|
|
2284
2268
|
warned = {};
|
|
2285
2269
|
}
|
|
2286
|
-
function call(method4, valid,
|
|
2287
|
-
if (!valid && !warned[
|
|
2288
|
-
method4(false,
|
|
2289
|
-
warned[
|
|
2270
|
+
function call(method4, valid, message) {
|
|
2271
|
+
if (!valid && !warned[message]) {
|
|
2272
|
+
method4(false, message);
|
|
2273
|
+
warned[message] = true;
|
|
2290
2274
|
}
|
|
2291
2275
|
}
|
|
2292
|
-
function warningOnce(valid,
|
|
2293
|
-
call(warning$4, valid,
|
|
2276
|
+
function warningOnce(valid, message) {
|
|
2277
|
+
call(warning$4, valid, message);
|
|
2294
2278
|
}
|
|
2295
2279
|
function noop$3() {
|
|
2296
2280
|
}
|
|
2297
2281
|
let warning$2 = noop$3;
|
|
2298
2282
|
if (process.env.NODE_ENV !== "production") {
|
|
2299
|
-
warning$2 = (valid, component,
|
|
2300
|
-
warningOnce(valid, `[ant-design-vue: ${component}] ${
|
|
2283
|
+
warning$2 = (valid, component, message) => {
|
|
2284
|
+
warningOnce(valid, `[ant-design-vue: ${component}] ${message}`);
|
|
2301
2285
|
if (process.env.NODE_ENV === "test") {
|
|
2302
2286
|
resetWarned();
|
|
2303
2287
|
}
|
|
@@ -3492,13 +3476,13 @@ function _defineProperty$8(obj, key, value) {
|
|
|
3492
3476
|
}
|
|
3493
3477
|
return obj;
|
|
3494
3478
|
}
|
|
3495
|
-
function warn(valid,
|
|
3479
|
+
function warn(valid, message) {
|
|
3496
3480
|
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
3497
|
-
console.error("Warning: ".concat(
|
|
3481
|
+
console.error("Warning: ".concat(message));
|
|
3498
3482
|
}
|
|
3499
3483
|
}
|
|
3500
|
-
function warning$1(valid,
|
|
3501
|
-
warn(valid, "[@ant-design/icons-vue] ".concat(
|
|
3484
|
+
function warning$1(valid, message) {
|
|
3485
|
+
warn(valid, "[@ant-design/icons-vue] ".concat(message));
|
|
3502
3486
|
}
|
|
3503
3487
|
function isIconDefinition(target) {
|
|
3504
3488
|
return typeof target === "object" && typeof target.name === "string" && typeof target.theme === "string" && (typeof target.icon === "object" || typeof target.icon === "function");
|
|
@@ -5059,12 +5043,12 @@ function stringify(element, index2, children, callback) {
|
|
|
5059
5043
|
}
|
|
5060
5044
|
return strlen(children = serialize(element.children, callback)) ? element.return = element.value + "{" + children + "}" : "";
|
|
5061
5045
|
}
|
|
5062
|
-
function lintWarning(
|
|
5046
|
+
function lintWarning(message, info) {
|
|
5063
5047
|
const {
|
|
5064
5048
|
path,
|
|
5065
5049
|
parentSelectors
|
|
5066
5050
|
} = info;
|
|
5067
|
-
warningOnce(false, `[Ant Design Vue CSS-in-JS] ${path ? `Error in '${path}': ` : ""}${
|
|
5051
|
+
warningOnce(false, `[Ant Design Vue CSS-in-JS] ${path ? `Error in '${path}': ` : ""}${message}${parentSelectors.length ? ` Selector info: ${parentSelectors.join(" -> ")}` : ""}`);
|
|
5068
5052
|
}
|
|
5069
5053
|
const linter$1 = (key, value, info) => {
|
|
5070
5054
|
if (key === "content") {
|
|
@@ -8746,13 +8730,13 @@ function validateRule(name, value, rule, options, messageVariables) {
|
|
|
8746
8730
|
if (errObj.errors) {
|
|
8747
8731
|
result = errObj.errors.map((_ref, index2) => {
|
|
8748
8732
|
let {
|
|
8749
|
-
message
|
|
8733
|
+
message
|
|
8750
8734
|
} = _ref;
|
|
8751
8735
|
return (
|
|
8752
8736
|
// Wrap VueNode with `key`
|
|
8753
|
-
isValidElement(
|
|
8737
|
+
isValidElement(message) ? cloneVNode(message, {
|
|
8754
8738
|
key: `error_${index2}`
|
|
8755
|
-
}) :
|
|
8739
|
+
}) : message
|
|
8756
8740
|
);
|
|
8757
8741
|
});
|
|
8758
8742
|
} else {
|
|
@@ -14455,8 +14439,8 @@ const FormItemInput = defineComponent({
|
|
|
14455
14439
|
}
|
|
14456
14440
|
});
|
|
14457
14441
|
const FormItemInput$1 = FormItemInput;
|
|
14458
|
-
const devWarning = (valid, component,
|
|
14459
|
-
warningOnce(valid, `[ant-design-vue: ${component}] ${
|
|
14442
|
+
const devWarning = (valid, component, message) => {
|
|
14443
|
+
warningOnce(valid, `[ant-design-vue: ${component}] ${message}`);
|
|
14460
14444
|
};
|
|
14461
14445
|
function createContext(defaultValue) {
|
|
14462
14446
|
const contextKey2 = Symbol("contextKey");
|
|
@@ -15749,26 +15733,8 @@ const COMPONENT_MAP = /* @__PURE__ */ new Map([
|
|
|
15749
15733
|
["transfer", Transfer]
|
|
15750
15734
|
]);
|
|
15751
15735
|
const FORM_DATA = Symbol("formData");
|
|
15752
|
-
const UPDATE_FORM_DATA = Symbol(
|
|
15753
|
-
|
|
15754
|
-
);
|
|
15755
|
-
const COMMAND = Symbol("command");
|
|
15756
|
-
const UPDATE_ACTIVE_PATH = Symbol(
|
|
15757
|
-
"setActivePath"
|
|
15758
|
-
);
|
|
15759
|
-
const RULE_TYPE_MAP = /* @__PURE__ */ new Map([
|
|
15760
|
-
["setValue", "字段赋值"],
|
|
15761
|
-
["setHidden", "字段隐藏/显示"],
|
|
15762
|
-
["setDisabled", "字段禁用/启用"],
|
|
15763
|
-
["setOptions", "字段选项枚举变更"],
|
|
15764
|
-
["setRules", "字段校验规则变更"],
|
|
15765
|
-
["setField", "字段配置变更"],
|
|
15766
|
-
["triggerValidate", "字段触发校验"],
|
|
15767
|
-
["triggerClearValidate", "字段触发清除校验"],
|
|
15768
|
-
["triggerMessage", "字段触发提示"]
|
|
15769
|
-
]);
|
|
15770
|
-
const FunctionRegexp = /^\s*function\s*\w*\s*\([^)]*\)\s*{([\s\S]*)}/g;
|
|
15771
|
-
const ArrowFunctionRegexp = /^\s*(?:\([^)]*\)|\w+)\s*=>\s*\(?({[\s\S]*}|[^;]*)\)?/g;
|
|
15736
|
+
const UPDATE_FORM_DATA = Symbol("updateFormData");
|
|
15737
|
+
const UPDATE_ACTIVE_PATH = Symbol("setActivePath");
|
|
15772
15738
|
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
15773
15739
|
...{
|
|
15774
15740
|
name: "BaseFormItem"
|
|
@@ -15901,7 +15867,6 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
15901
15867
|
key: 2,
|
|
15902
15868
|
ref_for: true
|
|
15903
15869
|
}, unref(omitFormItemProps)(field), {
|
|
15904
|
-
label: field.label,
|
|
15905
15870
|
path: getPath(field),
|
|
15906
15871
|
onSetComponentRef: (el) => setComponentRef(el, field),
|
|
15907
15872
|
onFieldChange: () => {
|
|
@@ -15912,7 +15877,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
15912
15877
|
var _a2, _b, _c;
|
|
15913
15878
|
return (_c = (_b = (_a2 = formItemRefs.value) == null ? void 0 : _a2[index2]) == null ? void 0 : _b.onFieldBlur) == null ? void 0 : _c.call(_b);
|
|
15914
15879
|
}
|
|
15915
|
-
}), null, 16, ["
|
|
15880
|
+
}), null, 16, ["path", "onSetComponentRef", "onFieldChange", "onFieldBlur"]))
|
|
15916
15881
|
]),
|
|
15917
15882
|
_: 2
|
|
15918
15883
|
}, [
|
|
@@ -16121,294 +16086,6 @@ const useForm = (initFormData = {}, initFields = []) => {
|
|
|
16121
16086
|
};
|
|
16122
16087
|
};
|
|
16123
16088
|
const useForm$1 = useForm;
|
|
16124
|
-
const isFunctionString = (param) => {
|
|
16125
|
-
FunctionRegexp.lastIndex = 0;
|
|
16126
|
-
ArrowFunctionRegexp.lastIndex = 0;
|
|
16127
|
-
return FunctionRegexp.test(param) || ArrowFunctionRegexp.test(param);
|
|
16128
|
-
};
|
|
16129
|
-
const jsonStringifyReplacer = (k2, v2) => {
|
|
16130
|
-
if (v2 instanceof RegExp || typeof v2 === "function") {
|
|
16131
|
-
return v2.toString();
|
|
16132
|
-
}
|
|
16133
|
-
return v2;
|
|
16134
|
-
};
|
|
16135
|
-
const jsonParseReviver = (k2, v2) => {
|
|
16136
|
-
if (typeof v2 === "string") {
|
|
16137
|
-
if (v2.match(/^\/(.+?)\/(i|g|m|s|u|y)*?$/g)) {
|
|
16138
|
-
return new Function(`return ${v2}`)();
|
|
16139
|
-
}
|
|
16140
|
-
if (isFunctionString(v2)) {
|
|
16141
|
-
return new Function("h", `return ${v2}`)(h$1);
|
|
16142
|
-
}
|
|
16143
|
-
}
|
|
16144
|
-
return v2;
|
|
16145
|
-
};
|
|
16146
|
-
const tool = {
|
|
16147
|
-
round: round$1
|
|
16148
|
-
};
|
|
16149
|
-
const conditionTypeMap = {
|
|
16150
|
-
AND: "&&",
|
|
16151
|
-
OR: "||"
|
|
16152
|
-
};
|
|
16153
|
-
const fontCssMap = {
|
|
16154
|
-
large: "font-size: 14px;",
|
|
16155
|
-
blue: "color: #1677ff;",
|
|
16156
|
-
gray: "color: #262626;",
|
|
16157
|
-
red: "color: #f5222d;",
|
|
16158
|
-
purple: "color: #722ed1;",
|
|
16159
|
-
indent2: "text-indent: 2em;",
|
|
16160
|
-
indent4: "text-indent: 4em;",
|
|
16161
|
-
mb10: "margin-bottom: 10px;"
|
|
16162
|
-
};
|
|
16163
|
-
function printLog(param, styles) {
|
|
16164
|
-
let msg = "";
|
|
16165
|
-
const msgStyle = [];
|
|
16166
|
-
if (Array.isArray(param)) {
|
|
16167
|
-
param.forEach(([text, textStyles]) => {
|
|
16168
|
-
msg += `%c${text}`;
|
|
16169
|
-
const style = textStyles == null ? void 0 : textStyles.map((item) => fontCssMap[item]).join("");
|
|
16170
|
-
msgStyle.push(style);
|
|
16171
|
-
});
|
|
16172
|
-
} else {
|
|
16173
|
-
msg = `%c${param}`;
|
|
16174
|
-
const style = styles == null ? void 0 : styles.map((item) => fontCssMap[item]).join("");
|
|
16175
|
-
msgStyle.push(style);
|
|
16176
|
-
}
|
|
16177
|
-
console.log(msg, ...msgStyle);
|
|
16178
|
-
}
|
|
16179
|
-
const enumRegExp = /enum\((.*?)\)/g;
|
|
16180
|
-
async function runExpression(expression, form) {
|
|
16181
|
-
let result = expression;
|
|
16182
|
-
if (typeof expression === "string") {
|
|
16183
|
-
let functionStr = expression.replaceAll(/\n/g, "");
|
|
16184
|
-
if (isFunctionString(expression)) {
|
|
16185
|
-
const fn = new Function(`return ${functionStr}`)();
|
|
16186
|
-
result = await fn({ tool, form });
|
|
16187
|
-
} else {
|
|
16188
|
-
if (expression.match(enumRegExp)) {
|
|
16189
|
-
functionStr = expression.replace(enumRegExp, "$1");
|
|
16190
|
-
}
|
|
16191
|
-
const fn = new Function("{ tool, form }", `return ${functionStr}`);
|
|
16192
|
-
result = await fn({ tool, form });
|
|
16193
|
-
}
|
|
16194
|
-
}
|
|
16195
|
-
return result;
|
|
16196
|
-
}
|
|
16197
|
-
async function validateConditions(conditions, baseParam) {
|
|
16198
|
-
const { form, logQueue } = baseParam;
|
|
16199
|
-
logQueue.push([[`逻辑执行条件: `, ["purple", "indent2"]]]);
|
|
16200
|
-
const conditionsResultArr = [];
|
|
16201
|
-
for (let conditionIndex = 0; conditionIndex < conditions.length; conditionIndex += 1) {
|
|
16202
|
-
const condition = conditions[conditionIndex];
|
|
16203
|
-
const {
|
|
16204
|
-
type: conditionType,
|
|
16205
|
-
expression: conditionExpression,
|
|
16206
|
-
disabled
|
|
16207
|
-
} = condition;
|
|
16208
|
-
if (disabled) {
|
|
16209
|
-
logQueue.push([
|
|
16210
|
-
[`条件${conditionIndex + 1}: `, ["blue", "indent4"]],
|
|
16211
|
-
[`禁用`, ["red"]]
|
|
16212
|
-
]);
|
|
16213
|
-
} else {
|
|
16214
|
-
const conditionResult = await runExpression(conditionExpression, form);
|
|
16215
|
-
logQueue.push([
|
|
16216
|
-
[`条件${conditionIndex + 1}: `, ["blue", "indent4"]],
|
|
16217
|
-
[`${conditionExpression}`, ["gray"]]
|
|
16218
|
-
]);
|
|
16219
|
-
logQueue.push([
|
|
16220
|
-
[`条件${conditionIndex + 1}是否通过: `, ["blue", "indent4"]],
|
|
16221
|
-
[`${conditionResult}`, ["gray"]]
|
|
16222
|
-
]);
|
|
16223
|
-
if (conditionIndex !== 0) {
|
|
16224
|
-
conditionsResultArr.push(
|
|
16225
|
-
`${conditionTypeMap[conditionType]}${conditionResult}`
|
|
16226
|
-
);
|
|
16227
|
-
} else {
|
|
16228
|
-
conditionsResultArr.push(conditionResult);
|
|
16229
|
-
}
|
|
16230
|
-
}
|
|
16231
|
-
}
|
|
16232
|
-
const result = new Function(`return ${conditionsResultArr.join(",")}`)();
|
|
16233
|
-
logQueue.push([
|
|
16234
|
-
[`全部条件是否通过: `, ["purple", "indent4"]],
|
|
16235
|
-
[`${result}`, ["gray"]]
|
|
16236
|
-
]);
|
|
16237
|
-
return result;
|
|
16238
|
-
}
|
|
16239
|
-
async function runRules(rules2, baseParam) {
|
|
16240
|
-
const { form, run, message: message2, logQueue } = baseParam;
|
|
16241
|
-
logQueue.push([[`逻辑执行规则: `, ["purple", "indent2"]]]);
|
|
16242
|
-
for (let ruleIndex = 0; ruleIndex < rules2.length; ruleIndex += 1) {
|
|
16243
|
-
const rule = rules2[ruleIndex];
|
|
16244
|
-
const { type: type4, path, expression, disabled } = rule;
|
|
16245
|
-
if (disabled) {
|
|
16246
|
-
logQueue.push([
|
|
16247
|
-
[`逻辑${ruleIndex + 1}: `, ["blue", "indent4"]],
|
|
16248
|
-
[`禁用`, ["red"]]
|
|
16249
|
-
]);
|
|
16250
|
-
return;
|
|
16251
|
-
}
|
|
16252
|
-
const value = await runExpression(expression, form);
|
|
16253
|
-
logQueue.push([
|
|
16254
|
-
[`逻辑${ruleIndex + 1}: `, ["blue", "indent4"]],
|
|
16255
|
-
[`${JSON.stringify(expression)}`, ["gray"]]
|
|
16256
|
-
]);
|
|
16257
|
-
logQueue.push([
|
|
16258
|
-
[`逻辑${ruleIndex + 1}执行结果: `, ["blue", "indent4"]],
|
|
16259
|
-
[`${JSON.stringify(value)}`, ["gray"]]
|
|
16260
|
-
]);
|
|
16261
|
-
logQueue.push([
|
|
16262
|
-
[`逻辑${ruleIndex + 1}操作类型: `, ["blue", "indent4"]],
|
|
16263
|
-
[`${RULE_TYPE_MAP.get(type4)}`, ["gray"]]
|
|
16264
|
-
]);
|
|
16265
|
-
logQueue.push([
|
|
16266
|
-
[`逻辑${ruleIndex + 1}变更字段: `, ["blue", "indent4", "mb10"]],
|
|
16267
|
-
[`${path}`, ["gray"]]
|
|
16268
|
-
]);
|
|
16269
|
-
switch (type4) {
|
|
16270
|
-
case "setValue": {
|
|
16271
|
-
form.setFormData(path, value);
|
|
16272
|
-
nextTick(() => run(path, "onUpdateValue"));
|
|
16273
|
-
break;
|
|
16274
|
-
}
|
|
16275
|
-
case "setHidden":
|
|
16276
|
-
form.setField(path, { hidden: value });
|
|
16277
|
-
break;
|
|
16278
|
-
case "setDisabled":
|
|
16279
|
-
form.setField(path, { disabled: value });
|
|
16280
|
-
break;
|
|
16281
|
-
case "setOptions":
|
|
16282
|
-
form.setField(path, { options: value });
|
|
16283
|
-
break;
|
|
16284
|
-
case "setRules": {
|
|
16285
|
-
const validateRule2 = [];
|
|
16286
|
-
for (let validateRuleIndex = 0; validateRuleIndex < value.length; validateRuleIndex += 1) {
|
|
16287
|
-
const validateRuleItem = value[validateRuleIndex];
|
|
16288
|
-
const { pattern: pattern4, validator, asyncValidator } = validateRuleItem;
|
|
16289
|
-
const overrides = {};
|
|
16290
|
-
if (pattern4) {
|
|
16291
|
-
const fn = new Function(`return ${pattern4}`);
|
|
16292
|
-
overrides.pattern = fn();
|
|
16293
|
-
}
|
|
16294
|
-
if (validator) {
|
|
16295
|
-
const validatorFn = new Function(`return ${validator}`)();
|
|
16296
|
-
overrides.validator = (...args) => validatorFn({ tool, form }, ...args);
|
|
16297
|
-
}
|
|
16298
|
-
if (asyncValidator) {
|
|
16299
|
-
const asyncValidatorFn = new Function(`return ${asyncValidator}`)();
|
|
16300
|
-
overrides.asyncValidator = (...args) => asyncValidatorFn({ tool, form }, args);
|
|
16301
|
-
}
|
|
16302
|
-
validateRule2.push({
|
|
16303
|
-
...validateRuleItem,
|
|
16304
|
-
...overrides
|
|
16305
|
-
});
|
|
16306
|
-
}
|
|
16307
|
-
form.setField(path, (preField) => ({ ...preField, rule: validateRule2 }));
|
|
16308
|
-
break;
|
|
16309
|
-
}
|
|
16310
|
-
case "setField":
|
|
16311
|
-
form.setField(path, (preField) => ({ ...preField, ...value }));
|
|
16312
|
-
break;
|
|
16313
|
-
case "triggerValidate":
|
|
16314
|
-
break;
|
|
16315
|
-
case "triggerClearValidate":
|
|
16316
|
-
break;
|
|
16317
|
-
case "triggerMessage":
|
|
16318
|
-
message2.info(value);
|
|
16319
|
-
break;
|
|
16320
|
-
default: {
|
|
16321
|
-
const n2 = type4;
|
|
16322
|
-
console.log("n: ", n2);
|
|
16323
|
-
}
|
|
16324
|
-
}
|
|
16325
|
-
}
|
|
16326
|
-
}
|
|
16327
|
-
const runCommands = async ({ path, trigger, ...baseParam }) => {
|
|
16328
|
-
const { form, logQueue } = baseParam;
|
|
16329
|
-
const field = form.getField(path);
|
|
16330
|
-
if (!field)
|
|
16331
|
-
return;
|
|
16332
|
-
const { autoCommand } = field;
|
|
16333
|
-
const commands = autoCommand == null ? void 0 : autoCommand[trigger];
|
|
16334
|
-
if (!commands || commands.length === 0)
|
|
16335
|
-
return;
|
|
16336
|
-
for (const command of commands) {
|
|
16337
|
-
const { no, logics, name, description } = command || {};
|
|
16338
|
-
if (!logics || logics.length === 0)
|
|
16339
|
-
return;
|
|
16340
|
-
logQueue.push({ no, name });
|
|
16341
|
-
logQueue.push([
|
|
16342
|
-
[`****** 开始执行逻辑指令 (`, ["large", "blue"]],
|
|
16343
|
-
[`${no}`, ["large", "purple"]],
|
|
16344
|
-
[`) ******`, ["large", "blue"]]
|
|
16345
|
-
]);
|
|
16346
|
-
logQueue.push([
|
|
16347
|
-
[`指令名称:`, ["blue"]],
|
|
16348
|
-
[`${name}`, ["gray"]]
|
|
16349
|
-
]);
|
|
16350
|
-
logQueue.push([
|
|
16351
|
-
[`指令描述:`, ["blue"]],
|
|
16352
|
-
[`${description}`, ["gray"]]
|
|
16353
|
-
]);
|
|
16354
|
-
for (let logicIndex = 0; logicIndex < logics.length; logicIndex += 1) {
|
|
16355
|
-
const logic = logics[logicIndex];
|
|
16356
|
-
const { conditions, actions } = logic;
|
|
16357
|
-
if (conditions.length === 0 || actions.length === 0)
|
|
16358
|
-
return;
|
|
16359
|
-
logQueue.push([
|
|
16360
|
-
[`逻辑${logicIndex + 1}:`, ["large", "purple"]],
|
|
16361
|
-
[`${path}`, ["large", "red"]],
|
|
16362
|
-
[
|
|
16363
|
-
`${logic.disabled ? " 禁用中" : " 启用中"}`,
|
|
16364
|
-
["large", `${logic.disabled ? "red" : "blue"}`]
|
|
16365
|
-
]
|
|
16366
|
-
]);
|
|
16367
|
-
if (logic.disabled)
|
|
16368
|
-
return;
|
|
16369
|
-
const conditionsValid = await validateConditions(conditions, baseParam);
|
|
16370
|
-
if (conditionsValid) {
|
|
16371
|
-
await runRules(actions, baseParam);
|
|
16372
|
-
}
|
|
16373
|
-
}
|
|
16374
|
-
logQueue.push([
|
|
16375
|
-
["****** 结束执行逻辑指令 ******", ["large", "blue", "mb10"]]
|
|
16376
|
-
]);
|
|
16377
|
-
}
|
|
16378
|
-
};
|
|
16379
|
-
const useCommand = (form) => {
|
|
16380
|
-
let message$1;
|
|
16381
|
-
try {
|
|
16382
|
-
message$1 = message;
|
|
16383
|
-
} catch (error) {
|
|
16384
|
-
message$1 = { info: (s2) => alert(s2) };
|
|
16385
|
-
console.log("error: ", error);
|
|
16386
|
-
}
|
|
16387
|
-
const run = (path, trigger) => {
|
|
16388
|
-
const logQueue = [];
|
|
16389
|
-
runCommands({
|
|
16390
|
-
path,
|
|
16391
|
-
trigger,
|
|
16392
|
-
form,
|
|
16393
|
-
message: message$1,
|
|
16394
|
-
run,
|
|
16395
|
-
logQueue
|
|
16396
|
-
}).catch((err) => {
|
|
16397
|
-
setTimeout(() => printLog("逻辑运行出错了😂", ["large", "red"]));
|
|
16398
|
-
throw err;
|
|
16399
|
-
}).finally(() => {
|
|
16400
|
-
const logGroupInfo = logQueue.splice(0, 1)[0];
|
|
16401
|
-
console.groupCollapsed(
|
|
16402
|
-
`%c【逻辑指令${logGroupInfo.no}】${logGroupInfo.name}`,
|
|
16403
|
-
"font-size: 13px;"
|
|
16404
|
-
);
|
|
16405
|
-
logQueue.forEach((logParam) => printLog(logParam));
|
|
16406
|
-
console.groupEnd();
|
|
16407
|
-
});
|
|
16408
|
-
};
|
|
16409
|
-
return { run };
|
|
16410
|
-
};
|
|
16411
|
-
const useCommand$1 = useCommand;
|
|
16412
16089
|
const useInitProps = () => {
|
|
16413
16090
|
const initPropsMap = /* @__PURE__ */ new Map();
|
|
16414
16091
|
INIT_PROPS_MAP.forEach((val, key) => {
|
|
@@ -16433,8 +16110,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
16433
16110
|
__name: "index",
|
|
16434
16111
|
props: {
|
|
16435
16112
|
component: { default: () => h$1("div", 'Missing required prop: "component"') },
|
|
16436
|
-
path: { default: "" }
|
|
16437
|
-
label: { default: "" }
|
|
16113
|
+
path: { default: "" }
|
|
16438
16114
|
},
|
|
16439
16115
|
emits: ["setComponentRef", "fieldChange", "fieldBlur"],
|
|
16440
16116
|
setup(__props, { emit: __emit }) {
|
|
@@ -16442,7 +16118,6 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
16442
16118
|
const emit = __emit;
|
|
16443
16119
|
const formData = inject(FORM_DATA);
|
|
16444
16120
|
const updateFormData = inject(UPDATE_FORM_DATA);
|
|
16445
|
-
const command = inject(COMMAND);
|
|
16446
16121
|
const updateActivePath = inject(UPDATE_ACTIVE_PATH);
|
|
16447
16122
|
const { getInitProps } = useInitProps$1();
|
|
16448
16123
|
const componentRef = ref();
|
|
@@ -16468,32 +16143,10 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
16468
16143
|
triggerFormItemChange();
|
|
16469
16144
|
}
|
|
16470
16145
|
});
|
|
16471
|
-
const forceUpdateKey = ref(0);
|
|
16472
|
-
watch(value, (val, oldVal) => {
|
|
16473
|
-
if (val === void 0 && oldVal) {
|
|
16474
|
-
forceUpdateKey.value += 1;
|
|
16475
|
-
}
|
|
16476
|
-
});
|
|
16477
16146
|
const attrs = useAttrs();
|
|
16478
16147
|
const componentType = computed(
|
|
16479
16148
|
() => typeof props.component === "function" || isVNode(props.component) ? void 0 : props.component
|
|
16480
16149
|
);
|
|
16481
|
-
const rewriteMethod = (methodName) => {
|
|
16482
|
-
var _a, _b;
|
|
16483
|
-
if (attrs.autoCommand && ((_b = (_a = attrs.autoCommand) == null ? void 0 : _a[methodName]) == null ? void 0 : _b.length) > 0) {
|
|
16484
|
-
return {
|
|
16485
|
-
[methodName]: (...args) => {
|
|
16486
|
-
var _a2;
|
|
16487
|
-
(_a2 = attrs[methodName]) == null ? void 0 : _a2.call(attrs, ...args);
|
|
16488
|
-
nextTick(() => {
|
|
16489
|
-
var _a3;
|
|
16490
|
-
(_a3 = command == null ? void 0 : command.value) == null ? void 0 : _a3.run(props.path, methodName);
|
|
16491
|
-
});
|
|
16492
|
-
}
|
|
16493
|
-
};
|
|
16494
|
-
}
|
|
16495
|
-
return {};
|
|
16496
|
-
};
|
|
16497
16150
|
const modelName = computed(() => {
|
|
16498
16151
|
if (componentType.value === "switch") {
|
|
16499
16152
|
return "checked";
|
|
@@ -16507,17 +16160,9 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
16507
16160
|
component: compType,
|
|
16508
16161
|
type: attrs.type
|
|
16509
16162
|
});
|
|
16510
|
-
const methods = { ...rewriteMethod("onUpdateValue") };
|
|
16511
|
-
switch (compType) {
|
|
16512
|
-
case "input":
|
|
16513
|
-
case "input-number":
|
|
16514
|
-
Object.assign(methods, rewriteMethod("onBlur"), rewriteMethod("onFocus"));
|
|
16515
|
-
break;
|
|
16516
|
-
}
|
|
16517
16163
|
return {
|
|
16518
16164
|
...initProps,
|
|
16519
16165
|
...attrs,
|
|
16520
|
-
...methods,
|
|
16521
16166
|
onFocus: void 0,
|
|
16522
16167
|
disabled: attrs.disabled ?? parentDisabled.value ?? initProps.disabled,
|
|
16523
16168
|
slots: void 0
|
|
@@ -16537,7 +16182,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
16537
16182
|
path: _ctx.path
|
|
16538
16183
|
}, {
|
|
16539
16184
|
default: withCtx(() => [
|
|
16540
|
-
(openBlock(), createBlock(resolveDynamicComponent(is.value), mergeProps(
|
|
16185
|
+
(openBlock(), createBlock(resolveDynamicComponent(is.value), mergeProps(unref(omit$1)(mergedAttrs.value, "componentContainer"), {
|
|
16541
16186
|
ref_key: "componentRef",
|
|
16542
16187
|
ref: componentRef,
|
|
16543
16188
|
[modelName.value]: value.value,
|
|
@@ -16566,7 +16211,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
16566
16211
|
};
|
|
16567
16212
|
}
|
|
16568
16213
|
});
|
|
16569
|
-
const
|
|
16214
|
+
const index_vue_vue_type_style_index_0_scoped_37574a50_lang = "";
|
|
16570
16215
|
const _export_sfc = (sfc, props) => {
|
|
16571
16216
|
const target = sfc.__vccOpts || sfc;
|
|
16572
16217
|
for (const [key, val] of props) {
|
|
@@ -16574,7 +16219,7 @@ const _export_sfc = (sfc, props) => {
|
|
|
16574
16219
|
}
|
|
16575
16220
|
return target;
|
|
16576
16221
|
};
|
|
16577
|
-
const BaseField = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-
|
|
16222
|
+
const BaseField = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-37574a50"]]);
|
|
16578
16223
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
16579
16224
|
...{
|
|
16580
16225
|
name: "ContainerFragment",
|
|
@@ -16618,78 +16263,46 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
16618
16263
|
},
|
|
16619
16264
|
__name: "index",
|
|
16620
16265
|
props: {
|
|
16621
|
-
form: { default: void 0 },
|
|
16622
|
-
formData: { default: () => ({}) },
|
|
16623
|
-
fields: { default: () => [] },
|
|
16624
16266
|
grid: { type: [Boolean, Object], default: false },
|
|
16625
|
-
|
|
16626
|
-
activePath: { default: void 0 }
|
|
16267
|
+
form: { default: () => ({}) }
|
|
16627
16268
|
},
|
|
16628
|
-
|
|
16629
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
16269
|
+
setup(__props, { expose: __expose }) {
|
|
16630
16270
|
const props = __props;
|
|
16271
|
+
const {
|
|
16272
|
+
setActivePath: updateActivePath,
|
|
16273
|
+
setFormData,
|
|
16274
|
+
formData = {},
|
|
16275
|
+
fields = [],
|
|
16276
|
+
setFormRef,
|
|
16277
|
+
formRef
|
|
16278
|
+
} = props.form;
|
|
16631
16279
|
const injectProps = useInjectProps(INJECT_KEYS["pro-form"]);
|
|
16632
16280
|
const injectAttrs = omit$1(injectProps, Object.keys(props));
|
|
16633
|
-
const emit = __emit;
|
|
16634
|
-
const updateActivePath = (path) => {
|
|
16635
|
-
var _a, _b;
|
|
16636
|
-
if (props.form) {
|
|
16637
|
-
(_b = (_a = props.form) == null ? void 0 : _a.setActivePath) == null ? void 0 : _b.call(_a, path);
|
|
16638
|
-
} else {
|
|
16639
|
-
emit("update:activePath", path);
|
|
16640
|
-
}
|
|
16641
|
-
};
|
|
16642
|
-
const _formData = computed(
|
|
16643
|
-
() => {
|
|
16644
|
-
var _a;
|
|
16645
|
-
return props.form ? (_a = props.form) == null ? void 0 : _a.formData.value : props.formData;
|
|
16646
|
-
}
|
|
16647
|
-
);
|
|
16648
|
-
const _fields = computed(
|
|
16649
|
-
() => {
|
|
16650
|
-
var _a;
|
|
16651
|
-
return props.form ? (_a = props.form) == null ? void 0 : _a.fields.value : props.fields;
|
|
16652
|
-
}
|
|
16653
|
-
);
|
|
16654
16281
|
const updateFormData = (path, value) => {
|
|
16655
|
-
|
|
16656
|
-
|
|
16657
|
-
(_a = props.form) == null ? void 0 : _a.setFormData(path, value);
|
|
16658
|
-
} else {
|
|
16659
|
-
const newFormData = cloneDeep(_formData);
|
|
16660
|
-
set$1(newFormData, path, value);
|
|
16661
|
-
emit("update:formData", newFormData);
|
|
16662
|
-
}
|
|
16663
|
-
updateActivePath(path);
|
|
16282
|
+
setFormData == null ? void 0 : setFormData(path, value);
|
|
16283
|
+
updateActivePath == null ? void 0 : updateActivePath(path);
|
|
16664
16284
|
};
|
|
16665
|
-
const command = computed(() => {
|
|
16666
|
-
return props.form && !props.autoCommandDisabled ? useCommand$1(props.form) : null;
|
|
16667
|
-
});
|
|
16668
16285
|
const exposed = shallowReactive({});
|
|
16669
16286
|
const formInstanceRef = ref(null);
|
|
16670
16287
|
onMounted(() => {
|
|
16671
|
-
var _a;
|
|
16672
16288
|
Object.assign(exposed, formInstanceRef.value);
|
|
16673
|
-
if (
|
|
16674
|
-
|
|
16675
|
-
props.form.setFormRef(exposed);
|
|
16676
|
-
}
|
|
16289
|
+
if (setFormRef && !(formRef == null ? void 0 : formRef.value)) {
|
|
16290
|
+
setFormRef(exposed);
|
|
16677
16291
|
}
|
|
16678
16292
|
});
|
|
16679
|
-
provide(FORM_DATA,
|
|
16293
|
+
provide(FORM_DATA, formData);
|
|
16680
16294
|
provide(UPDATE_FORM_DATA, updateFormData);
|
|
16681
|
-
provide(COMMAND, command);
|
|
16682
16295
|
provide(UPDATE_ACTIVE_PATH, updateActivePath);
|
|
16683
16296
|
__expose(exposed);
|
|
16684
16297
|
return (_ctx, _cache) => {
|
|
16685
16298
|
return openBlock(), createBlock(unref(Form$2), mergeProps({
|
|
16686
16299
|
ref_key: "formInstanceRef",
|
|
16687
16300
|
ref: formInstanceRef,
|
|
16688
|
-
model:
|
|
16301
|
+
model: unref(formData)
|
|
16689
16302
|
}, { ...unref(injectAttrs), ..._ctx.$attrs }), {
|
|
16690
16303
|
default: withCtx(() => [
|
|
16691
16304
|
createVNode(unref(_sfc_main$4), {
|
|
16692
|
-
fields:
|
|
16305
|
+
fields: unref(fields),
|
|
16693
16306
|
grid: _ctx.grid,
|
|
16694
16307
|
disabled: _ctx.$attrs.disabled
|
|
16695
16308
|
}, null, 8, ["fields", "grid", "disabled"]),
|
|
@@ -16705,7 +16318,6 @@ export {
|
|
|
16705
16318
|
BaseField as B,
|
|
16706
16319
|
COMPONENT_MAP as C,
|
|
16707
16320
|
FORM_ITEM_SLOT_KEYS as F,
|
|
16708
|
-
RULE_TYPE_MAP as R,
|
|
16709
16321
|
UPDATE_FORM_DATA as U,
|
|
16710
16322
|
_sfc_main as _,
|
|
16711
16323
|
_export_sfc as a,
|
|
@@ -16715,17 +16327,10 @@ export {
|
|
|
16715
16327
|
_sfc_main$1 as e,
|
|
16716
16328
|
FORM_DATA as f,
|
|
16717
16329
|
get$1 as g,
|
|
16718
|
-
|
|
16719
|
-
|
|
16720
|
-
|
|
16721
|
-
|
|
16722
|
-
isFunctionString as l,
|
|
16723
|
-
jsonStringifyReplacer as m,
|
|
16724
|
-
jsonParseReviver as n,
|
|
16330
|
+
UPDATE_ACTIVE_PATH as h,
|
|
16331
|
+
useFields$1 as i,
|
|
16332
|
+
useFormData$1 as j,
|
|
16333
|
+
useInitProps$1 as k,
|
|
16725
16334
|
omit$1 as o,
|
|
16726
|
-
useFields$1 as p,
|
|
16727
|
-
useFormData$1 as q,
|
|
16728
|
-
useCommand$1 as r,
|
|
16729
|
-
useInitProps$1 as s,
|
|
16730
16335
|
useForm$1 as u
|
|
16731
16336
|
};
|