w-web-perm 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/.editorconfig +9 -0
  2. package/.eslintignore +3 -0
  3. package/.eslintrc.js +55 -0
  4. package/.github/workflows/ci-test.yml +24 -0
  5. package/.jsdoc +25 -0
  6. package/.vscode/launch.json +21 -0
  7. package/LICENSE +21 -0
  8. package/README.md +24 -0
  9. package/SECURITY.md +5 -0
  10. package/babel.config.js +15 -0
  11. package/dist/css/app.79b4b59b.css +1 -0
  12. package/dist/css/chunk-vendors.65775501.css +5 -0
  13. package/dist/index.tmp +1 -0
  14. package/dist/js/app-legacy.954e168c.js +2 -0
  15. package/dist/js/app-legacy.954e168c.js.map +1 -0
  16. package/dist/js/app.954e168c.js +2 -0
  17. package/dist/js/app.954e168c.js.map +1 -0
  18. package/dist/js/chunk-vendors-legacy.f5f1a231.js +13 -0
  19. package/dist/js/chunk-vendors-legacy.f5f1a231.js.map +1 -0
  20. package/dist/js/chunk-vendors.f5f1a231.js +13 -0
  21. package/dist/js/chunk-vendors.f5f1a231.js.map +1 -0
  22. package/dist/w-web-perm.umd.js +7 -0
  23. package/dist/w-web-perm.umd.js.map +1 -0
  24. package/docs/WWebPerm.html +826 -0
  25. package/docs/WWebPerm.mjs.html +558 -0
  26. package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  27. package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  28. package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  29. package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  30. package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  31. package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  32. package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  33. package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  34. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  35. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
  36. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  37. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  38. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  39. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  40. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
  41. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  42. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  43. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  44. package/docs/index.html +84 -0
  45. package/docs/scripts/collapse.js +39 -0
  46. package/docs/scripts/commonNav.js +28 -0
  47. package/docs/scripts/linenumber.js +25 -0
  48. package/docs/scripts/nav.js +12 -0
  49. package/docs/scripts/polyfill.js +4 -0
  50. package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
  51. package/docs/scripts/prettify/lang-css.js +2 -0
  52. package/docs/scripts/prettify/prettify.js +28 -0
  53. package/docs/scripts/search.js +99 -0
  54. package/docs/styles/jsdoc.css +776 -0
  55. package/docs/styles/prettify.css +80 -0
  56. package/g.getSettings.mjs +17 -0
  57. package/g.mDb.mjs +10 -0
  58. package/g.mInitialTestData.mjs +20 -0
  59. package/g.mOrm.mjs +24 -0
  60. package/package.json +75 -0
  61. package/public/index.html +23 -0
  62. package/server/WWebPerm.mjs +486 -0
  63. package/src/App.vue +153 -0
  64. package/src/components/Common/CheckYes.vue +85 -0
  65. package/src/components/Common/CheckYesNo.vue +91 -0
  66. package/src/components/Common/LabelItem.vue +106 -0
  67. package/src/components/Common/LoadingWinBar.vue +87 -0
  68. package/src/components/Layout.vue +152 -0
  69. package/src/components/LayoutContent.vue +246 -0
  70. package/src/components/LayoutContentGroups.vue +664 -0
  71. package/src/components/LayoutContentTargets.vue +538 -0
  72. package/src/components/LayoutContentUsers.vue +493 -0
  73. package/src/components/LayoutState.vue +91 -0
  74. package/src/components/VeUser.vue +453 -0
  75. package/src/components/ruleGroup.vue +667 -0
  76. package/src/main.js +103 -0
  77. package/src/perm.mjs +61 -0
  78. package/src/plugins/mDataSelectorSchema.mjs +30 -0
  79. package/src/plugins/mDataSupport.mjs +66 -0
  80. package/src/plugins/mShare.mjs +366 -0
  81. package/src/plugins/mUI.mjs +229 -0
  82. package/src/plugins/mVuetify.mjs +12 -0
  83. package/src/schema/gi.mjs +8 -0
  84. package/src/schema/index.mjs +20 -0
  85. package/src/schema/tables/ruleGroups.mjs +100 -0
  86. package/src/schema/tables/targets.mjs +100 -0
  87. package/src/schema/tables/users.mjs +125 -0
  88. package/src/store/actions.mjs +1 -0
  89. package/src/store/getters.mjs +1 -0
  90. package/src/store/index.mjs +25 -0
  91. package/src/store/mutations.mjs +201 -0
  92. package/src/store/types.mjs +15 -0
  93. package/srv.mjs +52 -0
  94. package/tableTags-web-perm.json +1 -0
  95. package/test/all.test.mjs +10 -0
  96. package/toolg/addVersion.mjs +4 -0
  97. package/toolg/cleanFolder.mjs +4 -0
  98. package/toolg/gDistRollup.mjs +36 -0
  99. package/toolg/genEntry.mjs +23 -0
  100. package/toolg/modifyReadme.mjs +4 -0
  101. package/vue.config.js +15 -0
