@neatui/vue 1.0.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.
Files changed (100) hide show
  1. package/README.md +139 -0
  2. package/package.json +26 -0
  3. package/src/components/basic/IDraggable.vue +84 -0
  4. package/src/components/basic/IDraggable@b.vue +80 -0
  5. package/src/components/basic/IFollowView.vue +172 -0
  6. package/src/components/basic/IFollowView@v2.vue +188 -0
  7. package/src/components/basic/IPickerView.vue +351 -0
  8. package/src/components/basic/IRouterView@v2.vue.backup +119 -0
  9. package/src/components/basic/IRouterView@v3.vue.backup +252 -0
  10. package/src/components/basic/IRouterView@v4.vue +362 -0
  11. package/src/components/basic/IScrollView.vue +127 -0
  12. package/src/components/basic/Icon.vue +54 -0
  13. package/src/components/basic/LayerView/Layer.vue +333 -0
  14. package/src/components/basic/LayerView/index.ts +5 -0
  15. package/src/components/basic/follow.ts +119 -0
  16. package/src/components/basic/index.ts +7 -0
  17. package/src/components/display/Avatar.vue +1 -0
  18. package/src/components/display/Badge.vue +1 -0
  19. package/src/components/display/Calendar.vue +245 -0
  20. package/src/components/display/CalendarReg.vue +245 -0
  21. package/src/components/display/Card.vue +1 -0
  22. package/src/components/display/Carousel.vue +1 -0
  23. package/src/components/display/Collapse.vue +1 -0
  24. package/src/components/display/Desriptions.vue +1 -0
  25. package/src/components/display/Empty.vue +1 -0
  26. package/src/components/display/Image.vue +112 -0
  27. package/src/components/display/List.vue +1 -0
  28. package/src/components/display/PhotoEditor.vue +181 -0
  29. package/src/components/display/PhotoViewer.vue +50 -0
  30. package/src/components/display/Popover.vue +1 -0
  31. package/src/components/display/QRCode.vue +1 -0
  32. package/src/components/display/Segmented.vue +1 -0
  33. package/src/components/display/Statistic.vue +1 -0
  34. package/src/components/display/Table.vue +1 -0
  35. package/src/components/display/Tabs.vue +1 -0
  36. package/src/components/display/Tag.vue +1 -0
  37. package/src/components/display/Timeline.vue +1 -0
  38. package/src/components/display/Tooltip.vue +1 -0
  39. package/src/components/display/Tour.vue +1 -0
  40. package/src/components/display/Tree.vue +431 -0
  41. package/src/components/display/TreeView.vue +222 -0
  42. package/src/components/display/index.ts +7 -0
  43. package/src/components/form/Cascader.vue +435 -0
  44. package/src/components/form/DatePicker.vue +124 -0
  45. package/src/components/form/DateRangePicker@v2.vue.backup +224 -0
  46. package/src/components/form/DateRangePicker@v3.vue +116 -0
  47. package/src/components/form/DateRangeView@v3.vue +386 -0
  48. package/src/components/form/DateView.vue +231 -0
  49. package/src/components/form/DateView@v2.vue +386 -0
  50. package/src/components/form/DateView@v3.vue +471 -0
  51. package/src/components/form/EditUpload.vue +4 -0
  52. package/src/components/form/ImgUpload.vue +174 -0
  53. package/src/components/form/Input.vue.backup +230 -0
  54. package/src/components/form/Input@v3.vue +267 -0
  55. package/src/components/form/InputNumber.vue +200 -0
  56. package/src/components/form/InputRange.vue +235 -0
  57. package/src/components/form/MoreSelect.vue.backup +144 -0
  58. package/src/components/form/MoreSelect@v3.vue +190 -0
  59. package/src/components/form/MoreSelectList.vue +120 -0
  60. package/src/components/form/MoreSelectPanel@v3.vue +190 -0
  61. package/src/components/form/MoreSelectPicker.vue +119 -0
  62. package/src/components/form/MoreSelectTags.vue +119 -0
  63. package/src/components/form/PageMoreSelect.vue +187 -0
  64. package/src/components/form/PageSelect.vue +189 -0
  65. package/src/components/form/SearchMoreSelect.vue +168 -0
  66. package/src/components/form/SearchSelect.vue.backup +194 -0
  67. package/src/components/form/SearchSelect@v3.vue +202 -0
  68. package/src/components/form/Select@v3.vue +201 -0
  69. package/src/components/form/SelectList.vue +58 -0
  70. package/src/components/form/SelectPicker.vue +97 -0
  71. package/src/components/form/SelectTags.vue +52 -0
  72. package/src/components/form/SelectTree/SelectTree@v1.vue +227 -0
  73. package/src/components/form/Switch.vue +135 -0
  74. package/src/components/form/TextArea.vue +171 -0
  75. package/src/components/form/TimePicker.vue +11 -0
  76. package/src/components/form/TimeView.vue +244 -0
  77. package/src/components/form/Upload.vue +349 -0
  78. package/src/components/form/index.ts +82 -0
  79. package/src/components/loader/FormLoader/FormLoader@v2.vue +422 -0
  80. package/src/components/loader/FormLoader/FormLoader@v3.vue.backup +318 -0
  81. package/src/components/loader/FormLoader/index.ts +2 -0
  82. package/src/components/loader/LimitLoader/LimitLoader.vue.backup +131 -0
  83. package/src/components/loader/LimitLoader/LimitLoader@v2.vue.backup +174 -0
  84. package/src/components/loader/LimitLoader/LimitLoader@v3.vue +183 -0
  85. package/src/components/loader/LimitLoader/index.ts +2 -0
  86. package/src/components/loader/TableLoader/TableColView.vue +115 -0
  87. package/src/components/loader/TableLoader/TableLoader.vue +356 -0
  88. package/src/components/loader/TableLoader/index.ts +2 -0
  89. package/src/components/loader/ViewLoader/ViewLoader@v1.vue +256 -0
  90. package/src/components/loader/ViewLoader/index.ts +2 -0
  91. package/src/components/loader/index.ts +5 -0
  92. package/src/components/tools/FormDraftsView.vue +308 -0
  93. package/src/components/tools/FormVerifyView.vue +206 -0
  94. package/src/components/tools/MoreTools.vue +74 -0
  95. package/src/components/tools/MoreTools@v2.vue +74 -0
  96. package/src/components/tools/Pagination@a.vue +222 -0
  97. package/src/components/tools/Pagination@b.vue +221 -0
  98. package/src/components/tools/index.ts +5 -0
  99. package/src/index.ts +5 -0
  100. package/tsconfig.json +24 -0
