@wp1001/ui 2.9.13 → 3.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.
- package/@vant-D4fmGxs6.js +1 -3891
- package/index.html +28 -0
- package/index.js +1 -8419
- package/lib/tinymce/zh_CN.js +1 -0
- package/package.json +1 -1
- package/packages/assets/devtools-detector.js +1 -2
- package/packages/components/xarray/index.js +1 -64
- package/packages/components/xautorows/index.js +1 -35
- package/packages/components/xbutton/mobile.js +1 -3
- package/packages/components/xbutton/pc.js +1 -3
- package/packages/components/xbuttons/mobile.js +1 -51
- package/packages/components/xbuttons/pc.js +1 -51
- package/packages/components/xchart/constants.js +1 -58
- package/packages/components/xchart/index.js +1 -263
- package/packages/components/xchart/utils.js +1 -121
- package/packages/components/xcheckboxs/mobile.js +1 -58
- package/packages/components/xcheckboxs/pc.js +1 -49
- package/packages/components/xcol/mobile.js +1 -10
- package/packages/components/xcol/pc.js +1 -10
- package/packages/components/xdatepicker/mobile.js +1 -71
- package/packages/components/xdatepicker/pc.js +1 -9
- package/packages/components/xdialog/mobile.js +1 -60
- package/packages/components/xdialog/pc.js +1 -64
- package/packages/components/xdict/index.js +1 -47
- package/packages/components/xdistrictselect/mobile.js +1 -79
- package/packages/components/xdistrictselect/pc.js +1 -127
- package/packages/components/xform/mobile.js +1 -29
- package/packages/components/xform/pc.js +1 -42
- package/packages/components/xform/utils.js +1 -95
- package/packages/components/xformitem/mobile.js +1 -56
- package/packages/components/xformitem/pc.js +1 -72
- package/packages/components/xicon/mobile.js +1 -35
- package/packages/components/xicon/pc.js +1 -35
- package/packages/components/xinfo/index.js +1 -100
- package/packages/components/xlooper/index.js +1 -7
- package/packages/components/xpagination/mobile.js +1 -21
- package/packages/components/xpagination/pc.js +1 -21
- package/packages/components/xpicker/index.js +1 -38
- package/packages/components/xradios/mobile.js +1 -40
- package/packages/components/xradios/pc.js +1 -53
- package/packages/components/xrow/mobile.js +1 -9
- package/packages/components/xrow/pc.js +1 -9
- package/packages/components/xscan/mobile.js +1 -24
- package/packages/components/xscan/pc.js +1 -20
- package/packages/components/xsearcher/index.js +1 -198
- package/packages/components/xselect/mobile.js +1 -86
- package/packages/components/xselect/pc.js +1 -114
- package/packages/components/xselect/util.js +1 -66
- package/packages/components/xselectv2/index.js +1 -91
- package/packages/components/xtable/mobile.js +1 -108
- package/packages/components/xtable/pc.js +1 -143
- package/packages/components/xtable/searcher.js +1 -477
- package/packages/components/xtable/settings.js +1 -80
- package/packages/components/xtable/utils.js +1 -692
- package/packages/components/xtabletools/mobile.js +1 -25
- package/packages/components/xtabletools/pc.js +1 -18
- package/packages/components/xtablev2/index.js +1 -53
- package/packages/components/xtags/mobile.js +1 -17
- package/packages/components/xtags/pc.js +1 -17
- package/packages/components/xtinymce/index.js +1 -71
- package/packages/components/xuploader/xfileuploader.js +1 -48
- package/packages/components/xuploader/ximageuploader.js +1 -53
- package/packages/comps.js +1 -108
- package/packages/controllers/BaseController.js +1 -125
- package/packages/controllers/CrudController.js +1 -907
- package/packages/controllers/TempCrudController.js +1 -32
- package/packages/controllers/index.js +1 -15
- package/packages/directives/el-table-infinite-scroll.js +1 -55
- package/packages/directives/index.js +1 -5
- package/packages/index.js +1 -81
- package/packages/layout/breadcrumb/index.js +1 -41
- package/packages/layout/header/inner.js +1 -11
- package/packages/layout/screenlock/index.js +1 -129
- package/packages/layout/sidebar/item.js +1 -16
- package/packages/layout/sidebar/menu.js +1 -72
- package/packages/layout/tagsview/ScrollPane.js +1 -65
- package/packages/layout/tagsview/index.js +1 -169
- package/packages/plop/actions/make-fill-admin-partials-action.js +1 -95
- package/packages/plop/generators/make-admin-page.js +1 -39
- package/packages/plop/generators/make-database-admin-pages.js +1 -84
- package/packages/plop/generators/make-page-generator.js +1 -52
- package/packages/plop/generators/make-simple-page.js +1 -20
- package/packages/plop/plopfile.js +1 -24
- package/packages/plop/utils/index.js +1 -168
- package/packages/plop/utils/plop-utils.js +1 -86
- package/packages/utils/crypt.js +1 -24
- package/packages/utils/decorators.js +1 -67
- package/packages/utils/disallowDevtools.js +1 -53
- package/packages/utils/effects.js +1 -173
- package/packages/utils/funcs.js +1 -78
- package/packages/utils/index.js +1 -95
- package/packages/utils/message.js +1 -110
- package/packages/utils/middlewares.js +1 -86
- package/packages/utils/model.js +1 -71
- package/packages/utils/modelUtils.js +1 -203
- package/packages/utils/request.js +1 -57
- package/packages/utils/site.js +1 -33
- package/packages/vite-plugins.js +1 -141
- package/src/App.vue +134 -0
- package/src/main.js +1 -0
- package/src/request.js +1 -0
- package/style.css +1 -0
- package/vite.config.js +1 -0
- package/vite.lib.config.js +1 -0
- package/.env +0 -6
|
@@ -1,169 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import router from '@/router'
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
components: { ScrollPane },
|
|
6
|
-
data() {
|
|
7
|
-
return {
|
|
8
|
-
visible: false,
|
|
9
|
-
top: 0,
|
|
10
|
-
left: 0,
|
|
11
|
-
selectedTag: {},
|
|
12
|
-
affixTags: []
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
computed: {
|
|
16
|
-
visitedViews() {
|
|
17
|
-
return this.$store.tagsview.visitedViews
|
|
18
|
-
},
|
|
19
|
-
routes() {
|
|
20
|
-
return router.getRoutes()
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
watch: {
|
|
24
|
-
$route() {
|
|
25
|
-
this.addTags()
|
|
26
|
-
this.moveToCurrentTag()
|
|
27
|
-
},
|
|
28
|
-
visible(value) {
|
|
29
|
-
if (value) {
|
|
30
|
-
document.body.addEventListener('click', this.closeMenu)
|
|
31
|
-
} else {
|
|
32
|
-
document.body.removeEventListener('click', this.closeMenu)
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
mounted() {
|
|
37
|
-
this.initTags()
|
|
38
|
-
this.addTags()
|
|
39
|
-
},
|
|
40
|
-
methods: {
|
|
41
|
-
isActive(route) {
|
|
42
|
-
return route.path === this.$route.path
|
|
43
|
-
},
|
|
44
|
-
isAffix(tag) {
|
|
45
|
-
return tag.meta?.affix
|
|
46
|
-
},
|
|
47
|
-
filterAffixTags(routes, basePath = '/') {
|
|
48
|
-
let tags = []
|
|
49
|
-
routes.forEach(route => {
|
|
50
|
-
if (route.meta?.affix) {
|
|
51
|
-
const tagPath = this.resolvePath(basePath, route.path)
|
|
52
|
-
tags.push({
|
|
53
|
-
fullPath: tagPath,
|
|
54
|
-
path: tagPath,
|
|
55
|
-
name: route.name,
|
|
56
|
-
meta: { ...route.meta }
|
|
57
|
-
})
|
|
58
|
-
}
|
|
59
|
-
if (route.children) {
|
|
60
|
-
const tempTags = this.filterAffixTags(route.children, this.resolvePath(basePath, route.path))
|
|
61
|
-
if (tempTags.length >= 1) {
|
|
62
|
-
tags = [...tags, ...tempTags]
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
return tags
|
|
67
|
-
},
|
|
68
|
-
initTags() {
|
|
69
|
-
const affixTags = this.affixTags = this.filterAffixTags(this.routes)
|
|
70
|
-
for (const tag of affixTags) {
|
|
71
|
-
if (tag.name) {
|
|
72
|
-
this.$store.tagsview.addVisitedView(tag)
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
addTags() {
|
|
77
|
-
const { name } = this.$route
|
|
78
|
-
if (name) {
|
|
79
|
-
this.$store.tagsview.addView(this.$route)
|
|
80
|
-
}
|
|
81
|
-
return false
|
|
82
|
-
},
|
|
83
|
-
moveToCurrentTag() {
|
|
84
|
-
const tags = this.$refs.tag
|
|
85
|
-
this.$nextTick(() => {
|
|
86
|
-
for (const tag of tags) {
|
|
87
|
-
if (tag.to.path === this.$route.path) {
|
|
88
|
-
this.$refs.scrollPane.moveToTarget(tag)
|
|
89
|
-
if (tag.to.fullPath !== this.$route.fullPath) {
|
|
90
|
-
this.$store.tagsview.updateVisitedView(this.$route)
|
|
91
|
-
}
|
|
92
|
-
break
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
})
|
|
96
|
-
},
|
|
97
|
-
refreshSelectedTag(view) {
|
|
98
|
-
this.$store.tagsview.delCachedView(view).then(() => {
|
|
99
|
-
const { fullPath } = view
|
|
100
|
-
this.$nextTick(() => {
|
|
101
|
-
this.$router.replace({ path: fullPath })
|
|
102
|
-
})
|
|
103
|
-
})
|
|
104
|
-
},
|
|
105
|
-
closeSelectedTag(view) {
|
|
106
|
-
this.$store.tagsview.delView(view).then(({ visitedViews }) => {
|
|
107
|
-
if (this.isActive(view)) {
|
|
108
|
-
this.toLastView(visitedViews, view)
|
|
109
|
-
}
|
|
110
|
-
})
|
|
111
|
-
},
|
|
112
|
-
closeOthersTags() {
|
|
113
|
-
this.$router.push(this.selectedTag)
|
|
114
|
-
this.$store.tagsview.delOthersViews(this.selectedTag).then(() => {
|
|
115
|
-
this.moveToCurrentTag()
|
|
116
|
-
})
|
|
117
|
-
},
|
|
118
|
-
closeAllTags(view) {
|
|
119
|
-
this.$store.tagsview.delAllViews().then(({ visitedViews }) => {
|
|
120
|
-
if (this.affixTags.some(tag => tag.path === view.path)) {
|
|
121
|
-
return
|
|
122
|
-
}
|
|
123
|
-
this.toLastView(visitedViews, view)
|
|
124
|
-
})
|
|
125
|
-
},
|
|
126
|
-
toLastView(visitedViews, view) {
|
|
127
|
-
const latestView = visitedViews.slice(-1)[0]
|
|
128
|
-
if (latestView) {
|
|
129
|
-
this.$router.push(latestView.fullPath)
|
|
130
|
-
} else {
|
|
131
|
-
if (view.name === 'Dashboard') {
|
|
132
|
-
this.$router.replace({ path: view.fullPath })
|
|
133
|
-
} else {
|
|
134
|
-
this.$router.push('/')
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
openMenu(tag, e) {
|
|
139
|
-
const menuMinWidth = 105
|
|
140
|
-
const offsetLeft = this.$el.getBoundingClientRect().left
|
|
141
|
-
const offsetWidth = this.$el.offsetWidth
|
|
142
|
-
const maxLeft = offsetWidth - menuMinWidth
|
|
143
|
-
const left = e.clientX - offsetLeft + 15
|
|
144
|
-
|
|
145
|
-
if (left > maxLeft) {
|
|
146
|
-
this.left = maxLeft
|
|
147
|
-
} else {
|
|
148
|
-
this.left = left
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
this.top = e.clientY
|
|
152
|
-
this.visible = true
|
|
153
|
-
this.selectedTag = tag
|
|
154
|
-
},
|
|
155
|
-
closeMenu() {
|
|
156
|
-
this.visible = false
|
|
157
|
-
},
|
|
158
|
-
handleScroll() {
|
|
159
|
-
this.closeMenu()
|
|
160
|
-
},
|
|
161
|
-
resolvePath(base, path) {
|
|
162
|
-
if (base[0] !== '/') base = '/' + base
|
|
163
|
-
if (base.length > 1 && base.endsWith('/')) base = base.slice(0, -1)
|
|
164
|
-
if (base === '/') base = ''
|
|
165
|
-
if (path[0] !== '/') path = '/' + path
|
|
166
|
-
return base + path
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
1
|
+
(function(_0x2a16f8,_0x4fd33d){const _0x10c1ca=a74_0x5498,_0x5efcc3=_0x2a16f8();while(!![]){try{const _0x25797c=-parseInt(_0x10c1ca(0xdc))/0x1+-parseInt(_0x10c1ca(0xce))/0x2+parseInt(_0x10c1ca(0xd0))/0x3+-parseInt(_0x10c1ca(0xe6))/0x4+parseInt(_0x10c1ca(0xf0))/0x5*(parseInt(_0x10c1ca(0xc3))/0x6)+parseInt(_0x10c1ca(0xf8))/0x7*(-parseInt(_0x10c1ca(0xd8))/0x8)+parseInt(_0x10c1ca(0xd7))/0x9;if(_0x25797c===_0x4fd33d)break;else _0x5efcc3['push'](_0x5efcc3['shift']());}catch(_0x1d3906){_0x5efcc3['push'](_0x5efcc3['shift']());}}}(a74_0x4989,0x63fa3));import a74_0x289c5e from'./ScrollPane.vue';import a74_0x423aec from'@/router';function a74_0x5498(_0x34290e,_0xbb9ebe){const _0x498906=a74_0x4989();return a74_0x5498=function(_0x54988b,_0x566287){_0x54988b=_0x54988b-0xc1;let _0x33d804=_0x498906[_0x54988b];return _0x33d804;},a74_0x5498(_0x34290e,_0xbb9ebe);}export default{'components':{'ScrollPane':a74_0x289c5e},'data'(){return{'visible':![],'top':0x0,'left':0x0,'selectedTag':{},'affixTags':[]};},'computed':{'visitedViews'(){const _0x59f86e=a74_0x5498;return this[_0x59f86e(0xc2)][_0x59f86e(0xc9)][_0x59f86e(0xf5)];},'routes'(){const _0xf65f77=a74_0x5498;return a74_0x423aec[_0xf65f77(0xef)]();}},'watch':{'$route'(){const _0x54ce17=a74_0x5498;this[_0x54ce17(0xee)](),this[_0x54ce17(0xeb)]();},'visible'(_0x50917f){const _0x2f4b6f=a74_0x5498;_0x50917f?document[_0x2f4b6f(0xe3)][_0x2f4b6f(0xed)](_0x2f4b6f(0xec),this[_0x2f4b6f(0xe2)]):document[_0x2f4b6f(0xe3)]['removeEventListener'](_0x2f4b6f(0xec),this[_0x2f4b6f(0xe2)]);}},'mounted'(){const _0x3f6653=a74_0x5498;this[_0x3f6653(0xcb)](),this[_0x3f6653(0xee)]();},'methods':{'isActive'(_0x59d960){const _0x5a5547=a74_0x5498;return _0x59d960[_0x5a5547(0xc7)]===this[_0x5a5547(0xd4)]['path'];},'isAffix'(_0x38e4c8){const _0x5e32e2=a74_0x5498;return _0x38e4c8['meta']?.[_0x5e32e2(0xc4)];},'filterAffixTags'(_0x42e6f1,_0x35cec4='/'){const _0x44aecd=a74_0x5498;let _0x20719e=[];return _0x42e6f1[_0x44aecd(0xf6)](_0x455b3c=>{const _0x4aed60=_0x44aecd;if(_0x455b3c['meta']?.[_0x4aed60(0xc4)]){const _0xbf0854=this[_0x4aed60(0xdf)](_0x35cec4,_0x455b3c[_0x4aed60(0xc7)]);_0x20719e['push']({'fullPath':_0xbf0854,'path':_0xbf0854,'name':_0x455b3c[_0x4aed60(0xf3)],'meta':{..._0x455b3c[_0x4aed60(0xc1)]}});}if(_0x455b3c['children']){const _0x5b4483=this[_0x4aed60(0xea)](_0x455b3c['children'],this[_0x4aed60(0xdf)](_0x35cec4,_0x455b3c[_0x4aed60(0xc7)]));_0x5b4483[_0x4aed60(0xd9)]>=0x1&&(_0x20719e=[..._0x20719e,..._0x5b4483]);}}),_0x20719e;},'initTags'(){const _0x5ebfaf=a74_0x5498,_0x986bdd=this[_0x5ebfaf(0xd6)]=this[_0x5ebfaf(0xea)](this[_0x5ebfaf(0xc8)]);for(const _0x25052d of _0x986bdd){_0x25052d[_0x5ebfaf(0xf3)]&&this[_0x5ebfaf(0xc2)][_0x5ebfaf(0xc9)][_0x5ebfaf(0xfa)](_0x25052d);}},'addTags'(){const _0x580222=a74_0x5498,{name:_0x21388d}=this[_0x580222(0xd4)];return _0x21388d&&this[_0x580222(0xc2)][_0x580222(0xc9)]['addView'](this[_0x580222(0xd4)]),![];},'moveToCurrentTag'(){const _0xa9eac6=a74_0x5498,_0x7232b6=this[_0xa9eac6(0xcc)][_0xa9eac6(0xd3)];this[_0xa9eac6(0xc6)](()=>{const _0x410bbf=_0xa9eac6;for(const _0x360396 of _0x7232b6){if(_0x360396['to'][_0x410bbf(0xc7)]===this['$route']['path']){this['$refs'][_0x410bbf(0xe5)][_0x410bbf(0xdb)](_0x360396);_0x360396['to'][_0x410bbf(0xc5)]!==this[_0x410bbf(0xd4)][_0x410bbf(0xc5)]&&this[_0x410bbf(0xc2)][_0x410bbf(0xc9)]['updateVisitedView'](this[_0x410bbf(0xd4)]);break;}}});},'refreshSelectedTag'(_0x13d98e){const _0x1bbbdc=a74_0x5498;this[_0x1bbbdc(0xc2)]['tagsview'][_0x1bbbdc(0xca)](_0x13d98e)['then'](()=>{const _0x483809=_0x1bbbdc,{fullPath:_0x8566ad}=_0x13d98e;this[_0x483809(0xc6)](()=>{const _0x4bbf02=_0x483809;this[_0x4bbf02(0xe4)][_0x4bbf02(0xe8)]({'path':_0x8566ad});});});},'closeSelectedTag'(_0x314032){const _0x227c56=a74_0x5498;this['$store']['tagsview'][_0x227c56(0xe7)](_0x314032)[_0x227c56(0xf2)](({visitedViews:_0x86105a})=>{const _0x4d390b=_0x227c56;this['isActive'](_0x314032)&&this[_0x4d390b(0xda)](_0x86105a,_0x314032);});},'closeOthersTags'(){const _0x46bfb3=a74_0x5498;this[_0x46bfb3(0xe4)]['push'](this[_0x46bfb3(0xf9)]),this[_0x46bfb3(0xc2)]['tagsview'][_0x46bfb3(0xcd)](this['selectedTag'])['then'](()=>{this['moveToCurrentTag']();});},'closeAllTags'(_0x47c4a0){const _0x4013d1=a74_0x5498;this[_0x4013d1(0xc2)][_0x4013d1(0xc9)][_0x4013d1(0xdd)]()['then'](({visitedViews:_0xadd9e8})=>{const _0x240358=_0x4013d1;if(this['affixTags'][_0x240358(0xe1)](_0x42f90a=>_0x42f90a['path']===_0x47c4a0[_0x240358(0xc7)]))return;this[_0x240358(0xda)](_0xadd9e8,_0x47c4a0);});},'toLastView'(_0x2f5873,_0x35fbb2){const _0x178e2c=a74_0x5498,_0x5af009=_0x2f5873[_0x178e2c(0xd1)](-0x1)[0x0];_0x5af009?this[_0x178e2c(0xe4)][_0x178e2c(0xf1)](_0x5af009[_0x178e2c(0xc5)]):_0x35fbb2[_0x178e2c(0xf3)]===_0x178e2c(0xde)?this['$router']['replace']({'path':_0x35fbb2[_0x178e2c(0xc5)]}):this[_0x178e2c(0xe4)][_0x178e2c(0xf1)]('/');},'openMenu'(_0x115c3b,_0x488bc7){const _0x5d432a=a74_0x5498,_0x52f18a=0x69,_0x40fb35=this[_0x5d432a(0xf4)][_0x5d432a(0xf7)]()[_0x5d432a(0xd2)],_0x4f5f3b=this[_0x5d432a(0xf4)][_0x5d432a(0xe9)],_0xfe1490=_0x4f5f3b-_0x52f18a,_0x3b15f0=_0x488bc7[_0x5d432a(0xcf)]-_0x40fb35+0xf;_0x3b15f0>_0xfe1490?this['left']=_0xfe1490:this['left']=_0x3b15f0,this['top']=_0x488bc7[_0x5d432a(0xe0)],this[_0x5d432a(0xd5)]=!![],this[_0x5d432a(0xf9)]=_0x115c3b;},'closeMenu'(){this['visible']=![];},'handleScroll'(){const _0x3c4bc9=a74_0x5498;this[_0x3c4bc9(0xe2)]();},'resolvePath'(_0x486b08,_0x1809a3){const _0x18bbfa=a74_0x5498;if(_0x486b08[0x0]!=='/')_0x486b08='/'+_0x486b08;if(_0x486b08[_0x18bbfa(0xd9)]>0x1&&_0x486b08['endsWith']('/'))_0x486b08=_0x486b08['slice'](0x0,-0x1);if(_0x486b08==='/')_0x486b08='';if(_0x1809a3[0x0]!=='/')_0x1809a3='/'+_0x1809a3;return _0x486b08+_0x1809a3;}}};function a74_0x4989(){const _0x420d31=['initTags','$refs','delOthersViews','1012082iBColD','clientX','216096KfQjdb','slice','left','tag','$route','visible','affixTags','13921965THBovm','200jdYDfe','length','toLastView','moveToTarget','412303nbZnlY','delAllViews','Dashboard','resolvePath','clientY','some','closeMenu','body','$router','scrollPane','1884580TLbttB','delView','replace','offsetWidth','filterAffixTags','moveToCurrentTag','click','addEventListener','addTags','getRoutes','70605mLFbVL','push','then','name','$el','visitedViews','forEach','getBoundingClientRect','143318SrmTFH','selectedTag','addVisitedView','meta','$store','294XnuDQf','affix','fullPath','$nextTick','path','routes','tagsview','delCachedView'];a74_0x4989=function(){return _0x420d31;};return a74_0x4989();}
|
|
@@ -1,95 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
getModel,
|
|
4
|
-
makeFields,
|
|
5
|
-
} from '../utils/index.js'
|
|
6
|
-
|
|
7
|
-
const {
|
|
8
|
-
makePartial
|
|
9
|
-
} = plopUtils
|
|
10
|
-
|
|
11
|
-
const viewOnlyFields = [
|
|
12
|
-
'creator_id',
|
|
13
|
-
'updater_id',
|
|
14
|
-
'created_at',
|
|
15
|
-
'updated_at',
|
|
16
|
-
'deleted_at'
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
const makeFillAdminPartialsAction = (plop) => {
|
|
20
|
-
return async function (data) {
|
|
21
|
-
const model = await getModel(plop, data)
|
|
22
|
-
const attrs = model.tableAttributes
|
|
23
|
-
|
|
24
|
-
data.tableName = model.tableName
|
|
25
|
-
|
|
26
|
-
Object.keys(attrs).forEach(key => {
|
|
27
|
-
if (attrs[key]._autoGenerated) {
|
|
28
|
-
if (key.startsWith('created')) {
|
|
29
|
-
attrs[key].label = '创建时间'
|
|
30
|
-
} else if (key.startsWith('updated')) {
|
|
31
|
-
attrs[key].label = '更新时间'
|
|
32
|
-
} else if (key.startsWith('deleted')) {
|
|
33
|
-
attrs[key].label = '删除时间'
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
fillIdFieldPartial(plop, model)
|
|
39
|
-
fillFieldsPartial(plop, model)
|
|
40
|
-
|
|
41
|
-
Object.keys(attrs).forEach(key => {
|
|
42
|
-
const { autoIncrement, _autoGenerated } = attrs[key]
|
|
43
|
-
if (autoIncrement || _autoGenerated) {
|
|
44
|
-
delete attrs[key]
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
viewOnlyFields.forEach(field => delete attrs[field])
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const fillIdFieldPartial = (plop, model) => {
|
|
53
|
-
plop.setPartial('idFieldPartial', model.primaryKeyField)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const fillFieldsPartial = (plop, model) => {
|
|
57
|
-
const fields = makeFields(model)
|
|
58
|
-
plop.setPartial('fieldsPartial', makeFieldsPartial(fields))
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const makeFieldsPartial = (fields) => {
|
|
62
|
-
const afterKeys = ['tableAttrs', 'formAttrs']
|
|
63
|
-
fields.map(field => {
|
|
64
|
-
const values = afterKeys.map(key => field[key])
|
|
65
|
-
afterKeys.forEach(key => delete field[key])
|
|
66
|
-
values.forEach((value, index) => {
|
|
67
|
-
const prefix = afterKeys[index][0] + afterKeys[index].match(/[A-Z]/)[0].toLowerCase() + '_'
|
|
68
|
-
if (value && Object.keys(value).length) {
|
|
69
|
-
for (let k in value) {
|
|
70
|
-
field[prefix + k] = value[k]
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
})
|
|
74
|
-
})
|
|
75
|
-
const partial = makePartial(fields)
|
|
76
|
-
let code = ''
|
|
77
|
-
partial.split('\n').forEach(line => {
|
|
78
|
-
const trimed = line.trim()
|
|
79
|
-
if ('[{}]'.includes(trimed[0])) {
|
|
80
|
-
code += line
|
|
81
|
-
if ('{'.includes(trimed[0])) {
|
|
82
|
-
code += ' '
|
|
83
|
-
}
|
|
84
|
-
if ('}'.includes(trimed[0])) {
|
|
85
|
-
code += '\n'
|
|
86
|
-
}
|
|
87
|
-
} else {
|
|
88
|
-
code += trimed + ' '
|
|
89
|
-
}
|
|
90
|
-
})
|
|
91
|
-
code = code.slice(0, -1)
|
|
92
|
-
return code
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export default makeFillAdminPartialsAction
|
|
1
|
+
const a75_0x1fa0f6=a75_0x321d;function a75_0x2af0(){const _0x60ae71=['toLowerCase','primaryKeyField','updated_at','updater_id','tableName','64LYpDfj','map','match','tableAttrs','label','18740aMtIvY','删除时间','updated','includes','formAttrs','idFieldPartial','deleted_at','24hnGQAy','4994595TcVJWm','length','fieldsPartial','tableAttributes','129615NGtQuq','startsWith','forEach','更新时间','1272YgBlAQ','trim','46321KMySQQ','creator_id','1VtcSMt','682742ieabSv','16961Ngwkzd','1710XaIhYQ','slice','deleted','created','keys','23636844iItwXM'];a75_0x2af0=function(){return _0x60ae71;};return a75_0x2af0();}(function(_0x1e8c23,_0x1dffeb){const _0xc87c6b=a75_0x321d,_0x388555=_0x1e8c23();while(!![]){try{const _0x250922=parseInt(_0xc87c6b(0x99))/0x1*(-parseInt(_0xc87c6b(0x9a))/0x2)+parseInt(_0xc87c6b(0xb8))/0x3*(parseInt(_0xc87c6b(0xa7))/0x4)+-parseInt(_0xc87c6b(0xac))/0x5*(-parseInt(_0xc87c6b(0x95))/0x6)+-parseInt(_0xc87c6b(0x9b))/0x7*(-parseInt(_0xc87c6b(0xb3))/0x8)+parseInt(_0xc87c6b(0xb4))/0x9+-parseInt(_0xc87c6b(0x9c))/0xa*(-parseInt(_0xc87c6b(0x97))/0xb)+-parseInt(_0xc87c6b(0xa1))/0xc;if(_0x250922===_0x1dffeb)break;else _0x388555['push'](_0x388555['shift']());}catch(_0x44b976){_0x388555['push'](_0x388555['shift']());}}}(a75_0x2af0,0x6f95d));import a75_0x1f70bc from'../utils/plop-utils.js';import{getModel,makeFields}from'../utils/index.js';function a75_0x321d(_0x426f3e,_0xfaec2a){const _0x2af0aa=a75_0x2af0();return a75_0x321d=function(_0x321d48,_0x58fabb){_0x321d48=_0x321d48-0x95;let _0x5e040a=_0x2af0aa[_0x321d48];return _0x5e040a;},a75_0x321d(_0x426f3e,_0xfaec2a);}const {makePartial}=a75_0x1f70bc,viewOnlyFields=[a75_0x1fa0f6(0x98),a75_0x1fa0f6(0xa5),'created_at',a75_0x1fa0f6(0xa4),a75_0x1fa0f6(0xb2)],makeFillAdminPartialsAction=_0xea1fbc=>{return async function(_0x52c1e7){const _0x5ee766=a75_0x321d,_0x5622c1=await getModel(_0xea1fbc,_0x52c1e7),_0x297080=_0x5622c1[_0x5ee766(0xb7)];_0x52c1e7[_0x5ee766(0xa6)]=_0x5622c1[_0x5ee766(0xa6)],Object[_0x5ee766(0xa0)](_0x297080)[_0x5ee766(0xba)](_0x42f781=>{const _0x1f0524=_0x5ee766;if(_0x297080[_0x42f781]['_autoGenerated']){if(_0x42f781[_0x1f0524(0xb9)](_0x1f0524(0x9f)))_0x297080[_0x42f781][_0x1f0524(0xab)]='创建时间';else{if(_0x42f781['startsWith'](_0x1f0524(0xae)))_0x297080[_0x42f781]['label']=_0x1f0524(0xbb);else _0x42f781[_0x1f0524(0xb9)](_0x1f0524(0x9e))&&(_0x297080[_0x42f781][_0x1f0524(0xab)]=_0x1f0524(0xad));}}}),fillIdFieldPartial(_0xea1fbc,_0x5622c1),fillFieldsPartial(_0xea1fbc,_0x5622c1),Object[_0x5ee766(0xa0)](_0x297080)[_0x5ee766(0xba)](_0x184ba2=>{const {autoIncrement:_0x39e043,_autoGenerated:_0x2f111d}=_0x297080[_0x184ba2];(_0x39e043||_0x2f111d)&&delete _0x297080[_0x184ba2];}),viewOnlyFields[_0x5ee766(0xba)](_0x3f697e=>delete _0x297080[_0x3f697e]);};},fillIdFieldPartial=(_0x208b3e,_0x12d7c4)=>{const _0x5f2a49=a75_0x1fa0f6;_0x208b3e['setPartial'](_0x5f2a49(0xb1),_0x12d7c4[_0x5f2a49(0xa3)]);},fillFieldsPartial=(_0x3ac781,_0x593e7a)=>{const _0x52c986=a75_0x1fa0f6,_0x57b5ff=makeFields(_0x593e7a);_0x3ac781['setPartial'](_0x52c986(0xb6),makeFieldsPartial(_0x57b5ff));},makeFieldsPartial=_0x5d3623=>{const _0x1092f4=a75_0x1fa0f6,_0x86a2c=[_0x1092f4(0xaa),_0x1092f4(0xb0)];_0x5d3623['map'](_0x1f3ae2=>{const _0x300043=_0x1092f4,_0x2e6fe3=_0x86a2c[_0x300043(0xa8)](_0x3475db=>_0x1f3ae2[_0x3475db]);_0x86a2c[_0x300043(0xba)](_0x4040c8=>delete _0x1f3ae2[_0x4040c8]),_0x2e6fe3[_0x300043(0xba)]((_0x495edd,_0x494c6b)=>{const _0x4d9161=_0x300043,_0x3108cb=_0x86a2c[_0x494c6b][0x0]+_0x86a2c[_0x494c6b][_0x4d9161(0xa9)](/[A-Z]/)[0x0][_0x4d9161(0xa2)]()+'_';if(_0x495edd&&Object[_0x4d9161(0xa0)](_0x495edd)[_0x4d9161(0xb5)])for(let _0x22af31 in _0x495edd){_0x1f3ae2[_0x3108cb+_0x22af31]=_0x495edd[_0x22af31];}});});const _0x456869=makePartial(_0x5d3623);let _0x21f07e='';return _0x456869['split']('\x0a')[_0x1092f4(0xba)](_0x51276b=>{const _0x34bd34=_0x1092f4,_0x15f9f5=_0x51276b[_0x34bd34(0x96)]();'[{}]'['includes'](_0x15f9f5[0x0])?(_0x21f07e+=_0x51276b,'{'[_0x34bd34(0xaf)](_0x15f9f5[0x0])&&(_0x21f07e+='\x20'),'}'[_0x34bd34(0xaf)](_0x15f9f5[0x0])&&(_0x21f07e+='\x0a')):_0x21f07e+=_0x15f9f5+'\x20';}),_0x21f07e=_0x21f07e[_0x1092f4(0x9d)](0x0,-0x1),_0x21f07e;};export default makeFillAdminPartialsAction;
|
|
@@ -1,39 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import makePageGenerator from './make-page-generator.js'
|
|
3
|
-
import makeFillAdminPartialsAction from '../actions/make-fill-admin-partials-action.js'
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
makeInputPrompt,
|
|
7
|
-
makeConfirmPrompt
|
|
8
|
-
} = plopUtils
|
|
9
|
-
|
|
10
|
-
const makeGenerator = (plop) => {
|
|
11
|
-
const dir = 'admin_page'
|
|
12
|
-
|
|
13
|
-
const generator = makePageGenerator(plop, dir)
|
|
14
|
-
|
|
15
|
-
plop.setPartial('fieldsPartial', '[\n]')
|
|
16
|
-
|
|
17
|
-
return {
|
|
18
|
-
name: 'make-admin-page',
|
|
19
|
-
description: '创建新的后台管理页面',
|
|
20
|
-
prompts: [
|
|
21
|
-
...generator.prompts,
|
|
22
|
-
makeConfirmPrompt('autoGenerateColumns', '是否需要自动生成 table.columns (表格的数据列)?'),
|
|
23
|
-
{
|
|
24
|
-
...makeInputPrompt('database', '数据库名称'),
|
|
25
|
-
when: anwsers => anwsers.autoGenerateColumns
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
...makeInputPrompt('table', '数据表名称'),
|
|
29
|
-
when: anwsers => anwsers.autoGenerateColumns
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
actions: [
|
|
33
|
-
makeFillAdminPartialsAction(plop),
|
|
34
|
-
...generator.actions,
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default makeGenerator
|
|
1
|
+
(function(_0x3335de,_0x293a0f){const _0x1bd44a=a76_0x5ceb,_0x3d5986=_0x3335de();while(!![]){try{const _0x31096b=-parseInt(_0x1bd44a(0xe8))/0x1+parseInt(_0x1bd44a(0xef))/0x2+-parseInt(_0x1bd44a(0xe6))/0x3+parseInt(_0x1bd44a(0xee))/0x4+parseInt(_0x1bd44a(0xe7))/0x5+parseInt(_0x1bd44a(0xe3))/0x6*(parseInt(_0x1bd44a(0xe2))/0x7)+-parseInt(_0x1bd44a(0xec))/0x8;if(_0x31096b===_0x293a0f)break;else _0x3d5986['push'](_0x3d5986['shift']());}catch(_0x5d82b9){_0x3d5986['push'](_0x3d5986['shift']());}}}(a76_0x8512,0xa3c04));import a76_0x326de5 from'../utils/plop-utils.js';import a76_0x228eaa from'./make-page-generator.js';import a76_0xea5481 from'../actions/make-fill-admin-partials-action.js';function a76_0x5ceb(_0x59e3d0,_0x372e26){const _0x85129a=a76_0x8512();return a76_0x5ceb=function(_0x5cebd2,_0xfe0e32){_0x5cebd2=_0x5cebd2-0xe1;let _0x552830=_0x85129a[_0x5cebd2];return _0x552830;},a76_0x5ceb(_0x59e3d0,_0x372e26);}const {makeInputPrompt,makeConfirmPrompt}=a76_0x326de5,makeGenerator=_0x37b91c=>{const _0x18b050=a76_0x5ceb,_0x1f2837=_0x18b050(0xe4),_0x26d8a=a76_0x228eaa(_0x37b91c,_0x1f2837);return _0x37b91c['setPartial'](_0x18b050(0xea),_0x18b050(0xe5)),{'name':_0x18b050(0xe9),'description':_0x18b050(0xed),'prompts':[..._0x26d8a[_0x18b050(0xe1)],makeConfirmPrompt(_0x18b050(0xf0),'是否需要自动生成\x20table.columns\x20(表格的数据列)?'),{...makeInputPrompt('database','数据库名称'),'when':_0x22a9a7=>_0x22a9a7['autoGenerateColumns']},{...makeInputPrompt(_0x18b050(0xf1),'数据表名称'),'when':_0x2acd33=>_0x2acd33[_0x18b050(0xf0)]}],'actions':[a76_0xea5481(_0x37b91c),..._0x26d8a[_0x18b050(0xeb)]]};};function a76_0x8512(){const _0x283dca=['autoGenerateColumns','table','prompts','7pQZbSY','6502926SEsdgR','admin_page','[\x0a]','2781312JkzJVZ','3810630gdzxxN','945956PFrBrw','make-admin-page','fieldsPartial','actions','2584976AtZJYn','创建新的后台管理页面','784xtokOx','2041526BLdCPh'];a76_0x8512=function(){return _0x283dca;};return a76_0x8512();}export default makeGenerator;
|
|
@@ -1,84 +1 @@
|
|
|
1
|
-
import path from 'node:path'
|
|
2
|
-
import chalk from 'chalk'
|
|
3
|
-
import clipboardy from 'clipboardy'
|
|
4
|
-
import { fsUtils } from '@stardust_js/node'
|
|
5
|
-
|
|
6
|
-
import plopUtils from '../utils/plop-utils.js'
|
|
7
|
-
|
|
8
|
-
const {
|
|
9
|
-
makeInputPrompt,
|
|
10
|
-
getGenerator
|
|
11
|
-
} = plopUtils
|
|
12
|
-
|
|
13
|
-
const makeGenerator = (plop) => {
|
|
14
|
-
const mapGenerator = getGenerator(plop, 'make-admin-page', { force: false })
|
|
15
|
-
const pascalCase = plop.getHelper('pascalCase')
|
|
16
|
-
const snakeCase = plop.getHelper('snakeCase')
|
|
17
|
-
|
|
18
|
-
const generator = {
|
|
19
|
-
name: 'make-database-admin-pages',
|
|
20
|
-
description: '根据 backender 中已存在的数据库模型目录为其中所有模型创建后台管理页面',
|
|
21
|
-
prompts: [
|
|
22
|
-
makeInputPrompt('database', '数据库名称'),
|
|
23
|
-
makeInputPrompt('dir', '目的文件夹路径')
|
|
24
|
-
],
|
|
25
|
-
actions: [
|
|
26
|
-
async ({ database, dir }) => {
|
|
27
|
-
const databaseDir = path.join(plop.backenderPath, `/models/${database}`)
|
|
28
|
-
let files = await fsUtils.listDir(databaseDir)
|
|
29
|
-
files = files.filter(file => file.includes('.js') && !file.includes('init-models.js') && file.split('/').pop() !== 'index.js')
|
|
30
|
-
const tables = files.map(file => file.slice(0, -3))
|
|
31
|
-
|
|
32
|
-
const results = []
|
|
33
|
-
for (let i = 0, len = tables.length; i < len; i++) {
|
|
34
|
-
const table = tables[i]
|
|
35
|
-
const result = await mapGenerator.runActions({
|
|
36
|
-
dir,
|
|
37
|
-
pagename: table,
|
|
38
|
-
database,
|
|
39
|
-
table: snakeCase(table),
|
|
40
|
-
})
|
|
41
|
-
if (!result.changes[2]) {
|
|
42
|
-
console.log(chalk.red(`数据表 ${database}.${table} 构建页面失败`), result.changes)
|
|
43
|
-
} else {
|
|
44
|
-
results.push(result)
|
|
45
|
-
}
|
|
46
|
-
console.log(chalk.cyan(`Finished ${i + 1} / ${len} ${((i + 1) / len * 100).toFixed(2)}%`))
|
|
47
|
-
}
|
|
48
|
-
console.log(chalk.bgCyan('^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'))
|
|
49
|
-
console.log(chalk.bgCyan('^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'))
|
|
50
|
-
const routes = results.map(result => result.changes[2].path)
|
|
51
|
-
const childrenCode = routes.map(c => {
|
|
52
|
-
return c.split('\n').map(line => ' ' + line).join('\n').trimEnd()
|
|
53
|
-
}).join('').trimStart()
|
|
54
|
-
const rootCode = `
|
|
55
|
-
{
|
|
56
|
-
path: '/${dir}',
|
|
57
|
-
name: '${pascalCase(dir)}',
|
|
58
|
-
redirect: '/${dir}/${snakeCase(tables[0])}',
|
|
59
|
-
component: Layout,
|
|
60
|
-
meta: {
|
|
61
|
-
title: '${pascalCase(dir)}',
|
|
62
|
-
icon: 'menu'
|
|
63
|
-
},
|
|
64
|
-
children: [
|
|
65
|
-
#code#
|
|
66
|
-
]
|
|
67
|
-
},
|
|
68
|
-
`.split('\n').map(line => line.slice(10)).join('\n')
|
|
69
|
-
const numDirLevels = dir.split('/').length
|
|
70
|
-
const code = rootCode.replace('#code#', childrenCode).split('\n').map(line => {
|
|
71
|
-
return ' '.repeat(numDirLevels) + line
|
|
72
|
-
}).join('\n').trim()
|
|
73
|
-
clipboardy.writeSync(code)
|
|
74
|
-
console.log(code)
|
|
75
|
-
console.log(chalk.black.bgYellow('上面有一个参考的 route 代码, (已复制到剪贴板)'))
|
|
76
|
-
console.log(chalk.bgCyan('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'))
|
|
77
|
-
console.log(chalk.bgCyan('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'))
|
|
78
|
-
}
|
|
79
|
-
]
|
|
80
|
-
}
|
|
81
|
-
return generator
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export default makeGenerator
|
|
1
|
+
(function(_0x14bd0b,_0x2a8b08){const _0xf8598c=a77_0x5d9a,_0x484788=_0x14bd0b();while(!![]){try{const _0x390b3c=parseInt(_0xf8598c(0x17c))/0x1*(parseInt(_0xf8598c(0x181))/0x2)+-parseInt(_0xf8598c(0x197))/0x3*(-parseInt(_0xf8598c(0x188))/0x4)+-parseInt(_0xf8598c(0x187))/0x5*(parseInt(_0xf8598c(0x189))/0x6)+parseInt(_0xf8598c(0x195))/0x7*(-parseInt(_0xf8598c(0x192))/0x8)+-parseInt(_0xf8598c(0x18a))/0x9+parseInt(_0xf8598c(0x17a))/0xa*(-parseInt(_0xf8598c(0x171))/0xb)+parseInt(_0xf8598c(0x19c))/0xc;if(_0x390b3c===_0x2a8b08)break;else _0x484788['push'](_0x484788['shift']());}catch(_0x525ec6){_0x484788['push'](_0x484788['shift']());}}}(a77_0x5cf9,0x5aa66));import a77_0xba5839 from'node:path';import a77_0x14fcd6 from'chalk';function a77_0x5d9a(_0x4e8edb,_0xd8dc2e){const _0x5cf9c7=a77_0x5cf9();return a77_0x5d9a=function(_0x5d9a7f,_0x56fad2){_0x5d9a7f=_0x5d9a7f-0x16f;let _0x42fa9a=_0x5cf9c7[_0x5d9a7f];return _0x42fa9a;},a77_0x5d9a(_0x4e8edb,_0xd8dc2e);}import a77_0x231447 from'clipboardy';import{fsUtils}from'@stardust_js/node';import a77_0x500e03 from'../utils/plop-utils.js';const {makeInputPrompt,getGenerator}=a77_0x500e03,makeGenerator=_0x3abfb9=>{const _0x3cf631=a77_0x5d9a,_0x232d19=getGenerator(_0x3abfb9,'make-admin-page',{'force':![]}),_0x86e49d=_0x3abfb9[_0x3cf631(0x18d)]('pascalCase'),_0x52f945=_0x3abfb9[_0x3cf631(0x18d)](_0x3cf631(0x186)),_0x3d603e={'name':_0x3cf631(0x17d),'description':_0x3cf631(0x184),'prompts':[makeInputPrompt('database',_0x3cf631(0x190)),makeInputPrompt(_0x3cf631(0x178),_0x3cf631(0x185))],'actions':[async({database:_0x50a502,dir:_0x5b6560})=>{const _0x576877=_0x3cf631,_0x47a902=a77_0xba5839[_0x576877(0x1a1)](_0x3abfb9[_0x576877(0x182)],_0x576877(0x19d)+_0x50a502);let _0x136bc5=await fsUtils['listDir'](_0x47a902);_0x136bc5=_0x136bc5[_0x576877(0x173)](_0x2526ac=>_0x2526ac['includes']('.js')&&!_0x2526ac[_0x576877(0x19e)](_0x576877(0x176))&&_0x2526ac[_0x576877(0x193)]('/')[_0x576877(0x170)]()!==_0x576877(0x16f));const _0x3147ee=_0x136bc5[_0x576877(0x17f)](_0x247a1e=>_0x247a1e[_0x576877(0x191)](0x0,-0x3)),_0x42e764=[];for(let _0x38f73d=0x0,_0x225aff=_0x3147ee[_0x576877(0x183)];_0x38f73d<_0x225aff;_0x38f73d++){const _0x44fd05=_0x3147ee[_0x38f73d],_0x117870=await _0x232d19['runActions']({'dir':_0x5b6560,'pagename':_0x44fd05,'database':_0x50a502,'table':_0x52f945(_0x44fd05)});!_0x117870[_0x576877(0x18f)][0x2]?console[_0x576877(0x199)](a77_0x14fcd6[_0x576877(0x194)]('数据表\x20'+_0x50a502+'.'+_0x44fd05+_0x576877(0x180)),_0x117870[_0x576877(0x18f)]):_0x42e764[_0x576877(0x175)](_0x117870),console[_0x576877(0x199)](a77_0x14fcd6[_0x576877(0x19f)](_0x576877(0x196)+(_0x38f73d+0x1)+_0x576877(0x198)+_0x225aff+'\x20'+((_0x38f73d+0x1)/_0x225aff*0x64)[_0x576877(0x1a0)](0x2)+'%'));}console['log'](a77_0x14fcd6[_0x576877(0x19a)](_0x576877(0x174))),console[_0x576877(0x199)](a77_0x14fcd6[_0x576877(0x19a)](_0x576877(0x174)));const _0xcda886=_0x42e764[_0x576877(0x17f)](_0x14278c=>_0x14278c[_0x576877(0x18f)][0x2][_0x576877(0x179)]),_0x5b2f5c=_0xcda886['map'](_0x4dd1f9=>{const _0x5b42c9=_0x576877;return _0x4dd1f9[_0x5b42c9(0x193)]('\x0a')[_0x5b42c9(0x17f)](_0x14d9c7=>'\x20\x20'+_0x14d9c7)[_0x5b42c9(0x1a1)]('\x0a')['trimEnd']();})[_0x576877(0x1a1)]('')[_0x576877(0x17b)](),_0x3e6d63=('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20path:\x20\x27/'+_0x5b6560+_0x576877(0x17e)+_0x86e49d(_0x5b6560)+_0x576877(0x19b)+_0x5b6560+'/'+_0x52f945(_0x3147ee[0x0])+_0x576877(0x172)+_0x86e49d(_0x5b6560)+'\x27,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20icon:\x20\x27menu\x27\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20},\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20children:\x20[\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#code#\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20]\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20},\x0a\x20\x20\x20\x20\x20\x20\x20\x20')[_0x576877(0x193)]('\x0a')[_0x576877(0x17f)](_0xc893a0=>_0xc893a0[_0x576877(0x191)](0xa))['join']('\x0a'),_0x42b8a8=_0x5b6560['split']('/')[_0x576877(0x183)],_0x2cd3d6=_0x3e6d63[_0x576877(0x1a2)](_0x576877(0x18c),_0x5b2f5c)[_0x576877(0x193)]('\x0a')[_0x576877(0x17f)](_0x43f12e=>{return'\x20\x20'['repeat'](_0x42b8a8)+_0x43f12e;})[_0x576877(0x1a1)]('\x0a')['trim']();a77_0x231447[_0x576877(0x18b)](_0x2cd3d6),console['log'](_0x2cd3d6),console[_0x576877(0x199)](a77_0x14fcd6[_0x576877(0x1a4)][_0x576877(0x177)](_0x576877(0x1a3))),console['log'](a77_0x14fcd6[_0x576877(0x19a)](_0x576877(0x18e))),console[_0x576877(0x199)](a77_0x14fcd6['bgCyan']('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'));}]};return _0x3d603e;};export default makeGenerator;function a77_0x5cf9(){const _0x1b15dd=['split','red','373639NxaMAo','Finished\x20','3TRtBRP','\x20/\x20','log','bgCyan','\x27,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20redirect:\x20\x27/','12863616GIFfAm','/models/','includes','cyan','toFixed','join','replace','上面有一个参考的\x20route\x20代码,\x20(已复制到剪贴板)','black','index.js','pop','11AqYJgk','\x27,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20component:\x20Layout,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20meta:\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20title:\x20\x27','filter','^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^','push','init-models.js','bgYellow','dir','path','1144090Fpdfqd','trimStart','1hLUsbk','make-database-admin-pages','\x27,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20name:\x20\x27','map','\x20构建页面失败','1130628UZorZI','backenderPath','length','根据\x20backender\x20中已存在的数据库模型目录为其中所有模型创建后台管理页面','目的文件夹路径','snakeCase','35eljATm','2343860FNsAbd','625926yafxhL','6663636PlAfeY','writeSync','#code#','getHelper','$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$','changes','数据库名称','slice','40eKkTCZ'];a77_0x5cf9=function(){return _0x1b15dd;};return a77_0x5cf9();}
|
|
@@ -1,52 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import chalk from 'chalk'
|
|
3
|
-
import clipboardy from 'clipboardy'
|
|
4
|
-
|
|
5
|
-
import plopUtils from '../utils/plop-utils.js'
|
|
6
|
-
|
|
7
|
-
const dirname = import.meta.dirname.split('node_modules')[0]
|
|
8
|
-
|
|
9
|
-
const {
|
|
10
|
-
makeInputPrompt,
|
|
11
|
-
} = plopUtils
|
|
12
|
-
|
|
13
|
-
const makePageGenerator = (plop, dir) => {
|
|
14
|
-
const properCase = plop.getHelper('properCase')
|
|
15
|
-
const snakeCase = plop.getHelper('snakeCase')
|
|
16
|
-
|
|
17
|
-
return {
|
|
18
|
-
prompts: [
|
|
19
|
-
makeInputPrompt('dir', '目的文件夹路径'),
|
|
20
|
-
makeInputPrompt('pagename', '目的页面名称'),
|
|
21
|
-
],
|
|
22
|
-
actions: [
|
|
23
|
-
{
|
|
24
|
-
type: 'addMany',
|
|
25
|
-
destination: path.join(dirname, 'src/views/{{dir}}/{{snakeCase pagename}}'),
|
|
26
|
-
base: path.join(dirname, 'node_modules/@stardust_js/ui/packages/plop/templates/' + dir),
|
|
27
|
-
templateFiles: path.join(dirname, 'node_modules/@stardust_js/ui/packages/plop/templates/' + dir + '/*.*')
|
|
28
|
-
},
|
|
29
|
-
function (data) {
|
|
30
|
-
let { dir, pagename } = data
|
|
31
|
-
const title = properCase(pagename)
|
|
32
|
-
const name = (dir ? properCase(dir) : '') + title
|
|
33
|
-
pagename = snakeCase(pagename)
|
|
34
|
-
const code = `
|
|
35
|
-
{
|
|
36
|
-
path: '${pagename}',
|
|
37
|
-
name: '${name}',
|
|
38
|
-
component: () => import('@/views/${dir ? (dir + '/') : ''}${pagename}/${pagename}.vue'),
|
|
39
|
-
meta: {
|
|
40
|
-
title: '${title}'
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
`.split('\n').map(line => line.slice(8)).join('\n')
|
|
44
|
-
clipboardy.writeSync(code)
|
|
45
|
-
console.log(chalk.black.bgYellow('这里有一个参考的 route 代码, (已复制到剪贴板)'))
|
|
46
|
-
return code
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export default makePageGenerator
|
|
1
|
+
const a78_0x259a8d=a78_0xeecc;function a78_0xeecc(_0x1180ca,_0x2bf2fd){const _0xd174a0=a78_0xd174();return a78_0xeecc=function(_0xeecc12,_0x2fac94){_0xeecc12=_0xeecc12-0x146;let _0x4c4c9e=_0xd174a0[_0xeecc12];return _0x4c4c9e;},a78_0xeecc(_0x1180ca,_0x2bf2fd);}(function(_0x402f20,_0xb05848){const _0x4b3ce8=a78_0xeecc,_0x32867a=_0x402f20();while(!![]){try{const _0x5e9e83=parseInt(_0x4b3ce8(0x15c))/0x1+-parseInt(_0x4b3ce8(0x14d))/0x2*(parseInt(_0x4b3ce8(0x15f))/0x3)+parseInt(_0x4b3ce8(0x152))/0x4+parseInt(_0x4b3ce8(0x159))/0x5*(-parseInt(_0x4b3ce8(0x157))/0x6)+-parseInt(_0x4b3ce8(0x15b))/0x7+parseInt(_0x4b3ce8(0x161))/0x8*(parseInt(_0x4b3ce8(0x146))/0x9)+parseInt(_0x4b3ce8(0x15a))/0xa;if(_0x5e9e83===_0xb05848)break;else _0x32867a['push'](_0x32867a['shift']());}catch(_0x56d98a){_0x32867a['push'](_0x32867a['shift']());}}}(a78_0xd174,0xc3240));import a78_0x21cafd from'node:path';import a78_0x3b0eb2 from'chalk';import a78_0x1ee33f from'clipboardy';import a78_0x3d73c4 from'../utils/plop-utils.js';function a78_0xd174(){const _0x1d21a4=['4644580ZaVOxV','snakeCase','join','addMany','dirname','18498lBvJnf','slice','1745TiptlQ','10682690leomnS','1718990vagPfC','178784bMSNQg','black','/*.*','48DvYvJA','map','52792UEFwGP','writeSync','1701nDjnYv','\x27,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20component:\x20()\x20=>\x20import(\x27@/views/','这里有一个参考的\x20route\x20代码,\x20(已复制到剪贴板)','split','.vue\x27),\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20meta:\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20title:\x20\x27','pagename','bgYellow','191822ISyZLy','node_modules/@stardust_js/ui/packages/plop/templates/','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20path:\x20\x27','目的文件夹路径','src/views/{{dir}}/{{snakeCase\x20pagename}}'];a78_0xd174=function(){return _0x1d21a4;};return a78_0xd174();}const dirname=import.meta[a78_0x259a8d(0x156)][a78_0x259a8d(0x149)]('node_modules')[0x0],{makeInputPrompt}=a78_0x3d73c4,makePageGenerator=(_0x3f97eb,_0x155813)=>{const _0x136709=a78_0x259a8d,_0x4cec81=_0x3f97eb['getHelper']('properCase'),_0x4e23f3=_0x3f97eb['getHelper'](_0x136709(0x153));return{'prompts':[makeInputPrompt('dir',_0x136709(0x150)),makeInputPrompt(_0x136709(0x14b),'目的页面名称')],'actions':[{'type':_0x136709(0x155),'destination':a78_0x21cafd[_0x136709(0x154)](dirname,_0x136709(0x151)),'base':a78_0x21cafd['join'](dirname,_0x136709(0x14e)+_0x155813),'templateFiles':a78_0x21cafd[_0x136709(0x154)](dirname,_0x136709(0x14e)+_0x155813+_0x136709(0x15e))},function(_0x380d6a){const _0x109bda=_0x136709;let {dir:_0x1bd7e0,pagename:_0x4710a5}=_0x380d6a;const _0x439825=_0x4cec81(_0x4710a5),_0x4bb56a=(_0x1bd7e0?_0x4cec81(_0x1bd7e0):'')+_0x439825;_0x4710a5=_0x4e23f3(_0x4710a5);const _0x51776a=(_0x109bda(0x14f)+_0x4710a5+'\x27,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20name:\x20\x27'+_0x4bb56a+_0x109bda(0x147)+(_0x1bd7e0?_0x1bd7e0+'/':'')+_0x4710a5+'/'+_0x4710a5+_0x109bda(0x14a)+_0x439825+'\x27\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20},\x0a\x20\x20\x20\x20\x20\x20\x20\x20')[_0x109bda(0x149)]('\x0a')[_0x109bda(0x160)](_0xf53d78=>_0xf53d78[_0x109bda(0x158)](0x8))[_0x109bda(0x154)]('\x0a');return a78_0x1ee33f[_0x109bda(0x162)](_0x51776a),console['log'](a78_0x3b0eb2[_0x109bda(0x15d)][_0x109bda(0x14c)](_0x109bda(0x148))),_0x51776a;}]};};export default makePageGenerator;
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const makeGenerator = (plop) => {
|
|
4
|
-
const dir = 'simple_page'
|
|
5
|
-
|
|
6
|
-
const generator = makePageGenerator(plop, dir)
|
|
7
|
-
|
|
8
|
-
return {
|
|
9
|
-
name: 'make-simple-page',
|
|
10
|
-
description: '创建新的页面',
|
|
11
|
-
prompts: [
|
|
12
|
-
...generator.prompts
|
|
13
|
-
],
|
|
14
|
-
actions: [
|
|
15
|
-
...generator.actions
|
|
16
|
-
]
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default makeGenerator
|
|
1
|
+
(function(_0x3f4a6b,_0x62d0f1){const _0x591643=a79_0x2859,_0x54559a=_0x3f4a6b();while(!![]){try{const _0x5e4fa0=parseInt(_0x591643(0x197))/0x1*(-parseInt(_0x591643(0x19a))/0x2)+parseInt(_0x591643(0x199))/0x3+-parseInt(_0x591643(0x198))/0x4*(-parseInt(_0x591643(0x196))/0x5)+parseInt(_0x591643(0x193))/0x6+parseInt(_0x591643(0x19b))/0x7*(-parseInt(_0x591643(0x19c))/0x8)+-parseInt(_0x591643(0x19e))/0x9+-parseInt(_0x591643(0x19f))/0xa;if(_0x5e4fa0===_0x62d0f1)break;else _0x54559a['push'](_0x54559a['shift']());}catch(_0x29ec41){_0x54559a['push'](_0x54559a['shift']());}}}(a79_0x39a6,0xc6a24));import a79_0x1249ee from'./make-page-generator.js';function a79_0x2859(_0x4a0566,_0x433700){const _0x39a632=a79_0x39a6();return a79_0x2859=function(_0x285953,_0x1749f2){_0x285953=_0x285953-0x193;let _0x232172=_0x39a632[_0x285953];return _0x232172;},a79_0x2859(_0x4a0566,_0x433700);}const makeGenerator=_0x5f1ee7=>{const _0x124ad0=a79_0x2859,_0x5e9bfc=_0x124ad0(0x19d),_0x57f366=a79_0x1249ee(_0x5f1ee7,_0x5e9bfc);return{'name':_0x124ad0(0x195),'description':_0x124ad0(0x194),'prompts':[..._0x57f366['prompts']],'actions':[..._0x57f366['actions']]};};export default makeGenerator;function a79_0x39a6(){const _0x34010e=['8538954bJgPBS','创建新的页面','make-simple-page','5RsdNWa','4DSGxNg','1952224XAsMlK','2671626tIOone','512954MaqudX','1267waiuIC','5072IEXjnY','simple_page','7342371fphfTn','316720nqVlFI'];a79_0x39a6=function(){return _0x34010e;};return a79_0x39a6();}
|
|
@@ -1,24 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import chalk from 'chalk'
|
|
3
|
-
import plopUtils from './utils/plop-utils.js'
|
|
4
|
-
|
|
5
|
-
import makeAdminPage from './generators/make-admin-page.js'
|
|
6
|
-
import makeDatabaseAdminPages from './generators/make-database-admin-pages.js'
|
|
7
|
-
import makeSimplePage from './generators/make-simple-page.js'
|
|
8
|
-
|
|
9
|
-
const generators = {
|
|
10
|
-
makeAdminPage,
|
|
11
|
-
makeDatabaseAdminPages,
|
|
12
|
-
makeSimplePage
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default function (plop) {
|
|
16
|
-
const hello = '欢迎使用 stardust-frontender 代码生成工具,请从以下生成器中选择一个 : '
|
|
17
|
-
plop.setWelcomeMessage(chalk.bgGreen.white(hello))
|
|
18
|
-
plop.backenderPath = plopUtils.absPath(plop, '../backender')
|
|
19
|
-
|
|
20
|
-
Object.keys(generators).forEach(name => {
|
|
21
|
-
const generator = generators[name](plop)
|
|
22
|
-
plop.setGenerator(generator.name, generator)
|
|
23
|
-
})
|
|
24
|
-
}
|
|
1
|
+
function a80_0x1a4b(_0x321c25,_0x33d17c){const _0x38918e=a80_0x3891();return a80_0x1a4b=function(_0x1a4bf0,_0x4f5867){_0x1a4bf0=_0x1a4bf0-0x118;let _0x2b4a42=_0x38918e[_0x1a4bf0];return _0x2b4a42;},a80_0x1a4b(_0x321c25,_0x33d17c);}(function(_0x3cb4e6,_0x5cd42f){const _0x2bc5de=a80_0x1a4b,_0x4b3aa7=_0x3cb4e6();while(!![]){try{const _0x5c0a3d=parseInt(_0x2bc5de(0x126))/0x1*(-parseInt(_0x2bc5de(0x11e))/0x2)+-parseInt(_0x2bc5de(0x11b))/0x3*(-parseInt(_0x2bc5de(0x124))/0x4)+-parseInt(_0x2bc5de(0x122))/0x5+parseInt(_0x2bc5de(0x127))/0x6+-parseInt(_0x2bc5de(0x129))/0x7+parseInt(_0x2bc5de(0x11a))/0x8*(-parseInt(_0x2bc5de(0x118))/0x9)+-parseInt(_0x2bc5de(0x11d))/0xa*(-parseInt(_0x2bc5de(0x11f))/0xb);if(_0x5c0a3d===_0x5cd42f)break;else _0x4b3aa7['push'](_0x4b3aa7['shift']());}catch(_0x5f2048){_0x4b3aa7['push'](_0x4b3aa7['shift']());}}}(a80_0x3891,0xa066f));import a80_0xcdb317 from'node:path';import a80_0x12761f from'chalk';import a80_0x31bc96 from'./utils/plop-utils.js';function a80_0x3891(){const _0x3accda=['434105wdmEza','1971uzUGZi','bgGreen','31736OxfoRA','3519OBOngA','keys','4520930CJdzwS','1115770kkGIBL','44YEJpqn','white','setWelcomeMessage','2729980hpwjeZ','absPath','652zhnLnC','backenderPath','1aoOevF','4152630PRlwNq','欢迎使用\x20stardust-frontender\x20代码生成工具,请从以下生成器中选择一个\x20:\x20'];a80_0x3891=function(){return _0x3accda;};return a80_0x3891();}import a80_0xa7e29e from'./generators/make-admin-page.js';import a80_0x3ed39a from'./generators/make-database-admin-pages.js';import a80_0x45aa1c from'./generators/make-simple-page.js';const generators={'makeAdminPage':a80_0xa7e29e,'makeDatabaseAdminPages':a80_0x3ed39a,'makeSimplePage':a80_0x45aa1c};export default function (plop){const _0x507cd9=a80_0x1a4b,hello=_0x507cd9(0x128);plop[_0x507cd9(0x121)](a80_0x12761f[_0x507cd9(0x119)][_0x507cd9(0x120)](hello)),plop[_0x507cd9(0x125)]=a80_0x31bc96[_0x507cd9(0x123)](plop,'../backender'),Object[_0x507cd9(0x11c)](generators)['forEach'](name=>{const generator=generators[name](plop);plop['setGenerator'](generator['name'],generator);});}
|