@fmdeui/fmui 1.0.89 → 1.0.90

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.
Files changed (45) hide show
  1. package/es/component.mjs +2 -0
  2. package/es/components/fm-inputdropdown/index.d.ts +185 -0
  3. package/es/components/fm-inputdropdown/index.vue.d.ts +228 -0
  4. package/es/components/index.d.ts +1 -0
  5. package/es/components/select-table/index.d.ts +3 -3
  6. package/es/components/select-table/src/index.vue.d.ts +1 -1
  7. package/es/index.mjs +1 -0
  8. package/es/packages/components/fm-inputdropdown/index.mjs +6 -0
  9. package/es/packages/components/fm-inputdropdown/index.vue.mjs +5 -0
  10. package/es/packages/components/fm-inputdropdown/index.vue2.mjs +198 -0
  11. package/es/packages/components/index.mjs +1 -0
  12. package/es/packages/stores/ainputdropdow.mjs +36 -0
  13. package/es/packages/stores/index.mjs +1 -0
  14. package/es/stores/ainputdropdow.d.ts +17 -0
  15. package/es/stores/index.d.ts +1 -0
  16. package/index.js +264 -38
  17. package/index.min.js +7 -7
  18. package/index.min.mjs +7 -7
  19. package/index.mjs +266 -41
  20. package/lib/component.js +26 -24
  21. package/lib/components/fm-inputdropdown/index.d.ts +185 -0
  22. package/lib/components/fm-inputdropdown/index.vue.d.ts +228 -0
  23. package/lib/components/index.d.ts +1 -0
  24. package/lib/components/select-table/index.d.ts +3 -3
  25. package/lib/components/select-table/src/index.vue.d.ts +1 -1
  26. package/lib/index.js +2 -0
  27. package/lib/packages/components/fm-inputdropdown/index.js +8 -0
  28. package/lib/packages/components/fm-inputdropdown/index.vue.js +9 -0
  29. package/lib/packages/components/fm-inputdropdown/index.vue2.js +202 -0
  30. package/lib/packages/components/index.js +4 -2
  31. package/lib/packages/stores/ainputdropdow.js +38 -0
  32. package/lib/packages/stores/index.js +2 -0
  33. package/lib/stores/ainputdropdow.d.ts +17 -0
  34. package/lib/stores/index.d.ts +1 -0
  35. package/locale/en.js +1 -1
  36. package/locale/en.min.js +1 -1
  37. package/locale/en.min.mjs +1 -1
  38. package/locale/en.mjs +1 -1
  39. package/locale/zh-cn.js +1 -1
  40. package/locale/zh-cn.min.js +1 -1
  41. package/locale/zh-cn.min.mjs +1 -1
  42. package/locale/zh-cn.mjs +1 -1
  43. package/package.json +1 -1
  44. /package/es/{component.css → version.css} +0 -0
  45. /package/lib/{index.css → component.css} +0 -0
