@wp1001/ui 2.9.13 → 3.0.1

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 (106) hide show
  1. package/@vant-D4fmGxs6.js +1 -3891
  2. package/index.html +28 -0
  3. package/index.js +1 -8419
  4. package/lib/tinymce/zh_CN.js +1 -0
  5. package/package.json +1 -1
  6. package/packages/assets/devtools-detector.js +1 -2
  7. package/packages/components/xarray/index.js +1 -64
  8. package/packages/components/xautorows/index.js +1 -35
  9. package/packages/components/xbutton/mobile.js +1 -3
  10. package/packages/components/xbutton/pc.js +1 -3
  11. package/packages/components/xbuttons/mobile.js +1 -51
  12. package/packages/components/xbuttons/pc.js +1 -51
  13. package/packages/components/xchart/constants.js +1 -58
  14. package/packages/components/xchart/index.js +1 -263
  15. package/packages/components/xchart/utils.js +1 -121
  16. package/packages/components/xcheckboxs/mobile.js +1 -58
  17. package/packages/components/xcheckboxs/pc.js +1 -49
  18. package/packages/components/xcol/mobile.js +1 -10
  19. package/packages/components/xcol/pc.js +1 -10
  20. package/packages/components/xdatepicker/mobile.js +1 -71
  21. package/packages/components/xdatepicker/pc.js +1 -9
  22. package/packages/components/xdialog/mobile.js +1 -60
  23. package/packages/components/xdialog/pc.js +1 -64
  24. package/packages/components/xdict/index.js +1 -47
  25. package/packages/components/xdistrictselect/mobile.js +1 -79
  26. package/packages/components/xdistrictselect/pc.js +1 -127
  27. package/packages/components/xform/mobile.js +1 -29
  28. package/packages/components/xform/pc.js +1 -42
  29. package/packages/components/xform/utils.js +1 -95
  30. package/packages/components/xformitem/mobile.js +1 -56
  31. package/packages/components/xformitem/pc.js +1 -72
  32. package/packages/components/xicon/mobile.js +1 -35
  33. package/packages/components/xicon/pc.js +1 -35
  34. package/packages/components/xinfo/index.js +1 -100
  35. package/packages/components/xlooper/index.js +1 -7
  36. package/packages/components/xpagination/mobile.js +1 -21
  37. package/packages/components/xpagination/pc.js +1 -21
  38. package/packages/components/xpicker/index.js +1 -38
  39. package/packages/components/xradios/mobile.js +1 -40
  40. package/packages/components/xradios/pc.js +1 -53
  41. package/packages/components/xrow/mobile.js +1 -9
  42. package/packages/components/xrow/pc.js +1 -9
  43. package/packages/components/xscan/mobile.js +1 -24
  44. package/packages/components/xscan/pc.js +1 -20
  45. package/packages/components/xsearcher/index.js +1 -198
  46. package/packages/components/xselect/mobile.js +1 -86
  47. package/packages/components/xselect/pc.js +1 -114
  48. package/packages/components/xselect/util.js +1 -66
  49. package/packages/components/xselectv2/index.js +1 -91
  50. package/packages/components/xtable/mobile.js +1 -108
  51. package/packages/components/xtable/pc.js +1 -143
  52. package/packages/components/xtable/searcher.js +1 -477
  53. package/packages/components/xtable/settings.js +1 -80
  54. package/packages/components/xtable/utils.js +1 -692
  55. package/packages/components/xtabletools/mobile.js +1 -25
  56. package/packages/components/xtabletools/pc.js +1 -18
  57. package/packages/components/xtablev2/index.js +1 -53
  58. package/packages/components/xtags/mobile.js +1 -17
  59. package/packages/components/xtags/pc.js +1 -17
  60. package/packages/components/xtinymce/index.js +1 -71
  61. package/packages/components/xuploader/xfileuploader.js +1 -48
  62. package/packages/components/xuploader/ximageuploader.js +1 -53
  63. package/packages/comps.js +1 -108
  64. package/packages/controllers/BaseController.js +1 -125
  65. package/packages/controllers/CrudController.js +1 -907
  66. package/packages/controllers/TempCrudController.js +1 -32
  67. package/packages/controllers/index.js +1 -15
  68. package/packages/directives/el-table-infinite-scroll.js +1 -55
  69. package/packages/directives/index.js +1 -5
  70. package/packages/index.js +1 -81
  71. package/packages/layout/breadcrumb/index.js +1 -41
  72. package/packages/layout/header/inner.js +1 -11
  73. package/packages/layout/pc.vue +1 -1
  74. package/packages/layout/screenlock/index.js +1 -129
  75. package/packages/layout/sidebar/item.js +1 -16
  76. package/packages/layout/sidebar/menu.js +1 -72
  77. package/packages/layout/tagsview/ScrollPane.js +1 -65
  78. package/packages/layout/tagsview/index.js +1 -169
  79. package/packages/plop/actions/make-fill-admin-partials-action.js +1 -95
  80. package/packages/plop/generators/make-admin-page.js +1 -39
  81. package/packages/plop/generators/make-database-admin-pages.js +1 -84
  82. package/packages/plop/generators/make-page-generator.js +1 -52
  83. package/packages/plop/generators/make-simple-page.js +1 -20
  84. package/packages/plop/plopfile.js +1 -24
  85. package/packages/plop/utils/index.js +1 -168
  86. package/packages/plop/utils/plop-utils.js +1 -86
  87. package/packages/utils/crypt.js +1 -24
  88. package/packages/utils/decorators.js +1 -67
  89. package/packages/utils/disallowDevtools.js +1 -53
  90. package/packages/utils/effects.js +1 -173
  91. package/packages/utils/funcs.js +1 -78
  92. package/packages/utils/index.js +1 -95
  93. package/packages/utils/message.js +1 -110
  94. package/packages/utils/middlewares.js +1 -86
  95. package/packages/utils/model.js +1 -71
  96. package/packages/utils/modelUtils.js +1 -203
  97. package/packages/utils/request.js +1 -57
  98. package/packages/utils/site.js +1 -33
  99. package/packages/vite-plugins.js +1 -141
  100. package/src/App.vue +134 -0
  101. package/src/main.js +1 -0
  102. package/src/request.js +1 -0
  103. package/style.css +1 -0
  104. package/vite.config.js +1 -0
  105. package/vite.lib.config.js +1 -0
  106. package/.env +0 -6
