cnhis-design-vue 3.1.16-beta.4 → 3.1.16-beta.5
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/es/packages/big-table/index.d.ts +1 -429
- package/es/packages/big-table/src/BigTable.vue.d.ts +26 -458
- package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +61 -97
- package/es/packages/big-table/style/index.css +1 -2
- package/es/packages/form-render/src/FormRender.js +6 -3
- package/es/packages/form-render/src/components/renderer/linebar.js +1 -4
- package/es/packages/form-render/src/components/renderer/select.js +16 -10
- package/es/packages/form-render/src/hooks/useChangeContext.d.ts +4 -2
- package/es/packages/form-render/src/hooks/useChangeContext.js +4 -7
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +1 -1
- package/es/packages/index.css +1 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, reactive, useAttrs, computed, onMounted, onUnmounted, onActivated, createVNode, h, resolveComponent, Teleport, createTextVNode, nextTick, watch, openBlock, createElementBlock, Fragment,
|
|
1
|
+
import { defineComponent, ref, reactive, useAttrs, computed, onMounted, onUnmounted, onActivated, createVNode, h, resolveComponent, Teleport, createTextVNode, nextTick, watch, openBlock, createElementBlock, Fragment, createBlock, unref, withCtx, renderList, createCommentVNode, createElementVNode, normalizeClass, normalizeStyle, mergeProps, renderSlot, toDisplayString, withDirectives, vShow, isVNode } from 'vue';
|
|
2
2
|
import { isArray, isFunction } from 'lodash-es';
|
|
3
3
|
import bigTableState from './bigTableState.js';
|
|
4
4
|
import bigTableProps from './bigTableProps.js';
|
|
@@ -30,12 +30,9 @@ const _hoisted_1 = {
|
|
|
30
30
|
class: "check-wrap"
|
|
31
31
|
};
|
|
32
32
|
const _hoisted_2 = /* @__PURE__ */ createElementVNode("span", null, "\u7CFB\u7EDF\u68C0\u6D4B\u5230\u6709\u6570\u636E\u66F4\u65B0,", -1);
|
|
33
|
-
const _hoisted_3 =
|
|
34
|
-
class: "disabled-checked-tips"
|
|
35
|
-
}, null, -1);
|
|
33
|
+
const _hoisted_3 = ["innerHTML"];
|
|
36
34
|
const _hoisted_4 = ["innerHTML"];
|
|
37
|
-
const _hoisted_5 =
|
|
38
|
-
const _hoisted_6 = {
|
|
35
|
+
const _hoisted_5 = {
|
|
39
36
|
class: "refresh-row"
|
|
40
37
|
};
|
|
41
38
|
function _isSlot(s) {
|
|
@@ -129,7 +126,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
129
126
|
let {
|
|
130
127
|
noSetting
|
|
131
128
|
} = getOtherConfigInit() || {};
|
|
132
|
-
return noSetting || ((_a = props.showSettings) == null ? void 0 : _a.hideSettingBtn)
|
|
129
|
+
return noSetting || ((_a = props.showSettings) == null ? void 0 : _a.hideSettingBtn);
|
|
133
130
|
});
|
|
134
131
|
const isScanMultiTable = computed(() => {
|
|
135
132
|
var _a;
|
|
@@ -340,7 +337,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
340
337
|
state.currentPageSelectedLength = currentPageSelectedRows.length;
|
|
341
338
|
};
|
|
342
339
|
const formatColumns = (map) => {
|
|
343
|
-
var _a, _b;
|
|
340
|
+
var _a, _b, _c;
|
|
344
341
|
let {
|
|
345
342
|
selectType
|
|
346
343
|
} = getOtherConfigInit() || {};
|
|
@@ -421,24 +418,24 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
421
418
|
visible: checkVisible,
|
|
422
419
|
resizable: false,
|
|
423
420
|
width: checkMinWidth,
|
|
424
|
-
slots: selectType === "checkbox" ? checkboxSlot : null,
|
|
421
|
+
slots: selectType === "checkbox" && !((_b = attr.checkboxConfig) == null ? void 0 : _b.checkMethod) ? checkboxSlot : null,
|
|
425
422
|
showOverflow: true
|
|
426
423
|
}];
|
|
427
424
|
const seqObj = columns.find((v) => v.type == "seq");
|
|
428
|
-
if ((
|
|
425
|
+
if ((_c = props == null ? void 0 : props.columnConfig) == null ? void 0 : _c.seqSlotFn) {
|
|
429
426
|
seqObj.slots.default = (params) => {
|
|
430
427
|
var _a2;
|
|
431
428
|
return (_a2 = props.columnConfig) == null ? void 0 : _a2.seqSlotFn(params);
|
|
432
429
|
};
|
|
433
430
|
}
|
|
434
431
|
const currentColumns = fieldList.map((item, index) => {
|
|
435
|
-
var _a2, _b2,
|
|
432
|
+
var _a2, _b2, _c2, _d, _e, _f, _g;
|
|
436
433
|
let filterField = false;
|
|
437
434
|
let filterItems = [];
|
|
438
435
|
try {
|
|
439
436
|
const fieldSetting = JSON.parse(item.fieldSetting);
|
|
440
437
|
filterField = ((_a2 = fieldSetting == null ? void 0 : fieldSetting.mapping) == null ? void 0 : _a2.type) === "manual" && item.isMerge != 1;
|
|
441
|
-
filterItems = (
|
|
438
|
+
filterItems = (_c2 = (_b2 = fieldSetting == null ? void 0 : fieldSetting.mapping) == null ? void 0 : _b2.mappingFiled) == null ? void 0 : _c2.map((item2) => item2.value[0]);
|
|
442
439
|
} catch (e) {
|
|
443
440
|
}
|
|
444
441
|
let notParticipatingSort = ((_d = item == null ? void 0 : item.fieldSetting) == null ? void 0 : _d.notParticipatingSort) || "";
|
|
@@ -465,31 +462,13 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
465
462
|
treeNode,
|
|
466
463
|
type,
|
|
467
464
|
slots: {
|
|
468
|
-
edit: (params) =>
|
|
469
|
-
if (isEdit && item.isEdit && item.columnName !== "operatorColumn") {
|
|
470
|
-
return formatterEdit(params, item);
|
|
471
|
-
} else {
|
|
472
|
-
return createVNode("span", null, [params.row[item.columnName]]);
|
|
473
|
-
}
|
|
474
|
-
},
|
|
465
|
+
edit: (params) => formatterEdit(params, item),
|
|
475
466
|
default: (params) => {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
return formatter(params, item);
|
|
479
|
-
} else if (item.formType === "separate") {
|
|
480
|
-
const SeparateComponent = Separate;
|
|
481
|
-
return createVNode(SeparateComponent, {
|
|
482
|
-
"row": params.row,
|
|
483
|
-
"col": item
|
|
484
|
-
}, null);
|
|
485
|
-
} else if (isEdit && item.isEdit && ((_a3 = item.checkEditStatus) == null ? void 0 : _a3.call(item, params))) {
|
|
486
|
-
return formatterEdit(params, item);
|
|
487
|
-
} else {
|
|
488
|
-
return createVNode("span", null, [getDefaultValue(params, item)]);
|
|
489
|
-
}
|
|
467
|
+
const _isEdit = isEdit && item.isEdit;
|
|
468
|
+
return formatter(params, item, _isEdit);
|
|
490
469
|
}
|
|
491
470
|
},
|
|
492
|
-
editRender: isEdit ? {} : generateEditRender(item)
|
|
471
|
+
editRender: isEdit && item.isEdit ? {} : generateEditRender(item)
|
|
493
472
|
});
|
|
494
473
|
if (filterField && !props.isNestTable && !isScanMultiTable2) {
|
|
495
474
|
state.filterFields[item.columnName] = Object.assign({}, vexutils.clone({
|
|
@@ -594,15 +573,28 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
594
573
|
}
|
|
595
574
|
});
|
|
596
575
|
};
|
|
597
|
-
const formatter = (params, col) => {
|
|
598
|
-
var _a, _b;
|
|
576
|
+
const formatter = (params, col, _isEdit) => {
|
|
577
|
+
var _a, _b, _c;
|
|
599
578
|
let {
|
|
600
579
|
row,
|
|
601
580
|
column,
|
|
602
581
|
$rowIndex
|
|
603
582
|
} = params;
|
|
604
|
-
let
|
|
605
|
-
|
|
583
|
+
let attrType = (col == null ? void 0 : col.attrType) || "";
|
|
584
|
+
if (col.formType === "separate") {
|
|
585
|
+
const SeparateComponent = Separate;
|
|
586
|
+
return createVNode(SeparateComponent, {
|
|
587
|
+
"row": params.row,
|
|
588
|
+
"col": col
|
|
589
|
+
}, null);
|
|
590
|
+
}
|
|
591
|
+
if (_isEdit) {
|
|
592
|
+
if ((_a = col.checkEditStatus) == null ? void 0 : _a.call(col, params)) {
|
|
593
|
+
return formatterEdit(params, col);
|
|
594
|
+
} else {
|
|
595
|
+
return createVNode("span", null, [getDefaultValue(params, col)]);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
606
598
|
let formUnionItem = showEditForm(row, column, $rowIndex);
|
|
607
599
|
if (formUnionItem) {
|
|
608
600
|
let dynamicProps = initBatchDynamicProps(formUnionItem, row, column);
|
|
@@ -618,66 +610,66 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
618
610
|
return row[GROUP_TITLE_KEY];
|
|
619
611
|
}
|
|
620
612
|
if (attrType == "PICTURE" || attrType == "HEADPORTRAIT") {
|
|
621
|
-
return getPicture(row,
|
|
613
|
+
return getPicture(row, col, attrType);
|
|
622
614
|
}
|
|
623
615
|
if (attrType == "COLOR") {
|
|
624
|
-
return getColor(row,
|
|
616
|
+
return getColor(row, col);
|
|
625
617
|
}
|
|
626
618
|
if (attrType == "EVALUATE") {
|
|
627
|
-
return getEvaluate(row,
|
|
619
|
+
return getEvaluate(row, col);
|
|
628
620
|
}
|
|
629
621
|
if (attrType == "MAP") {
|
|
630
|
-
return getMapVal(row,
|
|
622
|
+
return getMapVal(row, col);
|
|
631
623
|
}
|
|
632
624
|
if (attrType == "DATE" || attrType == "TASKDATE") {
|
|
633
|
-
return getDate(row,
|
|
625
|
+
return getDate(row, col);
|
|
634
626
|
}
|
|
635
627
|
if (attrType == "PERCENTAGE") {
|
|
636
|
-
return getPercentage(row,
|
|
628
|
+
return getPercentage(row, col);
|
|
637
629
|
}
|
|
638
630
|
if (attrType == "VIDEO") {
|
|
639
|
-
return getvideoList(row,
|
|
631
|
+
return getvideoList(row, col);
|
|
640
632
|
}
|
|
641
633
|
if (attrType == "CANDIDATE_COMPONENTS") {
|
|
642
|
-
return getCandidateComponents(row,
|
|
634
|
+
return getCandidateComponents(row, col);
|
|
643
635
|
}
|
|
644
636
|
if (attrType == "AGE") {
|
|
645
|
-
return getageShowType(row,
|
|
637
|
+
return getageShowType(row, col);
|
|
646
638
|
}
|
|
647
639
|
if (attrType === "COUNTDOWN") {
|
|
648
640
|
return createVNode(NTooltip, null, {
|
|
649
641
|
trigger() {
|
|
650
642
|
return createVNode("span", {
|
|
651
|
-
"innerHTML": row[
|
|
643
|
+
"innerHTML": row[col.columnName + "_countdown"] || ""
|
|
652
644
|
}, null);
|
|
653
645
|
},
|
|
654
646
|
default() {
|
|
655
|
-
return row[
|
|
647
|
+
return row[col.columnName + "_countdownTip"];
|
|
656
648
|
}
|
|
657
649
|
});
|
|
658
650
|
}
|
|
659
651
|
if (attrType === "DURATION") {
|
|
660
|
-
const value = row[
|
|
661
|
-
const duration = (
|
|
652
|
+
const value = row[col.columnName];
|
|
653
|
+
const duration = (_b = col == null ? void 0 : col.fieldSetting) == null ? void 0 : _b.duration;
|
|
662
654
|
return parseDurationValue(value, duration);
|
|
663
655
|
}
|
|
664
656
|
if (attrType === "COMBINATION") {
|
|
665
|
-
const value = row[
|
|
666
|
-
const params2 =
|
|
657
|
+
const value = row[col.columnName];
|
|
658
|
+
const params2 = col.fieldSetting || {};
|
|
667
659
|
const data = parseCombinationValue(value, params2);
|
|
668
660
|
return data ? [createVNode("span", {
|
|
669
661
|
"title": data
|
|
670
662
|
}, [data])] : "";
|
|
671
663
|
}
|
|
672
664
|
if (attrType === "PASSWORD") {
|
|
673
|
-
const value = row[
|
|
665
|
+
const value = row[col.columnName];
|
|
674
666
|
return [createVNode(resolveComponent("password-com"), {
|
|
675
667
|
"value": value,
|
|
676
668
|
"styleSetting": props.styleSetting
|
|
677
669
|
}, null)];
|
|
678
670
|
}
|
|
679
671
|
if (attrType === "QR_CODE") {
|
|
680
|
-
return getOrCode(row,
|
|
672
|
+
return getOrCode(row, col);
|
|
681
673
|
}
|
|
682
674
|
if (column.property === "operatorColumn") {
|
|
683
675
|
if ((col == null ? void 0 : col.formType) === "custom" && col.slotFn && !row.initRow) {
|
|
@@ -693,21 +685,21 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
693
685
|
const foldBtnList = getFoldBtnList(row, $rowIndex);
|
|
694
686
|
return [createVNode("span", null, [tileBtnList, foldBtnList, inlineBtnList])];
|
|
695
687
|
}
|
|
696
|
-
if (isLink(props,
|
|
697
|
-
if (
|
|
688
|
+
if (isLink(props, col, row) && !isScanMultiTable.value) {
|
|
689
|
+
if (col.btnLinkSwitch) {
|
|
698
690
|
let disabled = false;
|
|
699
|
-
let curBtn = (
|
|
691
|
+
let curBtn = (_c = row.btnList) == null ? void 0 : _c.find((v) => v.name == col.columnName);
|
|
700
692
|
if (curBtn && "authorizedMark" in curBtn) {
|
|
701
693
|
if (!curBtn.authorizedMark) {
|
|
702
694
|
disabled = true;
|
|
703
695
|
}
|
|
704
696
|
}
|
|
705
|
-
return getBtnLinkSwitch(row,
|
|
697
|
+
return getBtnLinkSwitch(row, col, disabled, $rowIndex);
|
|
706
698
|
} else {
|
|
707
|
-
return getField(row,
|
|
699
|
+
return getField(row, col, $rowIndex, true);
|
|
708
700
|
}
|
|
709
701
|
} else {
|
|
710
|
-
return getField(row,
|
|
702
|
+
return getField(row, col, $rowIndex, false);
|
|
711
703
|
}
|
|
712
704
|
};
|
|
713
705
|
const formatterHeader = (item) => {
|
|
@@ -1156,9 +1148,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1156
1148
|
var _a;
|
|
1157
1149
|
const {
|
|
1158
1150
|
row,
|
|
1159
|
-
column
|
|
1160
|
-
_rowIndex,
|
|
1161
|
-
_columnIndex
|
|
1151
|
+
column
|
|
1162
1152
|
} = payload;
|
|
1163
1153
|
if (isFunction(attr.spanMethod))
|
|
1164
1154
|
return attr.spanMethod(payload);
|
|
@@ -1206,8 +1196,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1206
1196
|
};
|
|
1207
1197
|
let {
|
|
1208
1198
|
$rowIndex,
|
|
1209
|
-
_columnIndex
|
|
1210
|
-
column
|
|
1199
|
+
_columnIndex
|
|
1211
1200
|
} = obj;
|
|
1212
1201
|
let len = state.columnLen || 99;
|
|
1213
1202
|
let {
|
|
@@ -1532,9 +1521,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1532
1521
|
};
|
|
1533
1522
|
const radioOnChange = (rowData = {}) => {
|
|
1534
1523
|
let {
|
|
1535
|
-
|
|
1536
|
-
row,
|
|
1537
|
-
$rowIndex
|
|
1524
|
+
row
|
|
1538
1525
|
} = rowData;
|
|
1539
1526
|
emit("selectionChange", [{
|
|
1540
1527
|
...row
|
|
@@ -2283,14 +2270,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2283
2270
|
loadData
|
|
2284
2271
|
});
|
|
2285
2272
|
return (_ctx, _cache) => {
|
|
2286
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
2287
|
-
class="big-table custom-big-table"
|
|
2288
|
-
:class="{
|
|
2289
|
-
mt: state.visibleCheckAllWrap || state.visibleTreeCheck || state.hasRefresh,
|
|
2290
|
-
'expand-padding': !props.isNestTable
|
|
2291
|
-
}"
|
|
2292
|
-
:style="{ height: state.tableHeight }"
|
|
2293
|
-
> `), state.anchorList.length ? (openBlock(), createBlock(unref(NTabs), {
|
|
2273
|
+
return openBlock(), createElementBlock(Fragment, null, [state.anchorList.length ? (openBlock(), createBlock(unref(NTabs), {
|
|
2294
2274
|
key: 0,
|
|
2295
2275
|
type: "line",
|
|
2296
2276
|
animated: "",
|
|
@@ -2319,7 +2299,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2319
2299
|
}, [_hoisted_2, createElementVNode("span", {
|
|
2320
2300
|
class: "check-wrap-btn",
|
|
2321
2301
|
onClick: refreshTable
|
|
2322
|
-
}, "\u70B9\u51FB\u67E5\u770B")])])) : createCommentVNode("v-if", true),
|
|
2302
|
+
}, "\u70B9\u51FB\u67E5\u770B")])])) : createCommentVNode("v-if", true), createVNode(unref(CGrid), mergeProps({
|
|
2323
2303
|
ref_key: "xGrid",
|
|
2324
2304
|
ref: xGrid,
|
|
2325
2305
|
border: "",
|
|
@@ -2401,28 +2381,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2401
2381
|
"no-data-tip": props.emptyItems.noDataTip,
|
|
2402
2382
|
"show-img": !props.isNestTable
|
|
2403
2383
|
}, null, 8, ["no-data-img", "no-data-tip", "show-img"])]) : createCommentVNode("v-if", true)]),
|
|
2404
|
-
tooltip_checkbox: withCtx(({
|
|
2405
|
-
row,
|
|
2406
|
-
checked
|
|
2407
|
-
}) => [row.forbiddenBatchSelect ? (openBlock(), createBlock(unref(NTooltip), {
|
|
2408
|
-
key: 0,
|
|
2409
|
-
trigger: "hover",
|
|
2410
|
-
placement: "right"
|
|
2411
|
-
}, {
|
|
2412
|
-
trigger: withCtx(() => [_hoisted_3]),
|
|
2413
|
-
default: withCtx(() => [createTextVNode(" " + toDisplayString(row.forbiddenBatchSelectReason), 1)]),
|
|
2414
|
-
_: 2
|
|
2415
|
-
}, 1024)) : (openBlock(), createBlock(unref(NCheckbox), {
|
|
2416
|
-
key: 1,
|
|
2417
|
-
class: "tooltip-checkbox-item",
|
|
2418
|
-
checked
|
|
2419
|
-
}, null, 8, ["checked"]))]),
|
|
2420
2384
|
tooltip_footer: withCtx(({
|
|
2421
2385
|
column
|
|
2422
2386
|
}) => [createCommentVNode(" \u5206\u7EC4\u7EDF\u8BA1 "), _ctx.groupCountFields && _ctx.groupCountFields.length ? (openBlock(), createElementBlock("span", {
|
|
2423
2387
|
key: 0,
|
|
2424
2388
|
innerHTML: state.groupText
|
|
2425
|
-
}, null, 8,
|
|
2389
|
+
}, null, 8, _hoisted_3)) : (openBlock(), createElementBlock(Fragment, {
|
|
2426
2390
|
key: 1
|
|
2427
2391
|
}, [createCommentVNode(" \u4E00\u822C\u7EDF\u8BA1 "), createVNode(unref(NTooltip), {
|
|
2428
2392
|
trigger: "hover"
|
|
@@ -2430,7 +2394,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2430
2394
|
trigger: withCtx(() => [createTextVNode(toDisplayString(getFooterTitle(column)), 1)]),
|
|
2431
2395
|
default: withCtx(() => [createElementVNode("div", {
|
|
2432
2396
|
innerHTML: getFooterTooltipTitle(column)
|
|
2433
|
-
}, null, 8,
|
|
2397
|
+
}, null, 8, _hoisted_4)]),
|
|
2434
2398
|
_: 2
|
|
2435
2399
|
}, 1024)], 2112))]),
|
|
2436
2400
|
nest_table_content: withCtx(({
|
|
@@ -2453,7 +2417,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2453
2417
|
}, [createVNode(unref(NIcon), {
|
|
2454
2418
|
size: "14",
|
|
2455
2419
|
component: unref(SyncOutline)
|
|
2456
|
-
}, null, 8, ["component"]), createElementVNode("p",
|
|
2420
|
+
}, null, 8, ["component"]), createElementVNode("p", _hoisted_5, toDisplayString(_ctx.refreshRow) + "\u6761\u66F4\u65B0", 1)], 512), [[vShow, props.refreshRow > 0 && !props.isNestTable]])], 6)], 64);
|
|
2457
2421
|
};
|
|
2458
2422
|
}
|
|
2459
2423
|
});
|
|
@@ -282,7 +282,7 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
282
282
|
height: 30px;
|
|
283
283
|
line-height: 30px;
|
|
284
284
|
}
|
|
285
|
-
.custom-big-table .vxe-table .vxe-cell--checkbox
|
|
285
|
+
.custom-big-table .vxe-table .vxe-cell--checkbox .vxe-checkbox--label {
|
|
286
286
|
display: none;
|
|
287
287
|
}
|
|
288
288
|
.custom-big-table .filter-box {
|
|
@@ -307,7 +307,6 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
307
307
|
}
|
|
308
308
|
.custom-big-table .disabled-checked-tips {
|
|
309
309
|
position: absolute;
|
|
310
|
-
left: 6px;
|
|
311
310
|
top: 50%;
|
|
312
311
|
bottom: 0;
|
|
313
312
|
right: 0;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { defineComponent, ref, computed, watch, openBlock, createBlock, unref, withCtx, createElementBlock, createVNode, isRef, Fragment, renderList, createCommentVNode, createElementVNode, normalizeStyle, renderSlot, toDisplayString, nextTick } from 'vue';
|
|
2
2
|
import { createForm, onFieldValueChange, isField } from '@formily/core';
|
|
3
3
|
import { FormProvider, FormConsumer } from '@formily/vue';
|
|
4
|
-
import {
|
|
4
|
+
import { isObject } from '@vue/shared';
|
|
5
|
+
import { cloneDeep, isArray } from 'lodash-es';
|
|
5
6
|
import { NForm, NTabs, NTabPane, NConfigProvider } from 'naive-ui';
|
|
6
7
|
import { FormItemLineBarDepKeyPrepend } from '../../../packages/form-render/src/constants';
|
|
7
8
|
import { useFormRenderLifeCycle } from '../../../packages/form-render/src/hooks/useFormRenderLifeCycle';
|
|
@@ -50,14 +51,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
50
51
|
const formModel = createForm({
|
|
51
52
|
initialValues: useInitialData().assignInitialData(props.initialData, props.fieldList),
|
|
52
53
|
effects() {
|
|
53
|
-
onFieldValueChange("*", (field) => {
|
|
54
|
+
onFieldValueChange("*", async (field) => {
|
|
54
55
|
const fieldKey = field.props.name.toString();
|
|
55
56
|
emit("formChange", {
|
|
56
57
|
fieldInstance: field,
|
|
57
58
|
fieldKey,
|
|
58
59
|
fieldName: field.title,
|
|
59
60
|
value: field.value,
|
|
60
|
-
context: changeContextCollector.getContext(fieldKey)
|
|
61
|
+
context: await changeContextCollector.getContext(fieldKey)
|
|
61
62
|
});
|
|
62
63
|
businessCollector.trigger(fieldKey);
|
|
63
64
|
formItemDepsCollector.trigger(fieldKey);
|
|
@@ -101,6 +102,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
101
102
|
return Promise.reject(Array.isArray(err) ? err.reduce(errInfoNormalize, []) : err);
|
|
102
103
|
});
|
|
103
104
|
function errInfoNormalize(result, error) {
|
|
105
|
+
if (!isObject(error))
|
|
106
|
+
return result;
|
|
104
107
|
let hasChildMessage = false;
|
|
105
108
|
if (isArray(error.messages)) {
|
|
106
109
|
error.messages.forEach((message) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref,
|
|
1
|
+
import { defineComponent, ref, inject, createVNode } from 'vue';
|
|
2
2
|
import { connect, mapProps } from '@formily/vue';
|
|
3
3
|
import { NDivider, NCollapseTransition } from 'naive-ui';
|
|
4
4
|
import { useFormField } from '../../../../../packages/form-render';
|
|
@@ -28,9 +28,6 @@ const script = defineComponent({
|
|
|
28
28
|
slots
|
|
29
29
|
}) {
|
|
30
30
|
const _show = ref(props.show);
|
|
31
|
-
onMounted(() => {
|
|
32
|
-
_show.value = props.show;
|
|
33
|
-
});
|
|
34
31
|
function toggleShow() {
|
|
35
32
|
if (props.disabled)
|
|
36
33
|
return;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, computed, ref, inject, nextTick, watch, createVNode } from 'vue';
|
|
2
2
|
import { isField } from '@formily/core';
|
|
3
|
-
import { isEqual
|
|
3
|
+
import { isEqual } from 'lodash-es';
|
|
4
4
|
import { useCommonInjection } from '../../../../../packages/form-render/src/hooks/useCommonInjection';
|
|
5
|
-
import {
|
|
5
|
+
import { InjectAsyncQueue, InjectionChangeContextCollector, InjectionFormItemDepsCollector } from '../../constants/index.js';
|
|
6
6
|
import { connect, mapProps } from '@formily/vue';
|
|
7
7
|
import { NSelect } from 'naive-ui';
|
|
8
8
|
import { useFormField } from '../../hooks/useFormField.js';
|
|
@@ -35,6 +35,10 @@ const script = defineComponent({
|
|
|
35
35
|
slots,
|
|
36
36
|
emit
|
|
37
37
|
}) {
|
|
38
|
+
const valueRef = computed({
|
|
39
|
+
get: () => props.value,
|
|
40
|
+
set: (v) => emit("update:value", v)
|
|
41
|
+
});
|
|
38
42
|
const remoteOptions = ref(null);
|
|
39
43
|
const lastSearch = ref("");
|
|
40
44
|
const labelKey = computed(() => {
|
|
@@ -45,11 +49,6 @@ const script = defineComponent({
|
|
|
45
49
|
var _a, _b;
|
|
46
50
|
return (_b = (_a = props.urlConfig) == null ? void 0 : _a.valueKey) != null ? _b : "value";
|
|
47
51
|
});
|
|
48
|
-
const changeContextCollector = inject(InjectionChangeContextCollector);
|
|
49
|
-
function update(v, option) {
|
|
50
|
-
changeContextCollector == null ? void 0 : changeContextCollector.setContext(fieldKey.value, "currentOption", cloneDeep(option));
|
|
51
|
-
emit("update:value", v);
|
|
52
|
-
}
|
|
53
52
|
const {
|
|
54
53
|
field,
|
|
55
54
|
fieldKey
|
|
@@ -102,6 +101,13 @@ const script = defineComponent({
|
|
|
102
101
|
});
|
|
103
102
|
}
|
|
104
103
|
});
|
|
104
|
+
const changeContextCollector = inject(InjectionChangeContextCollector);
|
|
105
|
+
changeContextCollector == null ? void 0 : changeContextCollector.setContext(fieldKey.value, async () => {
|
|
106
|
+
await nextTick();
|
|
107
|
+
return {
|
|
108
|
+
currentOption: parsedOptions.value.find((option) => option[valueKey.value] === props.value)
|
|
109
|
+
};
|
|
110
|
+
});
|
|
105
111
|
const formItemDepsCollector = inject(InjectionFormItemDepsCollector);
|
|
106
112
|
watch(() => props.urlConfig, (config, oldConfig) => {
|
|
107
113
|
if (isEqual(config, oldConfig))
|
|
@@ -135,8 +141,8 @@ const script = defineComponent({
|
|
|
135
141
|
return () => createVNode(NSelect, {
|
|
136
142
|
"remote": true,
|
|
137
143
|
"filterable": true,
|
|
138
|
-
"value":
|
|
139
|
-
"onUpdate:value":
|
|
144
|
+
"value": valueRef.value,
|
|
145
|
+
"onUpdate:value": ($event) => valueRef.value = $event,
|
|
140
146
|
"labelField": labelKey.value,
|
|
141
147
|
"valueField": valueKey.value,
|
|
142
148
|
"options": parsedOptions.value,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { FormChangeContext } from '../types';
|
|
2
2
|
export declare class ContextCollector {
|
|
3
3
|
private readonly contextMap;
|
|
4
|
-
setContext
|
|
4
|
+
setContext(key: string, value: () => Promise<FormChangeContext> | FormChangeContext): void;
|
|
5
5
|
getContext(key: string): Partial<{
|
|
6
6
|
currentOption: import("../../../../src/types").AnyObject;
|
|
7
|
-
}
|
|
7
|
+
}> | Promise<Partial<{
|
|
8
|
+
currentOption: import("../../../../src/types").AnyObject;
|
|
9
|
+
}>> | undefined;
|
|
8
10
|
}
|
|
9
11
|
export declare function useChangeContext(): {
|
|
10
12
|
create: () => ContextCollector;
|
|
@@ -2,15 +2,12 @@ class ContextCollector {
|
|
|
2
2
|
constructor() {
|
|
3
3
|
this.contextMap = /* @__PURE__ */ new Map();
|
|
4
4
|
}
|
|
5
|
-
setContext(key,
|
|
6
|
-
|
|
7
|
-
context[prop] = value;
|
|
8
|
-
this.contextMap.set(key, context);
|
|
5
|
+
setContext(key, value) {
|
|
6
|
+
this.contextMap.set(key, value);
|
|
9
7
|
}
|
|
10
8
|
getContext(key) {
|
|
11
|
-
|
|
12
|
-
this.contextMap.
|
|
13
|
-
return result;
|
|
9
|
+
var _a;
|
|
10
|
+
return (_a = this.contextMap.get(key)) == null ? void 0 : _a();
|
|
14
11
|
}
|
|
15
12
|
}
|
|
16
13
|
function useChangeContext() {
|
package/es/packages/index.css
CHANGED
|
@@ -282,7 +282,7 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
282
282
|
height: 30px;
|
|
283
283
|
line-height: 30px;
|
|
284
284
|
}
|
|
285
|
-
.custom-big-table .vxe-table .vxe-cell--checkbox
|
|
285
|
+
.custom-big-table .vxe-table .vxe-cell--checkbox .vxe-checkbox--label {
|
|
286
286
|
display: none;
|
|
287
287
|
}
|
|
288
288
|
.custom-big-table .filter-box {
|
|
@@ -307,7 +307,6 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
307
307
|
}
|
|
308
308
|
.custom-big-table .disabled-checked-tips {
|
|
309
309
|
position: absolute;
|
|
310
|
-
left: 6px;
|
|
311
310
|
top: 50%;
|
|
312
311
|
bottom: 0;
|
|
313
312
|
right: 0;
|