@fmdeui/fmui 1.0.122 → 1.0.123

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/component.mjs CHANGED
@@ -17,6 +17,7 @@ import { FmInputNumber } from './packages/components/fm-inputnumber/index.mjs';
17
17
  import { FmAutocomplete } from './packages/components/fm-autocomplete/index.mjs';
18
18
  import { FmSelect } from './packages/components/fm-select/index.mjs';
19
19
  import { Fmdatepicker } from './packages/components/fm-datepicker/index.mjs';
20
+ import { FmPeriod } from './packages/components/fm-period/index.mjs';
20
21
 
21
22
  const plugins = [
22
23
  FButton,
@@ -37,7 +38,8 @@ const plugins = [
37
38
  FmInputNumber,
38
39
  FmAutocomplete,
39
40
  FmSelect,
40
- Fmdatepicker
41
+ Fmdatepicker,
42
+ FmPeriod
41
43
  ];
42
44
 
43
45
  export { plugins as default };
@@ -0,0 +1 @@
1
+ export declare const FmPeriod: any;
@@ -16,3 +16,4 @@ export * from './fm-inputdropdown';
16
16
  export * from './fm-inputnumber';
17
17
  export * from './fm-autocomplete';
18
18
  export * from './fm-datepicker';
19
+ export * from './fm-period';
@@ -0,0 +1,5 @@
1
+ import _sfc_main from './index.vue.mjs';
2
+
3
+ const FmPeriod = _sfc_main;
4
+
5
+ export { FmPeriod };
@@ -0,0 +1,204 @@
1
+ import { ref, useModel, resolveComponent, openBlock, createBlock, withCtx, createVNode, normalizeStyle, unref, createElementVNode, createCommentVNode, toDisplayString, createElementBlock, Fragment, renderList, createTextVNode, mergeModels } from 'vue';
2
+ import { Calendar, DArrowLeft, DArrowRight } from '@element-plus/icons-vue';
3
+
4
+ const _hoisted_1 = { style: { "display": "flex", "justify-content": "space-between", "align-items": "center" } };
5
+ const _hoisted_2 = { style: { "font-size": "16px" } };
6
+ const _sfc_main = /* @__PURE__ */ Object.assign({
7
+ name: "FmPeriod"
8
+ }, {
9
+ __name: "index",
10
+ props: /* @__PURE__ */ mergeModels({
11
+ placeholder: {
12
+ type: String,
13
+ default: "\u8BF7\u9009\u62E9\u4F1A\u8BA1\u671F\u95F4"
14
+ },
15
+ inputWidth: {
16
+ type: String,
17
+ default: "200px"
18
+ },
19
+ dropWidth: {
20
+ type: String,
21
+ default: "200px"
22
+ }
23
+ }, {
24
+ "modelValue": {},
25
+ "modelModifiers": {}
26
+ }),
27
+ emits: ["update:modelValue"],
28
+ setup(__props) {
29
+ const dropdownRef = ref(null);
30
+ const currentYear = ref((/* @__PURE__ */ new Date()).getFullYear());
31
+ const selectedPeriod = useModel(__props, "modelValue");
32
+ const props = __props;
33
+ const handleVisibleChange = (visible) => {
34
+ if (visible) {
35
+ const val = selectedPeriod.value;
36
+ if (val && typeof val === "string" && val.length >= 4) {
37
+ currentYear.value = parseInt(val.substring(0, 4), 10);
38
+ } else {
39
+ currentYear.value = (/* @__PURE__ */ new Date()).getFullYear();
40
+ }
41
+ }
42
+ };
43
+ const selectMonth = (item) => {
44
+ const monthStr = String(item).padStart(2, "0");
45
+ selectedPeriod.value = `${currentYear.value}${monthStr}`;
46
+ if (dropdownRef.value) {
47
+ dropdownRef.value.handleClose();
48
+ }
49
+ };
50
+ const isSelectedMonth = (item) => {
51
+ if (!selectedPeriod.value) return false;
52
+ const monthStr = String(item).padStart(2, "0");
53
+ return selectedPeriod.value === `${currentYear.value}${monthStr}`;
54
+ };
55
+ const changeYear = (offset) => {
56
+ currentYear.value += offset;
57
+ };
58
+ return (_ctx, _cache) => {
59
+ const _component_el_icon = resolveComponent("el-icon");
60
+ const _component_el_input = resolveComponent("el-input");
61
+ const _component_el_button = resolveComponent("el-button");
62
+ const _component_el_col = resolveComponent("el-col");
63
+ const _component_el_row = resolveComponent("el-row");
64
+ const _component_el_dropdown_menu = resolveComponent("el-dropdown-menu");
65
+ const _component_el_dropdown = resolveComponent("el-dropdown");
66
+ return openBlock(), createBlock(
67
+ _component_el_dropdown,
68
+ {
69
+ ref_key: "dropdownRef",
70
+ ref: dropdownRef,
71
+ trigger: "click",
72
+ "hide-on-click": true,
73
+ onVisibleChange: handleVisibleChange
74
+ },
75
+ {
76
+ dropdown: withCtx(() => [
77
+ createVNode(_component_el_dropdown_menu, null, {
78
+ default: withCtx(() => [
79
+ createElementVNode(
80
+ "div",
81
+ {
82
+ style: normalizeStyle({ width: __props.dropWidth, padding: "10px" })
83
+ },
84
+ [
85
+ createCommentVNode(" \u5E74\u4EFD\u63A7\u5236\u533A "),
86
+ createVNode(_component_el_row, { style: { "margin-top": "8px" } }, {
87
+ default: withCtx(() => [
88
+ createVNode(_component_el_col, {
89
+ span: 24,
90
+ class: "mb20"
91
+ }, {
92
+ default: withCtx(() => [
93
+ createElementVNode("div", _hoisted_1, [
94
+ createVNode(_component_el_button, {
95
+ size: "large",
96
+ link: "",
97
+ icon: unref(DArrowLeft),
98
+ onClick: _cache[1] || (_cache[1] = ($event) => changeYear(-1))
99
+ }, null, 8, ["icon"]),
100
+ createElementVNode(
101
+ "b",
102
+ _hoisted_2,
103
+ toDisplayString(currentYear.value) + toDisplayString(_ctx.$t("\u5E74") || "\u5E74"),
104
+ 1
105
+ /* TEXT */
106
+ ),
107
+ createVNode(_component_el_button, {
108
+ size: "large",
109
+ link: "",
110
+ icon: unref(DArrowRight),
111
+ onClick: _cache[2] || (_cache[2] = ($event) => changeYear(1))
112
+ }, null, 8, ["icon"])
113
+ ])
114
+ ]),
115
+ _: 1
116
+ /* STABLE */
117
+ }),
118
+ createCommentVNode(" \u6708\u4EFD\u9009\u62E9\u533A "),
119
+ (openBlock(), createElementBlock(
120
+ Fragment,
121
+ null,
122
+ renderList(12, (item) => {
123
+ return createVNode(
124
+ _component_el_col,
125
+ {
126
+ key: item,
127
+ span: 6,
128
+ class: "mb10",
129
+ style: { "text-align": "center" }
130
+ },
131
+ {
132
+ default: withCtx(() => [
133
+ createVNode(_component_el_button, {
134
+ circle: "",
135
+ type: isSelectedMonth(item) ? "primary" : "",
136
+ onClick: ($event) => selectMonth(item)
137
+ }, {
138
+ default: withCtx(() => [
139
+ createCommentVNode(" \u4F7F\u7528 padStart \u4F18\u96C5\u5730\u8865\u96F6\uFF0C\u4F8B\u5982 7 -> '07' "),
140
+ createTextVNode(
141
+ " " + toDisplayString(String(item).padStart(2, "0")),
142
+ 1
143
+ /* TEXT */
144
+ )
145
+ ]),
146
+ _: 2
147
+ /* DYNAMIC */
148
+ }, 1032, ["type", "onClick"])
149
+ ]),
150
+ _: 2
151
+ /* DYNAMIC */
152
+ },
153
+ 1024
154
+ /* DYNAMIC_SLOTS */
155
+ );
156
+ }),
157
+ 64
158
+ /* STABLE_FRAGMENT */
159
+ ))
160
+ ]),
161
+ _: 1
162
+ /* STABLE */
163
+ })
164
+ ],
165
+ 4
166
+ /* STYLE */
167
+ )
168
+ ]),
169
+ _: 1
170
+ /* STABLE */
171
+ })
172
+ ]),
173
+ default: withCtx(() => [
174
+ createVNode(_component_el_input, {
175
+ modelValue: selectedPeriod.value,
176
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedPeriod.value = $event),
177
+ placeholder: "\u8BF7\u9009\u62E9\u4F1A\u8BA1\u671F\u95F4",
178
+ readonly: "",
179
+ style: normalizeStyle({ width: __props.inputWidth, cursor: "pointer" })
180
+ }, {
181
+ suffix: withCtx(() => [
182
+ createVNode(_component_el_icon, null, {
183
+ default: withCtx(() => [
184
+ createVNode(unref(Calendar))
185
+ ]),
186
+ _: 1
187
+ /* STABLE */
188
+ })
189
+ ]),
190
+ _: 1
191
+ /* STABLE */
192
+ }, 8, ["modelValue", "style"])
193
+ ]),
194
+ _: 1
195
+ /* STABLE */
196
+ },
197
+ 512
198
+ /* NEED_PATCH */
199
+ );
200
+ };
201
+ }
202
+ });
203
+
204
+ export { _sfc_main as default };
@@ -16,3 +16,4 @@ export { Fminputdropdown } from './fm-inputdropdown/index.mjs';
16
16
  export { FmInputNumber } from './fm-inputnumber/index.mjs';
17
17
  export { FmAutocomplete } from './fm-autocomplete/index.mjs';
18
18
  export { Fmdatepicker } from './fm-datepicker/index.mjs';
19
+ export { FmPeriod } from './fm-period/index.mjs';