cnhis-design-vue 3.1.15-beta.6 → 3.1.15-beta.9
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 +12105 -0
- package/es/packages/form-config/index.js +10 -0
- package/es/packages/form-config/src/FormConfig.js +113 -0
- package/es/packages/form-config/src/FormConfig.vue.d.ts +12107 -0
- package/es/packages/form-config/src/components/FormConfigCreator.js +97 -0
- package/es/packages/form-config/src/components/FormConfigCreator.vue.d.ts +5094 -0
- package/es/packages/form-config/src/components/FormConfigEdit.js +81 -0
- package/es/packages/form-config/src/components/FormConfigEdit.vue.d.ts +3589 -0
- package/es/packages/form-config/src/constants/index.d.ts +28 -0
- package/es/packages/form-config/src/constants/index.js +28 -0
- package/es/packages/form-config/src/hooks/index.d.ts +2 -0
- package/es/packages/form-config/src/hooks/index.js +2 -0
- package/es/packages/form-config/src/hooks/useConfigurationField.d.ts +6 -0
- package/es/packages/form-config/src/hooks/useConfigurationField.js +103 -0
- package/es/packages/form-config/src/hooks/usePresetRenderer.d.ts +5 -0
- package/es/packages/form-config/src/hooks/usePresetRenderer.js +117 -0
- package/es/packages/form-config/src/hooks/useSortable.d.ts +11 -0
- package/es/packages/form-config/src/hooks/useSortable.js +31 -0
- package/es/packages/form-config/src/types/index.d.ts +18 -0
- package/es/packages/form-config/src/types/index.js +1 -0
- package/es/packages/form-config/style/index.css +108 -0
- package/es/packages/form-render/index.d.ts +6 -6
- package/es/packages/form-render/src/FormRender.vue.d.ts +6 -6
- package/es/packages/form-render/src/components/renderer/formItem.js +2 -1
- package/es/packages/form-render/src/components/renderer/select.js +16 -9
- package/es/packages/form-render/src/hooks/useAsyncQueue.d.ts +2 -2
- package/es/packages/form-render/src/hooks/useAsyncQueue.js +6 -10
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +2 -1
- package/es/packages/form-render/src/hooks/useFormContext.js +12 -6
- package/es/packages/form-render/src/hooks/useFormRenderLifeCycle.d.ts +4 -4
- package/es/packages/form-render/src/types/index.d.ts +8 -4
- package/es/packages/form-render/src/utils/index.d.ts +2 -2
- package/es/packages/form-render/src/utils/index.js +22 -6
- package/es/packages/index.css +108 -0
- package/es/packages/index.d.ts +3 -1
- package/es/packages/index.js +4 -1
- package/es/packages/shortcut-setter/index.d.ts +8 -8
- package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +8 -8
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +1 -1
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +2 -2
- package/es/src/utils/state.d.ts +29 -0
- package/es/src/utils/state.js +44 -0
- package/package.json +2 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { COMPONENT_NAMESPACE } from '../../src/global/variable';
|
|
2
|
+
import { safeComponentRegister } from '../../src/utils';
|
|
3
|
+
import script from './src/FormConfig.js';
|
|
4
|
+
|
|
5
|
+
const FormConfig = script;
|
|
6
|
+
FormConfig.install = function(app) {
|
|
7
|
+
safeComponentRegister(app, FormConfig, COMPONENT_NAMESPACE + "FormConfig");
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { FormConfig as default };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { defineComponent, ref, provide, toRaw, openBlock, createElementBlock, createElementVNode, createVNode, unref, mergeProps, withCtx, normalizeStyle, toDisplayString, createTextVNode } from 'vue';
|
|
2
|
+
import SlotRender from '../../../src/components/SlotRender';
|
|
3
|
+
import { cloneDeep, isFunction } from 'lodash-es';
|
|
4
|
+
import Draggable from 'vuedraggable';
|
|
5
|
+
import FormConfigEdit from './components/FormConfigEdit.js';
|
|
6
|
+
import FormConfigCreator from './components/FormConfigCreator.js';
|
|
7
|
+
import { InjectionActiveFieldItem } from '../../../packages/form-config/src/constants';
|
|
8
|
+
import { useSortable, usePresetRenderer } from '../../../packages/form-config/src/hooks';
|
|
9
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.js';
|
|
10
|
+
|
|
11
|
+
const _hoisted_1 = { class: "form-config" };
|
|
12
|
+
const _hoisted_2 = { class: "form-config__material" };
|
|
13
|
+
const _hoisted_3 = /* @__PURE__ */ createElementVNode("header", { class: "form-config__materialHeader" }, "\u7269\u6599\u533A", -1);
|
|
14
|
+
const _hoisted_4 = { class: "form-config__displayWrapper" };
|
|
15
|
+
const _hoisted_5 = { class: "form-config__displayHeader" };
|
|
16
|
+
const _hoisted_6 = /* @__PURE__ */ createTextVNode(" \u5E03\u5C40\u533A ");
|
|
17
|
+
const _hoisted_7 = { class: "form-config__config" };
|
|
18
|
+
const _hoisted_8 = /* @__PURE__ */ createElementVNode("header", { class: "form-config__materialHeader" }, "\u914D\u7F6E\u533A", -1);
|
|
19
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
20
|
+
__name: "FormConfig",
|
|
21
|
+
props: {
|
|
22
|
+
textFormatter: { type: Function }
|
|
23
|
+
},
|
|
24
|
+
setup(__props, { expose }) {
|
|
25
|
+
const props = __props;
|
|
26
|
+
const { commonConfig } = useSortable();
|
|
27
|
+
const fieldListRef = ref([]);
|
|
28
|
+
const materialListRef = ref([]);
|
|
29
|
+
function addItem(fieldItem) {
|
|
30
|
+
if (fieldListRef.value.some((field) => field.val_key === fieldItem.val_key))
|
|
31
|
+
return;
|
|
32
|
+
fieldListRef.value.push(fieldItem);
|
|
33
|
+
}
|
|
34
|
+
const textFormatter = (fieldItem, parsedText) => {
|
|
35
|
+
if (!isFunction(props.textFormatter))
|
|
36
|
+
return parsedText;
|
|
37
|
+
return props.textFormatter(fieldItem, parsedText);
|
|
38
|
+
};
|
|
39
|
+
const { getRenderer } = usePresetRenderer(textFormatter);
|
|
40
|
+
const currentEditField = ref();
|
|
41
|
+
provide(InjectionActiveFieldItem, currentEditField);
|
|
42
|
+
const formConfigEditRef = ref();
|
|
43
|
+
expose({
|
|
44
|
+
loadData({ fieldList, materialList }) {
|
|
45
|
+
fieldListRef.value = cloneDeep(toRaw(fieldList));
|
|
46
|
+
materialListRef.value = cloneDeep(toRaw(materialList));
|
|
47
|
+
},
|
|
48
|
+
validate() {
|
|
49
|
+
var _a;
|
|
50
|
+
return (_a = formConfigEditRef.value) == null ? void 0 : _a.validate();
|
|
51
|
+
},
|
|
52
|
+
getData() {
|
|
53
|
+
return { fieldList: cloneDeep(toRaw(fieldListRef.value)), materialList: cloneDeep(toRaw(materialListRef.value)) };
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return (_ctx, _cache) => {
|
|
57
|
+
return openBlock(), createElementBlock("section", _hoisted_1, [
|
|
58
|
+
createElementVNode("section", _hoisted_2, [
|
|
59
|
+
_hoisted_3,
|
|
60
|
+
createVNode(unref(Draggable), mergeProps(unref(commonConfig), {
|
|
61
|
+
class: "form-config__materialContent",
|
|
62
|
+
group: "__display",
|
|
63
|
+
modelValue: materialListRef.value,
|
|
64
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => materialListRef.value = $event)
|
|
65
|
+
}), {
|
|
66
|
+
item: withCtx(({ element }) => [
|
|
67
|
+
createElementVNode("div", {
|
|
68
|
+
style: normalizeStyle({ "--item-column": element.elem_width }),
|
|
69
|
+
class: "form-config__materialContentItem"
|
|
70
|
+
}, toDisplayString(element.alias), 5)
|
|
71
|
+
]),
|
|
72
|
+
_: 1
|
|
73
|
+
}, 16, ["modelValue"])
|
|
74
|
+
]),
|
|
75
|
+
createElementVNode("section", _hoisted_4, [
|
|
76
|
+
createElementVNode("header", _hoisted_5, [
|
|
77
|
+
_hoisted_6,
|
|
78
|
+
createVNode(FormConfigCreator, { onSubmit: addItem })
|
|
79
|
+
]),
|
|
80
|
+
createVNode(unref(Draggable), mergeProps(unref(commonConfig), {
|
|
81
|
+
group: "__display",
|
|
82
|
+
class: "form-config__displayContent",
|
|
83
|
+
modelValue: fieldListRef.value,
|
|
84
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => fieldListRef.value = $event)
|
|
85
|
+
}), {
|
|
86
|
+
item: withCtx(({ element }) => [
|
|
87
|
+
createElementVNode("section", {
|
|
88
|
+
class: "form-config__displayContentItem",
|
|
89
|
+
style: normalizeStyle({ "--item-column": element.elem_width })
|
|
90
|
+
}, [
|
|
91
|
+
createVNode(unref(SlotRender), {
|
|
92
|
+
renderer: unref(getRenderer)(element),
|
|
93
|
+
fieldItem: element
|
|
94
|
+
}, null, 8, ["renderer", "fieldItem"])
|
|
95
|
+
], 4)
|
|
96
|
+
]),
|
|
97
|
+
_: 1
|
|
98
|
+
}, 16, ["modelValue"])
|
|
99
|
+
]),
|
|
100
|
+
createElementVNode("section", _hoisted_7, [
|
|
101
|
+
_hoisted_8,
|
|
102
|
+
createVNode(FormConfigEdit, {
|
|
103
|
+
ref_key: "formConfigEditRef",
|
|
104
|
+
ref: formConfigEditRef
|
|
105
|
+
}, null, 512)
|
|
106
|
+
])
|
|
107
|
+
]);
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
var script = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "FormConfig.vue"]]);
|
|
112
|
+
|
|
113
|
+
export { script as default };
|