cnhis-design-vue 3.1.25-beta.4 → 3.1.25-beta.6
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/components/big-table/src/BigTable.vue.d.ts +1 -16
- package/es/components/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +16 -8
- package/es/components/big-table/src/utils.d.ts +3 -1
- package/es/components/big-table/src/utils.js +15 -5
- package/es/components/field-set/index.d.ts +73 -0
- package/es/components/field-set/src/FieldSet.js +3 -3
- package/es/components/field-set/src/FieldSet.vue.d.ts +73 -0
- package/es/components/form-render/index.js +2 -0
- package/es/components/form-render/src/components/renderer/checkbox.d.ts +66 -2
- package/es/components/form-render/src/components/renderer/checkbox.js +47 -9
- package/es/components/form-render/src/components/renderer/radio.d.ts +60 -0
- package/es/components/form-render/src/components/renderer/radio.js +39 -13
- package/es/components/form-render/src/components/renderer/search.d.ts +5 -5
- package/es/components/form-render/src/components/renderer/search.js +14 -61
- package/es/components/form-render/src/hooks/index.d.ts +2 -0
- package/es/components/form-render/src/hooks/index.js +2 -0
- package/es/components/form-render/src/hooks/useAutographOptions.d.ts +17 -0
- package/es/components/form-render/src/hooks/useAutographOptions.js +70 -0
- package/es/components/form-render/src/hooks/useFieldListAdaptor.js +12 -11
- package/es/components/index.js +2 -0
- package/package.json +2 -2
|
@@ -912,22 +912,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
912
912
|
NIcon: any;
|
|
913
913
|
CGrid: import("../../../shared/types").SFCWithInstall<import("vue").DefineComponent<{}, any, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>>;
|
|
914
914
|
checkMethod: ({ row }: {
|
|
915
|
-
row: any;
|
|
916
|
-
* 针对 bigTable 的设置列
|
|
917
|
-
* type: 列的类型
|
|
918
|
-
* field: 列字段名(注:属性层级越深,渲染性能将直线下降)
|
|
919
|
-
* title: 列标题(支持开启国际化)
|
|
920
|
-
* width: 列宽度(如果为空则均匀分配剩余宽度,如果全部列固定了,可能会存在宽屏下不会铺满,可以配合 "%" 或者 "min-width" 布局)
|
|
921
|
-
* minWidth: 最小列宽度;会自动将剩余空间按比例分配
|
|
922
|
-
* resizable: 列是否允许拖动列宽调整大小
|
|
923
|
-
* visible: 列是否显示
|
|
924
|
-
* fixed: 将列固定在左侧或者右侧(注意:固定列应该放在左右两侧的位置)
|
|
925
|
-
* align: 列对齐方式
|
|
926
|
-
* headerAlign: 表头列的对齐方式
|
|
927
|
-
* footerAlign: 表尾列的对齐方式
|
|
928
|
-
* formatter: 格式化显示内容 Function({cellValue, row, column})
|
|
929
|
-
* sortable: 是否允许列排序
|
|
930
|
-
*/
|
|
915
|
+
row: any;
|
|
931
916
|
}) => boolean;
|
|
932
917
|
visibleMethod: ({ row }: any) => boolean;
|
|
933
918
|
getRowStyle: ({ row }: any) => string | null;
|
|
@@ -19,7 +19,7 @@ import { useMessage, NIcon, NTooltip, NCheckbox, NCheckboxGroup, NGrid, NGi, NSp
|
|
|
19
19
|
import Grid from '../../grid/index.js';
|
|
20
20
|
import XEUtils from 'xe-utils';
|
|
21
21
|
import 'moment';
|
|
22
|
-
import { handleTableHeight, setTableConfig, handleGroupColums, treeToList, checkMethod, setTreeGroupTitle, handleName, generateEditRender, handlerInitSearchItem, getEvaluate, getMapVal, getCandidateComponents, getageShowType, isLink, showFilter, reScrollFilterWrap, hideFilterWrap, mergeConObjFn, setDefaultFormData, handleImgArr, handleImgSrc, modalDetailImage, handleQrCodeContent, getInlineEditBtn, isCopy, setVisibleCheckAllWrap, handleTableImageSize, visibleMethod, getRowStyle, getFooterGroup, flattenRow, intersectRow, removeCheckedDisabledRows } from './utils.js';
|
|
22
|
+
import { handleTableHeight, setTableConfig, handleGroupColums, treeToList, checkMethod, setTreeGroupTitle, isFilterItem, handleName, generateEditRender, handlerInitSearchItem, getEvaluate, getMapVal, getCandidateComponents, getageShowType, isLink, showFilter, reScrollFilterWrap, hideFilterWrap, mergeConObjFn, setDefaultFormData, handleImgArr, handleImgSrc, modalDetailImage, handleQrCodeContent, getInlineEditBtn, isCopy, setVisibleCheckAllWrap, handleTableImageSize, visibleMethod, getRowStyle, getFooterGroup, flattenRow, intersectRow, removeCheckedDisabledRows } from './utils.js';
|
|
23
23
|
import InputButtonScript from './components/input-button.js';
|
|
24
24
|
import Separate from './components/separate.js';
|
|
25
25
|
import xb_big from '../../../shared/assets/img/xb_big.js';
|
|
@@ -405,22 +405,30 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
405
405
|
};
|
|
406
406
|
}
|
|
407
407
|
const currentColumns = fieldList.map((item, index) => {
|
|
408
|
-
var _a2, _b2, _c2, _d, _e, _f, _g, _h;
|
|
408
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i;
|
|
409
409
|
let filterField = false;
|
|
410
|
+
let isOtherFilter = false;
|
|
410
411
|
let filterItems = [];
|
|
411
412
|
try {
|
|
412
413
|
const fieldSetting = JSON.parse(item.fieldSetting || "{}");
|
|
413
414
|
let notParticipatingSearch = (fieldSetting == null ? void 0 : fieldSetting.notParticipatingSearch) || "";
|
|
414
415
|
filterField = notParticipatingSearch != 1 && ((_a2 = fieldSetting == null ? void 0 : fieldSetting.mapping) == null ? void 0 : _a2.type) === "manual" && item.isMerge != 1;
|
|
415
416
|
filterItems = (_c2 = (_b2 = fieldSetting == null ? void 0 : fieldSetting.mapping) == null ? void 0 : _b2.mappingFiled) == null ? void 0 : _c2.map((item2) => item2.value[0]);
|
|
417
|
+
if (isFilterItem(item)) {
|
|
418
|
+
isOtherFilter = filterField = true;
|
|
419
|
+
filterItems = (_d = item.options) == null ? void 0 : _d.map((item2) => ({
|
|
420
|
+
...item2,
|
|
421
|
+
key: item2.label
|
|
422
|
+
}));
|
|
423
|
+
}
|
|
416
424
|
} catch (e) {
|
|
417
425
|
}
|
|
418
|
-
let notParticipatingSort = ((
|
|
426
|
+
let notParticipatingSort = ((_e = item == null ? void 0 : item.fieldSetting) == null ? void 0 : _e.notParticipatingSort) || "";
|
|
419
427
|
let fixed = isAboutNestTable.value ? "" : item.isFixed ? item.isFixed == 1 ? "left" : "right" : "";
|
|
420
428
|
let sortable = props.isNestTable ? false : !filterField && item.isSort == 1 && notParticipatingSort != 1 && item.isMerge != 1;
|
|
421
429
|
let treeNode = props.isNestTable ? false : state.isTree != 0 ? index === 0 : false;
|
|
422
430
|
let type = index === 0 && props.showNestTable ? "expand" : "";
|
|
423
|
-
const isShow = item.isShow == 1 && ((
|
|
431
|
+
const isShow = item.isShow == 1 && ((_f = item == null ? void 0 : item.settingObj) == null ? void 0 : _f.isHide) != 1;
|
|
424
432
|
if (isScanMultiTable2) {
|
|
425
433
|
fixed = "";
|
|
426
434
|
sortable = false;
|
|
@@ -435,8 +443,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
435
443
|
fixed,
|
|
436
444
|
sortable,
|
|
437
445
|
headerClassName: "mycolumn",
|
|
438
|
-
resizable: (
|
|
439
|
-
showOverflow: (
|
|
446
|
+
resizable: (_g = item.resizable) != null ? _g : true,
|
|
447
|
+
showOverflow: (_h = item.showOverflow) != null ? _h : "title",
|
|
440
448
|
treeNode,
|
|
441
449
|
type,
|
|
442
450
|
slots: {
|
|
@@ -465,7 +473,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
465
473
|
filterItems
|
|
466
474
|
});
|
|
467
475
|
let field = state.filterFields[item.columnName];
|
|
468
|
-
handlerInitSearchItem([field]);
|
|
476
|
+
handlerInitSearchItem([field], isOtherFilter);
|
|
469
477
|
col.slots.header = formatterHeader(item);
|
|
470
478
|
} else {
|
|
471
479
|
col.slots.header = toolTipTitle(item);
|
|
@@ -473,7 +481,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
473
481
|
if (!isScanMultiTable2 && !isFunction(attr.footerMethod) && !isFunction(attr["footer-method"])) {
|
|
474
482
|
col.slots.footer = "tooltip_footer";
|
|
475
483
|
}
|
|
476
|
-
if (props.showNestTable && state.isTree == 0 && ((
|
|
484
|
+
if (props.showNestTable && state.isTree == 0 && ((_i = props.curNestColumnConfig) == null ? void 0 : _i.isTree) == 0) {
|
|
477
485
|
col.slots.content = "nest_table_content";
|
|
478
486
|
}
|
|
479
487
|
return col;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AnyObject } from '../../../../es/shared/types';
|
|
1
2
|
/** 评价组件 */
|
|
2
3
|
export declare const getEvaluate: (row: any, item: any) => any;
|
|
3
4
|
export declare const getMapVal: (row: any, item: any) => any;
|
|
@@ -6,7 +7,8 @@ export declare const getageShowType: (row: any, item: any) => any;
|
|
|
6
7
|
export declare const reScrollFilterWrap: () => void;
|
|
7
8
|
export declare const showFilter: (field: any, columnName: any, event: any, props: any, state: any) => false | undefined;
|
|
8
9
|
export declare const handleGroupColums: (columns: any, props: any) => any[];
|
|
9
|
-
export declare const
|
|
10
|
+
export declare const isFilterItem: (item: AnyObject) => any;
|
|
11
|
+
export declare const handlerInitSearchItem: (arr: any, isOtherFilter: boolean) => void;
|
|
10
12
|
export declare const generateEditRender: (fieldItem: any) => {
|
|
11
13
|
name: string;
|
|
12
14
|
enabled: boolean;
|
|
@@ -73,7 +73,7 @@ const getConObj = (arr, state) => {
|
|
|
73
73
|
} else if (!XEUtils.isEmpty(item.QUOTE)) {
|
|
74
74
|
value = item.QUOTE.join("|#|");
|
|
75
75
|
} else if (!XEUtils.isEmpty(item.CONVERT)) {
|
|
76
|
-
value = item.CONVERT.map((item2) => JSON.parse(item2));
|
|
76
|
+
value = item.CONVERT.map((item2) => ["string", "number"].includes(typeof item2) ? item2 : JSON.parse(item2));
|
|
77
77
|
} else if (item.DATE) {
|
|
78
78
|
if (item.DATE.start_val || item.DATE.end_val) {
|
|
79
79
|
item.DATE.con = "IN";
|
|
@@ -144,7 +144,7 @@ const reScrollFilterWrap = () => {
|
|
|
144
144
|
});
|
|
145
145
|
};
|
|
146
146
|
const showFilter = (field, columnName, event, props, state) => {
|
|
147
|
-
var _a, _b, _c;
|
|
147
|
+
var _a, _b, _c, _d, _e, _f;
|
|
148
148
|
if (props.isInlineOperating)
|
|
149
149
|
return false;
|
|
150
150
|
const target = event.target;
|
|
@@ -166,7 +166,7 @@ const showFilter = (field, columnName, event, props, state) => {
|
|
|
166
166
|
field.visible = !field.visible;
|
|
167
167
|
const len = (_a = state.filterFields[columnName]) == null ? void 0 : _a.CONVERT.length;
|
|
168
168
|
field.checkAll = len === ((_c = (_b = state.filterFields[columnName]) == null ? void 0 : _b.filterItems) == null ? void 0 : _c.length);
|
|
169
|
-
field.indeterminate = !!len && len !== field.setting.showSetting.length;
|
|
169
|
+
field.indeterminate = !!len && len !== (((_e = (_d = field.setting) == null ? void 0 : _d.showSetting) == null ? void 0 : _e.length) || ((_f = field.options) == null ? void 0 : _f.length));
|
|
170
170
|
field.searchFilterText = "";
|
|
171
171
|
};
|
|
172
172
|
const handleGroupColums = (columns, props) => {
|
|
@@ -183,11 +183,21 @@ const handleGroupColums = (columns, props) => {
|
|
|
183
183
|
return fieldList.find((field) => (field.columnName || field.type) === fieldName);
|
|
184
184
|
}
|
|
185
185
|
};
|
|
186
|
-
const
|
|
186
|
+
const isFilterItem = (item) => {
|
|
187
|
+
var _a;
|
|
188
|
+
const filterTypes = ["search", "select", "radio", "checkbox"];
|
|
189
|
+
const notParticipatingSearch = item.notParticipatingSearch || "";
|
|
190
|
+
return notParticipatingSearch != 1 && filterTypes.includes(item.formType) && ((_a = item.options) == null ? void 0 : _a.length);
|
|
191
|
+
};
|
|
192
|
+
const handlerInitSearchItem = (arr, isOtherFilter) => {
|
|
187
193
|
if (!Array.isArray(arr))
|
|
188
194
|
return;
|
|
189
195
|
arr.forEach((el) => {
|
|
190
196
|
var _a;
|
|
197
|
+
if (isOtherFilter) {
|
|
198
|
+
el["CONVERT"] = [];
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
191
201
|
if (el.setting) {
|
|
192
202
|
el.setting = typeof el.setting == "string" ? JSON.parse(el.setting) : el.setting;
|
|
193
203
|
if (!XEUtils.isEmpty(el.setting.wordbook)) {
|
|
@@ -605,4 +615,4 @@ const setVisibleCheckAllWrap = (state, props, currentCheckedKeys) => {
|
|
|
605
615
|
state.visibleCheckAllWrapMore = isSpreadSelected || isLargerOrEqualPageSize && !isShowAllTable;
|
|
606
616
|
};
|
|
607
617
|
|
|
608
|
-
export { checkMethod, flattenRow, generateEditRender, getCandidateComponents, getEvaluate, getFooterGroup, getInlineEditBtn, getMapVal, getRowStyle, getageShowType, handleGroupColums, handleImgArr, handleImgSrc, handleName, handleQrCodeContent, handleTableHeight, handleTableImageSize, handlerInitSearchItem, hideFilterWrap, intersectRow, isCopy, isLink, mergeConObjFn, modalDetailImage, reScrollFilterWrap, removeCheckedDisabledRows, setDefaultFormData, setFilterStatus, setTableConfig, setTreeGroupTitle, setVisibleCheckAllWrap, showFilter, treeToList, visibleMethod };
|
|
618
|
+
export { checkMethod, flattenRow, generateEditRender, getCandidateComponents, getEvaluate, getFooterGroup, getInlineEditBtn, getMapVal, getRowStyle, getageShowType, handleGroupColums, handleImgArr, handleImgSrc, handleName, handleQrCodeContent, handleTableHeight, handleTableImageSize, handlerInitSearchItem, hideFilterWrap, intersectRow, isCopy, isFilterItem, isLink, mergeConObjFn, modalDetailImage, reScrollFilterWrap, removeCheckedDisabledRows, setDefaultFormData, setFilterStatus, setTableConfig, setTreeGroupTitle, setVisibleCheckAllWrap, showFilter, treeToList, visibleMethod };
|
|
@@ -140,6 +140,79 @@ declare const FieldSet: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
140
140
|
NSpin: any;
|
|
141
141
|
NTooltip: any;
|
|
142
142
|
NPopconfirm: any;
|
|
143
|
+
draggable: import("vue").DefineComponent<{
|
|
144
|
+
list: {
|
|
145
|
+
type: ArrayConstructor;
|
|
146
|
+
required: boolean;
|
|
147
|
+
default: any;
|
|
148
|
+
};
|
|
149
|
+
modelValue: {
|
|
150
|
+
type: ArrayConstructor;
|
|
151
|
+
required: boolean;
|
|
152
|
+
default: any;
|
|
153
|
+
};
|
|
154
|
+
itemKey: {
|
|
155
|
+
type: (StringConstructor | FunctionConstructor)[];
|
|
156
|
+
required: boolean;
|
|
157
|
+
};
|
|
158
|
+
clone: {
|
|
159
|
+
type: FunctionConstructor;
|
|
160
|
+
default: (original: any) => any;
|
|
161
|
+
};
|
|
162
|
+
tag: {
|
|
163
|
+
type: StringConstructor;
|
|
164
|
+
default: string;
|
|
165
|
+
};
|
|
166
|
+
move: {
|
|
167
|
+
type: FunctionConstructor;
|
|
168
|
+
default: any;
|
|
169
|
+
};
|
|
170
|
+
componentData: {
|
|
171
|
+
type: ObjectConstructor;
|
|
172
|
+
required: boolean;
|
|
173
|
+
default: any;
|
|
174
|
+
};
|
|
175
|
+
}, unknown, {
|
|
176
|
+
error: boolean;
|
|
177
|
+
}, {
|
|
178
|
+
realList(): any;
|
|
179
|
+
getKey(): any;
|
|
180
|
+
}, {
|
|
181
|
+
getUnderlyingVm(domElement: any): any;
|
|
182
|
+
getUnderlyingPotencialDraggableComponent(htmElement: any): any;
|
|
183
|
+
emitChanges(evt: any): void;
|
|
184
|
+
alterList(onList: any): void;
|
|
185
|
+
spliceList(): void;
|
|
186
|
+
updatePosition(oldIndex: any, newIndex: any): void;
|
|
187
|
+
getRelatedContextFromMoveEvent({ to, related }: {
|
|
188
|
+
to: any;
|
|
189
|
+
related: any;
|
|
190
|
+
}): any;
|
|
191
|
+
getVmIndexFromDomIndex(domIndex: any): any;
|
|
192
|
+
onDragStart(evt: any): void;
|
|
193
|
+
onDragAdd(evt: any): void;
|
|
194
|
+
onDragRemove(evt: any): void;
|
|
195
|
+
onDragUpdate(evt: any): void;
|
|
196
|
+
computeFutureIndex(relatedContext: any, evt: any): any;
|
|
197
|
+
onDragMove(evt: any, originalEvent: any): any;
|
|
198
|
+
onDragEnd(): void;
|
|
199
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any[], any, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
200
|
+
move: Function;
|
|
201
|
+
tag: string;
|
|
202
|
+
clone: Function;
|
|
203
|
+
list: unknown[];
|
|
204
|
+
modelValue: unknown[];
|
|
205
|
+
componentData: Record<string, any>;
|
|
206
|
+
} & {
|
|
207
|
+
itemKey?: string | Function | undefined;
|
|
208
|
+
}>, {
|
|
209
|
+
move: Function;
|
|
210
|
+
tag: string;
|
|
211
|
+
clone: Function;
|
|
212
|
+
list: unknown[];
|
|
213
|
+
modelValue: unknown[];
|
|
214
|
+
componentData: Record<string, any>;
|
|
215
|
+
}>;
|
|
143
216
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("onSave" | "onClose" | "reset")[], "onSave" | "onClose" | "reset", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
144
217
|
fields: {
|
|
145
218
|
type: import("vue").PropType<any[]>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { defineComponent, ref, reactive, watch, onMounted,
|
|
1
|
+
import { defineComponent, ref, reactive, watch, onMounted, openBlock, createElementBlock, normalizeStyle, createVNode, unref, withCtx, createElementVNode, normalizeClass, createCommentVNode, createBlock, createTextVNode, toDisplayString, withDirectives, vShow, renderSlot } from 'vue';
|
|
2
2
|
import { NSpin, NCheckbox, NTooltip, NSelect, NInput, NInputNumber, NPopconfirm, NButton } from 'naive-ui';
|
|
3
|
+
import draggableComponent from '../../../shared/components/VueDraggable/src/vuedraggable.js';
|
|
3
4
|
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.js';
|
|
4
5
|
|
|
5
6
|
const _hoisted_1 = { class: "fields-set-content" };
|
|
@@ -226,7 +227,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
226
227
|
getTableFields
|
|
227
228
|
});
|
|
228
229
|
return (_ctx, _cache) => {
|
|
229
|
-
const _component_draggable = resolveComponent("draggable");
|
|
230
230
|
return openBlock(), createElementBlock("div", {
|
|
231
231
|
ref_key: "settingView",
|
|
232
232
|
ref: settingView,
|
|
@@ -294,7 +294,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
294
294
|
ref: "setShow",
|
|
295
295
|
class: normalizeClass(["set-show", { "set-show-api": !state.isCustomSearch }])
|
|
296
296
|
}, [
|
|
297
|
-
createVNode(
|
|
297
|
+
createVNode(unref(draggableComponent), {
|
|
298
298
|
list: state.fields,
|
|
299
299
|
animation: "150",
|
|
300
300
|
"item-key": "id",
|
|
@@ -94,6 +94,79 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
94
94
|
NSpin: any;
|
|
95
95
|
NTooltip: any;
|
|
96
96
|
NPopconfirm: any;
|
|
97
|
+
draggable: import("vue").DefineComponent<{
|
|
98
|
+
list: {
|
|
99
|
+
type: ArrayConstructor;
|
|
100
|
+
required: boolean;
|
|
101
|
+
default: any;
|
|
102
|
+
};
|
|
103
|
+
modelValue: {
|
|
104
|
+
type: ArrayConstructor;
|
|
105
|
+
required: boolean;
|
|
106
|
+
default: any;
|
|
107
|
+
};
|
|
108
|
+
itemKey: {
|
|
109
|
+
type: (StringConstructor | FunctionConstructor)[];
|
|
110
|
+
required: boolean;
|
|
111
|
+
};
|
|
112
|
+
clone: {
|
|
113
|
+
type: FunctionConstructor;
|
|
114
|
+
default: (original: any) => any;
|
|
115
|
+
};
|
|
116
|
+
tag: {
|
|
117
|
+
type: StringConstructor;
|
|
118
|
+
default: string;
|
|
119
|
+
};
|
|
120
|
+
move: {
|
|
121
|
+
type: FunctionConstructor;
|
|
122
|
+
default: any;
|
|
123
|
+
};
|
|
124
|
+
componentData: {
|
|
125
|
+
type: ObjectConstructor;
|
|
126
|
+
required: boolean;
|
|
127
|
+
default: any;
|
|
128
|
+
};
|
|
129
|
+
}, unknown, {
|
|
130
|
+
error: boolean;
|
|
131
|
+
}, {
|
|
132
|
+
realList(): any;
|
|
133
|
+
getKey(): any;
|
|
134
|
+
}, {
|
|
135
|
+
getUnderlyingVm(domElement: any): any;
|
|
136
|
+
getUnderlyingPotencialDraggableComponent(htmElement: any): any;
|
|
137
|
+
emitChanges(evt: any): void;
|
|
138
|
+
alterList(onList: any): void;
|
|
139
|
+
spliceList(): void;
|
|
140
|
+
updatePosition(oldIndex: any, newIndex: any): void;
|
|
141
|
+
getRelatedContextFromMoveEvent({ to, related }: {
|
|
142
|
+
to: any;
|
|
143
|
+
related: any;
|
|
144
|
+
}): any;
|
|
145
|
+
getVmIndexFromDomIndex(domIndex: any): any;
|
|
146
|
+
onDragStart(evt: any): void;
|
|
147
|
+
onDragAdd(evt: any): void;
|
|
148
|
+
onDragRemove(evt: any): void;
|
|
149
|
+
onDragUpdate(evt: any): void;
|
|
150
|
+
computeFutureIndex(relatedContext: any, evt: any): any;
|
|
151
|
+
onDragMove(evt: any, originalEvent: any): any;
|
|
152
|
+
onDragEnd(): void;
|
|
153
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, any[], any, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
154
|
+
move: Function;
|
|
155
|
+
tag: string;
|
|
156
|
+
clone: Function;
|
|
157
|
+
list: unknown[];
|
|
158
|
+
modelValue: unknown[];
|
|
159
|
+
componentData: Record<string, any>;
|
|
160
|
+
} & {
|
|
161
|
+
itemKey?: string | Function | undefined;
|
|
162
|
+
}>, {
|
|
163
|
+
move: Function;
|
|
164
|
+
tag: string;
|
|
165
|
+
clone: Function;
|
|
166
|
+
list: unknown[];
|
|
167
|
+
modelValue: unknown[];
|
|
168
|
+
componentData: Record<string, any>;
|
|
169
|
+
}>;
|
|
97
170
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("onSave" | "onClose" | "reset")[], "onSave" | "onClose" | "reset", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
98
171
|
fields: {
|
|
99
172
|
type: PropType<any[]>;
|
|
@@ -13,7 +13,9 @@ export { BusinessCollector, useBusinessBinding } from './src/hooks/useBusinessBi
|
|
|
13
13
|
export { ContextCollector, useChangeContext } from './src/hooks/useChangeContext.js';
|
|
14
14
|
export { FormItemDepsCollector, useFormItemDeps } from './src/hooks/useFormItemDeps.js';
|
|
15
15
|
export { useAnchor } from './src/hooks/useAnchor.js';
|
|
16
|
+
export { useAutographOptions } from './src/hooks/useAutographOptions.js';
|
|
16
17
|
export { useFormContext } from './src/hooks/useFormContext.js';
|
|
18
|
+
export { useCommonInjection, useSelectOptionProps } from './src/hooks/useCommonInjection.js';
|
|
17
19
|
export * from '@formily/core';
|
|
18
20
|
|
|
19
21
|
const FormRender = script;
|
|
@@ -1,26 +1,90 @@
|
|
|
1
1
|
import { AnyObject } from '../../../../../../es/shared/types';
|
|
2
2
|
import { PropType } from 'vue';
|
|
3
3
|
export declare const CHECKBOX: import("vue").DefineComponent<{
|
|
4
|
+
value: {};
|
|
4
5
|
options: {
|
|
5
6
|
type: PropType<AnyObject[]>;
|
|
6
7
|
default: () => never[];
|
|
7
8
|
};
|
|
9
|
+
autograph: {
|
|
10
|
+
type: StringConstructor;
|
|
11
|
+
};
|
|
12
|
+
lazyRequest: {
|
|
13
|
+
type: BooleanConstructor;
|
|
14
|
+
default: boolean;
|
|
15
|
+
};
|
|
16
|
+
requestCache: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
default: boolean;
|
|
19
|
+
};
|
|
20
|
+
wordbook: {
|
|
21
|
+
type: PropType<Partial<{
|
|
22
|
+
level_num: number;
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
render_key: string[];
|
|
26
|
+
search_key: string[];
|
|
27
|
+
primary_key: string;
|
|
28
|
+
type: string;
|
|
29
|
+
value_key: string;
|
|
30
|
+
level_key: string;
|
|
31
|
+
link_key: string;
|
|
32
|
+
link_key_split: string;
|
|
33
|
+
show_key: string[];
|
|
34
|
+
conObj: AnyObject[];
|
|
35
|
+
conObjFirstLevel: AnyObject[];
|
|
36
|
+
}>>;
|
|
37
|
+
};
|
|
8
38
|
vertical: {
|
|
9
39
|
type: BooleanConstructor;
|
|
10
40
|
default: boolean;
|
|
11
41
|
};
|
|
12
42
|
onChange: {};
|
|
13
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
43
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
44
|
+
value: {};
|
|
14
45
|
options: {
|
|
15
46
|
type: PropType<AnyObject[]>;
|
|
16
47
|
default: () => never[];
|
|
17
48
|
};
|
|
49
|
+
autograph: {
|
|
50
|
+
type: StringConstructor;
|
|
51
|
+
};
|
|
52
|
+
lazyRequest: {
|
|
53
|
+
type: BooleanConstructor;
|
|
54
|
+
default: boolean;
|
|
55
|
+
};
|
|
56
|
+
requestCache: {
|
|
57
|
+
type: BooleanConstructor;
|
|
58
|
+
default: boolean;
|
|
59
|
+
};
|
|
60
|
+
wordbook: {
|
|
61
|
+
type: PropType<Partial<{
|
|
62
|
+
level_num: number;
|
|
63
|
+
id: string;
|
|
64
|
+
name: string;
|
|
65
|
+
render_key: string[];
|
|
66
|
+
search_key: string[];
|
|
67
|
+
primary_key: string;
|
|
68
|
+
type: string;
|
|
69
|
+
value_key: string;
|
|
70
|
+
level_key: string;
|
|
71
|
+
link_key: string;
|
|
72
|
+
link_key_split: string;
|
|
73
|
+
show_key: string[];
|
|
74
|
+
conObj: AnyObject[];
|
|
75
|
+
conObjFirstLevel: AnyObject[];
|
|
76
|
+
}>>;
|
|
77
|
+
};
|
|
18
78
|
vertical: {
|
|
19
79
|
type: BooleanConstructor;
|
|
20
80
|
default: boolean;
|
|
21
81
|
};
|
|
22
82
|
onChange: {};
|
|
23
|
-
}
|
|
83
|
+
}>> & {
|
|
84
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
85
|
+
}, {
|
|
24
86
|
options: AnyObject[];
|
|
25
87
|
vertical: boolean;
|
|
88
|
+
lazyRequest: boolean;
|
|
89
|
+
requestCache: boolean;
|
|
26
90
|
}>;
|
|
@@ -1,34 +1,72 @@
|
|
|
1
|
-
import { defineComponent, createVNode } from 'vue';
|
|
1
|
+
import { defineComponent, computed, createVNode } from 'vue';
|
|
2
|
+
import '../../../index.js';
|
|
2
3
|
import '../../utils/index.js';
|
|
3
4
|
import { connect, mapProps } from '@formily/vue';
|
|
4
5
|
import { NCheckboxGroup, NSpace, NCheckbox } from 'naive-ui';
|
|
5
|
-
import {
|
|
6
|
+
import { useAutographOptions } from '../../hooks/useAutographOptions.js';
|
|
7
|
+
import { assignUpdateValue } from '../../utils/schema.js';
|
|
8
|
+
import { useCommonInjection } from '../../hooks/useCommonInjection.js';
|
|
6
9
|
|
|
7
10
|
const script = defineComponent({
|
|
8
11
|
name: "FormCheckbox",
|
|
9
12
|
props: {
|
|
13
|
+
value: {},
|
|
10
14
|
options: {
|
|
11
15
|
type: Array,
|
|
12
16
|
default: () => []
|
|
13
17
|
},
|
|
18
|
+
autograph: {
|
|
19
|
+
type: String
|
|
20
|
+
},
|
|
21
|
+
lazyRequest: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false
|
|
24
|
+
},
|
|
25
|
+
requestCache: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: true
|
|
28
|
+
},
|
|
29
|
+
wordbook: {
|
|
30
|
+
type: Object
|
|
31
|
+
},
|
|
14
32
|
vertical: {
|
|
15
33
|
type: Boolean,
|
|
16
34
|
default: false
|
|
17
35
|
},
|
|
18
36
|
onChange: {}
|
|
19
37
|
},
|
|
20
|
-
|
|
21
|
-
|
|
38
|
+
emits: ["update:value"],
|
|
39
|
+
setup(props, {
|
|
40
|
+
emit
|
|
41
|
+
}) {
|
|
42
|
+
const valueRef = computed({
|
|
43
|
+
get: () => props.value,
|
|
44
|
+
set: (v) => emit("update:value", v)
|
|
45
|
+
});
|
|
46
|
+
const {
|
|
47
|
+
labelKey,
|
|
48
|
+
valueKey,
|
|
49
|
+
options
|
|
50
|
+
} = useAutographOptions(props, valueRef);
|
|
51
|
+
const {
|
|
52
|
+
injectValueBindKey
|
|
53
|
+
} = useCommonInjection();
|
|
54
|
+
const key = injectValueBindKey(valueRef);
|
|
55
|
+
return () => createVNode(NCheckboxGroup, {
|
|
56
|
+
"key": key.value,
|
|
57
|
+
"value": valueRef.value,
|
|
58
|
+
"onUpdate:value": ($event) => valueRef.value = $event
|
|
59
|
+
}, {
|
|
22
60
|
default: () => [createVNode(NSpace, {
|
|
23
61
|
"vertical": props.vertical
|
|
24
62
|
}, {
|
|
25
63
|
default: () => {
|
|
26
64
|
var _a;
|
|
27
|
-
return [(_a =
|
|
28
|
-
"key": option.value,
|
|
29
|
-
"value": option.value
|
|
65
|
+
return [(_a = options.value) == null ? void 0 : _a.map((option) => createVNode(NCheckbox, {
|
|
66
|
+
"key": option[valueKey.value],
|
|
67
|
+
"value": option[valueKey.value]
|
|
30
68
|
}, {
|
|
31
|
-
default: () => [option.
|
|
69
|
+
default: () => [option[labelKey.value]]
|
|
32
70
|
}))];
|
|
33
71
|
}
|
|
34
72
|
})]
|
|
@@ -37,6 +75,6 @@ const script = defineComponent({
|
|
|
37
75
|
});
|
|
38
76
|
const CHECKBOX = connect(script, mapProps({
|
|
39
77
|
dataSource: "options"
|
|
40
|
-
}, assignUpdateValue
|
|
78
|
+
}, assignUpdateValue));
|
|
41
79
|
|
|
42
80
|
export { CHECKBOX };
|
|
@@ -8,6 +8,35 @@ export declare const RADIO: import("vue").DefineComponent<{
|
|
|
8
8
|
type: PropType<AnyObject[]>;
|
|
9
9
|
default: () => never[];
|
|
10
10
|
};
|
|
11
|
+
autograph: {
|
|
12
|
+
type: StringConstructor;
|
|
13
|
+
};
|
|
14
|
+
lazyRequest: {
|
|
15
|
+
type: BooleanConstructor;
|
|
16
|
+
default: boolean;
|
|
17
|
+
};
|
|
18
|
+
requestCache: {
|
|
19
|
+
type: BooleanConstructor;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
22
|
+
wordbook: {
|
|
23
|
+
type: PropType<Partial<{
|
|
24
|
+
level_num: number;
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
render_key: string[];
|
|
28
|
+
search_key: string[];
|
|
29
|
+
primary_key: string;
|
|
30
|
+
type: string;
|
|
31
|
+
value_key: string;
|
|
32
|
+
level_key: string;
|
|
33
|
+
link_key: string;
|
|
34
|
+
link_key_split: string;
|
|
35
|
+
show_key: string[];
|
|
36
|
+
conObj: AnyObject[];
|
|
37
|
+
conObjFirstLevel: AnyObject[];
|
|
38
|
+
}>>;
|
|
39
|
+
};
|
|
11
40
|
vertical: {
|
|
12
41
|
type: BooleanConstructor;
|
|
13
42
|
default: boolean;
|
|
@@ -21,6 +50,35 @@ export declare const RADIO: import("vue").DefineComponent<{
|
|
|
21
50
|
type: PropType<AnyObject[]>;
|
|
22
51
|
default: () => never[];
|
|
23
52
|
};
|
|
53
|
+
autograph: {
|
|
54
|
+
type: StringConstructor;
|
|
55
|
+
};
|
|
56
|
+
lazyRequest: {
|
|
57
|
+
type: BooleanConstructor;
|
|
58
|
+
default: boolean;
|
|
59
|
+
};
|
|
60
|
+
requestCache: {
|
|
61
|
+
type: BooleanConstructor;
|
|
62
|
+
default: boolean;
|
|
63
|
+
};
|
|
64
|
+
wordbook: {
|
|
65
|
+
type: PropType<Partial<{
|
|
66
|
+
level_num: number;
|
|
67
|
+
id: string;
|
|
68
|
+
name: string;
|
|
69
|
+
render_key: string[];
|
|
70
|
+
search_key: string[];
|
|
71
|
+
primary_key: string;
|
|
72
|
+
type: string;
|
|
73
|
+
value_key: string;
|
|
74
|
+
level_key: string;
|
|
75
|
+
link_key: string;
|
|
76
|
+
link_key_split: string;
|
|
77
|
+
show_key: string[];
|
|
78
|
+
conObj: AnyObject[];
|
|
79
|
+
conObjFirstLevel: AnyObject[];
|
|
80
|
+
}>>;
|
|
81
|
+
};
|
|
24
82
|
vertical: {
|
|
25
83
|
type: BooleanConstructor;
|
|
26
84
|
default: boolean;
|
|
@@ -31,4 +89,6 @@ export declare const RADIO: import("vue").DefineComponent<{
|
|
|
31
89
|
}, {
|
|
32
90
|
options: AnyObject[];
|
|
33
91
|
vertical: boolean;
|
|
92
|
+
lazyRequest: boolean;
|
|
93
|
+
requestCache: boolean;
|
|
34
94
|
}>;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { defineComponent, computed, createVNode } from 'vue';
|
|
1
|
+
import { defineComponent, computed, createVNode, isVNode } from 'vue';
|
|
2
2
|
import { connect, mapProps } from '@formily/vue';
|
|
3
3
|
import { isNumber } from 'lodash-es';
|
|
4
4
|
import { NRadioGroup, NSpace, NRadio } from 'naive-ui';
|
|
5
|
+
import '../../../index.js';
|
|
5
6
|
import '../../utils/index.js';
|
|
6
|
-
import {
|
|
7
|
+
import { useAutographOptions } from '../../hooks/useAutographOptions.js';
|
|
8
|
+
import { assignUpdateValue } from '../../utils/schema.js';
|
|
9
|
+
import { useCommonInjection } from '../../hooks/useCommonInjection.js';
|
|
7
10
|
|
|
11
|
+
function _isSlot(s) {
|
|
12
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
13
|
+
}
|
|
8
14
|
const script = defineComponent({
|
|
9
15
|
props: {
|
|
10
16
|
value: {
|
|
@@ -14,6 +20,20 @@ const script = defineComponent({
|
|
|
14
20
|
type: Array,
|
|
15
21
|
default: () => []
|
|
16
22
|
},
|
|
23
|
+
autograph: {
|
|
24
|
+
type: String
|
|
25
|
+
},
|
|
26
|
+
lazyRequest: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false
|
|
29
|
+
},
|
|
30
|
+
requestCache: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: true
|
|
33
|
+
},
|
|
34
|
+
wordbook: {
|
|
35
|
+
type: Object
|
|
36
|
+
},
|
|
17
37
|
vertical: {
|
|
18
38
|
type: Boolean,
|
|
19
39
|
default: false
|
|
@@ -37,24 +57,30 @@ const script = defineComponent({
|
|
|
37
57
|
emit("update:value", v);
|
|
38
58
|
}
|
|
39
59
|
});
|
|
60
|
+
const {
|
|
61
|
+
labelKey,
|
|
62
|
+
valueKey,
|
|
63
|
+
options
|
|
64
|
+
} = useAutographOptions(props, valueRef);
|
|
65
|
+
const {
|
|
66
|
+
injectValueBindKey
|
|
67
|
+
} = useCommonInjection();
|
|
68
|
+
const key = injectValueBindKey(valueRef);
|
|
40
69
|
return () => {
|
|
70
|
+
let _slot;
|
|
41
71
|
return createVNode(NRadioGroup, {
|
|
72
|
+
"key": key.value,
|
|
42
73
|
"value": valueRef.value,
|
|
43
74
|
"onUpdate:value": ($event) => valueRef.value = $event
|
|
44
75
|
}, {
|
|
45
76
|
default: () => [createVNode(NSpace, {
|
|
46
77
|
"vertical": props.vertical
|
|
78
|
+
}, _isSlot(_slot = options.value.map((option) => createVNode(NRadio, {
|
|
79
|
+
"value": option[valueKey.value]
|
|
47
80
|
}, {
|
|
48
|
-
default: () =>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return createVNode(NRadio, {
|
|
52
|
-
"value": option.value
|
|
53
|
-
}, {
|
|
54
|
-
default: () => [option.text]
|
|
55
|
-
});
|
|
56
|
-
})];
|
|
57
|
-
}
|
|
81
|
+
default: () => [option[labelKey.value]]
|
|
82
|
+
}))) ? _slot : {
|
|
83
|
+
default: () => [_slot]
|
|
58
84
|
})]
|
|
59
85
|
});
|
|
60
86
|
};
|
|
@@ -62,6 +88,6 @@ const script = defineComponent({
|
|
|
62
88
|
});
|
|
63
89
|
const RADIO = connect(script, mapProps({
|
|
64
90
|
dataSource: "options"
|
|
65
|
-
}, assignUpdateValue
|
|
91
|
+
}, assignUpdateValue));
|
|
66
92
|
|
|
67
93
|
export { RADIO };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Func } from '../../../../../../es/shared/types';
|
|
2
2
|
import { PropType } from 'vue';
|
|
3
3
|
export declare const SEARCH: import("vue").DefineComponent<{
|
|
4
4
|
value: {
|
|
@@ -30,8 +30,8 @@ export declare const SEARCH: import("vue").DefineComponent<{
|
|
|
30
30
|
link_key: string;
|
|
31
31
|
link_key_split: string;
|
|
32
32
|
show_key: string[];
|
|
33
|
-
conObj: AnyObject[];
|
|
34
|
-
conObjFirstLevel: AnyObject[];
|
|
33
|
+
conObj: import("../../../../../../es/shared/types").AnyObject[];
|
|
34
|
+
conObjFirstLevel: import("../../../../../../es/shared/types").AnyObject[];
|
|
35
35
|
}>>;
|
|
36
36
|
required: true;
|
|
37
37
|
};
|
|
@@ -69,8 +69,8 @@ export declare const SEARCH: import("vue").DefineComponent<{
|
|
|
69
69
|
link_key: string;
|
|
70
70
|
link_key_split: string;
|
|
71
71
|
show_key: string[];
|
|
72
|
-
conObj: AnyObject[];
|
|
73
|
-
conObjFirstLevel: AnyObject[];
|
|
72
|
+
conObj: import("../../../../../../es/shared/types").AnyObject[];
|
|
73
|
+
conObjFirstLevel: import("../../../../../../es/shared/types").AnyObject[];
|
|
74
74
|
}>>;
|
|
75
75
|
required: true;
|
|
76
76
|
};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { defineComponent, computed,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { useCommonInjection, useSelectOptionProps } from '../../hooks/useCommonInjection.js';
|
|
5
|
-
import { InjectAsyncQueue, InjectionChangeContextCollector } from '../../constants/index.js';
|
|
1
|
+
import { defineComponent, computed, inject, createVNode } from 'vue';
|
|
2
|
+
import { cloneDeep } from 'lodash-es';
|
|
3
|
+
import { InjectionChangeContextCollector } from '../../constants/index.js';
|
|
6
4
|
import '../../../../../shared/utils/index.js';
|
|
7
5
|
import '../../../index.js';
|
|
8
|
-
import
|
|
9
|
-
import { useFormRequest } from '../../hooks/useFormRequest.js';
|
|
6
|
+
import '../../utils/index.js';
|
|
10
7
|
import { useFormField } from '../../hooks/useFormField.js';
|
|
8
|
+
import '@vueuse/core';
|
|
11
9
|
import '../../../../../shared/utils/tapable/SyncHook.js';
|
|
12
10
|
import '../../../../../shared/utils/tapable/SyncBailHook.js';
|
|
13
11
|
import '../../../../../shared/utils/tapable/SyncWaterfallHook.js';
|
|
@@ -20,9 +18,11 @@ import '../../../../../shared/utils/tapable/AsyncSeriesLoopHook.js';
|
|
|
20
18
|
import '../../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js';
|
|
21
19
|
import '../../hooks/useFormValidator.js';
|
|
22
20
|
import '@formily/core';
|
|
21
|
+
import { useAutographOptions } from '../../hooks/useAutographOptions.js';
|
|
23
22
|
import '@vue/shared';
|
|
24
23
|
import { connect, mapProps } from '@formily/vue';
|
|
25
24
|
import './index.js';
|
|
25
|
+
import { useCommonInjection, useSelectOptionProps } from '../../hooks/useCommonInjection.js';
|
|
26
26
|
import { NSelect } from 'naive-ui';
|
|
27
27
|
import { visitedDecorator, assignUpdateValue, assignClearBindVisited } from '../../utils/schema.js';
|
|
28
28
|
|
|
@@ -62,72 +62,25 @@ const script = defineComponent({
|
|
|
62
62
|
get: () => props.value,
|
|
63
63
|
set: (v) => emit("update:value", v)
|
|
64
64
|
});
|
|
65
|
-
const remoteOptions = ref(null);
|
|
66
|
-
const lastSearch = ref("");
|
|
67
|
-
const labelKey = computed(() => {
|
|
68
|
-
var _a, _b, _c;
|
|
69
|
-
return (_c = (_b = (_a = props.wordbook) == null ? void 0 : _a.render_key) == null ? void 0 : _b[0]) != null ? _c : "text";
|
|
70
|
-
});
|
|
71
|
-
const valueKey = computed(() => {
|
|
72
|
-
var _a, _b;
|
|
73
|
-
return (_b = (_a = props.wordbook) == null ? void 0 : _a.value_key) != null ? _b : "value";
|
|
74
|
-
});
|
|
75
65
|
const {
|
|
76
66
|
field,
|
|
77
67
|
fieldKey
|
|
78
68
|
} = useFormField();
|
|
79
|
-
const asyncQueue = inject(InjectAsyncQueue);
|
|
80
69
|
const {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return;
|
|
87
|
-
try {
|
|
88
|
-
remoteOptions.value = await asyncQueue.addAsync(createParams(props.wordbook, props.autograph, field.value, fieldKey.value));
|
|
89
|
-
} catch (e) {
|
|
90
|
-
isString(e) && formRenderLog(e);
|
|
91
|
-
}
|
|
92
|
-
function createParams(wordbook, autograph, field2, key2) {
|
|
93
|
-
const params = {
|
|
94
|
-
autograph,
|
|
95
|
-
wordbookId: wordbook.id,
|
|
96
|
-
wordbookType: wordbook.type,
|
|
97
|
-
fieldKeys: wordbook.search_key,
|
|
98
|
-
keyword: "",
|
|
99
|
-
page: 1
|
|
100
|
-
};
|
|
101
|
-
return {
|
|
102
|
-
...getSearchRequestInfo(),
|
|
103
|
-
params,
|
|
104
|
-
key: key2,
|
|
105
|
-
cache: props.requestCache
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
}, 300);
|
|
109
|
-
const parsedOptions = computed(() => {
|
|
110
|
-
return remoteOptions.value ? optionMatcher(remoteOptions.value, lastSearch.value, labelKey.value) : [];
|
|
111
|
-
});
|
|
70
|
+
fetchData,
|
|
71
|
+
labelKey,
|
|
72
|
+
valueKey,
|
|
73
|
+
options
|
|
74
|
+
} = useAutographOptions(props, valueRef);
|
|
112
75
|
const changeContextCollector = inject(InjectionChangeContextCollector);
|
|
113
76
|
changeContextCollector.setContext(fieldKey.value, (v) => {
|
|
114
77
|
return {
|
|
115
78
|
currentOption: cloneDeep(getCurrentOption(v))
|
|
116
79
|
};
|
|
117
80
|
function getCurrentOption(v2) {
|
|
118
|
-
return
|
|
81
|
+
return options.value.find((option) => option[valueKey.value] === v2);
|
|
119
82
|
}
|
|
120
83
|
});
|
|
121
|
-
watch(() => props.wordbook, (wordbook, oldWordbook) => {
|
|
122
|
-
if (isEqual(wordbook, oldWordbook))
|
|
123
|
-
return;
|
|
124
|
-
remoteOptions.value = null;
|
|
125
|
-
if (!wordbook)
|
|
126
|
-
return;
|
|
127
|
-
(valueRef.value || !props.lazyRequest) && fetchData();
|
|
128
|
-
}, {
|
|
129
|
-
immediate: true
|
|
130
|
-
});
|
|
131
84
|
const {
|
|
132
85
|
injectValueValidate,
|
|
133
86
|
injectValueWatchFromEmpty,
|
|
@@ -150,7 +103,7 @@ const script = defineComponent({
|
|
|
150
103
|
"node-props": nodeProps,
|
|
151
104
|
"labelField": labelKey.value,
|
|
152
105
|
"valueField": valueKey.value,
|
|
153
|
-
"options":
|
|
106
|
+
"options": options.value,
|
|
154
107
|
"onSearch": fetchData,
|
|
155
108
|
"onUpdate:show": (show) => show && fetchData(),
|
|
156
109
|
"onFocus": visitedDecorator(field, props.onFocus)
|
|
@@ -10,4 +10,6 @@ export * from './useBusinessBinding';
|
|
|
10
10
|
export * from './useChangeContext';
|
|
11
11
|
export * from './useFormItemDeps';
|
|
12
12
|
export * from './useAnchor';
|
|
13
|
+
export * from './useAutographOptions';
|
|
13
14
|
export * from './useFormContext';
|
|
15
|
+
export * from './useCommonInjection';
|
|
@@ -10,4 +10,6 @@ export { BusinessCollector, useBusinessBinding } from './useBusinessBinding.js';
|
|
|
10
10
|
export { ContextCollector, useChangeContext } from './useChangeContext.js';
|
|
11
11
|
export { FormItemDepsCollector, useFormItemDeps } from './useFormItemDeps.js';
|
|
12
12
|
export { useAnchor } from './useAnchor.js';
|
|
13
|
+
export { useAutographOptions } from './useAutographOptions.js';
|
|
13
14
|
export { useFormContext } from './useFormContext.js';
|
|
15
|
+
export { useCommonInjection, useSelectOptionProps } from './useCommonInjection.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AnyObject } from '../../../../../es/shared/types';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
import { FormWordbook } from '../../../../../es/components/form-render';
|
|
4
|
+
export declare function useAutographOptions(props: {
|
|
5
|
+
requestCache?: boolean;
|
|
6
|
+
wordbook?: FormWordbook;
|
|
7
|
+
autograph?: string;
|
|
8
|
+
lazyRequest?: boolean;
|
|
9
|
+
options?: AnyObject[];
|
|
10
|
+
}, valueRef: Ref): {
|
|
11
|
+
valueRef: Ref<any>;
|
|
12
|
+
options: import("vue").ComputedRef<AnyObject[]>;
|
|
13
|
+
fetchData: (content?: string) => Promise<void>;
|
|
14
|
+
labelKey: import("vue").ComputedRef<string>;
|
|
15
|
+
valueKey: import("vue").ComputedRef<string>;
|
|
16
|
+
lastSearch: Ref<string>;
|
|
17
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { useDebounceFn } from '@vueuse/core';
|
|
2
|
+
import { isString, isEqual } from 'lodash-es';
|
|
3
|
+
import { getCurrentInstance, inject, computed, ref, watch } from 'vue';
|
|
4
|
+
import '../../index.js';
|
|
5
|
+
import { InjectAsyncQueue } from '../constants/index.js';
|
|
6
|
+
import { formRenderLog, optionMatcher } from '../utils/index.js';
|
|
7
|
+
import { useFormField } from './useFormField.js';
|
|
8
|
+
import { useFormRequest } from './useFormRequest.js';
|
|
9
|
+
|
|
10
|
+
function useAutographOptions(props, valueRef) {
|
|
11
|
+
if (!getCurrentInstance())
|
|
12
|
+
throw new Error("can't use this hook out of setup environment");
|
|
13
|
+
const asyncQueue = inject(InjectAsyncQueue);
|
|
14
|
+
const labelKey = computed(() => {
|
|
15
|
+
var _a, _b, _c;
|
|
16
|
+
return (_c = (_b = (_a = props.wordbook) == null ? void 0 : _a.render_key) == null ? void 0 : _b[0]) != null ? _c : "text";
|
|
17
|
+
});
|
|
18
|
+
const valueKey = computed(() => {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
return (_b = (_a = props.wordbook) == null ? void 0 : _a.value_key) != null ? _b : "value";
|
|
21
|
+
});
|
|
22
|
+
const remoteOptions = ref(null);
|
|
23
|
+
const lastSearch = ref("");
|
|
24
|
+
const { field, fieldKey } = useFormField();
|
|
25
|
+
const { getSearchRequestInfo } = useFormRequest();
|
|
26
|
+
const fetchData = useDebounceFn(async function(content) {
|
|
27
|
+
if (!props.autograph || !props.wordbook)
|
|
28
|
+
return;
|
|
29
|
+
lastSearch.value = content || "";
|
|
30
|
+
if (remoteOptions.value && props.requestCache)
|
|
31
|
+
return;
|
|
32
|
+
try {
|
|
33
|
+
remoteOptions.value = await asyncQueue.addAsync(
|
|
34
|
+
createParams(props.wordbook, props.autograph, field.value, fieldKey.value)
|
|
35
|
+
);
|
|
36
|
+
} catch (e) {
|
|
37
|
+
isString(e) && formRenderLog(e);
|
|
38
|
+
}
|
|
39
|
+
function createParams(wordbook, autograph, field2, key) {
|
|
40
|
+
const params = {
|
|
41
|
+
autograph,
|
|
42
|
+
wordbookId: wordbook.id,
|
|
43
|
+
wordbookType: wordbook.type,
|
|
44
|
+
fieldKeys: wordbook.search_key,
|
|
45
|
+
keyword: "",
|
|
46
|
+
page: 1
|
|
47
|
+
};
|
|
48
|
+
return { ...getSearchRequestInfo(), params, key, cache: props.requestCache };
|
|
49
|
+
}
|
|
50
|
+
}, 300);
|
|
51
|
+
const options = computed(() => {
|
|
52
|
+
var _a;
|
|
53
|
+
return remoteOptions.value ? optionMatcher(remoteOptions.value, lastSearch.value, labelKey.value) : (_a = props.options) != null ? _a : [];
|
|
54
|
+
});
|
|
55
|
+
watch(
|
|
56
|
+
() => props.wordbook,
|
|
57
|
+
(wordbook, oldWordbook) => {
|
|
58
|
+
if (isEqual(wordbook, oldWordbook))
|
|
59
|
+
return;
|
|
60
|
+
remoteOptions.value = null;
|
|
61
|
+
if (!wordbook)
|
|
62
|
+
return;
|
|
63
|
+
(valueRef.value || !props.lazyRequest) && fetchData();
|
|
64
|
+
},
|
|
65
|
+
{ immediate: true }
|
|
66
|
+
);
|
|
67
|
+
return { valueRef, options, fetchData, labelKey, valueKey, lastSearch };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { useAutographOptions };
|
|
@@ -7,6 +7,16 @@ import { fieldKeyEscape, createLinebarId } from '../utils/schema.js';
|
|
|
7
7
|
import { transformDateFormat } from '../utils/business.js';
|
|
8
8
|
import { useFormValidator } from './useFormValidator.js';
|
|
9
9
|
|
|
10
|
+
function bindAutoGraphProps(schema, item) {
|
|
11
|
+
Object.assign(schema["x-component-props"], {
|
|
12
|
+
...pick(item, ["wordbook", "autograph"])
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function bindUrlProps(schema, item) {
|
|
16
|
+
Object.assign(schema["x-component-props"], {
|
|
17
|
+
...pick(item, ["urlConfig"])
|
|
18
|
+
});
|
|
19
|
+
}
|
|
10
20
|
function useFieldListAdaptor(collector) {
|
|
11
21
|
const { createValidatorSchema } = useFormValidator();
|
|
12
22
|
const createStandardSchema = (item) => {
|
|
@@ -63,6 +73,7 @@ function useFieldListAdaptor(collector) {
|
|
|
63
73
|
if (item.urlConfig) {
|
|
64
74
|
bindUrlProps(schema, item);
|
|
65
75
|
} else if (item.autograph) {
|
|
76
|
+
schema["x-component"] = "SEARCH";
|
|
66
77
|
bindAutoGraphProps(schema, item);
|
|
67
78
|
}
|
|
68
79
|
bindCommonProps(schema, item);
|
|
@@ -77,17 +88,6 @@ function useFieldListAdaptor(collector) {
|
|
|
77
88
|
});
|
|
78
89
|
multiple && (schema2.type = "array");
|
|
79
90
|
}
|
|
80
|
-
function bindAutoGraphProps(schema2, item2) {
|
|
81
|
-
schema2["x-component"] = "SEARCH";
|
|
82
|
-
Object.assign(schema2["x-component-props"], {
|
|
83
|
-
...pick(item2, ["wordbook", "autograph"])
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
function bindUrlProps(schema2, item2) {
|
|
87
|
-
Object.assign(schema2["x-component-props"], {
|
|
88
|
-
...pick(item2, ["urlConfig"])
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
91
|
};
|
|
92
92
|
const createRadioSchema = (item) => {
|
|
93
93
|
const schema = createStandardSchema(item);
|
|
@@ -95,6 +95,7 @@ function useFieldListAdaptor(collector) {
|
|
|
95
95
|
options: item.option,
|
|
96
96
|
vertical: item.__vertical
|
|
97
97
|
});
|
|
98
|
+
bindAutoGraphProps(schema, item);
|
|
98
99
|
return schema;
|
|
99
100
|
};
|
|
100
101
|
const createDateSchema = (item) => {
|
package/es/components/index.js
CHANGED
|
@@ -52,7 +52,9 @@ export { BusinessCollector, useBusinessBinding } from './form-render/src/hooks/u
|
|
|
52
52
|
export { ContextCollector, useChangeContext } from './form-render/src/hooks/useChangeContext.js';
|
|
53
53
|
export { FormItemDepsCollector, useFormItemDeps } from './form-render/src/hooks/useFormItemDeps.js';
|
|
54
54
|
export { useAnchor } from './form-render/src/hooks/useAnchor.js';
|
|
55
|
+
export { useAutographOptions } from './form-render/src/hooks/useAutographOptions.js';
|
|
55
56
|
export { useFormContext } from './form-render/src/hooks/useFormContext.js';
|
|
57
|
+
export { useCommonInjection, useSelectOptionProps } from './form-render/src/hooks/useCommonInjection.js';
|
|
56
58
|
export * from '@formily/core';
|
|
57
59
|
export { GlobalShortcutProvider, ShortcutManager, useShortcuts } from './shortcut-provider/src/hooks/useShortcuts.js';
|
|
58
60
|
export { useShortcutSignature } from './shortcut-provider/src/hooks/useShortcutSignature.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
|
-
"version": "3.1.25-beta.
|
|
3
|
+
"version": "3.1.25-beta.6",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"module": "./es/components/index.js",
|
|
6
6
|
"main": "./es/components/index.js",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"iOS 7",
|
|
62
62
|
"last 3 iOS versions"
|
|
63
63
|
],
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "cdc0700e3b31c56511fd783b638509159867a942"
|
|
65
65
|
}
|