@neatui/nuxt 0.1.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 (102) hide show
  1. package/README.md +3 -0
  2. package/package.json +43 -0
  3. package/rollup.config.js +35 -0
  4. package/src/components/basic/IDraggable.vue +84 -0
  5. package/src/components/basic/IDraggable@b.vue +80 -0
  6. package/src/components/basic/IFollowView.vue +211 -0
  7. package/src/components/basic/IPickerView.vue +351 -0
  8. package/src/components/basic/IRouterView.vue +360 -0
  9. package/src/components/basic/IScrollView.vue +127 -0
  10. package/src/components/basic/Icon.vue +54 -0
  11. package/src/components/basic/LayerView/Layer.vue +339 -0
  12. package/src/components/basic/LayerView/index.ts +5 -0
  13. package/src/components/basic/index.ts +7 -0
  14. package/src/components/display/Avatar.vue +1 -0
  15. package/src/components/display/Badge.vue +1 -0
  16. package/src/components/display/Calendar.vue +245 -0
  17. package/src/components/display/CalendarReg.vue +245 -0
  18. package/src/components/display/Card.vue +1 -0
  19. package/src/components/display/Carousel.vue +1 -0
  20. package/src/components/display/ChartView.vue +123 -0
  21. package/src/components/display/Collapse.vue +1 -0
  22. package/src/components/display/Desriptions.vue +1 -0
  23. package/src/components/display/Empty.vue +1 -0
  24. package/src/components/display/Image.vue +112 -0
  25. package/src/components/display/List.vue +1 -0
  26. package/src/components/display/PhotoEditor.vue +181 -0
  27. package/src/components/display/PhotoViewer.vue +50 -0
  28. package/src/components/display/Popover.vue +1 -0
  29. package/src/components/display/QRCode.vue +1 -0
  30. package/src/components/display/Segmented.vue +1 -0
  31. package/src/components/display/Statistic.vue +1 -0
  32. package/src/components/display/Table.vue +1 -0
  33. package/src/components/display/Tabs.vue +1 -0
  34. package/src/components/display/Tag.vue +1 -0
  35. package/src/components/display/Timeline.vue +1 -0
  36. package/src/components/display/Tooltip.vue +1 -0
  37. package/src/components/display/Tour.vue +1 -0
  38. package/src/components/display/Tree.vue +431 -0
  39. package/src/components/display/TreeView.vue +225 -0
  40. package/src/components/display/index.ts +8 -0
  41. package/src/components/form/Cascader.vue +435 -0
  42. package/src/components/form/DatePicker.vue +124 -0
  43. package/src/components/form/DateRangePicker@v2.vue.backup +224 -0
  44. package/src/components/form/DateRangePicker@v3.vue +116 -0
  45. package/src/components/form/DateRangeView@v3.vue +386 -0
  46. package/src/components/form/DateView.vue +229 -0
  47. package/src/components/form/DateView@v2.vue +386 -0
  48. package/src/components/form/DateView@v3.vue +471 -0
  49. package/src/components/form/EditUpload.vue +4 -0
  50. package/src/components/form/ImgUpload.vue +174 -0
  51. package/src/components/form/Input.vue.backup +230 -0
  52. package/src/components/form/Input@v3.vue +267 -0
  53. package/src/components/form/InputNumber.vue +200 -0
  54. package/src/components/form/InputRange.vue +235 -0
  55. package/src/components/form/MoreSelect.vue.backup +144 -0
  56. package/src/components/form/MoreSelect@v3.vue +195 -0
  57. package/src/components/form/MoreSelectList.vue +125 -0
  58. package/src/components/form/MoreSelectPanel@v3.vue +190 -0
  59. package/src/components/form/MoreSelectPicker.vue +124 -0
  60. package/src/components/form/MoreSelectTags.vue +124 -0
  61. package/src/components/form/PageMoreSelect.vue +187 -0
  62. package/src/components/form/PageSelect.vue +189 -0
  63. package/src/components/form/SearchMoreSelect.vue +173 -0
  64. package/src/components/form/SearchSelect.vue.backup +194 -0
  65. package/src/components/form/SearchSelect@v3.vue +202 -0
  66. package/src/components/form/Select@v3.vue +201 -0
  67. package/src/components/form/SelectList.vue +58 -0
  68. package/src/components/form/SelectPicker.vue +97 -0
  69. package/src/components/form/SelectTags.vue +52 -0
  70. package/src/components/form/SelectTree/SelectTree@v1.vue +227 -0
  71. package/src/components/form/Switch.vue +135 -0
  72. package/src/components/form/TextArea.vue +193 -0
  73. package/src/components/form/TimePicker.vue +11 -0
  74. package/src/components/form/TimeView.vue +244 -0
  75. package/src/components/form/Upload.vue +346 -0
  76. package/src/components/form/index.ts +82 -0
  77. package/src/components/loader/FormLoader/FormLoader@v2.vue +422 -0
  78. package/src/components/loader/FormLoader/FormLoader@v3.vue.backup +318 -0
  79. package/src/components/loader/FormLoader/index.ts +2 -0
  80. package/src/components/loader/FormLoader@v1/FormLoader.vue +506 -0
  81. package/src/components/loader/FormLoader@v1/FormRender.vue +277 -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 +360 -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 +330 -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 +9 -0
  100. package/src/shims-vue.d.ts +5 -0
  101. package/src/store/myui.ts +50 -0
  102. package/tsconfig.json +24 -0