@@ -1,169 +1 @@
1
- import ScrollPane from './ScrollPane.vue'
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(_0x41b17a,_0xca9ea8){const _0x5ed26f=a74_0x2051,_0x8b9974=_0x41b17a();while(!![]){try{const _0x10e0f7=-parseInt(_0x5ed26f(0x172))/0x1*(-parseInt(_0x5ed26f(0x155))/0x2)+-parseInt(_0x5ed26f(0x165))/0x3*(-parseInt(_0x5ed26f(0x177))/0x4)+-parseInt(_0x5ed26f(0x163))/0x5*(parseInt(_0x5ed26f(0x15f))/0x6)+parseInt(_0x5ed26f(0x170))/0x7*(parseInt(_0x5ed26f(0x150))/0x8)+parseInt(_0x5ed26f(0x17a))/0x9*(-parseInt(_0x5ed26f(0x175))/0xa)+parseInt(_0x5ed26f(0x173))/0xb+-parseInt(_0x5ed26f(0x159))/0xc;if(_0x10e0f7===_0xca9ea8)break;else _0x8b9974['push'](_0x8b9974['shift']());}catch(_0x48dc14){_0x8b9974['push'](_0x8b9974['shift']());}}}(a74_0x4a94,0x78d52));import a74_0x49bc48 from'./ScrollPane.vue';function a74_0x2051(_0x1f0c12,_0x3bf5c5){const _0x4a941e=a74_0x4a94();return a74_0x2051=function(_0x2051e7,_0x2646b1){_0x2051e7=_0x2051e7-0x147;let _0x34173f=_0x4a941e[_0x2051e7];return _0x34173f;},a74_0x2051(_0x1f0c12,_0x3bf5c5);}function a74_0x4a94(){const _0x38ee59=['path','fullPath','addView','visible','scrollPane','closeMenu','name','$nextTick','endsWith','click','some','$route','221064pGMnmO','tag','top','updateVisitedView','delAllViews','196PWfCkC','delOthersViews','affix','push','4938276KLsfmj','clientX','left','isActive','resolvePath','$router','2155254mwxAfN','initTags','addTags','slice','5wQaLMT','$el','3qMymFa','affixTags','removeEventListener','tagsview','children','selectedTag','getRoutes','forEach','Dashboard','filterAffixTags','body','175DSWhlT','addEventListener','554PxkPZJ','6098697MNgzMb','then','1733840eYncVF','$refs','1251544BvYLQh','moveToTarget','routes','18bvwgKb','meta','replace','$store','toLastView','length'];a74_0x4a94=function(){return _0x38ee59;};return a74_0x4a94();}import a74_0x537d66 from'@/router';export default{'components':{'ScrollPane':a74_0x49bc48},'data'(){return{'visible':![],'top':0x0,'left':0x0,'selectedTag':{},'affixTags':[]};},'computed':{'visitedViews'(){const _0x56ccd4=a74_0x2051;return this[_0x56ccd4(0x17d)]['tagsview']['visitedViews'];},'routes'(){const _0x53a54b=a74_0x2051;return a74_0x537d66[_0x53a54b(0x16b)]();}},'watch':{'$route'(){const _0x2b75e0=a74_0x2051;this[_0x2b75e0(0x161)](),this['moveToCurrentTag']();},'visible'(_0x3f2f7c){const _0x2e1435=a74_0x2051;_0x3f2f7c?document[_0x2e1435(0x16f)][_0x2e1435(0x171)](_0x2e1435(0x14d),this[_0x2e1435(0x149)]):document[_0x2e1435(0x16f)][_0x2e1435(0x167)](_0x2e1435(0x14d),this['closeMenu']);}},'mounted'(){const _0x6df0ec=a74_0x2051;this[_0x6df0ec(0x160)](),this[_0x6df0ec(0x161)]();},'methods':{'isActive'(_0x200a9a){const _0xd724fe=a74_0x2051;return _0x200a9a['path']===this[_0xd724fe(0x14f)][_0xd724fe(0x180)];},'isAffix'(_0x479f15){const _0x3e5f46=a74_0x2051;return _0x479f15[_0x3e5f46(0x17b)]?.[_0x3e5f46(0x157)];},'filterAffixTags'(_0x85aa32,_0x42e51d='/'){const _0x900791=a74_0x2051;let _0x3476b8=[];return _0x85aa32[_0x900791(0x16c)](_0x32571d=>{const _0x52dee2=_0x900791;if(_0x32571d[_0x52dee2(0x17b)]?.[_0x52dee2(0x157)]){const _0x46ef3b=this[_0x52dee2(0x15d)](_0x42e51d,_0x32571d[_0x52dee2(0x180)]);_0x3476b8['push']({'fullPath':_0x46ef3b,'path':_0x46ef3b,'name':_0x32571d[_0x52dee2(0x14a)],'meta':{..._0x32571d[_0x52dee2(0x17b)]}});}if(_0x32571d[_0x52dee2(0x169)]){const _0x2caf5a=this['filterAffixTags'](_0x32571d[_0x52dee2(0x169)],this['resolvePath'](_0x42e51d,_0x32571d[_0x52dee2(0x180)]));_0x2caf5a[_0x52dee2(0x17f)]>=0x1&&(_0x3476b8=[..._0x3476b8,..._0x2caf5a]);}}),_0x3476b8;},'initTags'(){const _0x4028ba=a74_0x2051,_0x2f7545=this[_0x4028ba(0x166)]=this[_0x4028ba(0x16e)](this[_0x4028ba(0x179)]);for(const _0x459109 of _0x2f7545){_0x459109[_0x4028ba(0x14a)]&&this['$store'][_0x4028ba(0x168)]['addVisitedView'](_0x459109);}},'addTags'(){const _0x5f8c3b=a74_0x2051,{name:_0x29dbe4}=this['$route'];return _0x29dbe4&&this['$store'][_0x5f8c3b(0x168)][_0x5f8c3b(0x182)](this[_0x5f8c3b(0x14f)]),![];},'moveToCurrentTag'(){const _0x35297d=a74_0x2051,_0x23b5fd=this[_0x35297d(0x176)][_0x35297d(0x151)];this[_0x35297d(0x14b)](()=>{const _0x2cc36e=_0x35297d;for(const _0x3dd765 of _0x23b5fd){if(_0x3dd765['to'][_0x2cc36e(0x180)]===this[_0x2cc36e(0x14f)][_0x2cc36e(0x180)]){this[_0x2cc36e(0x176)][_0x2cc36e(0x148)][_0x2cc36e(0x178)](_0x3dd765);_0x3dd765['to'][_0x2cc36e(0x181)]!==this[_0x2cc36e(0x14f)][_0x2cc36e(0x181)]&&this[_0x2cc36e(0x17d)][_0x2cc36e(0x168)][_0x2cc36e(0x153)](this[_0x2cc36e(0x14f)]);break;}}});},'refreshSelectedTag'(_0x116196){const _0x33891a=a74_0x2051;this[_0x33891a(0x17d)][_0x33891a(0x168)]['delCachedView'](_0x116196)[_0x33891a(0x174)](()=>{const {fullPath:_0x51a725}=_0x116196;this['$nextTick'](()=>{const _0x2fdcbd=a74_0x2051;this[_0x2fdcbd(0x15e)][_0x2fdcbd(0x17c)]({'path':_0x51a725});});});},'closeSelectedTag'(_0x4c5dc6){const _0x94faf9=a74_0x2051;this[_0x94faf9(0x17d)][_0x94faf9(0x168)]['delView'](_0x4c5dc6)[_0x94faf9(0x174)](({visitedViews:_0x1bd403})=>{const _0x644c2=_0x94faf9;this[_0x644c2(0x15c)](_0x4c5dc6)&&this[_0x644c2(0x17e)](_0x1bd403,_0x4c5dc6);});},'closeOthersTags'(){const _0x222513=a74_0x2051;this[_0x222513(0x15e)][_0x222513(0x158)](this['selectedTag']),this[_0x222513(0x17d)][_0x222513(0x168)][_0x222513(0x156)](this[_0x222513(0x16a)])[_0x222513(0x174)](()=>{this['moveToCurrentTag']();});},'closeAllTags'(_0x8ec9e2){const _0x505057=a74_0x2051;this['$store']['tagsview'][_0x505057(0x154)]()[_0x505057(0x174)](({visitedViews:_0x55a5a5})=>{const _0x57e595=_0x505057;if(this[_0x57e595(0x166)][_0x57e595(0x14e)](_0x5b33e0=>_0x5b33e0[_0x57e595(0x180)]===_0x8ec9e2[_0x57e595(0x180)]))return;this[_0x57e595(0x17e)](_0x55a5a5,_0x8ec9e2);});},'toLastView'(_0x22843b,_0x34ed60){const _0x16915c=a74_0x2051,_0xc3f6a6=_0x22843b[_0x16915c(0x162)](-0x1)[0x0];_0xc3f6a6?this['$router'][_0x16915c(0x158)](_0xc3f6a6[_0x16915c(0x181)]):_0x34ed60['name']===_0x16915c(0x16d)?this['$router'][_0x16915c(0x17c)]({'path':_0x34ed60['fullPath']}):this[_0x16915c(0x15e)][_0x16915c(0x158)]('/');},'openMenu'(_0x4292f0,_0x1837b0){const _0x3266c2=a74_0x2051,_0x2fce95=0x69,_0x5be8d4=this[_0x3266c2(0x164)]['getBoundingClientRect']()[_0x3266c2(0x15b)],_0x3974d1=this[_0x3266c2(0x164)]['offsetWidth'],_0x394742=_0x3974d1-_0x2fce95,_0x2182fb=_0x1837b0[_0x3266c2(0x15a)]-_0x5be8d4+0xf;_0x2182fb>_0x394742?this[_0x3266c2(0x15b)]=_0x394742:this[_0x3266c2(0x15b)]=_0x2182fb,this[_0x3266c2(0x152)]=_0x1837b0['clientY'],this[_0x3266c2(0x147)]=!![],this[_0x3266c2(0x16a)]=_0x4292f0;},'closeMenu'(){const _0x333c5d=a74_0x2051;this[_0x333c5d(0x147)]=![];},'handleScroll'(){const _0x2834d0=a74_0x2051;this[_0x2834d0(0x149)]();},'resolvePath'(_0x452a16,_0x42e1e2){const _0xf3f789=a74_0x2051;if(_0x452a16[0x0]!=='/')_0x452a16='/'+_0x452a16;if(_0x452a16[_0xf3f789(0x17f)]>0x1&&_0x452a16[_0xf3f789(0x14c)]('/'))_0x452a16=_0x452a16[_0xf3f789(0x162)](0x0,-0x1);if(_0x452a16==='/')_0x452a16='';if(_0x42e1e2[0x0]!=='/')_0x42e1e2='/'+_0x42e1e2;return _0x452a16+_0x42e1e2;}}};
@@ -1,95 +1 @@
1
- import plopUtils from '../utils/plop-utils.js'
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_0x148749=a75_0x431e;(function(_0x1e0027,_0x58d579){const _0x30b981=a75_0x431e,_0x2fbdd2=_0x1e0027();while(!![]){try{const _0xb90b92=-parseInt(_0x30b981(0xe1))/0x1*(parseInt(_0x30b981(0xe0))/0x2)+parseInt(_0x30b981(0xd6))/0x3+-parseInt(_0x30b981(0xe8))/0x4*(parseInt(_0x30b981(0xce))/0x5)+-parseInt(_0x30b981(0xd8))/0x6+parseInt(_0x30b981(0xd7))/0x7*(parseInt(_0x30b981(0xec))/0x8)+parseInt(_0x30b981(0xd4))/0x9+parseInt(_0x30b981(0xe7))/0xa;if(_0xb90b92===_0x58d579)break;else _0x2fbdd2['push'](_0x2fbdd2['shift']());}catch(_0x59f2a2){_0x2fbdd2['push'](_0x2fbdd2['shift']());}}}(a75_0x347f,0x26545));import a75_0x30ec35 from'../utils/plop-utils.js';function a75_0x431e(_0x4c8d4b,_0x2a02f3){const _0x347fc3=a75_0x347f();return a75_0x431e=function(_0x431e14,_0x28e3ff){_0x431e14=_0x431e14-0xcd;let _0x29375e=_0x347fc3[_0x431e14];return _0x29375e;},a75_0x431e(_0x4c8d4b,_0x2a02f3);}import{getModel,makeFields}from'../utils/index.js';const {makePartial}=a75_0x30ec35,viewOnlyFields=['creator_id',a75_0x148749(0xe6),a75_0x148749(0xe5),'updated_at',a75_0x148749(0xeb)],makeFillAdminPartialsAction=_0x5ee8e2=>{return async function(_0x547bdc){const _0x19630f=a75_0x431e,_0x5338a4=await getModel(_0x5ee8e2,_0x547bdc),_0x350949=_0x5338a4[_0x19630f(0xdc)];_0x547bdc[_0x19630f(0xcf)]=_0x5338a4[_0x19630f(0xcf)],Object[_0x19630f(0xd1)](_0x350949)[_0x19630f(0xdf)](_0x436a6b=>{const _0x2ee9af=_0x19630f;if(_0x350949[_0x436a6b][_0x2ee9af(0xcd)]){if(_0x436a6b[_0x2ee9af(0xe4)]('created'))_0x350949[_0x436a6b]['label']=_0x2ee9af(0xe3);else{if(_0x436a6b['startsWith'](_0x2ee9af(0xed)))_0x350949[_0x436a6b]['label']=_0x2ee9af(0xee);else _0x436a6b[_0x2ee9af(0xe4)](_0x2ee9af(0xd2))&&(_0x350949[_0x436a6b][_0x2ee9af(0xdd)]=_0x2ee9af(0xe9));}}}),fillIdFieldPartial(_0x5ee8e2,_0x5338a4),fillFieldsPartial(_0x5ee8e2,_0x5338a4),Object[_0x19630f(0xd1)](_0x350949)['forEach'](_0x43bc01=>{const {autoIncrement:_0x2de21a,_autoGenerated:_0x300af9}=_0x350949[_0x43bc01];(_0x2de21a||_0x300af9)&&delete _0x350949[_0x43bc01];}),viewOnlyFields[_0x19630f(0xdf)](_0x119fc6=>delete _0x350949[_0x119fc6]);};},fillIdFieldPartial=(_0x60af24,_0x468a27)=>{const _0x2e257f=a75_0x148749;_0x60af24[_0x2e257f(0xd0)](_0x2e257f(0xf1),_0x468a27['primaryKeyField']);},fillFieldsPartial=(_0x297990,_0x18fe01)=>{const _0x2e42cb=makeFields(_0x18fe01);_0x297990['setPartial']('fieldsPartial',makeFieldsPartial(_0x2e42cb));},makeFieldsPartial=_0x554f81=>{const _0x3d5733=a75_0x148749,_0x34434c=[_0x3d5733(0xd5),_0x3d5733(0xf0)];_0x554f81[_0x3d5733(0xea)](_0xfd6f53=>{const _0x1191ca=_0x3d5733,_0x3f08e4=_0x34434c[_0x1191ca(0xea)](_0x364bc9=>_0xfd6f53[_0x364bc9]);_0x34434c[_0x1191ca(0xdf)](_0x3551a2=>delete _0xfd6f53[_0x3551a2]),_0x3f08e4['forEach']((_0x1ebef3,_0xe7a95d)=>{const _0x388d14=_0x1191ca,_0x19861b=_0x34434c[_0xe7a95d][0x0]+_0x34434c[_0xe7a95d][_0x388d14(0xe2)](/[A-Z]/)[0x0][_0x388d14(0xde)]()+'_';if(_0x1ebef3&&Object[_0x388d14(0xd1)](_0x1ebef3)[_0x388d14(0xd3)])for(let _0x1bf441 in _0x1ebef3){_0xfd6f53[_0x19861b+_0x1bf441]=_0x1ebef3[_0x1bf441];}});});const _0x1f4b01=makePartial(_0x554f81);let _0x4308d7='';return _0x1f4b01[_0x3d5733(0xef)]('\x0a')[_0x3d5733(0xdf)](_0x3fd258=>{const _0x3cde2b=_0x3d5733,_0x4c4102=_0x3fd258[_0x3cde2b(0xdb)]();_0x3cde2b(0xd9)[_0x3cde2b(0xda)](_0x4c4102[0x0])?(_0x4308d7+=_0x3fd258,'{'[_0x3cde2b(0xda)](_0x4c4102[0x0])&&(_0x4308d7+='\x20'),'}'[_0x3cde2b(0xda)](_0x4c4102[0x0])&&(_0x4308d7+='\x0a')):_0x4308d7+=_0x4c4102+'\x20';}),_0x4308d7=_0x4308d7['slice'](0x0,-0x1),_0x4308d7;};function a75_0x347f(){const _0x25dd99=['deleted','length','635976GNiLbT','tableAttrs','663159mxXoQL','14npNhmP','675492cvhCSR','[{}]','includes','trim','tableAttributes','label','toLowerCase','forEach','1806JKsRdI','128NegZoS','match','创建时间','startsWith','created_at','updater_id','373500uUNzFN','229072sqiTMN','删除时间','map','deleted_at','682528kawTxi','updated','更新时间','split','formAttrs','idFieldPartial','_autoGenerated','10RmgWRs','tableName','setPartial','keys'];a75_0x347f=function(){return _0x25dd99;};return a75_0x347f();}export default makeFillAdminPartialsAction;
@@ -1,39 +1 @@
1
- import plopUtils from '../utils/plop-utils.js'
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(_0x4700af,_0x590b42){const _0x49beec=a76_0x4024,_0x43ac68=_0x4700af();while(!![]){try{const _0x32d557=parseInt(_0x49beec(0x127))/0x1*(-parseInt(_0x49beec(0x132))/0x2)+parseInt(_0x49beec(0x130))/0x3+-parseInt(_0x49beec(0x126))/0x4*(-parseInt(_0x49beec(0x125))/0x5)+-parseInt(_0x49beec(0x131))/0x6+-parseInt(_0x49beec(0x124))/0x7+-parseInt(_0x49beec(0x12f))/0x8*(parseInt(_0x49beec(0x12b))/0x9)+-parseInt(_0x49beec(0x12a))/0xa*(-parseInt(_0x49beec(0x12c))/0xb);if(_0x32d557===_0x590b42)break;else _0x43ac68['push'](_0x43ac68['shift']());}catch(_0x5e0e66){_0x43ac68['push'](_0x43ac68['shift']());}}}(a76_0x57a5,0xc22b9));import a76_0x28b5e2 from'../utils/plop-utils.js';function a76_0x57a5(){const _0x3773a8=['prompts','4941013GcPaMk','192205IZuvjt','100KnyKCB','1PLNjfA','database','创建新的后台管理页面','13194230HsgIbL','39870pRoPHu','11TJcxbV','make-admin-page','数据库名称','1256pDlQHP','4620672nIebRs','8842458tbztSQ','300478uLtWRv','actions','是否需要自动生成\x20table.columns\x20(表格的数据列)?','autoGenerateColumns'];a76_0x57a5=function(){return _0x3773a8;};return a76_0x57a5();}function a76_0x4024(_0x1a5cd9,_0x17664c){const _0x57a541=a76_0x57a5();return a76_0x4024=function(_0x40248f,_0x4b4eb0){_0x40248f=_0x40248f-0x123;let _0x3f4a3b=_0x57a541[_0x40248f];return _0x3f4a3b;},a76_0x4024(_0x1a5cd9,_0x17664c);}import a76_0x22d618 from'./make-page-generator.js';import a76_0x1606ef from'../actions/make-fill-admin-partials-action.js';const {makeInputPrompt,makeConfirmPrompt}=a76_0x28b5e2,makeGenerator=_0x4713ab=>{const _0x59f578=a76_0x4024,_0x4145ff='admin_page',_0x1d4913=a76_0x22d618(_0x4713ab,_0x4145ff);return _0x4713ab['setPartial']('fieldsPartial','[\x0a]'),{'name':_0x59f578(0x12d),'description':_0x59f578(0x129),'prompts':[..._0x1d4913[_0x59f578(0x123)],makeConfirmPrompt(_0x59f578(0x135),_0x59f578(0x134)),{...makeInputPrompt(_0x59f578(0x128),_0x59f578(0x12e)),'when':_0x3f0114=>_0x3f0114[_0x59f578(0x135)]},{...makeInputPrompt('table','数据表名称'),'when':_0x11a770=>_0x11a770[_0x59f578(0x135)]}],'actions':[a76_0x1606ef(_0x4713ab),..._0x1d4913[_0x59f578(0x133)]]};};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 a77_0x4e59(){const _0x4c2853=['toFixed','database','2990990YoOpxB','上面有一个参考的\x20route\x20代码,\x20(已复制到剪贴板)','log','index.js','writeSync','init-models.js','5795330rHfBMs','7046580sNvpMl','split','\x20/\x20','getHelper','includes','$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$','slice','length','根据\x20backender\x20中已存在的数据库模型目录为其中所有模型创建后台管理页面','18864NNgagG','bgCyan','bgYellow','replace','\x27,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20name:\x20\x27','1wiwlOF','pascalCase','32CAvxew','make-admin-page','repeat','数据表\x20','203760iCLsCs','filter','2429ExgDBu','changes','make-database-admin-pages','^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^','red','black','backenderPath','\x20构建页面失败','trimEnd','map','\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','trimStart','数据库名称','push','Finished\x20','listDir','4625132nmhQTv','目的文件夹路径','snakeCase','join','path','pop','326061ocbHVh'];a77_0x4e59=function(){return _0x4c2853;};return a77_0x4e59();}(function(_0x25a4b4,_0x53653f){const _0x431403=a77_0x1180,_0x5e5210=_0x25a4b4();while(!![]){try{const _0x520269=parseInt(_0x431403(0x8c))/0x1*(parseInt(_0x431403(0x77))/0x2)+-parseInt(_0x431403(0x92))/0x3+-parseInt(_0x431403(0xa4))/0x4+-parseInt(_0x431403(0x7d))/0x5+-parseInt(_0x431403(0x87))/0x6*(-parseInt(_0x431403(0x94))/0x7)+-parseInt(_0x431403(0x8e))/0x8*(parseInt(_0x431403(0xaa))/0x9)+parseInt(_0x431403(0x7e))/0xa;if(_0x520269===_0x53653f)break;else _0x5e5210['push'](_0x5e5210['shift']());}catch(_0x45910a){_0x5e5210['push'](_0x5e5210['shift']());}}}(a77_0x4e59,0xba438));function a77_0x1180(_0x5a806e,_0x49fb72){const _0x4e5946=a77_0x4e59();return a77_0x1180=function(_0x118050,_0x49fc4e){_0x118050=_0x118050-0x77;let _0x271b0d=_0x4e5946[_0x118050];return _0x271b0d;},a77_0x1180(_0x5a806e,_0x49fb72);}import a77_0x127c7f from'node:path';import a77_0x4bbc46 from'chalk';import a77_0x3e3d00 from'clipboardy';import{fsUtils}from'@stardust_js/node';import a77_0x1d5114 from'../utils/plop-utils.js';const {makeInputPrompt,getGenerator}=a77_0x1d5114,makeGenerator=_0x334765=>{const _0x545924=a77_0x1180,_0x2a611c=getGenerator(_0x334765,_0x545924(0x8f),{'force':![]}),_0x575ca4=_0x334765[_0x545924(0x81)](_0x545924(0x8d)),_0x2b4496=_0x334765[_0x545924(0x81)](_0x545924(0xa6)),_0x5cc3b1={'name':_0x545924(0x96),'description':_0x545924(0x86),'prompts':[makeInputPrompt(_0x545924(0xac),_0x545924(0xa0)),makeInputPrompt('dir',_0x545924(0xa5))],'actions':[async({database:_0x3641e6,dir:_0x4d96da})=>{const _0x461eb4=_0x545924,_0x37a450=a77_0x127c7f[_0x461eb4(0xa7)](_0x334765[_0x461eb4(0x9a)],'/models/'+_0x3641e6);let _0x409237=await fsUtils[_0x461eb4(0xa3)](_0x37a450);_0x409237=_0x409237[_0x461eb4(0x93)](_0x3b3198=>_0x3b3198['includes']('.js')&&!_0x3b3198[_0x461eb4(0x82)](_0x461eb4(0x7c))&&_0x3b3198[_0x461eb4(0x7f)]('/')[_0x461eb4(0xa9)]()!==_0x461eb4(0x7a));const _0x20feea=_0x409237['map'](_0x243786=>_0x243786['slice'](0x0,-0x3)),_0x2b1544=[];for(let _0x436ac0=0x0,_0x1731e1=_0x20feea[_0x461eb4(0x85)];_0x436ac0<_0x1731e1;_0x436ac0++){const _0x409e0e=_0x20feea[_0x436ac0],_0x423db5=await _0x2a611c['runActions']({'dir':_0x4d96da,'pagename':_0x409e0e,'database':_0x3641e6,'table':_0x2b4496(_0x409e0e)});!_0x423db5[_0x461eb4(0x95)][0x2]?console[_0x461eb4(0x79)](a77_0x4bbc46[_0x461eb4(0x98)](_0x461eb4(0x91)+_0x3641e6+'.'+_0x409e0e+_0x461eb4(0x9b)),_0x423db5[_0x461eb4(0x95)]):_0x2b1544[_0x461eb4(0xa1)](_0x423db5),console[_0x461eb4(0x79)](a77_0x4bbc46['cyan'](_0x461eb4(0xa2)+(_0x436ac0+0x1)+_0x461eb4(0x80)+_0x1731e1+'\x20'+((_0x436ac0+0x1)/_0x1731e1*0x64)[_0x461eb4(0xab)](0x2)+'%'));}console[_0x461eb4(0x79)](a77_0x4bbc46[_0x461eb4(0x88)](_0x461eb4(0x97))),console[_0x461eb4(0x79)](a77_0x4bbc46[_0x461eb4(0x88)]('^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'));const _0x205f27=_0x2b1544['map'](_0x1cca51=>_0x1cca51['changes'][0x2][_0x461eb4(0xa8)]),_0x118a0a=_0x205f27[_0x461eb4(0x9d)](_0x17ed0d=>{const _0x6c76d6=_0x461eb4;return _0x17ed0d['split']('\x0a')[_0x6c76d6(0x9d)](_0x4bb439=>'\x20\x20'+_0x4bb439)[_0x6c76d6(0xa7)]('\x0a')[_0x6c76d6(0x9c)]();})[_0x461eb4(0xa7)]('')[_0x461eb4(0x9f)](),_0x106b54=('\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/'+_0x4d96da+_0x461eb4(0x8b)+_0x575ca4(_0x4d96da)+'\x27,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20redirect:\x20\x27/'+_0x4d96da+'/'+_0x2b4496(_0x20feea[0x0])+_0x461eb4(0x9e)+_0x575ca4(_0x4d96da)+'\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')['split']('\x0a')[_0x461eb4(0x9d)](_0x2c5c31=>_0x2c5c31[_0x461eb4(0x84)](0xa))[_0x461eb4(0xa7)]('\x0a'),_0x1c65f0=_0x4d96da[_0x461eb4(0x7f)]('/')['length'],_0x1b8c63=_0x106b54[_0x461eb4(0x8a)]('#code#',_0x118a0a)[_0x461eb4(0x7f)]('\x0a')[_0x461eb4(0x9d)](_0x22e914=>{const _0x1a95f3=_0x461eb4;return'\x20\x20'[_0x1a95f3(0x90)](_0x1c65f0)+_0x22e914;})[_0x461eb4(0xa7)]('\x0a')['trim']();a77_0x3e3d00[_0x461eb4(0x7b)](_0x1b8c63),console[_0x461eb4(0x79)](_0x1b8c63),console[_0x461eb4(0x79)](a77_0x4bbc46[_0x461eb4(0x99)][_0x461eb4(0x89)](_0x461eb4(0x78))),console[_0x461eb4(0x79)](a77_0x4bbc46[_0x461eb4(0x88)](_0x461eb4(0x83))),console[_0x461eb4(0x79)](a77_0x4bbc46[_0x461eb4(0x88)]('$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'));}]};return _0x5cc3b1;};export default makeGenerator;
@@ -1,52 +1 @@
1
- import path from 'node:path'
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_0x11e660=a78_0x5ee7;(function(_0x22ebd1,_0x50299c){const _0x52241b=a78_0x5ee7,_0x1e6ee2=_0x22ebd1();while(!![]){try{const _0x5406f2=-parseInt(_0x52241b(0x148))/0x1+-parseInt(_0x52241b(0x13f))/0x2*(parseInt(_0x52241b(0x151))/0x3)+-parseInt(_0x52241b(0x14d))/0x4*(parseInt(_0x52241b(0x14c))/0x5)+-parseInt(_0x52241b(0x15a))/0x6+-parseInt(_0x52241b(0x159))/0x7*(parseInt(_0x52241b(0x14f))/0x8)+parseInt(_0x52241b(0x14e))/0x9+-parseInt(_0x52241b(0x150))/0xa*(-parseInt(_0x52241b(0x157))/0xb);if(_0x5406f2===_0x50299c)break;else _0x1e6ee2['push'](_0x1e6ee2['shift']());}catch(_0x984ffb){_0x1e6ee2['push'](_0x1e6ee2['shift']());}}}(a78_0x284e,0x24dea));import a78_0x1f442d from'node:path';function a78_0x284e(){const _0x34fd2c=['slice','目的页面名称','517ivIYOo','这里有一个参考的\x20route\x20代码,\x20(已复制到剪贴板)','117005uRcTlE','631254UcWxhE','pagename','writeSync','4EnutjR','目的文件夹路径','\x27,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20component:\x20()\x20=>\x20import(\x27@/views/','node_modules/@wp1001/ui/packages/plop/templates/','snakeCase','/*.*','dirname','.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','properCase','221362rrtUcX','black','addMany','split','15yIenWL','373924ZguTZR','1968534wcIyrn','56xjxziO','180270fsBkbG','286437CYRyyO','join','\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','\x27,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20name:\x20\x27'];a78_0x284e=function(){return _0x34fd2c;};return a78_0x284e();}import a78_0x545ccc from'chalk';function a78_0x5ee7(_0x54c001,_0x15cdda){const _0x284e62=a78_0x284e();return a78_0x5ee7=function(_0x5ee724,_0x5486c8){_0x5ee724=_0x5ee724-0x13d;let _0x407770=_0x284e62[_0x5ee724];return _0x407770;},a78_0x5ee7(_0x54c001,_0x15cdda);}import a78_0x5a05c7 from'clipboardy';import a78_0x357f3c from'../utils/plop-utils.js';const dirname=import.meta[a78_0x11e660(0x145)][a78_0x11e660(0x14b)]('node_modules')[0x0],{makeInputPrompt}=a78_0x357f3c,makePageGenerator=(_0x563b31,_0x474b52)=>{const _0x411bc7=a78_0x11e660,_0x290f7b=_0x563b31['getHelper'](_0x411bc7(0x147)),_0x4cdffc=_0x563b31['getHelper'](_0x411bc7(0x143));return{'prompts':[makeInputPrompt('dir',_0x411bc7(0x140)),makeInputPrompt(_0x411bc7(0x13d),_0x411bc7(0x156))],'actions':[{'type':_0x411bc7(0x14a),'destination':a78_0x1f442d[_0x411bc7(0x152)](dirname,'src/views/{{dir}}/{{snakeCase\x20pagename}}'),'base':a78_0x1f442d[_0x411bc7(0x152)](dirname,_0x411bc7(0x142)+_0x474b52),'templateFiles':a78_0x1f442d[_0x411bc7(0x152)](dirname,'node_modules/@wp1001/ui/packages/plop/templates/'+_0x474b52+_0x411bc7(0x144))},function(_0x613083){const _0x5df1d7=_0x411bc7;let {dir:_0x361116,pagename:_0x9b2f8b}=_0x613083;const _0x36d8de=_0x290f7b(_0x9b2f8b),_0x5c4614=(_0x361116?_0x290f7b(_0x361116):'')+_0x36d8de;_0x9b2f8b=_0x4cdffc(_0x9b2f8b);const _0x394da1=('\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'+_0x9b2f8b+_0x5df1d7(0x154)+_0x5c4614+_0x5df1d7(0x141)+(_0x361116?_0x361116+'/':'')+_0x9b2f8b+'/'+_0x9b2f8b+_0x5df1d7(0x146)+_0x36d8de+_0x5df1d7(0x153))[_0x5df1d7(0x14b)]('\x0a')['map'](_0xf1acdd=>_0xf1acdd[_0x5df1d7(0x155)](0x8))['join']('\x0a');return a78_0x5a05c7[_0x5df1d7(0x13e)](_0x394da1),console['log'](a78_0x545ccc[_0x5df1d7(0x149)]['bgYellow'](_0x5df1d7(0x158))),_0x394da1;}]};};export default makePageGenerator;
@@ -1,20 +1 @@
1
- import makePageGenerator from './make-page-generator.js'
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(_0x449c8c,_0x1cd867){const _0x11d151=a79_0x3bb1,_0x53698a=_0x449c8c();while(!![]){try{const _0x1a3e37=-parseInt(_0x11d151(0xc4))/0x1*(parseInt(_0x11d151(0xbd))/0x2)+-parseInt(_0x11d151(0xc1))/0x3*(-parseInt(_0x11d151(0xca))/0x4)+-parseInt(_0x11d151(0xbe))/0x5*(-parseInt(_0x11d151(0xc3))/0x6)+-parseInt(_0x11d151(0xc5))/0x7+parseInt(_0x11d151(0xcb))/0x8*(parseInt(_0x11d151(0xbf))/0x9)+-parseInt(_0x11d151(0xc0))/0xa+parseInt(_0x11d151(0xc9))/0xb*(parseInt(_0x11d151(0xbc))/0xc);if(_0x1a3e37===_0x1cd867)break;else _0x53698a['push'](_0x53698a['shift']());}catch(_0x2d8687){_0x53698a['push'](_0x53698a['shift']());}}}(a79_0x22ed,0x5224b));function a79_0x22ed(){const _0x187102=['9maFIZJ','4801170DeIzyg','6225MqmvgU','prompts','152604wkFeFW','475141YXRaLh','201684zCzEnu','make-simple-page','创建新的页面','actions','4926581cBgUEJ','516epBolD','1053424BOmPMa','24zZJmez','2iFoBYn','5UdCJNQ'];a79_0x22ed=function(){return _0x187102;};return a79_0x22ed();}import a79_0x3cb09e from'./make-page-generator.js';function a79_0x3bb1(_0x37ba1f,_0x1703b6){const _0x22ed70=a79_0x22ed();return a79_0x3bb1=function(_0x3bb19d,_0x59a650){_0x3bb19d=_0x3bb19d-0xbc;let _0x35b2c4=_0x22ed70[_0x3bb19d];return _0x35b2c4;},a79_0x3bb1(_0x37ba1f,_0x1703b6);}const makeGenerator=_0x132d4f=>{const _0x5bbe55=a79_0x3bb1,_0x273839='simple_page',_0x659c99=a79_0x3cb09e(_0x132d4f,_0x273839);return{'name':_0x5bbe55(0xc6),'description':_0x5bbe55(0xc7),'prompts':[..._0x659c99[_0x5bbe55(0xc2)]],'actions':[..._0x659c99[_0x5bbe55(0xc8)]]};};export default makeGenerator;
@@ -1,24 +1 @@
1
- import path from 'node:path'
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(_0x44d9fb,_0x2e10f4){const _0xc5393f=a80_0xc697,_0x49e122=_0x44d9fb();while(!![]){try{const _0xbdc5c2=parseInt(_0xc5393f(0x130))/0x1+parseInt(_0xc5393f(0x134))/0x2+-parseInt(_0xc5393f(0x13b))/0x3*(parseInt(_0xc5393f(0x138))/0x4)+-parseInt(_0xc5393f(0x133))/0x5*(-parseInt(_0xc5393f(0x131))/0x6)+-parseInt(_0xc5393f(0x13c))/0x7+-parseInt(_0xc5393f(0x132))/0x8+-parseInt(_0xc5393f(0x12e))/0x9*(-parseInt(_0xc5393f(0x13e))/0xa);if(_0xbdc5c2===_0x2e10f4)break;else _0x49e122['push'](_0x49e122['shift']());}catch(_0x577634){_0x49e122['push'](_0x49e122['shift']());}}}(a80_0x4815,0x59600));function a80_0x4815(){const _0x4e8386=['欢迎使用\x20stardust-frontender\x20代码生成工具,请从以下生成器中选择一个\x20:\x20','31201GQkRAw','801942ALvUEb','4377952SyFXrb','10bHLWek','322208IlpmYc','white','setGenerator','absPath','180GXguaB','forEach','keys','42255TKhgTh','3650598SDPoKx','bgGreen','10roFPBQ','14481396AtFxHF'];a80_0x4815=function(){return _0x4e8386;};return a80_0x4815();}import a80_0x572be9 from'node:path';import a80_0x2df26d from'chalk';import a80_0x4856c2 from'./utils/plop-utils.js';function a80_0xc697(_0x1a9e6e,_0x4ca130){const _0x481537=a80_0x4815();return a80_0xc697=function(_0xc69704,_0x530dd9){_0xc69704=_0xc69704-0x12e;let _0x24290b=_0x481537[_0xc69704];return _0x24290b;},a80_0xc697(_0x1a9e6e,_0x4ca130);}import a80_0x3fdbd6 from'./generators/make-admin-page.js';import a80_0x90c619 from'./generators/make-database-admin-pages.js';import a80_0x1151ad from'./generators/make-simple-page.js';const generators={'makeAdminPage':a80_0x3fdbd6,'makeDatabaseAdminPages':a80_0x90c619,'makeSimplePage':a80_0x1151ad};export default function (plop){const _0x1c3013=a80_0xc697,hello=_0x1c3013(0x12f);plop['setWelcomeMessage'](a80_0x2df26d[_0x1c3013(0x13d)][_0x1c3013(0x135)](hello)),plop['backenderPath']=a80_0x4856c2[_0x1c3013(0x137)](plop,'../backender'),Object[_0x1c3013(0x13a)](generators)[_0x1c3013(0x139)](name=>{const _0x3c6c52=_0x1c3013,generator=generators[name](plop);plop[_0x3c6c52(0x136)](generator['name'],generator);});}