@mptw/skylens-ui 1.4.34 → 1.4.36

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mptw/skylens-ui",
3
3
  "type": "module",
4
- "version": "1.4.34",
4
+ "version": "1.4.36",
5
5
  "main": "./nuxt.config.ts",
6
6
  "scripts": {
7
7
  "dev": "nuxi dev .playground",
@@ -12,8 +12,8 @@
12
12
  "postinstall": "nuxt prepare .playground"
13
13
  },
14
14
  "devDependencies": {
15
- "@nuxt/eslint-config": "^0.7.2",
16
- "eslint": "^9.16.0",
15
+ "@nuxt/eslint-config": "^0.7.4",
16
+ "eslint": "^9.17.0",
17
17
  "nuxt": "^3.14.1592",
18
18
  "typescript": "^5.7.2"
19
19
  },
@@ -33,7 +33,7 @@
33
33
  "@vue/language-plugin-pug": "^2.1.10",
34
34
  "commonmark": "^0.31.2",
35
35
  "date-fns": "^4.1.0",
36
- "dompurify": "^3.2.2",
36
+ "dompurify": "^3.2.3",
37
37
  "echarts": "^5.5.1",
38
38
  "echarts-wordcloud": "^2.1.0",
39
39
  "exceljs": "^4.4.0",
@@ -239,8 +239,8 @@ module.exports = {
239
239
  margin: 'margin',
240
240
  'font-size': 'font-size',
241
241
  padding: 'padding',
242
- 'siderbar-nav-item': 'border-radius, width',
243
- 'siderbar-nav-item-icon': 'width, height, font-size',
242
+ 'sidebar-nav-item': 'border-radius, width',
243
+ 'sidebar-nav-item-icon': 'width, height, font-size',
244
244
  'border-radius': 'border-radius',
245
245
  },