@@ -0,0 +1,127 @@
1
+ <template>
2
+ <div class="full fekit-ipull-scroll" ui-scroll=":y" ref="root">
3
+ <div>
4
+ <div class="fs-xs co-text o-mm" fekit-pullload-head="" v-if="pull">
5
+ <div v-show="demo.store.pull < 2" ui-flex="row cm">
6
+ <i class="pulldown icon icon-pulldown" :class="`${demo.store.pull === 1 ? 'toup' : ''}`"></i>
7
+ <span v-show="demo.store.pull === 0">下拉刷新</span>
8
+ <span v-show="demo.store.pull === 1">松开加载</span>
9
+ </div>
10
+ <div v-show="demo.store.pull === 2" ui-flex="row cm">
11
+ <span ui-load="@d"></span>
12
+ <!-- <span>正在刷新</span> -->
13
+ </div>
14
+ <div v-show="demo.store.pull === 3" ui-flex="row cm">
15
+ <span>刷新完成</span>
16
+ </div>
17
+ </div>
18
+ <slot></slot>
19
+ <div class="fs-xs co-text o-mm mb-sm" fekit-pullload-foot="" v-if="load">
20
+ <transition name="fekit-pullload-fade" mode="out-in">
21
+ <div v-if="demo.store.load === 2" ui-flex="row cm">
22
+ <span ui-load="@d"></span>
23
+ <!-- <span>正在加载</span> -->
24
+ </div>
25
+ <div v-else-if="demo.store.load === 3">没有更多了</div>
26
+ <div v-else>&nbsp;</div>
27
+ </transition>
28
+ </div>
29
+ </div>
30
+ </div>
31
+ </template>
32
+ <script setup lang="ts">
33
+ import { onMounted, onBeforeUnmount, ref } from 'vue';
34
+ import PullLoad, { Easing } from '@fekit/pullload';
35
+ const emits = defineEmits(['onpull', 'onload']);
36
+ const props: any = defineProps({
37
+ pull: {
38
+ type: Boolean,
39
+ default: false
40
+ },
41
+ load: {
42
+ type: Boolean,
43
+ default: false
44
+ }
45
+ });
46
+ const root: any = ref(null);
47
+ const demo: any = ref(null);
48
+ demo.value = new PullLoad({
49
+ easing: Easing.easeOut,
50
+ friction: 0.3,
51
+ triggerDistance: 60,
52
+ loadingDistance: 50,
53
+ ...(props.pull
54
+ ? {
55
+ onpull: async () => {
56
+ emits('onpull', demo.value);
57
+ }
58
+ }
59
+ : {}),
60
+ ...(props.pull
61
+ ? {
62
+ onload: async () => {
63
+ emits('onload', demo.value);
64
+ }
65
+ }
66
+ : {})
67
+ });
68
+
69
+ onMounted(() => {
70
+ if (root.value) {
71
+ demo.value?.listen(root.value);
72
+ if (props.pull) {
73
+ demo.value?.ispull();
74
+ }
75
+ }
76
+ });
77
+ onBeforeUnmount(() => {
78
+ demo.value?.remove();
79
+ });
80
+
81
+ const pullload = () => {
82
+ demo.value?.ispull();
83
+ };
84
+
85
+ defineExpose({ pullload, ex: () => demo.value });
86
+ </script>
87
+
88
+ <style lang="scss">
89
+ .fekit-ipull-scroll {
90
+ [fekit-pullload-head],
91
+ [fekit-pullload-foot] {
92
+ position: absolute;
93
+ width: 100%;
94
+ height: 2em;
95
+ left: 0;
96
+ display: flex;
97
+ justify-content: center;
98
+ align-items: center;
99
+ align-content: center;
100
+ }
101
+ [fekit-pullload-head] {
102
+ bottom: 100%;
103
+ margin-bottom: 1em;
104
+ }
105
+ [fekit-pullload-foot] {
106
+ position: relative;
107
+ top: 100%;
108
+ }
109
+
110
+ .fekit-pullload-fade-enter-active,
111
+ .fekit-pullload-fade-leave-active {
112
+ transition: opacity 0.2s;
113
+ }
114
+ .fekit-pullload-fade-enter,
115
+ .fekit-pullload-fade-leave-to {
116
+ opacity: 0;
117
+ }
118
+
119
+ .pulldown {
120
+ transition: all 0.3s;
121
+ display: inline-block;
122
+ &.toup {
123
+ transform: rotate(180deg);
124
+ }
125
+ }
126
+ }
127
+ </style>
@@ -0,0 +1,54 @@
1
+ <template>
2
+ <svg v-if="icons[name]" style="width: 1em; height: 1em" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
3
+ <path v-for="(d, i) in icons[name]?.path" :key="i" :d="d" />
4
+ </svg>
5
+ </template>
6
+ <script setup lang="ts">
7
+ const icons: any = {
8
+ 'arrow-left': {
9
+ path: [
10
+ 'M655.2 844c-12 0-24-4.8-32-13.6L336.8 544c-8.8-8.8-13.6-20-13.6-32s4.8-24 13.6-32l286.4-287.2c8.8-8 20-12.8 32-12.8s24 4.8 32 13.6c8.8 8.8 13.6 20 13.6 32s-4.8 23.2-12.8 32L432.8 512l254.4 254.4c8.8 8.8 13.6 20 13.6 32s-4.8 23.2-13.6 32c-8 8.8-20 13.6-32 13.6z'
11
+ ]
12
+ },
13
+ 'arrow-right': {
14
+ path: [
15
+ 'M368.8 844c-12 0-24-4.8-32-13.6-8.8-8.8-13.6-20-13.6-32s4.8-24 13.6-32L591.2 512 336.8 256.8c-8-8.8-12.8-20-12.8-32s4.8-23.2 13.6-32c8-8 20-13.6 32-13.6s23.2 4.8 32 12.8L688 479.2c8.8 8.8 13.6 20 13.6 32s-4.8 24-13.6 32l-286.4 286.4c-9.6 9.6-20.8 14.4-32.8 14.4z'
16
+ ]
17
+ },
18
+ 'double-arrow-left': {
19
+ path: [
20
+ 'M518.4 836.8c-11.2 0-22.4-4.8-31.2-12.8L205.6 541.6c-8.8-8.8-12.8-20-12.8-32s4.8-23.2 12.8-32l281.6-282.4c8.8-8.8 20-12.8 32-12.8s23.2 4.8 32 12.8c8.8 8.8 12.8 20 12.8 32s-4.8 23.2-12.8 32L300.8 509.6 551.2 760c8 8.8 12.8 20 12.8 32s-4.8 23.2-12.8 31.2-20 13.6-32.8 13.6z',
21
+ 'M786.4 840.8c-11.2 0-22.4-4.8-31.2-12.8L473.6 546.4c-8-8-12.8-20-12.8-32s4.8-23.2 12.8-32L755.2 200c8.8-8.8 20-12.8 32-12.8s23.2 4.8 32 12.8c8.8 8.8 12.8 20 12.8 32s-4.8 23.2-12.8 32L568 514.4l250.4 250.4c8 8.8 12.8 20 12.8 32s-4.8 23.2-12.8 31.2c-8.8 8-20 12.8-32 12.8z'
22
+ ]
23
+ },
24
+ 'double-arrow-right': {
25
+ path: [
26
+ 'M504.8 836.8c-12 0-23.2-4.8-31.2-12.8s-12.8-19.2-12.8-31.2 4-23.2 12.8-31.2l250.4-250.4-250.4-252c-8.8-8.8-12.8-20-12.8-32s4.8-23.2 12.8-32c8.8-8.8 20-12.8 32-12.8s23.2 4.8 32 12.8l281.6 282.4c8 8 12.8 20 12.8 32s-4.8 23.2-12.8 32L536.8 824c-8.8 8-20 12.8-32 12.8 0.8 0 0 0 0 0z',
27
+ 'M237.6 840.8c-12 0-23.2-4.8-31.2-12.8s-12.8-19.2-12.8-31.2 4-23.2 12.8-31.2L456 514.4 205.6 264c-8.8-8.8-12.8-20-12.8-32s4.8-23.2 12.8-32c8.8-8.8 20-12.8 32-12.8s23.2 4.8 32 12.8l281.6 282.4c8.8 8.8 12.8 20 12.8 32s-4.8 23.2-12.8 32l-281.6 282.4c-9.6 8-20 12-32 12z'
28
+ ]
29
+ },
30
+ more: {
31
+ path: [
32
+ 'M512 512m-116.363636 0a116.363636 116.363636 0 1 0 232.727272 0 116.363636 116.363636 0 1 0-232.727272 0Z',
33
+ 'M116.363636 512m-93.090909 0a93.090909 93.090909 0 1 0 186.181818 0 93.090909 93.090909 0 1 0-186.181818 0Z',
34
+ 'M907.636364 512m-93.090909 0a93.090909 93.090909 0 1 0 186.181818 0 93.090909 93.090909 0 1 0-186.181818 0Z'
35
+ ]
36
+ },
37
+ setting: {
38
+ path: [
39
+ 'M512 998.4c-22.4 0-44.8-3.2-67.2-6.4-35.2-6.4-67.2-32-76.8-64-16-54.4-64-89.6-121.6-89.6-9.6 0-19.2 0-28.8 3.2-6.4 0-12.8 3.2-19.2 3.2-28.8 0-54.4-12.8-73.6-35.2-25.6-35.2-51.2-73.6-67.2-115.2-12.8-35.2-6.4-73.6 19.2-99.2 44.8-48 44.8-121.6 0-172.8-25.6-25.6-32-64-19.2-99.2 19.2-38.4 41.6-76.8 70.4-112 19.2-22.4 44.8-35.2 73.6-35.2 6.4 0 12.8 0 19.2 3.2 9.6 3.2 19.2 3.2 28.8 3.2 54.4 0 102.4-35.2 118.4-89.6 9.6-35.2 41.6-60.8 76.8-64 22.4-3.2 44.8-3.2 67.2-3.2 22.4 0 44.8 0 67.2 3.2 35.2 6.4 67.2 32 76.8 64 9.6 32 28.8 57.6 57.6 70.4 19.2 9.6 41.6 16 64 16 9.6 0 19.2 0 28.8-3.2 6.4 0 12.8-3.2 19.2-3.2 28.8 0 54.4 12.8 73.6 35.2 25.6 35.2 48 76.8 67.2 118.4 12.8 32 6.4 73.6-19.2 99.2-44.8 48-44.8 121.6 0 172.8 25.6 25.6 32 64 19.2 99.2-16 41.6-38.4 80-67.2 115.2-19.2 22.4-44.8 35.2-73.6 35.2-6.4 0-12.8 0-19.2-3.2-9.6-3.2-19.2-3.2-28.8-3.2-54.4 0-102.4 35.2-118.4 89.6-9.6 35.2-41.6 60.8-76.8 64-25.6 3.2-48 3.2-70.4 3.2z m-265.6-236.8c89.6 0 169.6 57.6 198.4 144 3.2 6.4 6.4 9.6 12.8 9.6 19.2 3.2 35.2 3.2 54.4 3.2 12.8 0 25.6 0 38.4-3.2h22.4c6.4-3.2 9.6-6.4 9.6-9.6 16-51.2 48-92.8 92.8-115.2 32-19.2 67.2-25.6 102.4-25.6 16 0 32 3.2 44.8 6.4h3.2c3.2 0 9.6-3.2 12.8-3.2 22.4-28.8 41.6-60.8 57.6-96 3.2-6.4 0-12.8-3.2-16-70.4-80-70.4-198.4 0-275.2 3.2-6.4 3.2-12.8 3.2-19.2-12.8-35.2-32-67.2-57.6-96-6.4-6.4-9.6-9.6-12.8-9.6h-3.2c-16 3.2-28.8 6.4-44.8 6.4-35.2 0-70.4-9.6-102.4-25.6-44.8-25.6-76.8-67.2-92.8-115.2 0-6.4-6.4-9.6-9.6-9.6-19.2-3.2-38.4-3.2-57.6-3.2s-38.4 0-57.6 3.2c-6.4 3.2-9.6 6.4-9.6 9.6-16 51.2-48 92.8-92.8 115.2-32 19.2-67.2 25.6-102.4 25.6-16 0-32-3.2-44.8-6.4h-3.2c-9.6 3.2-12.8 3.2-16 6.4-22.4 28.8-41.6 60.8-57.6 96-3.2 6.4 0 12.8 3.2 16 70.4 80 70.4 198.4 0 275.2-3.2 3.2-3.2 9.6-3.2 16 12.8 35.2 32 67.2 54.4 96 3.2 3.2 9.6 6.4 16 6.4 12.8-3.2 28.8-6.4 44.8-6.4z m256-67.2c-48 0-92.8-19.2-128-54.4S320 560 320 512c0-99.2 83.2-182.4 182.4-182.4 102.4 0 182.4 83.2 182.4 182.4 0 102.4-80 182.4-182.4 182.4z m0-284.8c-57.6 0-102.4 48-102.4 105.6 0 57.6 48 105.6 105.6 105.6 57.6 0 105.6-48 102.4-105.6 0-60.8-48-105.6-105.6-105.6v-3.2 3.2z'
40
+ ]
41
+ },
42
+ 'tableloader-setting': {
43
+ path: [
44
+ 'M372 981.6c-80 0-154.4-43.2-195.2-112L35.2 624.8c-40-68.8-40-155.2 0-224.8l141.6-244.8c40-69.6 115.2-112 195.2-112h282.4c80 0 154.4 43.2 195.2 112L991.2 400c40 68.8 40 155.2 0 224.8l-141.6 244.8c-40 69.6-115.2 112-195.2 112H372z m0-825.6c-39.2 0-76.8 21.6-96.8 56L134.4 456c-20 34.4-20 76.8 0 112l140.8 244.8c20 34.4 56.8 55.2 96.8 55.2h282.4c39.2 0 76.8-21.6 96.8-56l140.8-244.8c20-34.4 20-76.8 0-112L751.2 211.2c-20-34.4-56.8-55.2-96.8-55.2H372z m140.8 552.8c-108.8 0-196.8-88-196.8-196.8 0-108.8 88-196.8 196.8-196.8 108.8 0 196.8 88 196.8 196.8 0.8 108.8-88 196.8-196.8 196.8z m0-280c-45.6 0-83.2 37.6-83.2 83.2s37.6 83.2 83.2 83.2c22.4 0 43.2-8.8 59.2-24 16-16 24-36.8 24-59.2 0-45.6-37.6-83.2-83.2-83.2z'
45
+ ]
46
+ }
47
+ };
48
+ const props: any = defineProps({
49
+ name: {
50
+ type: String,
51
+ default: ''
52
+ }
53
+ });
54
+ </script>
@@ -0,0 +1,339 @@
1
+ <!-- 实验性插件 -->
2
+ <template>
3
+ <Teleport :to="area">
4
+ <div
5
+ v-if="state.view"
6
+ :am-view="am"
7
+ :data-key="id"
8
+ :style="`${`${dark}` ? 'background-color: rgba(0, 0, 0, ' + dark + ');' : ''}${zIndex ? 'z-index:' + zIndex + ';' : ''}`"
9
+ :view="state.view"
10
+ class="fekit-layer"
11
+ >
12
+ <div :ui-flex="`col ${flex}`" :style="wrapStyle" class="fekit-layer-wrap" @animationend="anim" @click="_sys_hide">
13
+ <slot></slot>
14
+ </div>
15
+ </div>
16
+ </Teleport>
17
+ </template>
18
+ <script lang="ts" setup>
19
+ import { onBeforeUnmount, PropType, reactive, ref, watch } from 'vue';
20
+ import { isFunction } from '@fekit/utils';
21
+
22
+ // 弹层队列
23
+ if (!(window as any)._FEKIT_LAYER_TASKS) {
24
+ (window as any)._FEKIT_LAYER_TASKS = {};
25
+ }
26
+ const _tasks: any = (window as any)._FEKIT_LAYER_TASKS;
27
+
28
+ // 弹窗入参
29
+ const props: any = defineProps({
30
+ zIndex: {
31
+ type: [String, Number],
32
+ default: ''
33
+ },
34
+ area: {
35
+ type: String,
36
+ default: '#fekit'
37
+ },
38
+ id: {
39
+ type: String
40
+ },
41
+ am: {
42
+ type: String as PropType<'aa' | 'ab' | 'ac' | 'ad' | 'ae' | 'af' | 'ag' | 'ah' | 'ai' | 'aj' | 'ak' | 'al' | 'am' | 'an' | 'ao' | 'ap' | 'aq' | 'ar' | 'as' | 'at'>,
43
+ default: 'as'
44
+ },
45
+ flex: {
46
+ type: String as PropType<'lt' | 'ct' | 'rt' | 'lm' | 'cm' | 'rm' | 'lb' | 'cb' | 'rb'>,
47
+ default: 'cm'
48
+ },
49
+ dark: {
50
+ type: [String, Number],
51
+ default: ''
52
+ },
53
+ darkClickClose: {
54
+ type: Boolean,
55
+ default: true
56
+ },
57
+ wrapStyle: {
58
+ type: String,
59
+ default: ''
60
+ }
61
+ });
62
+
63
+ const _area: any = document.querySelector(props.area);
64
+ if (!_area) {
65
+ const el = document.createElement('div');
66
+ el.id = (props.area || '#fekit').substring(1);
67
+ el.style.position = 'absolute';
68
+ document.body.appendChild(el);
69
+ }
70
+
71
+ // 状态管理
72
+ const state = reactive({
73
+ view: 0,
74
+ params: {},
75
+ top: 0
76
+ });
77
+
78
+ function disableScroll() {
79
+ state.top = document.documentElement.scrollTop;
80
+ document.body.style.overflow = 'hidden';
81
+ document.body.style.position = 'fixed';
82
+ document.body.style.top = `-${state.top}px`;
83
+ document.body.style.width = '100%';
84
+ }
85
+
86
+ function enableScroll() {
87
+ document.body.style.removeProperty('overflow');
88
+ document.body.style.removeProperty('position');
89
+ document.body.style.removeProperty('top');
90
+ document.body.style.removeProperty('width');
91
+ window.scrollTo(0, state.top);
92
+ }
93
+
94
+ watch(
95
+ () => state.view,
96
+ (view: any) => {
97
+ if (view === 2) {
98
+ disableScroll();
99
+ }
100
+ if (view === 0) {
101
+ enableScroll();
102
+ }
103
+ },
104
+ { deep: true, immediate: true }
105
+ );
106
+
107
+ // 回调合集
108
+ const on: any = {
109
+ show: [],
110
+ hide: [],
111
+ open: [],
112
+ none: []
113
+ };
114
+
115
+ // 注入参数
116
+ const init = (params: any = {}) => {
117
+ _tasks[id].params = params;
118
+ if (params?.on?.show) {
119
+ on.show.push(params.on.show);
120
+ }
121
+ if (params?.on?.hide) {
122
+ on.hide.push(params.on.hide);
123
+ }
124
+ return _tasks[id];
125
+ };
126
+
127
+ // 显示弹层
128
+ const show = (params: any = {}, then = () => {}) => {
129
+ state.view = 2;
130
+ if (params?.on?.show) {
131
+ on.show.push(params.on.show);
132
+ }
133
+ if (params?.on?.hide) {
134
+ on.hide.push(params.on.hide);
135
+ }
136
+ on.show.push(then);
137
+ };
138
+
139
+ // 隐藏弹层
140
+ const hide = (_params: any = {}, then = () => {}) => {
141
+ if (state.view === 3) {
142
+ state.view = 1;
143
+ on.hide.push(then);
144
+ }
145
+ };
146
+
147
+ // 打开弹层(没有动画过程)
148
+ const open = (_params: any = {}, then = () => {}) => {
149
+ state.view = 3;
150
+ on.show.push(then);
151
+ };
152
+ // 关闭弹层(没有动画过程)
153
+ const none = (_params: any = {}, then = () => {}) => {
154
+ state.view = 0;
155
+ on.show.push(then);
156
+ };
157
+
158
+ // 点暗层关闭
159
+ const _sys_hide = (ev: any) => {
160
+ if (props.darkClickClose && ev.target.className === 'fekit-layer-wrap' && state.view === 3) {
161
+ state.view = 1;
162
+ }
163
+ };
164
+
165
+ // 监听动画
166
+ const anim = () => {
167
+ if (state.view === 1) {
168
+ state.view = 0;
169
+ on.hide.forEach((fun: any) => {
170
+ // isFunction(fun) && fun();
171
+ if (isFunction(fun)) {
172
+ fun();
173
+ }
174
+ });
175
+ }
176
+ if (state.view === 2) {
177
+ state.view = 3;
178
+ on.show.forEach((fun: any) => {
179
+ // isFunction(fun) && fun();
180
+ if (isFunction(fun)) {
181
+ fun();
182
+ }
183
+ });
184
+ }
185
+ };
186
+
187
+ // 注册弹层
188
+ const { id = '' }: any = { ...props };
189
+ if (_tasks[id]) {
190
+ console.error('Layer 有重复 id', id);
191
+ }
192
+ if (id) {
193
+ _tasks[id] = { init, show, hide, open, none };
194
+ } else {
195
+ console.error('Layer 必须填写全局统一的 id');
196
+ }
197
+
198
+ // 卸载弹层
199
+ onBeforeUnmount(() => {
200
+ delete _tasks[id];
201
+ });
202
+ </script>
203
+ <!-- <script lang="ts">
204
+ export const LayerById = (id: any) => {
205
+ return (window as any)._FEKIT_LAYER_TASKS[id];
206
+ };
207
+ </script> -->
208
+
209
+ <style lang="scss">
210
+ // 弹层
211
+ .fekit-layer {
212
+ position: fixed;
213
+ width: 100%;
214
+ height: 100%;
215
+ left: 0;
216
+ top: 0;
217
+ z-index: 50;
218
+ background-color: rgba(0, 0, 0, 0.75);
219
+ pointer-events: none;
220
+
221
+ &-wrap {
222
+ position: relative;
223
+ width: 100%;
224
+ height: 100%;
225
+ pointer-events: auto;
226
+
227
+ & > * {
228
+ position: relative !important;
229
+
230
+ &.com-dialog {
231
+ max-width: 80%;
232
+ }
233
+ }
234
+ }
235
+
236
+ &-close {
237
+ position: absolute;
238
+ width: 1.5em;
239
+ height: 1.5em;
240
+ left: 50%;
241
+ bottom: -2.5rem;
242
+ margin-left: -1rem;
243
+ padding: 0.25em;
244
+ text-align: center;
245
+ transform: scale(1) translate3d(0, -100%, 0);
246
+ transition: all 0.2s;
247
+ color: #fff;
248
+ box-shadow: 0 0 0 2px currentColor;
249
+ border-radius: 50%;
250
+ opacity: 0;
251
+ background:
252
+ linear-gradient(45deg, transparent 44%, currentColor 45%, currentColor 56%, transparent 57%) no-repeat center / 50% 50%,
253
+ linear-gradient(-45deg, transparent 44%, currentColor 45%, currentColor 56%, transparent 57%) no-repeat center / 50% 50%;
254
+
255
+ &:active {
256
+ transform: scale(0.9);
257
+ }
258
+ }
259
+
260
+ &[view='3'] {
261
+ .fekit-layer-close {
262
+ opacity: 0.85;
263
+ transform: translate3d(0, 0, 0);
264
+ }
265
+ }
266
+
267
+ // &-close {
268
+ // position: absolute;
269
+ // width: 2rem;
270
+ // height: 2rem;
271
+ // line-height: 2rem;
272
+ // right: 0.5rem;
273
+ // top: 0.5rem;
274
+ // text-align: center;
275
+ // transform: rotate(0deg);
276
+ // transition: all 0.2s;
277
+
278
+ // &:hover {
279
+ // transform: rotate(-90deg);
280
+ // }
281
+ // }
282
+
283
+ // &-close {
284
+ // position: absolute;
285
+ // width: 18px;
286
+ // height: 18px;
287
+ // right: 0.5em;
288
+ // top: 0.5em;
289
+ // padding: 0.25em;
290
+ // text-align: center;
291
+ // transition: all 0.2s;
292
+ // // box-shadow: 0 0 0 1px currentColor;
293
+ // border-radius: 50%;
294
+ // background: linear-gradient(45deg, transparent 44%, currentColor 46%, currentColor 54%, transparent 56%) no-repeat center / 50% 50%,
295
+ // linear-gradient(-45deg, transparent 44%, currentColor 46%, currentColor 54%, transparent 56%) no-repeat center / 50% 50%;
296
+ // transform: scale(1) rotate(0deg);
297
+ // opacity: 0.8;
298
+ // transition: all 0.25s;
299
+
300
+ // &:hover {
301
+ // transform: scale(1) rotate(-90deg);
302
+ // }
303
+
304
+ // &:active {
305
+ // transform: scale(0.8) rotate(-90deg);
306
+ // }
307
+
308
+ // &::before {
309
+ // position: absolute;
310
+ // content: '';
311
+ // width: 200%;
312
+ // height: 200%;
313
+ // left: -50%;
314
+ // top: -50%;
315
+ // }
316
+ // }
317
+ }
318
+
319
+ // html {
320
+ // &[size='xs'] {
321
+ // .fekit-layer-close {
322
+ // width: 16px;
323
+ // height: 16px;
324
+ // }
325
+ // }
326
+ // &[size='l'] {
327
+ // .fekit-layer-close {
328
+ // width: 20px;
329
+ // height: 20px;
330
+ // }
331
+ // }
332
+ // &[size='xl'] {
333
+ // .fekit-layer-close {
334
+ // width: 22px;
335
+ // height: 22px;
336
+ // }
337
+ // }
338
+ // }
339
+ </style>
@@ -0,0 +1,5 @@
1
+ import Layer from './Layer.vue';
2
+ const LayerById = (id: any) => {
3
+ return (window as any)._FEKIT_LAYER_TASKS[id];
4
+ };
5
+ export { Layer, LayerById };
@@ -0,0 +1,7 @@
1
+ import { Layer, LayerById } from './LayerView';
2
+ import Icon from './Icon.vue';
3
+ import IFollowView from './IFollowView.vue';
4
+ import IPickerView from './IPickerView.vue';
5
+ import IScrollView from './IScrollView.vue';
6
+ import IRouterView from './IRouterView.vue';
7
+ export { Icon, IRouterView, IFollowView, IPickerView, IScrollView, Layer, LayerById };
@@ -0,0 +1 @@
1
+ <template><div></div></template>
@@ -0,0 +1 @@
1
+ <template><div></div></template>