@ftjs/antd 3.1.0 → 3.2.0
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/dist/index.js +26 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getField, useFormItem, useLocale, unrefs, useFormInject, toValueWithForm, useForm, set, useTable, get } from "@ftjs/core";
|
|
2
2
|
import { computed, toValue, createVNode, mergeProps, unref, createTextVNode, isVNode, defineComponent, createBlock, openBlock, resolveDynamicComponent, createElementBlock, Fragment, renderList, normalizeClass, ref, useId, withCtx, renderSlot, createCommentVNode, toDisplayString, createElementVNode, onMounted, h, useTemplateRef, normalizeStyle, createSlots, normalizeProps } from "vue";
|
|
3
|
-
import { FormItem, Input, Select, DatePicker, RangePicker, Radio, Textarea, Upload, Cascader, AutoComplete, CheckboxGroup, InputNumber, Mentions, Rate, Slider, Switch, TreeSelect, Form, Button, Modal, Tree, Divider, Spin, Pagination } from "ant-design-vue";
|
|
3
|
+
import { FormItem, Input, Select, DatePicker, RangePicker, Radio, Textarea, Upload, Cascader, AutoComplete, CheckboxGroup, InputNumber, Mentions, Rate, Slider, Switch, TreeSelect, Form, Button, Modal, Tree, Badge, Divider, Spin, Pagination } from "ant-design-vue";
|
|
4
4
|
import dayjs from "dayjs";
|
|
5
5
|
import { SwapOutlined, SettingOutlined } from "@ant-design/icons-vue";
|
|
6
6
|
import { VxeGrid } from "vxe-table";
|
|
@@ -237,22 +237,26 @@ const cascader = defineFormItem((props) => {
|
|
|
237
237
|
const locale = useLocale();
|
|
238
238
|
return () => {
|
|
239
239
|
const _props = unrefs(props.column.props);
|
|
240
|
+
const fieldNames = (_props == null ? void 0 : _props.fieldNames) || {};
|
|
241
|
+
const labelKey = fieldNames.label || "label";
|
|
242
|
+
const valueKey = fieldNames.value || "value";
|
|
243
|
+
const childrenKey = fieldNames.children || "children";
|
|
240
244
|
const placeholder = locale.value.placeholder.select(formItemProps.value.label);
|
|
241
245
|
const getTextFromOptions = (options, value, level = 0) => {
|
|
242
246
|
if (!options || !value || level >= value.length) return void 0;
|
|
243
247
|
const currentValue = value[level];
|
|
244
|
-
const currentOption = options.find((option) => option
|
|
248
|
+
const currentOption = options.find((option) => option[valueKey] === currentValue);
|
|
245
249
|
if (!currentOption) return void 0;
|
|
246
250
|
if (level === value.length - 1) {
|
|
247
|
-
return currentOption
|
|
251
|
+
return currentOption[labelKey];
|
|
248
252
|
}
|
|
249
|
-
if (currentOption
|
|
250
|
-
const childText = getTextFromOptions(currentOption
|
|
253
|
+
if (currentOption[childrenKey] && currentOption[childrenKey].length > 0) {
|
|
254
|
+
const childText = getTextFromOptions(currentOption[childrenKey], value, level + 1);
|
|
251
255
|
if (childText) {
|
|
252
|
-
return `${currentOption
|
|
256
|
+
return `${currentOption[labelKey]} / ${childText}`;
|
|
253
257
|
}
|
|
254
258
|
}
|
|
255
|
-
return currentOption
|
|
259
|
+
return currentOption[labelKey];
|
|
256
260
|
};
|
|
257
261
|
const isViewText = computed(() => {
|
|
258
262
|
if (props.isView && valueComputed.value) {
|
|
@@ -783,6 +787,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
783
787
|
list.splice(fromIndex, 1);
|
|
784
788
|
list.splice(toIndex, 0, dragNode);
|
|
785
789
|
};
|
|
790
|
+
const hideCountNum = computed(() => {
|
|
791
|
+
return props.cache ? props.columns.length - columnsChecked.value.length : 0;
|
|
792
|
+
});
|
|
786
793
|
__expose({
|
|
787
794
|
formInstance: formRef,
|
|
788
795
|
formData: form,
|
|
@@ -872,18 +879,23 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
872
879
|
createVNode(unref(FormItem), { style: { "--ft-form-control-width": "220px" } }, {
|
|
873
880
|
default: withCtx(() => [
|
|
874
881
|
createElementVNode("div", _hoisted_4, [
|
|
875
|
-
_ctx.cache ? (openBlock(), createBlock(unref(
|
|
882
|
+
_ctx.cache ? (openBlock(), createBlock(unref(Badge), {
|
|
876
883
|
key: 0,
|
|
877
|
-
|
|
884
|
+
count: hideCountNum.value
|
|
878
885
|
}, {
|
|
879
|
-
icon: withCtx(() => [
|
|
880
|
-
createVNode(unref(SettingOutlined))
|
|
881
|
-
]),
|
|
882
886
|
default: withCtx(() => [
|
|
883
|
-
|
|
887
|
+
createVNode(unref(Button), { onClick: setting }, {
|
|
888
|
+
icon: withCtx(() => [
|
|
889
|
+
createVNode(unref(SettingOutlined))
|
|
890
|
+
]),
|
|
891
|
+
default: withCtx(() => [
|
|
892
|
+
createTextVNode(" " + toDisplayString(unref(locale).form.settings), 1)
|
|
893
|
+
]),
|
|
894
|
+
_: 1
|
|
895
|
+
})
|
|
884
896
|
]),
|
|
885
897
|
_: 1
|
|
886
|
-
})) : createCommentVNode("", true),
|
|
898
|
+
}, 8, ["count"])) : createCommentVNode("", true),
|
|
887
899
|
createVNode(unref(Button), {
|
|
888
900
|
type: "primary",
|
|
889
901
|
htmlType: "submit"
|