@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,386 @@
1
+ <template>
2
+ <div ui-date="@a" class="fekit-date-view pr" :class="`${frame ? 'b-solid b-line b-xs r-sm' : ''}`" ui-flex="col xy" style="width: 22em">
3
+ <div ui-date-head="" class="flex-fixed nx-sl mt-ss ny-sm b-solid b-back" ui-flex="row xm">
4
+ <div ui-flex="row lm" class="o-lm">
5
+ <div ui-btn="@a s none :square" @click="prev('y')">
6
+ <Icon name="double-arrow-left" />
7
+ </div>
8
+ <div ui-btn="@a s none :square" @click="prev('m')">
9
+ <Icon name="arrow-left" />
10
+ </div>
11
+ </div>
12
+ <div ui-flex="row cm" class="nx-ss-sub">
13
+ <div ui-flex="row cm" class="nx-ss-sub">
14
+ <p class="nowrap" ui-flex="row cm" ui-btns="@a none xs">
15
+ <b class="nx-ss" @click="setPanelType('year')">{{ state.curr.y }}年</b>
16
+ <b class="nx-ss" @click="setPanelType('month')">{{ state.curr.M }}月</b>
17
+ <!-- <b class="nx-ss" @click="setPanelType('time')">时间</b> -->
18
+ </p>
19
+ </div>
20
+ </div>
21
+ <div ui-flex="row rm" class="o-lm">
22
+ <div ui-btn="@a s none :square" @click="next('m')">
23
+ <Icon name="arrow-right" />
24
+ </div>
25
+ <div ui-btn="@a s none :square" @click="next('y')">
26
+ <Icon name="double-arrow-right" />
27
+ </div>
28
+ </div>
29
+ </div>
30
+ <div ui-date-body="" class="flex-block pr">
31
+ <div class="full">
32
+ <ul ui-flex="row am" class="fs-xs nx-sm nt-sm">
33
+ <li class="flex-block ac"><span>日</span></li>
34
+ <li class="flex-block ac"><span>一</span></li>
35
+ <li class="flex-block ac"><span>二</span></li>
36
+ <li class="flex-block ac"><span>三</span></li>
37
+ <li class="flex-block ac"><span>四</span></li>
38
+ <li class="flex-block ac"><span>五</span></li>
39
+ <li class="flex-block ac"><span>六</span></li>
40
+ </ul>
41
+ <ul ui-date-days="" ui-flex="col xm" class="flex-wrap nx-sm">
42
+ <li v-for="(week, idx) in state.curr.days" :key="idx" :ui-date-week="idx + 1" class="flex-block" ui-flex="row am" style="margin-bottom: -0.25em">
43
+ <div v-for="(item, i) in week" :key="i" class="pr flex-block nb-sm" ui-flex="col xy">
44
+ <div
45
+ v-if="item.day"
46
+ :ui-date-day="item.day"
47
+ class="flex-block"
48
+ :class="`${item.range ? 'bg-main+o-xs' : ''} ${item.sta ? 'r-lt-sl r-lb-sl' : ''} ${item.end ? 'r-rt-sl r-rb-sl' : ''}`"
49
+ ui-flex="col cm"
50
+ @click="change(item)"
51
+ @mouseenter="setRangeValue(item)"
52
+ >
53
+ <div
54
+ ui-flex="col cm"
55
+ class="r-sm b-solid bk-none b-xs my-ss ux-scale"
56
+ style="width: 1.8em; height: 1.8em"
57
+ :class="`${item.isLastMonth || item.isNextMonth ? 'co-idle' : item.isHoliday ? 'co-risk' : ''} ${
58
+ item.selected ? 'active bg-main+o-lm co-fore' : 'hover-bg-weak'
59
+ }`"
60
+ >
61
+ <span>{{ item.day }}</span>
62
+ </div>
63
+ </div>
64
+ <div class="pa full-x lh-xs ny-ss ob-no ol-no nowrap s-ml bold" style="transform-origin: 50% 100%" ui-flex="row ct" v-html="extras(item)"></div>
65
+ </div>
66
+ </li>
67
+ </ul>
68
+ </div>
69
+ </div>
70
+ <div v-if="!state.isNoTime" class="ny-sm nx-ms">
71
+ <div class="full ac b-solid b-back b-xs r-sm" ui-row="mob-8" style="width: 100%; height: 3em; padding: 0.5em">
72
+ <ul
73
+ :style="`${state.panel ? '' : 'pointer-events: none; opacity:.35'}`"
74
+ class="fekit-date-view-time-scroll"
75
+ ref="ths"
76
+ ui-scroll=":y xs"
77
+ ui-btns="@a none s :block"
78
+ data-type="h"
79
+ @scroll="timeScroll"
80
+ >
81
+ <li v-for="(item, idx) in hours" :key="idx">
82
+ {{ item }}
83
+ </li>
84
+ </ul>
85
+ <ul
86
+ :style="`${state.panel ? '' : 'pointer-events: none; opacity:.35'}`"
87
+ class="fekit-date-view-time-scroll"
88
+ ref="tms"
89
+ ui-scroll=":y xs"
90
+ ui-btns="@a none s :block"
91
+ data-type="m"
92
+ @scroll="timeScroll"
93
+ >
94
+ <li v-for="(item, idx) in seconds" :key="idx">
95
+ {{ item }}
96
+ </li>
97
+ </ul>
98
+ <ul
99
+ :style="`${state.panel ? '' : 'pointer-events: none; opacity:.35'}`"
100
+ class="fekit-date-view-time-scroll"
101
+ ref="tss"
102
+ ui-scroll=":y xs"
103
+ ui-btns="@a none s :block"
104
+ data-type="s"
105
+ @scroll="timeScroll"
106
+ >
107
+ <li v-for="(item, idx) in seconds" :key="idx">
108
+ {{ item }}
109
+ </li>
110
+ </ul>
111
+ </div>
112
+ </div>
113
+
114
+ <div v-if="tools" ui-date-foot="" ui-flex="row xm" class="flex-fixed nx-sl ny-sl b-solid bk-line+o-mm bt-xs">
115
+ <div ui-flex="row lm" class="nl-ss">
116
+ <div v-if="state.panel" ui-flex="row lm">
117
+ <span :anim-editing="state.type === 'date'" ui-btn="@a xs none" class="nx-ss" @click="setPanelType('date')">{{ idate(state.panel).format('YYYY-MM-DD') }}</span>
118
+ <span v-if="!state.isNoTime" :anim-editing="state.type === 'time'" ui-btn="@a xs none" class="nx-ss" @click="setPanelType('time')">
119
+ {{ idate(state.panel).format('HH:mm:ss') }}
120
+ </span>
121
+ </div>
122
+ <div v-else-if="state.shortcuts?.length" ui-flex="row lm">
123
+ <div class="mr-sm-sub nx-sl-sub ny-ss-sub lh-ss nowrap fs-ss dib-sub" ui-scroll=":x y:hidden">
124
+ <p v-for="(item, idx) in state.shortcuts" :key="idx" class="bg-main+o-xs co-main r-xl" ui-btn="@a xs none :round" @click="item?.func">{{ item?.text }}</p>
125
+ <p class="bg-main+o-xs co-main r-xl" ui-btn="@a xs none :round"><Icon class="co-main" name="more" /></p>
126
+ </div>
127
+ </div>
128
+ <div>&nbsp;</div>
129
+ </div>
130
+ <div class="ml-ss-sub" ui-flex="row rm">
131
+ <button v-if="state.panel" ui-btn="@a xs none" class="nx-ss co-risk" @click="remove">清除</button>
132
+ <button v-if="state.panel && !state.isNoTime" ui-btn="@a xs none" class="nx-ss co-main" @click="update">确定</button>
133
+ </div>
134
+ </div>
135
+ </div>
136
+ </template>
137
+ <script setup lang="ts">
138
+ import { computed, ref, reactive, watch, onMounted } from 'vue';
139
+ import { idate, isDateString, isObject, isString } from '@fekit/utils';
140
+ import { Icon } from '../basic';
141
+
142
+ // 创建日期
143
+ const cDate = (date: any = null) => {
144
+ return isDateString(date) ? new Date(date) : new Date();
145
+ };
146
+
147
+ // 快捷预设
148
+ const shortcutsList: any = {
149
+ yesterday: {
150
+ text: '昨天',
151
+ func() {
152
+ change({ date: idate(new Date().setDate(new Date().getDate() - 1)).format('YYYY-MM-DD') });
153
+ }
154
+ },
155
+ today: {
156
+ text: '今天',
157
+ func() {
158
+ change({ date: idate(new Date()).format('YYYY-MM-DD') });
159
+ }
160
+ },
161
+ tomorrow: {
162
+ text: '明天',
163
+ func() {
164
+ change({ date: idate(new Date().setDate(new Date().getDate() + 1)).format('YYYY-MM-DD') });
165
+ }
166
+ }
167
+ };
168
+
169
+ const emits: any = defineEmits(['update:modelValue', 'change', 'update']);
170
+ interface TimeProps {
171
+ h: boolean | number;
172
+ m?: boolean | number;
173
+ s?: boolean | number;
174
+ }
175
+ interface Props {
176
+ modelValue?: string | number;
177
+ frame: boolean;
178
+ tools?: boolean;
179
+ range?: boolean;
180
+ format?: string;
181
+ picker?: 'date' | 'week' | 'month' | 'quarter';
182
+ holiday?: object;
183
+ shortcuts?: Array<'yesterday' | 'today' | 'tomorrow'>;
184
+ extras?: (item: any) => string;
185
+ time?: boolean | TimeProps;
186
+ }
187
+ const props: any = withDefaults(defineProps<Props>(), {
188
+ // 值
189
+ modelValue: '',
190
+ // 是否显示框架
191
+ frame: false,
192
+ // 是否是示工具
193
+ tools: true,
194
+ // 时间范围
195
+ range: false,
196
+ // 面板类型
197
+ picker: 'date',
198
+ // 额外内容
199
+ extras: (item: any) => {
200
+ return `<i class="dib o-ms mb-xs r-xl ${item.today ? 'bg-main' : 'bg-none'}" style="width:.6em; height:.6em;"></i>`;
201
+ },
202
+ // 快捷选择
203
+ shortcuts: () => ['yesterday', 'today', 'tomorrow'],
204
+ // 数据格式化
205
+ format: 'YYYY-MM-DD',
206
+ // 节假日
207
+ holiday: () => ({}),
208
+ time: false
209
+ });
210
+
211
+ // 小时
212
+ const hours = computed(() => {
213
+ const _hours: any = [];
214
+ for (let i = 0; i < 24; i++) {
215
+ _hours.push(i > 9 ? `${i}` : `0${i}`);
216
+ }
217
+ return _hours;
218
+ });
219
+ // 分秒
220
+ const seconds = computed(() => {
221
+ const _seconds: any = [];
222
+ for (let i = 0; i < 60; i++) {
223
+ _seconds.push(i > 9 ? `${i}` : `0${i}`);
224
+ }
225
+ return _seconds;
226
+ });
227
+
228
+ // 内部数据
229
+ const state: any = reactive({
230
+ // 面板显示时间
231
+ panel: '',
232
+ // 当前时间计算
233
+ curr: computed(() => {
234
+ const date = idate(state.panel);
235
+ const days = date.calendar({ group: true, value: [state.panel] });
236
+ return { days, ...date.attr };
237
+ }),
238
+ type: 'date',
239
+ // 值
240
+ value: '',
241
+ // 快捷选择
242
+ shortcuts: computed(() => {
243
+ return props.shortcuts.map((item: any) => {
244
+ return isString(item) ? shortcutsList[item] : item;
245
+ });
246
+ }),
247
+ isNoTime: computed(() => {
248
+ if (isObject(props.time)) {
249
+ return !(props.time.h || props.time.m || props.time.s);
250
+ } else {
251
+ return !props.time;
252
+ }
253
+ })
254
+ });
255
+
256
+ const ths: any = ref(null);
257
+ const tms: any = ref(null);
258
+ const tss: any = ref(null);
259
+ const setTimeValue = () => {
260
+ const { H = 0, m = 0, s = 0 }: any = state.curr || {};
261
+ if (state.panel) {
262
+ if (ths.value && ths.value.children[H]) {
263
+ ths.value.scrollTop = ths.value.children[H].offsetTop;
264
+ }
265
+ if (tms.value && tms.value.children[m]) {
266
+ tms.value.scrollTop = tms.value.children[m].offsetTop;
267
+ }
268
+ if (tss.value && tss.value.children[s]) {
269
+ tss.value.scrollTop = tss.value.children[s].offsetTop;
270
+ }
271
+ } else {
272
+ if (ths.value && ths.value.children[H]) {
273
+ ths.value.scrollTop = ths.value.children[0].offsetTop;
274
+ }
275
+ if (tms.value && tms.value.children[m]) {
276
+ tms.value.scrollTop = tms.value.children[0].offsetTop;
277
+ }
278
+ if (tss.value && tss.value.children[s]) {
279
+ tss.value.scrollTop = tss.value.children[0].offsetTop;
280
+ }
281
+ }
282
+ };
283
+
284
+ watch(
285
+ () => props.modelValue,
286
+ (value: any) => {
287
+ // 面板显示日期
288
+ state.panel = value || '';
289
+ // 值
290
+ state.value = value || '';
291
+ },
292
+ { deep: true, immediate: true }
293
+ );
294
+
295
+ onMounted(() => {
296
+ setTimeValue();
297
+ });
298
+ watch(
299
+ () => state.panel,
300
+ () => {
301
+ setTimeValue();
302
+ }
303
+ );
304
+
305
+ // 更新时间
306
+ const upload = (a: any = 'm', b: any = 1) => {
307
+ const date = cDate(state.panel);
308
+ if (a === 'm') {
309
+ date.setMonth(date.getMonth() + b);
310
+ } else {
311
+ date.setFullYear(date.getFullYear() + b);
312
+ }
313
+ return idate(date).format(props.format);
314
+ };
315
+
316
+ // 日期前翻
317
+ const prev = (type: any = 'm') => {
318
+ state.panel = upload(type, -1);
319
+ };
320
+ // 日期后翻
321
+ const next = (type: any = 'm') => {
322
+ state.panel = upload(type, 1);
323
+ };
324
+
325
+ // 向外通信
326
+ const change = (item: any) => {
327
+ state.panel = item ? idate(item.date).format(props.format) : item;
328
+ emits('change', state.value);
329
+ if (state.isNoTime) {
330
+ update();
331
+ }
332
+ };
333
+
334
+ // 清空日期
335
+ const remove = () => {
336
+ state.panel = '';
337
+ update();
338
+ };
339
+
340
+ // 更新数据
341
+ const update = () => {
342
+ emits('update:modelValue', state.panel ? idate(state.panel).format(props.format) : '');
343
+ emits('update', state.panel ? idate(state.panel).format(props.format) : '');
344
+ };
345
+
346
+ // 设置范围
347
+ const setRangeValue = (item: any) => {};
348
+ // 设置面板类型
349
+ const setPanelType = (type: any) => {
350
+ state.type = type;
351
+ };
352
+
353
+ // 时间滚动
354
+ const _timer: any = ref(null);
355
+ const timeScroll = (ev: any) => {
356
+ const item: any = ev.target?.children[0];
357
+ const type: any = ev.target.getAttribute('data-type') || '';
358
+ if (state.panel && item) {
359
+ clearTimeout(_timer.value);
360
+ _timer.value = setTimeout(() => {
361
+ const h = item.offsetHeight;
362
+ const index = Math.floor(ev.target.scrollTop / h);
363
+ const { YYYY = 0, MM = 0, DD = 0, HH = '', mm = '', ss = '' }: any = state.curr || {};
364
+ if (type === 'h') {
365
+ state.panel = idate(`${YYYY}-${MM}-${DD} ${index}:${mm}:${ss}`).format('YYYY-MM-DD HH:mm:ss');
366
+ }
367
+ if (type === 'm') {
368
+ state.panel = idate(`${YYYY}-${MM}-${DD} ${HH}:${index}:${ss}`).format('YYYY-MM-DD HH:mm:ss');
369
+ }
370
+ if (type === 's') {
371
+ state.panel = idate(`${YYYY}-${MM}-${DD} ${HH}:${mm}:${index}`).format('YYYY-MM-DD HH:mm:ss');
372
+ }
373
+ }, 100);
374
+ }
375
+ };
376
+ </script>
377
+ <style lang="scss">
378
+ .fekit-date-view-time-scroll {
379
+ position: relative;
380
+ height: 100%;
381
+ scroll-snap-type: y mandatory;
382
+ & > * {
383
+ scroll-snap-align: center;
384
+ }
385
+ }
386
+ </style>