@@ -0,0 +1,198 @@
1
+ import { defineComponent, useModel, reactive, onMounted, resolveComponent, openBlock, createBlock, withCtx, createVNode, normalizeStyle, unref, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString, mergeModels } from 'vue';
2
+ import { RefreshLeft } from '@element-plus/icons-vue';
3
+ import '../../stores/index.mjs';
4
+ import { usefminputdropdownstore } from '../../stores/ainputdropdow.mjs';
5
+
6
+ var _sfc_main = /* @__PURE__ */ defineComponent({
7
+ ...{
8
+ name: "Fminputdropdown"
9
+ },
10
+ __name: "index",
11
+ props: /* @__PURE__ */ mergeModels({
12
+ //数据
13
+ optionData: {
14
+ type: Array,
15
+ default: []
16
+ },
17
+ /**
18
+ * 值的属性值
19
+ */
20
+ bvalue: {
21
+ type: String,
22
+ default: "id"
23
+ },
24
+ /**
25
+ * 值的属性标签
26
+ */
27
+ blabel: {
28
+ type: String,
29
+ default: "name"
30
+ },
31
+ placeholder: {
32
+ type: String,
33
+ default: "\u8BF7\u9009\u62E9"
34
+ },
35
+ inputWidth: {
36
+ type: String,
37
+ default: "40%"
38
+ },
39
+ dropWidth: {
40
+ type: String,
41
+ default: "90px"
42
+ },
43
+ dropHeight: {
44
+ type: String,
45
+ default: "180px"
46
+ },
47
+ /**
48
+ * api service name
49
+ */
50
+ apiService: {
51
+ type: String,
52
+ default: "baseData"
53
+ },
54
+ /**
55
+ * api service 下的方法
56
+ */
57
+ apiAction: {
58
+ type: String,
59
+ default: "baseDataList"
60
+ },
61
+ /**
62
+ * 基础编码 自动获取数据
63
+ */
64
+ basecode: {
65
+ type: String,
66
+ default: ""
67
+ },
68
+ /**
69
+ * 基础编码 多个编码合在一起调用
70
+ */
71
+ multibasecode: {
72
+ type: Array,
73
+ default: []
74
+ },
75
+ /**
76
+ * 是否默认加载数据
77
+ */
78
+ autoLoadData: {
79
+ type: Boolean,
80
+ default: true
81
+ }
82
+ }, {
83
+ "id": { default: 0, required: false },
84
+ "idModifiers": {},
85
+ "name": { default: "", required: false },
86
+ "nameModifiers": {}
87
+ }),
88
+ emits: /* @__PURE__ */ mergeModels(["change"], ["update:id", "update:name"]),
89
+ setup(__props, { emit: __emit }) {
90
+ const modeValueId = useModel(__props, "id");
91
+ const modeValueName = useModel(__props, "name");
92
+ const props = __props;
93
+ const state = reactive({
94
+ optionData: props.optionData
95
+ });
96
+ const emit = __emit;
97
+ const handCommand = (command) => {
98
+ const fitem = state.optionData.find((item) => item[props.bvalue] === command);
99
+ modeValueId.value = fitem != null ? fitem[props.bvalue] : 0;
100
+ modeValueName.value = fitem != null ? fitem[props.blabel] : "";
101
+ emit("change", fitem);
102
+ };
103
+ const handelChange = (val) => {
104
+ emit("change", val);
105
+ };
106
+ onMounted(async () => {
107
+ if (props.optionData.length > 0) {
108
+ state.optionData = props.optionData;
109
+ }
110
+ if (props.autoLoadData && props.basecode && props.basecode != "") {
111
+ const useBaseApi = usefminputdropdownstore();
112
+ state.optionData = await useBaseApi.getOptionsData(props.apiService, props.apiAction, props.basecode, false, props.multibasecode);
113
+ }
114
+ });
115
+ const handRestdata = async () => {
116
+ if (props.basecode && props.basecode != "") {
117
+ const useBaseApi = usefminputdropdownstore();
118
+ state.optionData = await useBaseApi.getOptionsData(props.apiService, props.apiAction, props.basecode, true, []);
119
+ }
120
+ };
121
+ return (_ctx, _cache) => {
122
+ const _component_el_icon = resolveComponent("el-icon");
123
+ const _component_el_input = resolveComponent("el-input");
124
+ const _component_el_dropdown_item = resolveComponent("el-dropdown-item");
125
+ const _component_el_dropdown_menu = resolveComponent("el-dropdown-menu");
126
+ const _component_el_dropdown = resolveComponent("el-dropdown");
127
+ return openBlock(), createBlock(_component_el_dropdown, {
128
+ class: "fminputdropdown",
129
+ placement: "bottom",
130
+ trigger: "click",
131
+ style: { "width": "100%" },
132
+ onCommand: handCommand
133
+ }, {
134
+ dropdown: withCtx(() => [
135
+ createVNode(_component_el_dropdown_menu, {
136
+ style: normalizeStyle({ width: __props.dropWidth, height: __props.dropHeight })
137
+ }, {
138
+ default: withCtx(() => [
139
+ (openBlock(true), createElementBlock(
140
+ Fragment,
141
+ null,
142
+ renderList(state.optionData, (item, index) => {
143
+ return openBlock(), createBlock(_component_el_dropdown_item, {
144
+ key: index,
145
+ command: item[__props.bvalue],
146
+ divided: ""
147
+ }, {
148
+ default: withCtx(() => [
149
+ createTextVNode(
150
+ toDisplayString(item[__props.blabel]),
151
+ 1
152
+ /* TEXT */
153
+ )
154
+ ]),
155
+ _: 2
156
+ /* DYNAMIC */
157
+ }, 1032, ["command"]);
158
+ }),
159
+ 128
160
+ /* KEYED_FRAGMENT */
161
+ ))
162
+ ]),
163
+ _: 1
164
+ /* STABLE */
165
+ }, 8, ["style"])
166
+ ]),
167
+ default: withCtx(() => [
168
+ createVNode(_component_el_input, {
169
+ modelValue: modeValueName.value,
170
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modeValueName.value = $event),
171
+ placeholder: props.placeholder,
172
+ style: normalizeStyle({ width: __props.inputWidth }),
173
+ onChange: handelChange
174
+ }, {
175
+ append: withCtx(() => [
176
+ createVNode(_component_el_icon, {
177
+ color: "#13c2c2",
178
+ onClick: handRestdata
179
+ }, {
180
+ default: withCtx(() => [
181
+ createVNode(unref(RefreshLeft))
182
+ ]),
183
+ _: 1
184
+ /* STABLE */
185
+ })
186
+ ]),
187
+ _: 1
188
+ /* STABLE */
189
+ }, 8, ["modelValue", "placeholder", "style"])
190
+ ]),
191
+ _: 1
192
+ /* STABLE */
193
+ });
194
+ };
195
+ }
196
+ });
197
+
198
+ export { _sfc_main as default };
@@ -11,3 +11,4 @@ export { elSvg } from './svgIcon/index.mjs';
11
11
  export { FLayout } from './fm-layout/index.mjs';
