cnhis-design-vue 3.1.17-beta.3 → 3.1.17-beta.4
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/form-config/index.d.ts +8614 -7222
- package/es/packages/form-config/src/FormConfig.js +19 -16
- package/es/packages/form-config/src/FormConfig.vue.d.ts +8615 -7223
- package/es/packages/form-config/src/components/FormConfigDragDisplay.js +6 -7
- package/es/packages/form-config/src/components/FormConfigDragDisplay.vue.d.ts +2 -10
- package/es/packages/form-config/src/components/index.d.ts +5 -0
- package/es/packages/form-config/src/components/index.js +6 -0
- package/es/packages/form-config/src/components/{CloseButton.js → renderer/CloseButton.js} +2 -2
- package/es/packages/form-config/src/components/{CloseButton.vue.d.ts → renderer/CloseButton.vue.d.ts} +1 -1
- package/es/packages/form-config/src/components/{ComplexNode.js → renderer/ComplexNode.js} +16 -17
- package/es/packages/form-config/src/components/{ComplexNode.vue.d.ts → renderer/ComplexNode.vue.d.ts} +5 -25
- package/es/packages/form-config/src/components/renderer/DefaultNode.js +59 -0
- package/es/packages/form-config/src/components/renderer/DefaultNode.vue.d.ts +3266 -0
- package/es/packages/form-config/src/components/renderer/index.d.ts +4 -0
- package/es/packages/form-config/src/components/renderer/index.js +3 -0
- package/es/packages/form-config/src/hooks/index.d.ts +1 -1
- package/es/packages/form-config/src/hooks/index.js +1 -1
- package/es/packages/form-config/src/hooks/usePresetRenderer.js +1 -2
- package/es/packages/form-config/src/hooks/{useSortable.d.ts → useSortalbeConfig.d.ts} +2 -2
- package/es/packages/form-config/src/hooks/{useSortable.js → useSortalbeConfig.js} +5 -5
- package/es/packages/form-config/src/utils/index.d.ts +0 -2
- package/es/packages/form-config/src/utils/index.js +2 -5
- package/es/packages/form-config/style/index.css +11 -17
- package/es/packages/form-render/src/FormRender.js +5 -7
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +1 -2
- package/es/packages/form-render/src/hooks/useFormContext.js +1 -4
- package/es/packages/form-render/src/hooks/useFormItemDeps.d.ts +1 -0
- package/es/packages/form-render/src/hooks/useFormItemDeps.js +5 -2
- package/es/packages/form-render/src/utils/index.js +1 -1
- package/es/packages/form-render/src/utils/schema.d.ts +0 -1
- package/es/packages/form-render/src/utils/schema.js +1 -12
- package/es/packages/index.css +11 -17
- package/es/packages/shortcut-setter/src/ShortcutSetter.js +2 -1
- package/package.json +1 -1
- package/es/packages/form-config/src/components/DefaultNode.js +0 -54
- package/es/packages/form-config/src/components/DefaultNode.vue.d.ts +0 -1543
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createBlock, unref, mergeProps, withCtx, createElementVNode, normalizeStyle, resolveDynamicComponent } from 'vue';
|
|
2
2
|
import Draggable from 'vuedraggable';
|
|
3
|
-
import {
|
|
3
|
+
import { usePresetRenderer, useSortableConfig } from '../../../../packages/form-config/src/hooks';
|
|
4
4
|
import { layoutWidthEnum2Column } from '../../../../packages/form-config/src/utils';
|
|
5
5
|
import _export_sfc from '../../../../_virtual/plugin-vue_export-helper.js';
|
|
6
6
|
|
|
@@ -8,16 +8,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
8
8
|
__name: "FormConfigDragDisplay",
|
|
9
9
|
props: {
|
|
10
10
|
fieldItem: { type: Object },
|
|
11
|
-
getRenderer: { type: Function, require: true },
|
|
12
11
|
textFormatter: { type: Function, required: true }
|
|
13
12
|
},
|
|
14
13
|
setup(__props) {
|
|
15
14
|
function getItemColumnStyle(fieldItem) {
|
|
16
15
|
return { "--item-column": fieldItem ? layoutWidthEnum2Column(fieldItem.layoutWidthEnum) : 24 };
|
|
17
16
|
}
|
|
18
|
-
const {
|
|
17
|
+
const { getRenderer } = usePresetRenderer();
|
|
18
|
+
const { getCommonConfig } = useSortableConfig();
|
|
19
19
|
return (_ctx, _cache) => {
|
|
20
|
-
return openBlock(), createBlock(unref(Draggable), mergeProps(unref(
|
|
20
|
+
return openBlock(), createBlock(unref(Draggable), mergeProps(unref(getCommonConfig)(), {
|
|
21
21
|
style: getItemColumnStyle(__props.fieldItem),
|
|
22
22
|
group: "__display"
|
|
23
23
|
}), {
|
|
@@ -26,11 +26,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
26
26
|
class: "form-config__displayContentItem",
|
|
27
27
|
style: normalizeStyle(getItemColumnStyle(element))
|
|
28
28
|
}, [
|
|
29
|
-
(openBlock(), createBlock(resolveDynamicComponent(
|
|
30
|
-
"get-renderer": __props.getRenderer,
|
|
29
|
+
(openBlock(), createBlock(resolveDynamicComponent(unref(getRenderer)(element)), {
|
|
31
30
|
"field-item": element,
|
|
32
31
|
textFormatter: __props.textFormatter
|
|
33
|
-
}, null, 8, ["
|
|
32
|
+
}, null, 8, ["field-item", "textFormatter"]))
|
|
34
33
|
], 4)
|
|
35
34
|
]),
|
|
36
35
|
_: 1
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import { Func } from '../../../../../es/src/types';
|
|
2
1
|
import { PropType } from 'vue';
|
|
3
2
|
import { FormConfigItem, FormConfigTextFormatter } from '../../../../../es/packages/form-config';
|
|
4
3
|
declare const _default: import("vue").DefineComponent<{
|
|
5
4
|
fieldItem: {
|
|
6
5
|
type: PropType<FormConfigItem>;
|
|
7
6
|
};
|
|
8
|
-
getRenderer: {
|
|
9
|
-
type: Func<any[], any>;
|
|
10
|
-
require: boolean;
|
|
11
|
-
};
|
|
12
7
|
textFormatter: {
|
|
13
8
|
type: PropType<FormConfigTextFormatter>;
|
|
14
9
|
required: true;
|
|
@@ -17,7 +12,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
17
12
|
getItemColumnStyle: (fieldItem?: FormConfigItem) => {
|
|
18
13
|
'--item-column': number;
|
|
19
14
|
};
|
|
20
|
-
|
|
15
|
+
getRenderer: (fieldItem: FormConfigItem) => import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | import("vue").FunctionalComponent<{}, {}>;
|
|
16
|
+
getCommonConfig: () => {
|
|
21
17
|
onMove: ({ to, from }: import("sortablejs").SortableEvent) => void;
|
|
22
18
|
onChoose: ({ target, item }: import("sortablejs").SortableEvent) => void;
|
|
23
19
|
onUnchoose: ({ from, to, target, item }: import("sortablejs").SortableEvent) => void;
|
|
@@ -102,10 +98,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
102
98
|
fieldItem: {
|
|
103
99
|
type: PropType<FormConfigItem>;
|
|
104
100
|
};
|
|
105
|
-
getRenderer: {
|
|
106
|
-
type: Func<any[], any>;
|
|
107
|
-
require: boolean;
|
|
108
|
-
};
|
|
109
101
|
textFormatter: {
|
|
110
102
|
type: PropType<FormConfigTextFormatter>;
|
|
111
103
|
required: true;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import FormConfigCreator from './FormConfigCreator.vue';
|
|
2
|
+
import FormConfigEdit from './FormConfigEdit.vue';
|
|
3
|
+
import FormConfigDragDisplay from './FormConfigDragDisplay.vue';
|
|
4
|
+
export * from './renderer';
|
|
5
|
+
export { FormConfigCreator, FormConfigEdit, FormConfigDragDisplay };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as FormConfigCreator } from './FormConfigCreator.js';
|
|
2
|
+
export { default as FormConfigEdit } from './FormConfigEdit.js';
|
|
3
|
+
export { default as FormConfigDragDisplay } from './FormConfigDragDisplay.js';
|
|
4
|
+
export { default as CloseButton } from './renderer/CloseButton.js';
|
|
5
|
+
export { default as ComplexNode } from './renderer/ComplexNode.js';
|
|
6
|
+
export { default as DefaultNode } from './renderer/DefaultNode.js';
|
|
@@ -2,8 +2,8 @@ import { defineComponent, inject, openBlock, createBlock, unref, withModifiers,
|
|
|
2
2
|
import { CloseCircle } from '@vicons/ionicons5';
|
|
3
3
|
import { isArray } from 'lodash-es';
|
|
4
4
|
import { NButton, NIcon } from 'naive-ui';
|
|
5
|
-
import { InjectionFieldList, InjectionMaterialList } from '
|
|
6
|
-
import _export_sfc from '
|
|
5
|
+
import { InjectionFieldList, InjectionMaterialList } from '../../../../../packages/form-config/src/constants';
|
|
6
|
+
import _export_sfc from '../../../../../_virtual/plugin-vue_export-helper.js';
|
|
7
7
|
|
|
8
8
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9
9
|
__name: "CloseButton",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
|
-
import { FormConfigItem } from '
|
|
2
|
+
import { FormConfigItem } from '../../../../../../es/packages/form-config';
|
|
3
3
|
declare const _default: import("vue").DefineComponent<{
|
|
4
4
|
fieldItem: {
|
|
5
5
|
type: PropType<FormConfigItem>;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { defineComponent, inject, computed, openBlock, createElementBlock,
|
|
2
|
-
import CloseButton from '
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import _export_sfc from '../../../../_virtual/plugin-vue_export-helper.js';
|
|
1
|
+
import { defineComponent, inject, computed, openBlock, createElementBlock, createElementVNode, mergeProps, unref, withModifiers, createTextVNode, toDisplayString, createVNode } from 'vue';
|
|
2
|
+
import { CloseButton, FormConfigDragDisplay } from '../../../../../packages/form-config/src/components';
|
|
3
|
+
import { InjectionActiveFieldItem } from '../../../../../packages/form-config/src/constants';
|
|
4
|
+
import { bindHover } from '../../../../../packages/form-config/src/utils';
|
|
5
|
+
import _export_sfc from '../../../../../_virtual/plugin-vue_export-helper.js';
|
|
7
6
|
|
|
8
|
-
const _hoisted_1 =
|
|
7
|
+
const _hoisted_1 = { class: "form-config__renderer--complex form-config__renderer" };
|
|
8
|
+
const _hoisted_2 = ["onClick"];
|
|
9
9
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10
10
|
__name: "ComplexNode",
|
|
11
11
|
props: {
|
|
12
12
|
fieldItem: { type: Object, required: true },
|
|
13
|
-
getRenderer: { type: Function, require: true },
|
|
14
13
|
textFormatter: { type: Function, required: true }
|
|
15
14
|
},
|
|
16
15
|
setup(__props) {
|
|
@@ -23,20 +22,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
23
22
|
return [{ "is-active": currentActiveEditField.value === props.fieldItem }, "form-config__renderer--complexHeader"];
|
|
24
23
|
});
|
|
25
24
|
return (_ctx, _cache) => {
|
|
26
|
-
return openBlock(), createElementBlock("section",
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
return openBlock(), createElementBlock("section", _hoisted_1, [
|
|
26
|
+
createElementVNode("header", mergeProps(unref(bindHover)(__props.fieldItem), {
|
|
27
|
+
class: unref(headerClassList),
|
|
28
|
+
onClick: withModifiers(active, ["stop"])
|
|
29
|
+
}), [
|
|
31
30
|
createTextVNode(toDisplayString(props.fieldItem.name) + " ", 1),
|
|
32
|
-
createVNode(CloseButton, { "field-item": __props.fieldItem }, null, 8, ["field-item"])
|
|
33
|
-
], 16),
|
|
34
|
-
createVNode(FormConfigDragDisplay, mergeProps(_ctx.$props, {
|
|
31
|
+
createVNode(unref(CloseButton), { "field-item": __props.fieldItem }, null, 8, ["field-item"])
|
|
32
|
+
], 16, _hoisted_2),
|
|
33
|
+
createVNode(unref(FormConfigDragDisplay), mergeProps(_ctx.$props, {
|
|
35
34
|
modelValue: __props.fieldItem.children,
|
|
36
35
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.fieldItem.children = $event),
|
|
37
36
|
class: "form-config__renderer--complex--grid"
|
|
38
37
|
}), null, 16, ["modelValue"])
|
|
39
|
-
]
|
|
38
|
+
]);
|
|
40
39
|
};
|
|
41
40
|
}
|
|
42
41
|
});
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import { Func } from '../../../../../es/src/types';
|
|
2
1
|
import { PropType } from 'vue';
|
|
3
|
-
import { FormConfigItem, FormConfigTextFormatter } from '
|
|
4
|
-
import { bindHover } from '
|
|
2
|
+
import { FormConfigItem, FormConfigTextFormatter } from '../../../../../../es/packages/form-config';
|
|
3
|
+
import { bindHover } from '../../../../../../es/packages/form-config/src/utils';
|
|
5
4
|
declare const _default: import("vue").DefineComponent<{
|
|
6
5
|
fieldItem: {
|
|
7
6
|
type: PropType<FormConfigItem>;
|
|
8
7
|
required: true;
|
|
9
8
|
};
|
|
10
|
-
getRenderer: {
|
|
11
|
-
type: Func<any[], any>;
|
|
12
|
-
require: boolean;
|
|
13
|
-
};
|
|
14
9
|
textFormatter: {
|
|
15
10
|
type: PropType<FormConfigTextFormatter>;
|
|
16
11
|
required: true;
|
|
@@ -21,10 +16,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
21
16
|
type: PropType<FormConfigItem>;
|
|
22
17
|
required: true;
|
|
23
18
|
};
|
|
24
|
-
getRenderer: {
|
|
25
|
-
type: Func<any[], any>;
|
|
26
|
-
require: boolean;
|
|
27
|
-
};
|
|
28
19
|
textFormatter: {
|
|
29
20
|
type: PropType<FormConfigTextFormatter>;
|
|
30
21
|
required: true;
|
|
@@ -32,7 +23,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
32
23
|
}>> & {
|
|
33
24
|
[x: `on${string}`]: ((...args: any[]) => any) | ((...args: unknown[]) => any) | undefined;
|
|
34
25
|
}>>;
|
|
35
|
-
currentActiveEditField: import("vue").Ref<import("../../../../../
|
|
26
|
+
currentActiveEditField: import("vue").Ref<import("../../../../../src/types").UndefinedAble<FormConfigItem>>;
|
|
36
27
|
active: () => void;
|
|
37
28
|
headerClassList: import("vue").ComputedRef<(string | {
|
|
38
29
|
'is-active': boolean;
|
|
@@ -1537,10 +1528,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1537
1528
|
fieldItem: {
|
|
1538
1529
|
type: PropType<FormConfigItem>;
|
|
1539
1530
|
};
|
|
1540
|
-
getRenderer: {
|
|
1541
|
-
type: Func<any[], any>;
|
|
1542
|
-
require: boolean;
|
|
1543
|
-
};
|
|
1544
1531
|
textFormatter: {
|
|
1545
1532
|
type: PropType<FormConfigTextFormatter>;
|
|
1546
1533
|
required: true;
|
|
@@ -1549,7 +1536,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1549
1536
|
getItemColumnStyle: (fieldItem?: FormConfigItem | undefined) => {
|
|
1550
1537
|
'--item-column': number;
|
|
1551
1538
|
};
|
|
1552
|
-
|
|
1539
|
+
getRenderer: (fieldItem: FormConfigItem) => import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | import("vue").FunctionalComponent<{}, {}>;
|
|
1540
|
+
getCommonConfig: () => {
|
|
1553
1541
|
onMove: ({ to, from }: import("sortablejs").SortableEvent) => void;
|
|
1554
1542
|
onChoose: ({ target, item }: import("sortablejs").SortableEvent) => void;
|
|
1555
1543
|
onUnchoose: ({ from, to, target, item }: import("sortablejs").SortableEvent) => void;
|
|
@@ -1634,10 +1622,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1634
1622
|
fieldItem: {
|
|
1635
1623
|
type: PropType<FormConfigItem>;
|
|
1636
1624
|
};
|
|
1637
|
-
getRenderer: {
|
|
1638
|
-
type: Func<any[], any>;
|
|
1639
|
-
require: boolean;
|
|
1640
|
-
};
|
|
1641
1625
|
textFormatter: {
|
|
1642
1626
|
type: PropType<FormConfigTextFormatter>;
|
|
1643
1627
|
required: true;
|
|
@@ -1649,10 +1633,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1649
1633
|
type: PropType<FormConfigItem>;
|
|
1650
1634
|
required: true;
|
|
1651
1635
|
};
|
|
1652
|
-
getRenderer: {
|
|
1653
|
-
type: Func<any[], any>;
|
|
1654
|
-
require: boolean;
|
|
1655
|
-
};
|
|
1656
1636
|
textFormatter: {
|
|
1657
1637
|
type: PropType<FormConfigTextFormatter>;
|
|
1658
1638
|
required: true;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { defineComponent, inject, computed, openBlock, createBlock, unref, mergeProps, withModifiers, withCtx, createVNode, normalizeClass, createTextVNode, toDisplayString } from 'vue';
|
|
2
|
+
import { NButton, NEllipsis } from 'naive-ui';
|
|
3
|
+
import { CloseButton } from '../../../../../packages/form-config/src/components';
|
|
4
|
+
import { InjectionActiveFieldItem, WidgetTextMap } from '../../../../../packages/form-config/src/constants';
|
|
5
|
+
import { bindHover } from '../../../../../packages/form-config/src/utils';
|
|
6
|
+
import _export_sfc from '../../../../../_virtual/plugin-vue_export-helper.js';
|
|
7
|
+
|
|
8
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9
|
+
__name: "DefaultNode",
|
|
10
|
+
props: {
|
|
11
|
+
fieldItem: { type: Object, required: true },
|
|
12
|
+
textFormatter: { type: Function, required: true }
|
|
13
|
+
},
|
|
14
|
+
setup(__props) {
|
|
15
|
+
const props = __props;
|
|
16
|
+
const currentActiveEditField = inject(InjectionActiveFieldItem);
|
|
17
|
+
function active() {
|
|
18
|
+
currentActiveEditField.value = props.fieldItem;
|
|
19
|
+
}
|
|
20
|
+
const classList = computed(() => {
|
|
21
|
+
return [{ "is-active": currentActiveEditField.value === props.fieldItem }, "form-config__renderer"];
|
|
22
|
+
});
|
|
23
|
+
const ellipsisClassList = computed(() => {
|
|
24
|
+
return ["form-config__renderer--default", { "is-required": props.fieldItem.required }];
|
|
25
|
+
});
|
|
26
|
+
const disabled = computed(() => {
|
|
27
|
+
return props.fieldItem.editable === false;
|
|
28
|
+
});
|
|
29
|
+
function getDisplayText() {
|
|
30
|
+
const type = WidgetTextMap.get(props.fieldItem.type);
|
|
31
|
+
return props.textFormatter(props.fieldItem, `${props.fieldItem.name}${type ? `(${type})` : ""}`);
|
|
32
|
+
}
|
|
33
|
+
return (_ctx, _cache) => {
|
|
34
|
+
return openBlock(), createBlock(unref(NButton), mergeProps({
|
|
35
|
+
secondary: !unref(disabled),
|
|
36
|
+
dashed: unref(disabled)
|
|
37
|
+
}, unref(bindHover)(__props.fieldItem), {
|
|
38
|
+
onClick: withModifiers(active, ["stop"]),
|
|
39
|
+
class: unref(classList)
|
|
40
|
+
}), {
|
|
41
|
+
default: withCtx(() => [
|
|
42
|
+
createVNode(unref(NEllipsis), {
|
|
43
|
+
class: normalizeClass(unref(ellipsisClassList))
|
|
44
|
+
}, {
|
|
45
|
+
default: withCtx(() => [
|
|
46
|
+
createTextVNode(toDisplayString(getDisplayText()), 1)
|
|
47
|
+
]),
|
|
48
|
+
_: 1
|
|
49
|
+
}, 8, ["class"]),
|
|
50
|
+
createVNode(unref(CloseButton), { "field-item": __props.fieldItem }, null, 8, ["field-item"])
|
|
51
|
+
]),
|
|
52
|
+
_: 1
|
|
53
|
+
}, 16, ["secondary", "dashed", "onClick", "class"]);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
var DefaultNode = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "DefaultNode.vue"]]);
|
|
58
|
+
|
|
59
|
+
export { DefaultNode as default };
|