@fmdeui/fmui 1.0.89 → 1.0.91

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 (55) hide show
  1. package/es/component.mjs +5 -1
  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/fm-inputnumber/index.d.ts +94 -0
  5. package/es/components/fm-inputnumber/index.vue.d.ts +63 -0
  6. package/es/components/index.d.ts +2 -0
  7. package/es/components/select-table/index.d.ts +3 -3
  8. package/es/components/select-table/src/index.vue.d.ts +1 -1
  9. package/es/index.mjs +1 -0
  10. package/es/packages/components/fm-inputdropdown/index.mjs +6 -0
  11. package/es/packages/components/fm-inputdropdown/index.vue.mjs +5 -0
  12. package/es/packages/components/fm-inputdropdown/index.vue2.mjs +198 -0
  13. package/es/packages/components/fm-inputnumber/index.mjs +6 -0
  14. package/es/packages/components/fm-inputnumber/index.vue.mjs +5 -0
  15. package/es/packages/components/fm-inputnumber/index.vue2.mjs +104 -0
  16. package/es/packages/components/index.mjs +2 -0
  17. package/es/packages/stores/ainputdropdow.mjs +36 -0
  18. package/es/packages/stores/index.mjs +1 -0
  19. package/es/stores/ainputdropdow.d.ts +17 -0
  20. package/es/stores/index.d.ts +1 -0
  21. package/index.js +369 -39
  22. package/index.min.js +7 -7
  23. package/index.min.mjs +7 -7
  24. package/index.mjs +371 -42
  25. package/lib/component.js +28 -24
  26. package/lib/components/fm-inputdropdown/index.d.ts +185 -0
  27. package/lib/components/fm-inputdropdown/index.vue.d.ts +228 -0
  28. package/lib/components/fm-inputnumber/index.d.ts +94 -0
  29. package/lib/components/fm-inputnumber/index.vue.d.ts +63 -0
  30. package/lib/components/index.d.ts +2 -0
  31. package/lib/components/select-table/index.d.ts +3 -3
  32. package/lib/components/select-table/src/index.vue.d.ts +1 -1
  33. package/lib/index.js +2 -0
  34. package/lib/packages/components/fm-inputdropdown/index.js +8 -0
  35. package/lib/packages/components/fm-inputdropdown/index.vue.js +9 -0
  36. package/lib/packages/components/fm-inputdropdown/index.vue2.js +202 -0
  37. package/lib/packages/components/fm-inputnumber/index.js +8 -0
  38. package/lib/packages/components/fm-inputnumber/index.vue.js +9 -0
  39. package/lib/packages/components/fm-inputnumber/index.vue2.js +108 -0
  40. package/lib/packages/components/index.js +6 -2
  41. package/lib/packages/stores/ainputdropdow.js +38 -0
  42. package/lib/packages/stores/index.js +2 -0
  43. package/lib/stores/ainputdropdow.d.ts +17 -0
  44. package/lib/stores/index.d.ts +1 -0
  45. package/locale/en.js +1 -1
  46. package/locale/en.min.js +1 -1
  47. package/locale/en.min.mjs +1 -1
  48. package/locale/en.mjs +1 -1
  49. package/locale/zh-cn.js +1 -1
  50. package/locale/zh-cn.min.js +1 -1
  51. package/locale/zh-cn.min.mjs +1 -1
  52. package/locale/zh-cn.mjs +1 -1
  53. package/package.json +1 -1
  54. /package/{lib → es}/index.css +0 -0
  55. /package/{es/component.css → lib/make-installer.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 };