@@ -0,0 +1,246 @@
1
+ <template>
2
+ <div
3
+ style="height:100%; width:100%;"
4
+ v-domresize
5
+ @domresize="resize"
6
+ >
7
+
8
+ <template v-if="syncState">
9
+
10
+ <WDrawer
11
+ :style="`height:${panelHeight}px; width:100%;`"
12
+ v-model="drawer"
13
+ :drawerWidth.sync="drawerWidth"
14
+ :drawerWidthMin="drawerWidthMin"
15
+ :drawerWidthMax="drawerWidthMax"
16
+ :mode="'from-left'"
17
+ :afloat="drawerAfloat"
18
+ :dragDrawerWidth="true"
19
+ >
20
+
21
+ <template v-slot:drawer="props">
22
+
23
+ <!-- 因drawer內部resize觸發可能不足或有容許誤差, 使用props.height可能會有多1px情形, 導致出現垂直捲軸 -->
24
+ <div :style="`height:${panelHeight}px; background:#fff; position:relative;`">
25
+
26
+ <WListVertical
27
+ style="height:100%;"
28
+ :items="menus"
29
+ :itemActive="menuActive"
30
+ :item-text-color="'#222'"
31
+ :item-text-color-hover="'#444'"
32
+ :item-text-color-active="'#EF6C00'"
33
+ :item-icon-color="'#222'"
34
+ :item-icon-color-hover="'#444'"
35
+ :item-icon-color-active="'#EF6C00'"
36
+ :item-background-color="'#fff'"
37
+ :item-background-color-hover="'#f2f2f2'"
38
+ :item-background-color-active="'#FFF3E0'"
39
+ :paddingStyle="{v:15,h:15}"
40
+ @click="(menu)=>{menuKey=menu.key}"
41
+ ></WListVertical>
42
+
43
+ <div
44
+ :style="`position:absolute; top:1px; right:4px;`"
45
+ v-if="drawer"
46
+ >
47
+ <WButtonCircle
48
+ :paddingStyle="{v:3,h:3}"
49
+ :icon="'mdi-arrow-left'"
50
+ :iconSize="16"
51
+ :backgroundColor="'#fff'"
52
+ :backgroundColorHover="'#eee'"
53
+ :backgroundColorFocus="'#fff'"
54
+ :borderColor="'transparent'"
55
+ :borderColorHover="'#eee'"
56
+ :borderColorFocus="'#eee'"
57
+ :tooltip="$t('menuTreeHide')"
58
+ :shadow="true"
59
+ @click="drawer=false"
60
+ ></WButtonCircle>
61
+ </div>
62
+
63
+ </div>
64
+
65
+ </template>
66
+
67
+ <template v-slot:content="props">
68
+ <!-- 因drawer內部resize觸發可能不足或有容許誤差, 使用props.height可能會有多1px情形, 導致出現垂直捲軸 -->
69
+ <div :style="`height:${panelHeight}px; width:${props.width}px; position:relative;`">
70
+
71
+ <template>
72
+
73
+ <LayoutContentTargets
74
+ v-if="menuKey==='blocks'"
75
+ ></LayoutContentTargets>
76
+
77
+ <LayoutContentGroups
78
+ v-if="menuKey==='groups'"
79
+ ></LayoutContentGroups>
80
+
81
+ <LayoutContentUsers
82
+ v-if="menuKey==='users'"
83
+ ></LayoutContentUsers>
84
+
85
+ </template>
86
+
87
+ <div
88
+ :style="`position:absolute; top:1px; left:4px;`"
89
+ v-if="!drawer"
90
+ >
91
+ <WButtonCircle
92
+ :paddingStyle="{v:3,h:3}"
93
+ :icon="'mdi-arrow-right'"
94
+ :iconSize="16"
95
+ :backgroundColor="'#fff'"
96
+ :backgroundColorHover="'#eee'"
97
+ :backgroundColorFocus="'#fff'"
98
+ :borderColor="'transparent'"
99
+ :borderColorHover="'#eee'"
100
+ :borderColorFocus="'#eee'"
101
+ :tooltip="$t('menuTreeShow')"
102
+ :shadow="true"
103
+ @click="drawer=true"
104
+ ></WButtonCircle>
105
+ </div>
106
+
107
+ </div>
108
+ </template>
109
+
110
+ </WDrawer>
111
+
112
+ </template>
113
+
114
+ <template v-else>
115
+ <div
116
+ style="padding:20px; font-size:0.9rem;"
117
+ >
118
+ {{$t('waitingData')}}
119
+ </div>
120
+ </template>
121
+
122
+ </div>
123
+ </template>
124
+
125
+ <script>
126
+ import { mdiGamepadCircle, mdiStackOverflow, mdiAccountGroupOutline, mdiBallotRecountOutline } from '@mdi/js/mdi.js'
127
+ import get from 'lodash/get'
128
+ // import map from 'lodash/map'
129
+ // import each from 'lodash/each'
130
+ // import cloneDeep from 'lodash/cloneDeep'
131
+ // import pmSeries from 'wsemi/src/pmSeries.mjs'
132
+ import WDrawer from 'w-component-vue/src/components/WDrawer.vue'
133
+ import WButtonCircle from 'w-component-vue/src/components/WButtonCircle.vue'
134
+ import WListVertical from 'w-component-vue/src/components/WListVertical.vue'
135
+ import LayoutContentTargets from './LayoutContentTargets.vue'
136
+ import LayoutContentGroups from './LayoutContentGroups.vue'
137
+ import LayoutContentUsers from './LayoutContentUsers.vue'
138
+
139
+
140
+ export default {
141
+ components: {
142
+ WDrawer,
143
+ WButtonCircle,
144
+ WListVertical,
145
+ LayoutContentTargets,
146
+ LayoutContentGroups,
147
+ LayoutContentUsers,
148
+ },
149
+ props: {
150
+ // menuKey: {
151
+ // type: String,
152
+ // default: '',
153
+ // },
154
+ },
155
+ data: function() {
156
+ let menus = [
157
+ {
158
+ key: 'blocks',
159
+ text: '管理區塊',
160
+ icon: mdiGamepadCircle,
161
+ },
162
+ {
163
+ key: 'groups',
164
+ text: '權限群組',
165
+ icon: mdiStackOverflow,
166
+ },
167
+ {
168
+ key: 'users',
169
+ text: '使用者權限',
170
+ icon: mdiAccountGroupOutline,
171
+ },
172
+ // {
173
+ // key: 'logs',
174
+ // text: '事件紀錄',
175
+ // icon: mdiBallotRecountOutline,
176
+ // },
177
+ ]
178
+ return {
179
+
180
+ menuKey: 'blocks',
181
+ menus,
182
+ menuActive: menus[0],
183
+
184
+ panelWidth: 0,
185
+ panelWidthTemp: 0,
186
+ panelHeight: 0,
187
+
188
+ drawer: true,
189
+ drawerAfloat: false,
190
+ drawerWidth: 180,
191
+ drawerWidthMin: 150,
192
+ drawerWidthMax: 300,
193
+
194
+ }
195
+ },
196
+ computed: {
197
+
198
+ syncState: function() {
199
+ return get(this, '$store.state.syncState')
200
+ },
201
+
202
+ },
203
+ methods: {
204
+
205
+ resize: function(msg) {
206
+ // console.log('methods resize', msg)
207
+
208
+ let vo = this
209
+
210
+ //save
211
+ vo.panelWidth = msg.snew.clientWidth
212
+ vo.panelHeight = msg.snew.clientHeight
213
+ // console.log('vo.panelHeight', vo.panelHeight)
214
+
215
+ //modeResize
216
+ let modeResize = '' //寬度可能相同故得有預設空字串的種類
217
+ if (vo.panelWidth > vo.panelWidthTemp) {
218
+ modeResize = 'toLarge'
219
+ }
220
+ else if (vo.panelWidth < vo.panelWidthTemp) {
221
+ modeResize = 'toSmall'
222
+ }
223
+ // console.log('modeResize', modeResize, vo.panelWidth, vo.panelWidthTemp)
224
+
225
+ //drawer
226
+ if (vo.drawer && modeResize === 'toSmall' && vo.panelWidth < 1.7 * vo.drawerWidthMax) { //已開啟抽屜且為變窄時才偵測
227
+ vo.drawer = false
228
+ }
229
+ else if (!vo.drawer && modeResize === 'toLarge' && vo.panelWidth >= 1.7 * vo.drawerWidthMax) { //已隱藏抽屜且為變寬時才偵測
230
+ vo.drawer = true
231
+ }
232
+
233
+ //drawerAfloat
234
+ vo.drawerAfloat = vo.panelWidth < 1.7 * vo.drawerWidthMax
235
+
236
+ //save
237
+ vo.panelWidthTemp = vo.panelWidth
238
+
239
+ },
240
+
241
+ }
242
+ }
243
+ </script>
244
+
245
+ <style scoped>
246
+ </style>