@@ -0,0 +1,245 @@
1
+ <template>
2
+ <div :class="`${frame ? 'b-solid b-line b-xs r-sm' : ''}`" ui-flex="col xy">
3
+ <div ui-calendar-head="" class="nx-sl ny-sm b-solid b-line bb-xs">
4
+ <div ui-flex="row lm"></div>
5
+ <div ui-flex="row cm" class="nx-ss-sub">
6
+ <p class="mx-ss-sub">
7
+ <b>{{ curr.y }}年</b>
8
+ <b>{{ curr.m }}月</b>
9
+ <b>{{ curr.d }}日</b>
10
+ </p>
11
+ </div>
12
+ <div ui-flex="row rm"></div>
13
+ </div>
14
+ <div ui-flex="row am" class="fs-xs bold nx-sl nt-sm"><span>日</span><span>一</span><span>二</span><span>三</span><span>四</span><span>五</span><span>六</span></div>
15
+ <div>
16
+ <ul ui-calendar-days="" ui-flex="row lm" class="flex-wrap nx-sm">
17
+ <li class="ew7 n-sm ux-none" v-for="(item, idx) in curr.days" :key="idx">
18
+ <div v-if="item.day" @click="change(item)" ui-cover="-xs">
19
+ <div
20
+ ui-flex="col cm"
21
+ class="r-ss b-solid bk-none b-xs"
22
+ :class="`${item.isToday ? 'bk-main+o-ls' : item.isLastMonth || item.isNextMonth ? 'co-note' : item.isHoliday ? 'co-risk' : ''} ${
23
+ state.selected && state.selected === item.date ? 'active bg-main+o-ls co-fore' : 'hover-bg-weak'
24
+ }`"
25
+ >
26
+ <span>{{ item.day }}</span>
27
+ <sup style="font-size: 0.6em; margin-top: -0.3em; position: absolute; left: 100%; top: 0" v-if="item.holiday" class="lh-ss">休</sup>
28
+ </div>
29
+ </div>
30
+ </li>
31
+ </ul>
32
+ </div>
33
+ <div ui-calendar-foot="" ui-flex="row xm" class="nx-sl nb-sl">
34
+ <div ui-flex="row lm">
35
+ <div ui-btn="@a s none :square" @click="prev('y')">
36
+ <svg style="width: 1em; height: 1em" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
37
+ <path
38
+ d="M220.1 481.5L502 199.3c7.6-7.6 17.8-11.8 28.5-11.8s20.9 4.2 28.5 11.8c7.5 7.6 11.8 17.8 11.8 28.5s-4.2 20.9-11.8 28.5L305.5 510l253.4 253.7c7.3 7.6 11.4 17.8 11.3 28.4-0.1 10.6-4.3 20.7-11.8 28.2-7.5 7.5-17.6 11.7-28.1 11.8-10.6 0.1-20.7-4-28.3-11.3L220.1 538.5c-7.5-7.6-11.8-17.8-11.8-28.5s4.2-21 11.8-28.5z"
39
+ p-id="3429"
40
+ ></path>
41
+ <path
42
+ d="M453.3 514.5c0-10.7 4.2-20.9 11.8-28.5L747 203.9c7.6-7.6 17.8-11.8 28.5-11.8s20.9 4.2 28.5 11.8c7.5 7.6 11.8 17.8 11.8 28.5s-4.2 20.9-11.8 28.5L550.5 514.5l253.4 253.7c7.3 7.6 11.4 17.8 11.3 28.4-0.1 10.6-4.3 20.7-11.8 28.2-7.5 7.5-17.6 11.7-28.1 11.8-10.6 0.1-20.7-4-28.3-11.3L465.1 543c-7.5-7.5-11.8-17.8-11.8-28.5z"
43
+ p-id="3430"
44
+ ></path>
45
+ </svg>
46
+ </div>
47
+ <div ui-btn="@a s none :square" @click="prev('m')">
48
+ <svg style="width: 1em; height: 1em" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
49
+ <path
50
+ d="M684.2 827.6c-7.7 7.7-18.1 12-28.9 12-10.9 0-21.3-4.3-28.9-12L339.8 540.7c-7.7-7.7-12-18.1-12-29 0-10.9 4.3-21.3 12-29l286.6-286.9c7.7-7.5 18.1-11.6 28.8-11.5 10.7 0.1 21 4.4 28.6 12 7.6 7.6 11.9 17.9 12 28.6 0.1 10.7-4 21.1-11.5 28.8L426.6 511.8l257.6 257.9c7.7 7.7 12 18.1 12 29s-4.3 21.2-12 28.9z"
51
+ p-id="1281"
52
+ ></path>
53
+ </svg>
54
+ </div>
55
+ </div>
56
+ <div ui-flex="row cm" class="nx-ss-sub">
57
+ <ul class="fs-xs n-sm-sub" ui-flex="row lm">
58
+ <li ui-btn="@a s none">年</li>
59
+ <li ui-btn="@a s none">月</li>
60
+ <li ui-btn="@a s none">日</li>
61
+ <!-- <li ui-btn="@a s none">时</li> -->
62
+ </ul>
63
+ </div>
64
+ <div ui-flex="row rm">
65
+ <div ui-btn="@a s none :square" @click="next('m')">
66
+ <svg style="width: 1em; height: 1em" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
67
+ <path
68
+ d="M339.8 827.6c-7.7-7.7-12-18.1-12-29s4.3-21.3 12-29l257.6-257.9-257.6-257.9c-7.5-7.7-11.6-18.1-11.5-28.8 0.1-10.7 4.4-21 12-28.6 7.6-7.6 17.9-11.9 28.6-12 10.7-0.1 21.1 4 28.8 11.5l286.6 286.9c7.7 7.7 12 18.1 12 29 0 10.9-4.3 21.3-12 29L397.7 827.6c-7.7 7.7-18.1 12-28.9 12-10.9 0-21.4-4.3-29-12z"
69
+ p-id="3084"
70
+ ></path>
71
+ </svg>
72
+ </div>
73
+ <div ui-btn="@a s none :square" @click="next('y')">
74
+ <svg style="width: 1em; height: 1em" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
75
+ <path
76
+ d="M803.9 481.5L522.1 199.3a40.18 40.18 0 0 0-28.5-11.8c-10.7 0-20.9 4.2-28.5 11.8-7.5 7.6-11.8 17.8-11.8 28.5s4.2 20.9 11.8 28.5L718.5 510 465.1 763.6c-7.3 7.6-11.4 17.8-11.3 28.4 0.1 10.6 4.3 20.7 11.8 28.2 7.5 7.5 17.6 11.7 28.1 11.8 10.6 0.1 20.7-4 28.3-11.3l281.9-282.2c7.5-7.6 11.8-17.8 11.8-28.5s-4.2-21-11.8-28.5z"
77
+ p-id="3256"
78
+ ></path>
79
+ <path
80
+ d="M570.7 514.5c0-10.7-4.2-20.9-11.8-28.5L277 203.9a40.18 40.18 0 0 0-28.5-11.8c-10.7 0-20.9 4.2-28.5 11.8-7.5 7.6-11.8 17.8-11.8 28.5s4.2 20.9 11.8 28.5l253.4 253.7-253.3 253.6c-7.3 7.6-11.4 17.8-11.3 28.4 0.1 10.6 4.3 20.7 11.8 28.2 7.5 7.5 17.6 11.7 28.1 11.8 10.6 0.1 20.7-4 28.3-11.3L558.9 543c7.5-7.5 11.8-17.8 11.8-28.5z"
81
+ p-id="3257"
82
+ ></path>
83
+ </svg>
84
+ </div>
85
+ </div>
86
+ </div>
87
+ </div>
88
+ </template>
89
+ <script setup lang="ts">
90
+ import { computed, reactive, toRefs } from 'vue';
91
+ import { idate } from '@fekit/utils';
92
+ // 创建日期
93
+ const cDate = (date: any = null) => {
94
+ const _date = new Date(date);
95
+ return date && _date instanceof Date && !isNaN(_date.getTime()) ? _date : new Date();
96
+ };
97
+ // 个位补零
98
+ const numfill = (num: string | number = '') => {
99
+ return Number(num) < 10 ? `0${num}` : num;
100
+ };
101
+ // 外部入参
102
+ const props = defineProps({
103
+ frame: { type: Boolean, default: false },
104
+ theme: { type: String, default: '@a' },
105
+ sz: { type: String, default: 'm' },
106
+ co: { type: String, default: '' },
107
+ block: { type: Boolean, default: true },
108
+ // 提示文案
109
+ tips: {
110
+ type: String,
111
+ default: ''
112
+ },
113
+ // 提示文案
114
+ placeholder: {
115
+ type: String,
116
+ default: ''
117
+ },
118
+ // 格式
119
+ format: {
120
+ type: String,
121
+ default: ''
122
+ },
123
+ // 值
124
+ value: {
125
+ type: [String, Number],
126
+ default: ''
127
+ },
128
+ // 值
129
+ modelValue: { type: [String, Number], default: '' },
130
+ // 节假日
131
+ holiday: {
132
+ type: Object,
133
+ default: () => ({})
134
+ },
135
+ // 校验规则
136
+ rules: {
137
+ type: Array,
138
+ default: () => []
139
+ },
140
+ // 是否是示校验图标
141
+ verify: {
142
+ type: Boolean,
143
+ default: false
144
+ }
145
+ });
146
+
147
+ // 内部数据
148
+ const state: any = reactive({
149
+ view: 1,
150
+ show: 0,
151
+ pos: 'bl',
152
+ selected: '',
153
+ date: props.value,
154
+ curr: computed(() => {
155
+ const date = cDate(state.date);
156
+ const calendar = [];
157
+ // 年
158
+ const y: any = date.getFullYear();
159
+ // 月
160
+ const m: any = date.getMonth() + 1;
161
+ // 日
162
+ const d: any = date.getDate();
163
+ // 本月第一天星期几
164
+ const w = new Date(`${y}-${m}-1`).getDay();
165
+ // 当前月份一共几天
166
+ const days = new Date(y, m, 0).getDate();
167
+
168
+ // 当前
169
+ const curr = new Date();
170
+ const curr_y = curr.getFullYear();
171
+ const curr_m = curr.getMonth() + 1;
172
+ const curr_d = curr.getDate();
173
+
174
+ // 上月
175
+ const last = new Date(y, m - 1, 0);
176
+ const last_y = last.getFullYear();
177
+ const last_m = last.getMonth() + 1;
178
+
179
+ // 下月
180
+ const next = new Date(y, m + 1, 0);
181
+ const next_y = next.getFullYear();
182
+ const next_m = next.getMonth() + 1;
183
+ let prevdays = last.getDate();
184
+
185
+ for (let i = 0; i < w; i++) {
186
+ calendar.unshift({
187
+ date: `${last_y}-${last_m}-${prevdays}`,
188
+ day: prevdays,
189
+ isLastMonth: 1
190
+ });
191
+ prevdays = prevdays - 1;
192
+ }
193
+ for (let i = 1; i <= days; i++) {
194
+ const _i = i;
195
+ calendar.push({
196
+ date: `${y}-${m}-${_i}`,
197
+ day: _i,
198
+ isToday: curr_y === y && curr_m === m && curr_d === i,
199
+ isHoliday: props.holiday[`${y}-${m}-${_i}`]?.name ? 1 : 0,
200
+ holiday: props.holiday[`${y}-${m}-${_i}`]?.name
201
+ });
202
+ }
203
+ for (let i = 1; calendar.length < 42; i++) {
204
+ const _i = i;
205
+ calendar.push({
206
+ date: `${next_y}-${next_m}-${_i}`,
207
+ day: _i,
208
+ isNextMonth: 1
209
+ });
210
+ }
211
+ return { days: calendar, y, m, d };
212
+ }),
213
+ value: computed(() => {
214
+ return props.format ? idate(state.selected || props.value).format(props.format) : state.selected || props.value;
215
+ })
216
+ });
217
+ const { curr = {} }: any = toRefs(state);
218
+
219
+ const upload = (a: any = 'm', b: any = 1) => {
220
+ const date = cDate(state.date);
221
+ if (a === 'm') {
222
+ date.setMonth(date.getMonth() + b);
223
+ } else {
224
+ date.setFullYear(date.getFullYear() + b);
225
+ }
226
+ return date.toISOString().substring(0, 10);
227
+ };
228
+
229
+ // 日期前翻
230
+ const prev = (type: any = 'm') => {
231
+ state.date = upload(type, -1);
232
+ };
233
+ // 日期后翻
234
+ const next = (type: any = 'm') => {
235
+ state.date = upload(type, 1);
236
+ };
237
+
238
+ // 向外通信
239
+ const emits = defineEmits(['change']);
240
+ const change = (item: any) => {
241
+ state.selected = item.date;
242
+ state.date = item.date;
243
+ emits('change', item.date);
244
+ };
245
+ </script>
@@ -0,0 +1,245 @@
1
+ <template>
2
+ <div :class="`${frame ? 'b-solid b-line b-xs r-sm' : ''}`" ui-flex="col xy">
3
+ <div ui-calendar-head="" class="nx-sl ny-sm b-solid b-line bb-xs">
4
+ <div ui-flex="row lm"></div>
5
+ <div ui-flex="row cm" class="nx-ss-sub">
6
+ <p class="mx-ss-sub">
7
+ <b>{{ curr.y }}年</b>
8
+ <b>{{ curr.m }}月</b>
9
+ <b>{{ curr.d }}日</b>
10
+ </p>
11
+ </div>
12
+ <div ui-flex="row rm"></div>
13
+ </div>
14
+ <div ui-flex="row am" class="fs-xs bold nx-sl nt-sm"><span>日</span><span>一</span><span>二</span><span>三</span><span>四</span><span>五</span><span>六</span></div>
15
+ <div>
16
+ <ul ui-calendar-days="" ui-flex="row lm" class="flex-wrap nx-sm">
17
+ <li class="ew7 n-sm ux-none" v-for="(item, idx) in curr.days" :key="idx">
18
+ <div v-if="item.day" @click="change(item)" ui-cover="-xs">
19
+ <div
20
+ ui-flex="col cm"
21
+ class="r-ss b-solid bk-none b-xs"
22
+ :class="`${item.isToday ? 'bk-main+o-ls' : item.isLastMonth || item.isNextMonth ? 'co-note' : item.isHoliday ? 'co-risk' : ''} ${
23
+ state.selected && state.selected === item.date ? 'active bg-main+o-ls co-fore' : 'hover-bg-weak'
24
+ }`"
25
+ >
26
+ <span>{{ item.day }}</span>
27
+ <sup style="font-size: 0.6em; margin-top: -0.3em; position: absolute; left: 100%; top: 0" v-if="item.holiday" class="lh-ss">休</sup>
28
+ </div>
29
+ </div>
30
+ </li>
31
+ </ul>
32
+ </div>
33
+ <div ui-calendar-foot="" ui-flex="row xm" class="nx-sl nb-sl">
34
+ <div ui-flex="row lm">
35
+ <div ui-btn="@a s none :square" @click="prev('y')">
36
+ <svg style="width: 1em; height: 1em" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
37
+ <path
38
+ d="M220.1 481.5L502 199.3c7.6-7.6 17.8-11.8 28.5-11.8s20.9 4.2 28.5 11.8c7.5 7.6 11.8 17.8 11.8 28.5s-4.2 20.9-11.8 28.5L305.5 510l253.4 253.7c7.3 7.6 11.4 17.8 11.3 28.4-0.1 10.6-4.3 20.7-11.8 28.2-7.5 7.5-17.6 11.7-28.1 11.8-10.6 0.1-20.7-4-28.3-11.3L220.1 538.5c-7.5-7.6-11.8-17.8-11.8-28.5s4.2-21 11.8-28.5z"
39
+ p-id="3429"
40
+ ></path>
41
+ <path
42
+ d="M453.3 514.5c0-10.7 4.2-20.9 11.8-28.5L747 203.9c7.6-7.6 17.8-11.8 28.5-11.8s20.9 4.2 28.5 11.8c7.5 7.6 11.8 17.8 11.8 28.5s-4.2 20.9-11.8 28.5L550.5 514.5l253.4 253.7c7.3 7.6 11.4 17.8 11.3 28.4-0.1 10.6-4.3 20.7-11.8 28.2-7.5 7.5-17.6 11.7-28.1 11.8-10.6 0.1-20.7-4-28.3-11.3L465.1 543c-7.5-7.5-11.8-17.8-11.8-28.5z"
43
+ p-id="3430"
44
+ ></path>
45
+ </svg>
46
+ </div>
47
+ <div ui-btn="@a s none :square" @click="prev('m')">
48
+ <svg style="width: 1em; height: 1em" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
49
+ <path
50
+ d="M684.2 827.6c-7.7 7.7-18.1 12-28.9 12-10.9 0-21.3-4.3-28.9-12L339.8 540.7c-7.7-7.7-12-18.1-12-29 0-10.9 4.3-21.3 12-29l286.6-286.9c7.7-7.5 18.1-11.6 28.8-11.5 10.7 0.1 21 4.4 28.6 12 7.6 7.6 11.9 17.9 12 28.6 0.1 10.7-4 21.1-11.5 28.8L426.6 511.8l257.6 257.9c7.7 7.7 12 18.1 12 29s-4.3 21.2-12 28.9z"
51
+ p-id="1281"
52
+ ></path>
53
+ </svg>
54
+ </div>
55
+ </div>
56
+ <div ui-flex="row cm" class="nx-ss-sub">
57
+ <ul class="fs-xs n-sm-sub" ui-flex="row lm">
58
+ <li ui-btn="@a s none">年</li>
59
+ <li ui-btn="@a s none">月</li>
60
+ <li ui-btn="@a s none">日</li>
61
+ <!-- <li ui-btn="@a s none">时</li> -->
62
+ </ul>
63
+ </div>
64
+ <div ui-flex="row rm">
65
+ <div ui-btn="@a s none :square" @click="next('m')">
66
+ <svg style="width: 1em; height: 1em" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
67
+ <path
68
+ d="M339.8 827.6c-7.7-7.7-12-18.1-12-29s4.3-21.3 12-29l257.6-257.9-257.6-257.9c-7.5-7.7-11.6-18.1-11.5-28.8 0.1-10.7 4.4-21 12-28.6 7.6-7.6 17.9-11.9 28.6-12 10.7-0.1 21.1 4 28.8 11.5l286.6 286.9c7.7 7.7 12 18.1 12 29 0 10.9-4.3 21.3-12 29L397.7 827.6c-7.7 7.7-18.1 12-28.9 12-10.9 0-21.4-4.3-29-12z"
69
+ p-id="3084"
70
+ ></path>
71
+ </svg>
72
+ </div>
73
+ <div ui-btn="@a s none :square" @click="next('y')">
74
+ <svg style="width: 1em; height: 1em" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
75
+ <path
76
+ d="M803.9 481.5L522.1 199.3a40.18 40.18 0 0 0-28.5-11.8c-10.7 0-20.9 4.2-28.5 11.8-7.5 7.6-11.8 17.8-11.8 28.5s4.2 20.9 11.8 28.5L718.5 510 465.1 763.6c-7.3 7.6-11.4 17.8-11.3 28.4 0.1 10.6 4.3 20.7 11.8 28.2 7.5 7.5 17.6 11.7 28.1 11.8 10.6 0.1 20.7-4 28.3-11.3l281.9-282.2c7.5-7.6 11.8-17.8 11.8-28.5s-4.2-21-11.8-28.5z"
77
+ p-id="3256"
78
+ ></path>
79
+ <path
80
+ d="M570.7 514.5c0-10.7-4.2-20.9-11.8-28.5L277 203.9a40.18 40.18 0 0 0-28.5-11.8c-10.7 0-20.9 4.2-28.5 11.8-7.5 7.6-11.8 17.8-11.8 28.5s4.2 20.9 11.8 28.5l253.4 253.7-253.3 253.6c-7.3 7.6-11.4 17.8-11.3 28.4 0.1 10.6 4.3 20.7 11.8 28.2 7.5 7.5 17.6 11.7 28.1 11.8 10.6 0.1 20.7-4 28.3-11.3L558.9 543c7.5-7.5 11.8-17.8 11.8-28.5z"
81
+ p-id="3257"
82
+ ></path>
83
+ </svg>
84
+ </div>
85
+ </div>
86
+ </div>
87
+ </div>
88
+ </template>
89
+ <script setup lang="ts">
90
+ import { computed, reactive, toRefs } from 'vue';
91
+ import { idate } from '@fekit/utils';
92
+ // 创建日期
93
+ const cDate = (date: any = null) => {
94
+ const _date = new Date(date);
95
+ return date && _date instanceof Date && !isNaN(_date.getTime()) ? _date : new Date();
96
+ };
97
+ // 个位补零
98
+ const numfill = (num: string | number = '') => {
99
+ return Number(num) < 10 ? `0${num}` : num;
100
+ };
101
+ // 外部入参
102
+ const props = defineProps({
103
+ frame: { type: Boolean, default: false },
104
+ theme: { type: String, default: '@a' },
105
+ sz: { type: String, default: 'm' },
106
+ co: { type: String, default: '' },
107
+ block: { type: Boolean, default: true },
108
+ // 提示文案
109
+ tips: {
110
+ type: String,
111
+ default: ''
112
+ },
113
+ // 提示文案
114
+ placeholder: {
115
+ type: String,
116
+ default: ''
117
+ },
118
+ // 格式
119
+ format: {
120
+ type: String,
121
+ default: ''
122
+ },
123
+ // 值
124
+ value: {
125
+ type: [String, Number],
126
+ default: ''
127
+ },
128
+ // 值
129
+ modelValue: { type: [String, Number], default: '' },
130
+ // 节假日
131
+ holiday: {
132
+ type: Object,
133
+ default: () => ({})
134
+ },
135
+ // 校验规则
136
+ rules: {
137
+ type: Array,
138
+ default: () => []
139
+ },
140
+ // 是否是示校验图标
141
+ verify: {
142
+ type: Boolean,
143
+ default: false
144
+ }
145
+ });
146
+
147
+ // 内部数据
148
+ const state: any = reactive({
149
+ view: 1,
150
+ show: 0,
151
+ pos: 'bl',
152
+ selected: '',
153
+ date: props.value,
154
+ curr: computed(() => {
155
+ const date = cDate(state.date);
156
+ const calendar = [];
157
+ // 年
158
+ const y: any = date.getFullYear();
159
+ // 月
160
+ const m: any = date.getMonth() + 1;
161
+ // 日
162
+ const d: any = date.getDate();
163
+ // 本月第一天星期几
164
+ const w = new Date(`${y}-${m}-1`).getDay();
165
+ // 当前月份一共几天
166
+ const days = new Date(y, m, 0).getDate();
167
+
168
+ // 当前
169
+ const curr = new Date();
170
+ const curr_y = curr.getFullYear();
171
+ const curr_m = curr.getMonth() + 1;
172
+ const curr_d = curr.getDate();
173
+
174
+ // 上月
175
+ const last = new Date(y, m - 1, 0);
176
+ const last_y = last.getFullYear();
177
+ const last_m = last.getMonth() + 1;
178
+
179
+ // 下月
180
+ const next = new Date(y, m + 1, 0);
181
+ const next_y = next.getFullYear();
182
+ const next_m = next.getMonth() + 1;
183
+ let prevdays = last.getDate();
184
+
185
+ for (let i = 0; i < w; i++) {
186
+ calendar.unshift({
187
+ date: `${last_y}-${last_m}-${prevdays}`,
188
+ day: prevdays,
189
+ isLastMonth: 1
190
+ });
191
+ prevdays = prevdays - 1;
192
+ }
193
+ for (let i = 1; i <= days; i++) {
194
+ const _i = i;
195
+ calendar.push({
196
+ date: `${y}-${m}-${_i}`,
197
+ day: _i,
198
+ isToday: curr_y === y && curr_m === m && curr_d === i,
199
+ isHoliday: props.holiday[`${y}-${m}-${_i}`]?.name ? 1 : 0,
200
+ holiday: props.holiday[`${y}-${m}-${_i}`]?.name
201
+ });
202
+ }
203
+ for (let i = 1; calendar.length < 42; i++) {
204
+ const _i = i;
205
+ calendar.push({
206
+ date: `${next_y}-${next_m}-${_i}`,
207
+ day: _i,
208
+ isNextMonth: 1
209
+ });
210
+ }
211
+ return { days: calendar, y, m, d };
212
+ }),
213
+ value: computed(() => {
214
+ return props.format ? idate(state.selected || props.value).format(props.format) : state.selected || props.value;
215
+ })
216
+ });
217
+ const { curr = {} }: any = toRefs(state);
218
+
219
+ const upload = (a: any = 'm', b: any = 1) => {
220
+ const date = cDate(state.date);
221
+ if (a === 'm') {
222
+ date.setMonth(date.getMonth() + b);
223
+ } else {
224
+ date.setFullYear(date.getFullYear() + b);
225
+ }
226
+ return date.toISOString().substring(0, 10);
227
+ };
228
+
229
+ // 日期前翻
230
+ const prev = (type: any = 'm') => {
231
+ state.date = upload(type, -1);
232
+ };
233
+ // 日期后翻
234
+ const next = (type: any = 'm') => {
235
+ state.date = upload(type, 1);
236
+ };
237
+
238
+ // 向外通信
239
+ const emits = defineEmits(['change']);
240
+ const change = (item: any) => {
241
+ state.selected = item.date;
242
+ state.date = item.date;
243
+ emits('change', item.date);
244
+ };
245
+ </script>
@@ -0,0 +1 @@
1
+ <template><div></div></template>
@@ -0,0 +1 @@
1
+ <template><div></div></template>
@@ -0,0 +1 @@
1
+ <template><div></div></template>
@@ -0,0 +1 @@
1
+ <template><div></div></template>
@@ -0,0 +1 @@
1
+ <template><div></div></template>
@@ -0,0 +1,112 @@
1
+ <template>
2
+ <div>
3
+ <div :class="`mc-img b-solid b-case b-xs ${imgClass}`" :style="imgStyle">
4
+ <img :src="src[srcName]" :style="`object-fit: ${fit}`" @click.stop="showPreview" />
5
+ <div v-if="tools" class="mc-img-tools">
6
+ <slot name="tools">
7
+ <div class="mc-img-clean co-risk" @click="delImg"></div>
8
+ </slot>
9
+ </div>
10
+ </div>
11
+ <Layer :id="`PhotoViewer${layerId}${initialSlide}`" am="as">
12
+ <PhotoViewer :initialSlide="initialSlide" :files="files" :srcName="srcName" :id="`PhotoViewer${layerId}${initialSlide}`"></PhotoViewer>
13
+ </Layer>
14
+ </div>
15
+ </template>
16
+ <script setup lang="ts">
17
+ import { Layer, LayerById } from '../basic';
18
+ import PhotoViewer from './PhotoViewer.vue';
19
+
20
+ const props: any = defineProps({
21
+ tools: { type: Boolean, default: true },
22
+ srcName: { type: String, default: 'imgUrl' },
23
+ theme: { type: String, default: '@a' },
24
+ co: { type: String, default: 'note' },
25
+ imgClass: { type: String, default: '' },
26
+ imgStyle: { type: String, default: '' },
27
+ src: {
28
+ type: Object,
29
+ default: () => ({})
30
+ },
31
+ files: {
32
+ type: Array as () => any[],
33
+ default: () => []
34
+ },
35
+ // 图片如何适应容器框,同原生object-fit
36
+ fit: {
37
+ type: String,
38
+ default: 'contain'
39
+ },
40
+ // 是否开启图片预览放大
41
+ preview: {
42
+ type: Boolean,
43
+ default: true
44
+ },
45
+ initialSlide: {
46
+ type: Number,
47
+ default: 0
48
+ }
49
+ });
50
+
51
+ const emit = defineEmits(['delImg']);
52
+ const layerId = Math.random().toString(36).slice(-6);
53
+
54
+ //预览
55
+ const showPreview = () => {
56
+ if (!props.preview) return;
57
+ LayerById(`PhotoViewer${layerId}${props.initialSlide}`).show();
58
+ };
59
+ const delImg = () => {
60
+ emit('delImg', props.src);
61
+ };
62
+ </script>
63
+ <style lang="scss">
64
+ .mc-img {
65
+ height: 8em;
66
+ width: 8em;
67
+ padding: 0.5em;
68
+ border-radius: 0.25em;
69
+ position: relative;
70
+ overflow: hidden;
71
+ // @include theme {
72
+ // border: 1px solid co(case);
73
+ // }
74
+
75
+ img {
76
+ width: 100%;
77
+ height: 100%;
78
+ transform: translate3d(0, 0, 0);
79
+ border-radius: 0.15em;
80
+ }
81
+
82
+ &-tools {
83
+ position: absolute;
84
+ height: 1.5em;
85
+ opacity: 0;
86
+ right: 0;
87
+ top: 0;
88
+ text-align: center;
89
+ transition: all 0.5s;
90
+
91
+ & > * {
92
+ width: 1.5em;
93
+ height: 1.5em;
94
+ border-radius: 50%;
95
+ text-align: center;
96
+ }
97
+ }
98
+ &-clean {
99
+ display: inline-block;
100
+
101
+ background:
102
+ linear-gradient(45deg, transparent 40%, #fff 45%, #fff 55%, transparent 60%) no-repeat center/38% 38%,
103
+ linear-gradient(-45deg, transparent 40%, #fff 45%, #fff 55%, transparent 60%) no-repeat center/38% 38%,
104
+ radial-gradient(circle at 50% 50%, currentColor 53%, transparent 58%);
105
+ }
106
+ &:hover {
107
+ .mc-img-tools {
108
+ opacity: 1;
109
+ }
110
+ }
111
+ }
112
+ </style>
@@ -0,0 +1 @@
1
+ <template><div></div></template>