@@ -0,0 +1,6 @@
1
+ import './index.vue.mjs';
2
+ import _sfc_main from './index.vue2.mjs';
3
+
4
+ const FmInputNumber = _sfc_main;
5
+
6
+ export { FmInputNumber };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from './index.vue2.mjs';
2
+
3
+
4
+
5
+ export { _sfc_main as default };
@@ -0,0 +1,104 @@
1
+ import { defineComponent, useModel, watch, resolveComponent, openBlock, createBlock, createSlots, withCtx, renderSlot, mergeModels } from 'vue';
2
+
3
+ var _sfc_main = /* @__PURE__ */ defineComponent({
4
+ ...{ name: "FmInputNumber" },
5
+ __name: "index",
6
+ props: /* @__PURE__ */ mergeModels({
7
+ placeholder: {
8
+ type: String,
9
+ default: "\u8BF7\u8F93\u5165\u91D1\u989D"
10
+ },
11
+ defaultValue: {
12
+ type: Number,
13
+ default: -1
14
+ },
15
+ bType: {
16
+ type: String,
17
+ default: "money"
18
+ }
19
+ }, {
20
+ "modelValue": { required: true, default: 0 },
21
+ "modelModifiers": {}
22
+ }),
23
+ emits: ["update:modelValue"],
24
+ setup(__props) {
25
+ const modelValue = useModel(__props, "modelValue");
26
+ const props = __props;
27
+ const handleInput = (val) => {
28
+ if (val == "" && props.defaultValue != -1) {
29
+ modelValue.value = props.defaultValue;
30
+ return;
31
+ }
32
+ if (props.bType == "number") {
33
+ modelValue.value = parseInt(val);
34
+ return;
35
+ }
36
+ let cleaned = String(val).replace(/[^\d.]/g, "");
37
+ const dotIndex = cleaned.indexOf(".");
38
+ if (dotIndex !== -1) {
39
+ const before = cleaned.substring(0, dotIndex + 1);
40
+ const after = cleaned.substring(dotIndex + 1).replace(/\./g, "");
41
+ cleaned = before + after;
42
+ }
43
+ if (cleaned.startsWith(".")) {
44
+ cleaned = "0" + cleaned;
45
+ }
46
+ const parts = cleaned.split(".");
47
+ parts[0] = parts[0].replace(/^0+/, "") || "0";
48
+ cleaned = parts.join(".");
49
+ if (cleaned.includes(".")) {
50
+ const [intPart, decPart] = cleaned.split(".");
51
+ cleaned = `${intPart}.${decPart.substring(0, 2)}`;
52
+ }
53
+ modelValue.value = cleaned;
54
+ };
55
+ watch(() => modelValue.value, (newvalue, oldValue) => {
56
+ if (newvalue == "") {
57
+ modelValue.value = props.defaultValue == -1 ? 0 : props.defaultValue;
58
+ }
59
+ });
60
+ return (_ctx, _cache) => {
61
+ const _component_el_input = resolveComponent("el-input");
62
+ return openBlock(), createBlock(_component_el_input, {
63
+ modelValue: modelValue.value,
64
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
65
+ placeholder: __props.placeholder,
66
+ onInput: handleInput
67
+ }, createSlots({
68
+ _: 2
69
+ /* DYNAMIC */
70
+ }, [
71
+ _ctx.$slots.prepend ? {
72
+ name: "prepend",
73
+ fn: withCtx(() => [
74
+ renderSlot(_ctx.$slots, "prepend")
75
+ ]),
76
+ key: "0"
77
+ } : void 0,
78
+ _ctx.$slots.append ? {
79
+ name: "append",
80
+ fn: withCtx(() => [
81
+ renderSlot(_ctx.$slots, "append")
82
+ ]),
83
+ key: "1"
84
+ } : void 0,
85
+ _ctx.$slots.prefix ? {
86
+ name: "prefix",
87
+ fn: withCtx(() => [
88
+ renderSlot(_ctx.$slots, "prefix")
89
+ ]),
90
+ key: "2"
91
+ } : void 0,
92
+ _ctx.$slots.suffix ? {
93
+ name: "suffix",
94
+ fn: withCtx(() => [
95
+ renderSlot(_ctx.$slots, "suffix")
96
+ ]),
97
+ key: "3"
98
+ } : void 0
99
+ ]), 1032, ["modelValue", "placeholder"]);
100
+ };
101
+ }
102
+ });
103
+
104
+ export { _sfc_main as default };
@@ -11,3 +11,5 @@ 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';
15
+ export { FmInputNumber } from './fm-inputnumber/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';