12
12
  export { FSettings } from './fm-settings/index.mjs';
13
13
  export { FModifyRecord } from './modifyRecord/index.mjs';
14
+ export { Fminputdropdown } from './fm-inputdropdown/index.mjs';
@@ -0,0 +1,36 @@
1
+ import { defineStore } from 'pinia';
2
+ import { reactive } from 'vue';
3
+ import '../api/index.mjs';
4
+ import { useBaseApi } from '../api/base/index.mjs';
5
+
6
+ const usefminputdropdownstore = defineStore("fminputdropdownstore", () => {
7
+ const state = reactive({
8
+ optionsData: {}
9
+ });
10
+ const getOptionsData = async (apiService, apiAction, basecode, reload = false, multibasecode = []) => {
11
+ var _a, _b;
12
+ if (!reload) {
13
+ if (state.optionsData[basecode] && state.optionsData[basecode].length > 0) {
14
+ return state.optionsData[basecode];
15
+ }
16
+ }
17
+ const res = await useBaseApi(apiService).get(null, apiAction + "/?codetype=" + basecode + "&mcodes=" + multibasecode.join(","));
18
+ if (multibasecode.length > 0) {
19
+ const mdata = (_a = res.data.result) != null ? _a : [];
20
+ multibasecode.forEach((p) => {
21
+ const tempdata = mdata.filter((x) => {
22
+ return x.code == p;
23
+ });
24
+ state.optionsData[p] = tempdata != null ? tempdata : [];
25
+ });
26
+ } else {
27
+ return state.optionsData[basecode] = (_b = res.data.result) != null ? _b : [];
28
+ }
29
+ };
30
+ return {
31
+ state,
32
+ getOptionsData
33
+ };
34
+ });
35
+
36
+ export { usefminputdropdownstore };
@@ -5,3 +5,4 @@ export { useRoutesList } from './routesList.mjs';
5
5
  export { useTagsViewRoutes } from './tagsViewRoutes.mjs';
6
6
  export { useThemeConfig } from './themeConfig.mjs';
7
7
  export { useUserInfo } from './userInfo.mjs';
8
+ export { usefminputdropdownstore } from './ainputdropdow.mjs';
@@ -0,0 +1,17 @@
1
+ import { StoreDefinition } from 'pinia';
2
+ export declare const usefminputdropdownstore: StoreDefinition<"fminputdropdownstore", Pick<{
3
+ state: {
4
+ optionsData: any;
5
+ };
6
+ getOptionsData: (apiService: string, apiAction: string, basecode: string, reload?: boolean, multibasecode?: Array<any>) => Promise<any>;
7
+ }, "state">, Pick<{
8
+ state: {
9
+ optionsData: any;
10
+ };
11
+ getOptionsData: (apiService: string, apiAction: string, basecode: string, reload?: boolean, multibasecode?: Array<any>) => Promise<any>;
12
+ }, never>, Pick<{
13
+ state: {
14
+ optionsData: any;
15
+ };
16
+ getOptionsData: (apiService: string, apiAction: string, basecode: string, reload?: boolean, multibasecode?: Array<any>) => Promise<any>;
17
+ }, "getOptionsData">>;
@@ -6,3 +6,4 @@ export * from './routesList';
6
6
  export * from './tagsViewRoutes';
7
7
  export * from './themeConfig';
8
8
  export * from './userInfo';
9
+ export * from './ainputdropdow';