246
246
  opacity: {
@@ -1,394 +0,0 @@
1
- <template lang="pug">
2
- .siderbar(:class="{ closure: isClosure, dark }")
3
- .siderbar-modal(@click="onClickedToggle")
4
- .siderbar-logo
5
- a.logo(href="javascript:;" @click="onClickedLogo")
6
- img.color(src="images/commons/app-logo.png")
7
- img.white(src="images/commons/app-logo-white.png")
8
- nav.site-nav
9
- .nav-wrapper.custom-scrollbar-y
10
- ul(v-if="firstConfig.length > 0")
11
- SLSiderbarNavItem(
12
- v-for="item, i in firstConfig"
13
- :config="item"
14
- :isSiderbarClosure="isClosure"
15
- :key="i"
16
- @toggle="onClickedToggle"
17
- @click-item="onClickedItem"
18
- )
19
- nav.mng-nav
20
- .nav-wrapper.custom-scrollbar-y
21
- ul(v-if="secondConfig.length > 0")
22
- SLSiderbarNavItem(
23
- v-for="item, i in secondConfig"
24
- :config="item"
25
- :isSiderbarClosure="isClosure"
26
- :key="i"
27
- @toggle="onClickedToggle"
28
- @click-item="onClickedItem"
29
- )
30
- .siderbar-mode-setting
31
- .siderbar-mode-setting-title 模式
32
- SLIOSSwitch(
33
- :modelValue="dark"
34
- trueLabel="深色"
35
- minTrueLabel="深"
36
- falseLabel="淺色"
37
- minFalseLabel="淺"
38
- :size="isClosure ? 'min' : ''"
39
- @update:modelValue="onUpdatedMode"
40
- )
41
- a.siderbar-toggle(href="javascript:;", @click="onClickedToggle")
42
- SLIcon(icon="chevron-left")
43
- SLIcon(icon="chevron-right")
44
- </template>
45
-
46
- <script lang="ts">
47
- import type { PropType } from "vue";
48
- import type { NavConfigType } from "~ui/interface/NavConfigType";
49
-
50
- export default defineComponent({
51
- name: "SLSidebarNav",
52
- props: {
53
- dark: {
54
- type: Boolean,
55
- default: false,
56
- },
57
- firstConfig: {
58
- type: Array as PropType<NavConfigType>,
59
- default: () => [],
60
- },
61
- secondConfig: {
62
- type: Array as PropType<NavConfigType>,
63
- default: () => [],
64
- },
65
- },
66
- emits: ["click:logo", "update:dark", "update:closure", "click:insight"],
67
- setup(_, { emit }) {
68
- const isClosure = ref(false);
69
-
70
- function onClickedToggle() {
71
- isClosure.value = !isClosure.value;
72
- }
73
-
74
- function onClickedLogo() {
75
- emit("click:logo");
76
- }
77
-
78
- function onClickedItem(
79
- eventName:
80
- | "click:logo"
81
- | "update:dark"
82
- | "update:closure"
83
- | "click:insight"
84
- ) {
85
- emit(eventName);
86
- }
87
-
88
- function onUpdatedMode(isDark: boolean) {
89
- emit("update:dark", isDark);
90
- }
91
-
92
- watch(isClosure, () => {
93
- emit("update:closure", isClosure.value);
94
- });
95
-
96
- return {
97
- isClosure,
98
- onClickedToggle,
99
- onClickedLogo,
100
- onClickedItem,
101
- onUpdatedMode,
102
- };
103
- },
104
- });
105
- </script>
106
-
107
- <style lang="stylus">
108
- .siderbar
109
- @apply relative flex flex-col h-full bg-white shadow transition-all
110
- width 188px
111
-
112
- &.dark
113
- @apply bg-primary
114
-
115
- &.closure
116
- nav
117
- .siderbar-nav-item
118
- &.included
119
- @apply text-primary-600
120
-
121
- & > .nav-item-container
122
- .nav-item-wrapper
123
- @apply bg-primary-25
124
-
125
- .siderbar-toggle
126
- &:hover
127
- @apply bg-primary-300 text-white
128
-
129
- .siderbar-logo
130
- .logo
131
- img.color
132
- @apply hidden
133
-
134
- img.white
135
- @apply block
136
-
137
- nav
138
- .nav-wrapper.custom-scrollbar-y
139
- /* Handle */
140
- &::-webkit-scrollbar-thumb
141
- @apply bg-primary-600
142
-
143
- /* Handle on hover */
144
- &::-webkit-scrollbar-thumb:hover
145
- @apply bg-primary-600
146
-
147
- .siderbar-nav-item
148
- @apply text-white
149
-
150
- &.highlighted
151
- @apply text-primary-600
152
-
153
- & > .nav-item-container
154
- &:hover
155
- .nav-item-wrapper
156
- @apply bg-primary-25
157
-
158
- .nav-item-wrapper
159
- @apply bg-primary-25
160
-
161
- .nav-item-container
162
- &:hover
163
- .nav-item-wrapper
164
- @apply bg-primary-600
165
-
166
- .nav-item-wrapper
167
- .nav-item-highlight-border
168
- @apply bg-insight-hint-line
169
-
170
- .siderbar-mode-setting
171
- @apply text-white
172
-
173
- .ios-switch
174
- label
175
- @apply border-primary-600
176
- background #2D2F57
177
-
178
- &:before
179
- @apply border-2 border-primary-600 bg-primary-300
180
-
181
- .siderbar-toggle
182
- @apply bg-primary-300 text-white
183
-
184
- &:hover
185
- @apply bg-primary-25 text-primary
186
-
187
- &.closure
188
- margin-left -188px
189
-
190
- @media screen and (min-width: 1024px)
191
- width 86px
192
- margin-left 0
193
-
194
- .siderbar-modal
195
- @apply hidden
196
-
197
- .siderbar-toggle
198
- @apply bg-primary-600 text-white
199
- margin-right -20px
200
- border-radius 0px 12px 12px 0px
201
-
202
- &:hover
203
- @apply bg-primary-300 text-white
204
-
205
- .icon-chevron-left
206
- @apply hidden
207
-
208
- .icon-chevron-right
209
- @apply inline-block
210
-
211
- nav
212
- .siderbar-nav-item
213
- &.included
214
- @apply text-white
215
-
216
- & > .nav-item-container
217
- .nav-item-wrapper
218
- @apply bg-primary-600
219
-
220
- .nav-item-container
221
- @apply rounded-r-full
222
- width 37px
223
-
224
- .nav-item-wrapper
225
- @apply pl-0
226
-
227
- .nav-item-button
228
- .button-pre-icon
229
- @apply text-lg
230
- width 37px
231
- height 37px
232
-
233
- .button-title
234
- @apply opacity-0
235
-
236
- .nav-item-toggle
237
- @apply opacity-0
238
-
239
- .siderbar-mode-setting
240
- @apply p-0 justify-center space-x-0
241
-
242
- &-title
243
- @apply hidden
244
-
245
- .ios-switch
246
- @apply flex-grow-0 flex-shrink-0
247
-
248
- &-modal
249
- @apply fixed top-0 left-0 w-full h-full bg-white opacity-0
250
- @apply s('lg:hidden')
251
-
252
- &-logo
253
- @apply flex-grow-0 flex-shrink-0 relative flex justify-center py-5
254
-
255
- .logo
256
- @apply block
257
-
258
- img.white
259
- @apply hidden
260
-
261
- nav + nav
262
- @apply border-t border-primary-300
263
-
264
- nav
265
- @apply flex-grow relative flex flex-col overflow-hidden
266
-
267
- &.mng-nav
268
- @apply flex-grow-0 flex-shrink-0 pt-2 mt-auto
269
-
270
- .nav-wrapper
271
- @apply flex-grow
272
-
273
- &.custom-scrollbar-y
274
- @apply overflow-hidden s('hover:overflow-auto')
275
-
276
- ul
277
- @apply flex flex-col space-y-2
278
-
279
- .siderbar-nav-item
280
- @apply relative flex flex-col items-center w-full text-primary text-base
281
-
282
- &.opened
283
- .nav-item-toggle
284
- @apply rotate-90
285
-
286
- &.included
287
- & > .nav-item-container
288
- .nav-item-wrapper
289
- .nav-item-button
290
- .button-title
291
- @apply font-bold
292
-
293
- &.highlighted
294
- @apply text-white
295
-
296
- & > .nav-item-container
297
- &:hover
298
- .nav-item-wrapper
299
- @apply bg-primary-600
300
-
301
- .nav-item-wrapper
302
- @apply bg-primary-600
303
-
304
- .nav-item-button
305
- .button-title
306
- @apply font-bold
307
-
308
- .nav-item-highlight-border
309
- @apply opacity-100
310
-
311
- &.disabled
312
- .nav-item-wrapper
313
- .nav-item-button
314
- @apply cursor-default
315
-
316
- .nav-item-toggle
317
- @apply text-gray-4 cursor-default
318
-
319
-
320
- .nav-item-container
321
- @apply relative w-full rounded-l-full overflow-hidden transition-siderbar-nav-item
322
- height 37px
323
-
324
- &:hover
325
- .nav-item-wrapper
326
- @apply bg-primary-100
327
-
328
- .nav-item-button
329
- @apply font-bold
330
-
331
- .nav-item-wrapper
332
- @apply absolute top-0 left-0 flex items-center pl-4 transition-padding
333
- width 188px
334
- height 37px
335
-
336
- .nav-item-button
337
- @apply flex-grow flex items-center space-x-2
338
-
339
- .button-pre-icon
340
- @apply flex-shrink-0 flex-grow-0 flex items-center justify-center text-base leading-none transition-siderbar-nav-item-icon
341
- width 16px
342
- height 16px
343
-
344
- .button-title
345
- @apply flex-grow block truncate opacity-100 transition-opacity
346
-
347
- .nav-item-toggle
348
- @apply flex-grow-0 flex-shrink-0 inline-flex justify-center items-center w-5 h-5 mr-px text-xs leading-none opacity-100 origin-center transition-opacity
349
-
350
- .nav-item-highlight-border
351
- @apply flex-grow-0 flex-shrink-0 w-1 h-full bg-primary opacity-0
352
-
353
- .sub-items-wrapper
354
- @apply w-full h-0 pl-4 overflow-hidden transition-height
355
-
356
- ul
357
- @apply pt-2
358
-
359
- .siderbar-nav-item
360
- .nav-item-container
361
- .nav-item-wrapper
362
- @apply pl-6
363
- width 172px
364
-
365
- .siderbar-mode-setting
366
- @apply flex items-center justify-start mt-6 mb-4 space-x-4 text-base text-primary
367
- padding-right 10px
368
- padding-left 40px
369
-
370
- &-title
371
- @apply flex-grow-0 flex-shrink-0
372
-
373
- .ios-switch
374
- @apply flex-grow
375
-
376
- label
377
- @apply border-primary-100 bg-primary-25
378
-
379
- &:before
380
- @apply border-2 border-primary-100
381
-
382
- &-toggle
383
- @apply absolute top-0 right-0 flex justify-center items-center bg-primary-50 text-sm text-primary-600 leading-none transition-all
384
- width 20px
385
- height 40px
386
- margin-top 25px
387
- border-radius 12px 0px 0px 12px
388
-
389
- &:hover
390
- @apply bg-primary-300 text-white
391
-
392
- .icon-chevron-right
393
- @apply hidden
394
- </style>
@@ -1,204 +0,0 @@
1
- <template lang="pug">
2
- li.siderbar-nav-item(:class="{ opened: isOpen, highlighted: isHighlight, included: isInclude, disabled: config && config.to === '' && config.subItems && config.subItems.length === 0 }")
3
- .nav-item-container
4
- .nav-item-wrapper
5
- a(href="javascript:;", @click="onClickedItem").nav-item-button
6
- .button-pre-icon(v-if="config && config.preIcon")
7
- SLIcon(:icon="config.preIcon")
8
- span.button-title {{ config ? config.title : '' }}
9
- a.nav-item-toggle(
10
- v-if="config && config.postIcon"
11
- href="javascript:;"
12
- @click="onClickedToggle"
13
- )
14
- SLIcon.button-post-icon(
15
- :icon="config.postIcon"
16
- )
17
- .nav-item-highlight-border
18
- .sub-items-wrapper(
19
- v-if="config && config.subItems && config.subItems.length > 0"
20
- :style="{ height: `${isOpen && !isSiderbarClosure ? subItemsWrapperHeight : 0}px` }"
21
- )
22
- ul(ref="subItemsUL")
23
- SLSiderbarNavItem(
24
- v-for="item, i in config.subItems"
25
- :config="item"
26
- :key="i"
27
- )
28
- </template>
29
-
30
- <script lang="ts">
31
- import type { PropType } from "vue";
32
- import { fromEvent, interval, Subscription } from "rxjs";
33
- import { debounce, startWith } from "rxjs/operators";
34
- import type { NavItemConfigType } from "~ui/interface/NavConfigType";
35
-
36
- function getConfigPaths(paths: string[], config: NavItemConfigType | null) {
37
- if (!config) {
38
- return paths;
39
- }
40
-
41
- let newPaths = [...paths];
42
-
43
- if (config.subItems) {
44
- config.subItems.forEach((itemConfig) => {
45
- newPaths = getConfigPaths(newPaths, itemConfig);
46
- });
47
- }
48
-
49
- if (config.to) {
50
- newPaths.push(config.to);
51
- }
52
-
53
- if (config.include) {
54
- newPaths.push(...config.include);
55
- }
56
-
57
- return newPaths;
58
- }
59
-
60
- export default defineComponent({
61
- name: "SLSiderbarNavItem",
62
- components: {},
63
- props: {
64
- config: {
65
- type: Object as PropType<NavItemConfigType | null>,
66
- default: () => null,
67
- },
68
- isSiderbarClosure: {
69
- type: Boolean,
70
- default: false,
71
- },
72
- },
73
- emits: ["toggle", "click-item"],
74
- setup(props, { emit }) {
75
- const route = useRoute();
76
- const router = useRouter();
77
-
78
- const { config, isSiderbarClosure } = toRefs(props);
79
-
80
- const subItemsUL = shallowRef<HTMLElement | null>(null);
81
- const isOpen = ref(false);
82
- const subItemsWrapperHeight = ref(0);
83
-
84
- let resizeSubscriber: Subscription | null = null;
85
-
86
- const configPaths = computed(() => {
87
- return getConfigPaths([], config.value);
88
- });
89
-
90
- const isInclude = computed(() => {
91
- let included = false;
92
- const matched = route.matched[route.matched.length - 1];
93
-
94
- configPaths.value.forEach((path) => {
95
- const regex = new RegExp(`${path}(/)?$`);
96
- if (regex.test(matched.path)) {
97
- included = true;
98
- }
99
- });
100
-
101
- return included;
102
- });
103
-
104
- const isHighlight = computed(() => {
105
- if (!config.value?.to) return false;
106
-
107
- const regex = new RegExp(`${config.value.to}(/)?$`);
108
- const matched = route.matched[route.matched.length - 1];
109
-
110
- return (
111
- regex.test(matched.path) ||
112
- ((config.value.subItems || []).length === 0 && isInclude.value)
113
- );
114
- });
115
-
116
- function isDefaultOpen() {
117
- let defaultOpen = false;
118
-
119
- configPaths.value.forEach((path) => {
120
- if (route.path.includes(path)) {
121
- defaultOpen = true;
122
- }
123
- });
124
-
125
- isOpen.value = defaultOpen;
126
- }
127
-
128
- function setSubItemsWrapperHeight() {
129
- nextTick(() => {
130
- if (subItemsUL.value) {
131
- subItemsWrapperHeight.value =
132
- subItemsUL.value.getBoundingClientRect().height;
133
- }
134
- });
135
- }
136
-
137
- function subscribeResize() {
138
- resizeSubscriber = fromEvent(window, "resize")
139
- .pipe(debounce(() => interval(500)))
140
- .pipe(startWith(0))
141
- .subscribe(setSubItemsWrapperHeight);
142
- }
143
-
144
- function unsubscribeResize() {
145
- if (resizeSubscriber) {
146
- resizeSubscriber.unsubscribe();
147
- }
148
- resizeSubscriber = null;
149
- }
150
-
151
- function onClickedItem() {
152
- if (isSiderbarClosure.value) {
153
- emit("toggle");
154
- return;
155
- }
156
-
157
- isOpen.value = !isOpen.value;
158
-
159
- if (config.value?.to && config.value?.to !== "") {
160
- router.push(config.value.to);
161
- return;
162
- }
163
-
164
- if (config.value?.emit && config.value?.emit !== "") {
165
- emit("click-item", config.value.emit);
166
- }
167
- }
168
-
169
- function onClickedToggle() {
170
- isOpen.value = !isOpen.value;
171
- }
172
-
173
- watch(route, () => {
174
- isDefaultOpen();
175
- });
176
-
177
- watch(config, () => {
178
- setSubItemsWrapperHeight();
179
- isDefaultOpen();
180
- });
181
-
182
- onMounted(() => {
183
- isDefaultOpen();
184
- subscribeResize();
185
- });
186
-
187
- onBeforeUnmount(() => {
188
- unsubscribeResize();
189
- });
190
-
191
- return {
192
- subItemsUL,
193
- isOpen,
194
- isHighlight,
195
- isInclude,
196
- subItemsWrapperHeight,
197
- onClickedItem,
198
- onClickedToggle,
199
- };
200
- },
201
- });
202
- </script>
203
-
204
- <style lang="stylus"></style>