misp-ui-library-test 0.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.
- package/README.md +113 -0
- package/dist/theme-chalk/alert/index.scss +152 -0
- package/dist/theme-chalk/avatar/index.scss +51 -0
- package/dist/theme-chalk/backtop/index.scss +38 -0
- package/dist/theme-chalk/badge/index.scss +63 -0
- package/dist/theme-chalk/breadcrumb/index.scss +36 -0
- package/dist/theme-chalk/breadcrumb-item/index.scss +36 -0
- package/dist/theme-chalk/button/index.scss +157 -0
- package/dist/theme-chalk/card/index.scss +38 -0
- package/dist/theme-chalk/chart/index.scss +21 -0
- package/dist/theme-chalk/checkbox/index.scss +358 -0
- package/dist/theme-chalk/col/index.scss +131 -0
- package/dist/theme-chalk/container/index.scss +40 -0
- package/dist/theme-chalk/css/alert.css +484 -0
- package/dist/theme-chalk/css/avatar.css +409 -0
- package/dist/theme-chalk/css/backtop.css +401 -0
- package/dist/theme-chalk/css/badge.css +419 -0
- package/dist/theme-chalk/css/breadcrumb-item.css +395 -0
- package/dist/theme-chalk/css/breadcrumb.css +395 -0
- package/dist/theme-chalk/css/button.css +587 -0
- package/dist/theme-chalk/css/card.css +397 -0
- package/dist/theme-chalk/css/chart.css +386 -0
- package/dist/theme-chalk/css/checkbox.css +648 -0
- package/dist/theme-chalk/css/col.css +2111 -0
- package/dist/theme-chalk/css/container.css +404 -0
- package/dist/theme-chalk/css/dialog.css +505 -0
- package/dist/theme-chalk/css/divider.css +405 -0
- package/dist/theme-chalk/css/drawer.css +546 -0
- package/dist/theme-chalk/css/empty.css +394 -0
- package/dist/theme-chalk/css/form.css +561 -0
- package/dist/theme-chalk/css/icon.css +1534 -0
- package/dist/theme-chalk/css/image.css +400 -0
- package/dist/theme-chalk/css/input-number.css +424 -0
- package/dist/theme-chalk/css/input.css +721 -0
- package/dist/theme-chalk/css/link.css +424 -0
- package/dist/theme-chalk/css/loading.css +483 -0
- package/dist/theme-chalk/css/message-box.css +479 -0
- package/dist/theme-chalk/css/message.css +456 -0
- package/dist/theme-chalk/css/no-data.css +397 -0
- package/dist/theme-chalk/css/notification.css +431 -0
- package/dist/theme-chalk/css/page-header.css +396 -0
- package/dist/theme-chalk/css/pagination.css +565 -0
- package/dist/theme-chalk/css/popover.css +421 -0
- package/dist/theme-chalk/css/popper.css +454 -0
- package/dist/theme-chalk/css/progress.css +451 -0
- package/dist/theme-chalk/css/radio.css +626 -0
- package/dist/theme-chalk/css/rate.css +414 -0
- package/dist/theme-chalk/css/result.css +403 -0
- package/dist/theme-chalk/css/row.css +433 -0
- package/dist/theme-chalk/css/scrollbar.css +422 -0
- package/dist/theme-chalk/css/select.css +1897 -0
- package/dist/theme-chalk/css/skeleton-item.css +407 -0
- package/dist/theme-chalk/css/skeleton.css +390 -0
- package/dist/theme-chalk/css/slider.css +460 -0
- package/dist/theme-chalk/css/spinner.css +403 -0
- package/dist/theme-chalk/css/statistic.css +396 -0
- package/dist/theme-chalk/css/status-timeline-chart.css +388 -0
- package/dist/theme-chalk/css/step.css +496 -0
- package/dist/theme-chalk/css/steps.css +496 -0
- package/dist/theme-chalk/css/switch.css +507 -0
- package/dist/theme-chalk/css/tab-pane.css +457 -0
- package/dist/theme-chalk/css/table.css +461 -0
- package/dist/theme-chalk/css/tabs-navigation.css +925 -0
- package/dist/theme-chalk/css/tabs.css +457 -0
- package/dist/theme-chalk/css/tag.css +599 -0
- package/dist/theme-chalk/css/time-picker.css +683 -0
- package/dist/theme-chalk/css/timeline-item.css +459 -0
- package/dist/theme-chalk/css/timeline.css +459 -0
- package/dist/theme-chalk/css/tooltip.css +485 -0
- package/dist/theme-chalk/css/tree.css +473 -0
- package/dist/theme-chalk/css/upload.css +665 -0
- package/dist/theme-chalk/dialog/index.scss +168 -0
- package/dist/theme-chalk/divider/index.scss +46 -0
- package/dist/theme-chalk/drawer/index.scss +172 -0
- package/dist/theme-chalk/empty/index.scss +36 -0
- package/dist/theme-chalk/fonts/element-icons.ttf +0 -0
- package/dist/theme-chalk/fonts/element-icons.woff +0 -0
- package/dist/theme-chalk/form/index.scss +220 -0
- package/dist/theme-chalk/icon/index.scss +1171 -0
- package/dist/theme-chalk/image/index.scss +39 -0
- package/dist/theme-chalk/index.scss +127 -0
- package/dist/theme-chalk/input/index.scss +363 -0
- package/dist/theme-chalk/input-number/index.scss +71 -0
- package/dist/theme-chalk/link/index.scss +75 -0
- package/dist/theme-chalk/loading/index.scss +131 -0
- package/dist/theme-chalk/message/index.scss +100 -0
- package/dist/theme-chalk/message-box/index.scss +131 -0
- package/dist/theme-chalk/mixins.scss +203 -0
- package/dist/theme-chalk/no-data/index.scss +36 -0
- package/dist/theme-chalk/notification/index.scss +76 -0
- package/dist/theme-chalk/page-header/index.scss +36 -0
- package/dist/theme-chalk/pagination/index.scss +225 -0
- package/dist/theme-chalk/popover/index.scss +56 -0
- package/dist/theme-chalk/popper/index.scss +89 -0
- package/dist/theme-chalk/progress/index.scss +105 -0
- package/dist/theme-chalk/radio/index.scss +328 -0
- package/dist/theme-chalk/rate/index.scss +56 -0
- package/dist/theme-chalk/reset.scss +262 -0
- package/dist/theme-chalk/result/index.scss +46 -0
- package/dist/theme-chalk/row/index.scss +88 -0
- package/dist/theme-chalk/scrollbar/index.scss +67 -0
- package/dist/theme-chalk/select/index.scss +223 -0
- package/dist/theme-chalk/skeleton/index.scss +30 -0
- package/dist/theme-chalk/skeleton-item/index.scss +49 -0
- package/dist/theme-chalk/slider/index.scss +113 -0
- package/dist/theme-chalk/spinner/index.scss +40 -0
- package/dist/theme-chalk/statistic/index.scss +38 -0
- package/dist/theme-chalk/status-timeline-chart/index.scss +23 -0
- package/dist/theme-chalk/step/index.scss +160 -0
- package/dist/theme-chalk/steps/index.scss +160 -0
- package/dist/theme-chalk/switch/index.scss +153 -0
- package/dist/theme-chalk/tab-pane/index.scss +112 -0
- package/dist/theme-chalk/table/index.scss +110 -0
- package/dist/theme-chalk/tabs/index.scss +112 -0
- package/dist/theme-chalk/tabs-navigation/index.scss +631 -0
- package/dist/theme-chalk/tag/index.scss +138 -0
- package/dist/theme-chalk/themes/blue.scss +76 -0
- package/dist/theme-chalk/themes/dark.scss +99 -0
- package/dist/theme-chalk/themes/index.scss +260 -0
- package/dist/theme-chalk/themes/light.scss +99 -0
- package/dist/theme-chalk/time-picker/index.scss +332 -0
- package/dist/theme-chalk/timeline/index.scss +119 -0
- package/dist/theme-chalk/timeline-item/index.scss +119 -0
- package/dist/theme-chalk/tooltip/index.scss +122 -0
- package/dist/theme-chalk/tree/index.scss +125 -0
- package/dist/theme-chalk/upload/index.scss +348 -0
- package/dist/theme-chalk/variables.scss +93 -0
- package/dist/vue2-ui-library.cjs.temp.js.map +1 -0
- package/dist/vue2-ui-library.common.js +28 -0
- package/dist/vue2-ui-library.common.js.map +1 -0
- package/dist/vue2-ui-library.esm.js +29 -0
- package/dist/vue2-ui-library.umd.js +27 -0
- package/package.json +161 -0
- package/src/directives/clickoutside/index.js +111 -0
- package/src/directives/init/index.js +50 -0
- package/src/directives/resize/index.js +69 -0
- package/src/index.js +174 -0
- package/src/mixins/emitter.js +47 -0
- package/src/mixins/focus.js +42 -0
- package/src/mixins/locale.js +24 -0
- package/src/mixins/migrating.js +46 -0
- package/src/packages/alert/index.js +12 -0
- package/src/packages/alert/src/main.vue +98 -0
- package/src/packages/aside/index.js +12 -0
- package/src/packages/aside/src/main.vue +20 -0
- package/src/packages/auto-grid-layout/index.js +18 -0
- package/src/packages/auto-grid-layout/prop.js +92 -0
- package/src/packages/auto-grid-layout/src/components/GridItem.vue +759 -0
- package/src/packages/auto-grid-layout/src/components/GridLayout.vue +367 -0
- package/src/packages/auto-grid-layout/src/main.vue +287 -0
- package/src/packages/auto-grid-layout/src/utils/DOM.js +46 -0
- package/src/packages/auto-grid-layout/src/utils/interact.js +333 -0
- package/src/packages/auto-grid-layout/src/utils/responsiveUtils.js +75 -0
- package/src/packages/auto-grid-layout/src/utils/utils.js +339 -0
- package/src/packages/autocomplete/index.js +12 -0
- package/src/packages/autocomplete/src/main.vue +170 -0
- package/src/packages/avatar/index.js +12 -0
- package/src/packages/avatar/src/main.vue +87 -0
- package/src/packages/backtop/index.js +12 -0
- package/src/packages/backtop/src/main.vue +120 -0
- package/src/packages/badge/index.js +12 -0
- package/src/packages/badge/src/main.vue +53 -0
- package/src/packages/breadcrumb/index.js +12 -0
- package/src/packages/breadcrumb/src/main.vue +34 -0
- package/src/packages/breadcrumb-item/index.js +12 -0
- package/src/packages/breadcrumb-item/src/main.vue +41 -0
- package/src/packages/button/index.js +13 -0
- package/src/packages/button/src/main.vue +106 -0
- package/src/packages/calendar/index.js +12 -0
- package/src/packages/calendar/src/main.vue +173 -0
- package/src/packages/card/index.js +12 -0
- package/src/packages/card/src/main.vue +26 -0
- package/src/packages/carousel/index.js +12 -0
- package/src/packages/carousel/src/main.vue +186 -0
- package/src/packages/carousel-item/index.js +12 -0
- package/src/packages/carousel-item/src/main.vue +34 -0
- package/src/packages/cascader/index.js +12 -0
- package/src/packages/cascader/src/main.vue +232 -0
- package/src/packages/chart/index.js +7 -0
- package/src/packages/chart/src/axis-chart.js +700 -0
- package/src/packages/chart/src/main.vue +828 -0
- package/src/packages/chart/src/utils.js +21 -0
- package/src/packages/checkbox/index.js +44 -0
- package/src/packages/checkbox/src/main.vue +312 -0
- package/src/packages/col/index.js +12 -0
- package/src/packages/col/src/main.vue +85 -0
- package/src/packages/collapse/index.js +12 -0
- package/src/packages/collapse/src/main.vue +69 -0
- package/src/packages/collapse-item/index.js +12 -0
- package/src/packages/collapse-item/src/main.vue +75 -0
- package/src/packages/color-picker/index.js +12 -0
- package/src/packages/color-picker/src/main.vue +206 -0
- package/src/packages/container/index.js +12 -0
- package/src/packages/container/src/main.vue +33 -0
- package/src/packages/date-picker/index.js +12 -0
- package/src/packages/date-picker/src/main.vue +246 -0
- package/src/packages/descriptions/index.js +12 -0
- package/src/packages/descriptions/src/main.vue +89 -0
- package/src/packages/descriptions-item/index.js +12 -0
- package/src/packages/descriptions-item/src/main.vue +26 -0
- package/src/packages/dialog/index.js +12 -0
- package/src/packages/dialog/src/main.vue +336 -0
- package/src/packages/divider/index.js +12 -0
- package/src/packages/divider/src/main.vue +37 -0
- package/src/packages/drawer/index.js +7 -0
- package/src/packages/drawer/src/main.vue +310 -0
- package/src/packages/dropdown/index.js +12 -0
- package/src/packages/dropdown/src/main.vue +82 -0
- package/src/packages/dropdown-menu-item/index.js +12 -0
- package/src/packages/dropdown-menu-item/src/main.vue +29 -0
- package/src/packages/empty/index.js +12 -0
- package/src/packages/empty/src/img-empty.vue +12 -0
- package/src/packages/empty/src/main.vue +49 -0
- package/src/packages/footer/index.js +12 -0
- package/src/packages/footer/src/main.vue +20 -0
- package/src/packages/form/index.js +13 -0
- package/src/packages/form/src/form-field.vue +790 -0
- package/src/packages/form/src/form-item.vue +464 -0
- package/src/packages/form/src/label-wrap.vue +127 -0
- package/src/packages/form/src/main.vue +442 -0
- package/src/packages/form-item/index.js +11 -0
- package/src/packages/header/index.js +12 -0
- package/src/packages/header/src/main.vue +20 -0
- package/src/packages/icon/index.js +12 -0
- package/src/packages/icon/src/main.vue +48 -0
- package/src/packages/image/index.js +12 -0
- package/src/packages/image/src/main.vue +224 -0
- package/src/packages/input/index.js +13 -0
- package/src/packages/input/src/calcTextareaHeight.js +123 -0
- package/src/packages/input/src/main.vue +510 -0
- package/src/packages/input-number/index.js +12 -0
- package/src/packages/input-number/src/main.vue +121 -0
- package/src/packages/link/index.js +12 -0
- package/src/packages/link/src/main.vue +53 -0
- package/src/packages/loading/index.js +17 -0
- package/src/packages/loading/src/directive.js +54 -0
- package/src/packages/loading/src/main.vue +38 -0
- package/src/packages/loading/src/service.js +63 -0
- package/src/packages/main/index.js +12 -0
- package/src/packages/main/src/main.vue +12 -0
- package/src/packages/menu/index.js +12 -0
- package/src/packages/menu/src/main.vue +117 -0
- package/src/packages/menu-item/index.js +12 -0
- package/src/packages/menu-item/src/main.vue +61 -0
- package/src/packages/message/index.js +95 -0
- package/src/packages/message/src/main.vue +131 -0
- package/src/packages/message-box/index.js +75 -0
- package/src/packages/message-box/src/main.vue +207 -0
- package/src/packages/no-data/index.js +8 -0
- package/src/packages/no-data/src/main.vue +23 -0
- package/src/packages/notification/index.js +72 -0
- package/src/packages/notification/src/main.vue +139 -0
- package/src/packages/option/index.js +13 -0
- package/src/packages/page-header/index.js +12 -0
- package/src/packages/page-header/src/main.vue +27 -0
- package/src/packages/pagination/index.js +12 -0
- package/src/packages/pagination/src/main.vue +255 -0
- package/src/packages/popconfirm/index.js +12 -0
- package/src/packages/popconfirm/src/main.vue +89 -0
- package/src/packages/popover/index.js +12 -0
- package/src/packages/popover/src/main.vue +452 -0
- package/src/packages/progress/index.js +12 -0
- package/src/packages/progress/src/main.vue +236 -0
- package/src/packages/radio/index.js +44 -0
- package/src/packages/radio/src/main.vue +291 -0
- package/src/packages/rate/index.js +12 -0
- package/src/packages/rate/src/main.vue +129 -0
- package/src/packages/result/index.js +12 -0
- package/src/packages/result/src/main.vue +52 -0
- package/src/packages/row/index.js +12 -0
- package/src/packages/row/src/main.vue +57 -0
- package/src/packages/scrollbar/index.js +12 -0
- package/src/packages/scrollbar/src/bar.vue +116 -0
- package/src/packages/scrollbar/src/main.vue +124 -0
- package/src/packages/select/index.js +15 -0
- package/src/packages/select/src/clickoutside.js +20 -0
- package/src/packages/select/src/main.vue +1055 -0
- package/src/packages/select/src/navigation-mixin.js +49 -0
- package/src/packages/select/src/option.vue +249 -0
- package/src/packages/select/src/select-dropdown.vue +95 -0
- package/src/packages/select/src/utils.js +5 -0
- package/src/packages/skeleton/index.js +12 -0
- package/src/packages/skeleton/src/main.vue +76 -0
- package/src/packages/skeleton-item/index.js +12 -0
- package/src/packages/skeleton-item/src/img-placeholder.vue +13 -0
- package/src/packages/skeleton-item/src/main.vue +22 -0
- package/src/packages/slider/index.js +12 -0
- package/src/packages/slider/src/main.vue +176 -0
- package/src/packages/spinner/index.js +12 -0
- package/src/packages/spinner/src/main.vue +27 -0
- package/src/packages/statistic/index.js +12 -0
- package/src/packages/statistic/src/main.vue +100 -0
- package/src/packages/status-timeline-chart/index.js +7 -0
- package/src/packages/status-timeline-chart/src/constants.js +20 -0
- package/src/packages/status-timeline-chart/src/main.vue +499 -0
- package/src/packages/status-timeline-chart/src/option-builder.js +475 -0
- package/src/packages/step/index.js +12 -0
- package/src/packages/step/src/main.vue +183 -0
- package/src/packages/steps/index.js +12 -0
- package/src/packages/steps/src/main.vue +57 -0
- package/src/packages/submenu/index.js +12 -0
- package/src/packages/submenu/src/main.vue +68 -0
- package/src/packages/switch/index.js +12 -0
- package/src/packages/switch/src/main.vue +166 -0
- package/src/packages/tab-pane/index.js +12 -0
- package/src/packages/tab-pane/src/main.vue +74 -0
- package/src/packages/table/index.js +8 -0
- package/src/packages/table/src/components/PagePagination.vue +82 -0
- package/src/packages/table/src/main.vue +153 -0
- package/src/packages/tabs/index.js +12 -0
- package/src/packages/tabs/src/main.vue +167 -0
- package/src/packages/tabs-navigation/index.js +7 -0
- package/src/packages/tabs-navigation/src/main.vue +462 -0
- package/src/packages/tag/index.js +12 -0
- package/src/packages/tag/src/main.vue +194 -0
- package/src/packages/time-picker/index.js +17 -0
- package/src/packages/time-picker/src/date-utils.js +455 -0
- package/src/packages/time-picker/src/main.vue +321 -0
- package/src/packages/time-picker/src/pane/date-range.vue +193 -0
- package/src/packages/time-picker/src/pane/date-time-range.vue +362 -0
- package/src/packages/time-picker/src/pane/date-time.vue +362 -0
- package/src/packages/time-picker/src/pane/date.vue +441 -0
- package/src/packages/time-picker/src/pane/time.vue +260 -0
- package/src/packages/time-picker/src/time-input.vue +203 -0
- package/src/packages/time-picker/src/time-range-input.vue +170 -0
- package/src/packages/timeline/index.js +12 -0
- package/src/packages/timeline/src/main.vue +24 -0
- package/src/packages/timeline-item/index.js +12 -0
- package/src/packages/timeline-item/src/main.vue +78 -0
- package/src/packages/tooltip/index.js +12 -0
- package/src/packages/tooltip/src/main.js +367 -0
- package/src/packages/transfer/index.js +8 -0
- package/src/packages/transfer/src/main.vue +229 -0
- package/src/packages/transfer/src/transfer-panel.vue +245 -0
- package/src/packages/transitions/collapse-transition.js +75 -0
- package/src/packages/tree/index.js +12 -0
- package/src/packages/tree/src/main.vue +322 -0
- package/src/packages/tree/src/model/node.js +348 -0
- package/src/packages/tree/src/model/tree-store.js +354 -0
- package/src/packages/tree/src/model/util.js +10 -0
- package/src/packages/tree/src/tree-node.vue +262 -0
- package/src/packages/upload/index.js +9 -0
- package/src/packages/upload/src/main.vue +415 -0
- package/src/playground/mixins/element.js +98 -0
- package/src/playground/types/element.js +197 -0
- package/src/playground/types/layout.js +80 -0
- package/src/plugins/i18n.js +125 -0
- package/src/styles/fonts/element-icons.ttf +0 -0
- package/src/styles/fonts/element-icons.woff +0 -0
- package/src/styles/index.scss +138 -0
- package/src/styles/reset.scss +257 -0
- package/src/styles/themes/blue.scss +75 -0
- package/src/styles/themes/dark.scss +98 -0
- package/src/styles/themes/index.scss +34 -0
- package/src/styles/themes/light.scss +98 -0
- package/src/styles/themes/variables.scss +233 -0
- package/src/styles/variables.scss +146 -0
- package/src/utils/async-validator/index.js +659 -0
- package/src/utils/browser/index.js +39 -0
- package/src/utils/color.js +76 -0
- package/src/utils/dom/index.js +421 -0
- package/src/utils/dom/scrollbar-width.js +49 -0
- package/src/utils/draggable/core.js +379 -0
- package/src/utils/draggable/draggable.js +478 -0
- package/src/utils/draggable/index.js +61 -0
- package/src/utils/draggable/sortable.js +751 -0
- package/src/utils/lodash/index.js +2395 -0
- package/src/utils/moment/index.js +909 -0
- package/src/utils/playground/index.js +37 -0
- package/src/utils/popper/index.js +308 -0
- package/src/utils/popper/popper.js +1132 -0
- package/src/utils/popper/popup-manager.js +288 -0
- package/src/utils/popper/popup.js +344 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import _ from '../../utils/lodash/index.js'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
props: {
|
|
5
|
+
// instance: {},
|
|
6
|
+
},
|
|
7
|
+
computed: {
|
|
8
|
+
// 获取 instance 实例类名
|
|
9
|
+
className() {
|
|
10
|
+
return (this.instance && this.instance.className) || ''
|
|
11
|
+
},
|
|
12
|
+
// 元素标准样式注入
|
|
13
|
+
styleProp() {
|
|
14
|
+
return {
|
|
15
|
+
left: this.instance.left,
|
|
16
|
+
top: this.instance.top,
|
|
17
|
+
width: this.instance.width,
|
|
18
|
+
height: this.instance.height,
|
|
19
|
+
margin: this.instance.margin,
|
|
20
|
+
padding: this.instance.padding,
|
|
21
|
+
flex: this.instance.flex,
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
// 元素标准类名注入
|
|
25
|
+
extraClassName() {
|
|
26
|
+
return [
|
|
27
|
+
this.instance.flexEnd ? 'flex-end' : '',
|
|
28
|
+
this.instance && this.instance.extraCustom && this.instance.extraCustom.isCard ? 'is-card' : ''
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
// 元素交互事件配置
|
|
32
|
+
echoCode() {
|
|
33
|
+
return (this.instance && this.instance.echoCode) || {}
|
|
34
|
+
},
|
|
35
|
+
// 元素是否支持点击
|
|
36
|
+
hasClickPermission() {
|
|
37
|
+
const clickCode = this.echoCode && this.echoCode.click
|
|
38
|
+
return !_.isEmpty(clickCode)
|
|
39
|
+
},
|
|
40
|
+
// 元素是否支持数据变更响应
|
|
41
|
+
hasChangePermission() {
|
|
42
|
+
const changeCode = this.echoCode && this.echoCode.change
|
|
43
|
+
return !_.isEmpty(changeCode)
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
methods: {
|
|
47
|
+
/**
|
|
48
|
+
* 点击事件响应
|
|
49
|
+
* @param {PointerEvent} event
|
|
50
|
+
*/
|
|
51
|
+
clickHandler(event) {
|
|
52
|
+
const clickCode = this.echoCode && this.echoCode.click;
|
|
53
|
+
if (clickCode === undefined || !this.hasClickPermission) return;
|
|
54
|
+
event.stopPropagation()
|
|
55
|
+
this.eventEchoHandler(clickCode || '', event)
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* 数据变更事件响应
|
|
59
|
+
*/
|
|
60
|
+
changeHandler() {
|
|
61
|
+
const changeCode = this.echoCode && this.echoCode.change
|
|
62
|
+
if (changeCode === undefined || !this.hasChangePermission) return;
|
|
63
|
+
this.eventEchoHandler(changeCode, ...arguments)
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* 元素交互事件响应
|
|
67
|
+
* @param {string | Array} eventCode
|
|
68
|
+
*/
|
|
69
|
+
eventEchoHandler(eventCode, ...arg) {
|
|
70
|
+
if (_.isEmpty(eventCode)) return
|
|
71
|
+
if (Array.isArray(eventCode)) {
|
|
72
|
+
// 点击事件配置了多个响应 code 时, 按序触发
|
|
73
|
+
eventCode.forEach(code => {
|
|
74
|
+
echo(code, ...arg)
|
|
75
|
+
})
|
|
76
|
+
} else {
|
|
77
|
+
echo(eventCode, ...arg)
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* 单个标准事件响应
|
|
82
|
+
* @param {string | Function} code
|
|
83
|
+
*/
|
|
84
|
+
echo(code, ...arg) {
|
|
85
|
+
if (typeof code === 'function') {
|
|
86
|
+
code(this, ...arg)
|
|
87
|
+
} else if (typeof code === 'string') {
|
|
88
|
+
this.$emit(code, this.eventArgumentsReturn())
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* 事件参数返回处理
|
|
93
|
+
*/
|
|
94
|
+
eventArgumentsReturn() {
|
|
95
|
+
return this.instance;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 判断尺寸是否为百分比弹性宽度(支持负数)
|
|
3
|
+
*/
|
|
4
|
+
export const elasticSizeReg = /^-?\d+(?:\.\d+)?%$/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 判断尺寸是否为像素固定宽度(支持负数)
|
|
8
|
+
*/
|
|
9
|
+
export const pixcelSizeReg = /^-?\d+(?:\.\d+)?px$/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 判断尺寸是否弹性占位
|
|
13
|
+
*/
|
|
14
|
+
export const flexRangeReg = /^\d+(?:\.\d+)?fr$/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 判断尺寸是否为计算尺寸
|
|
18
|
+
*/
|
|
19
|
+
export const calcSizeReg = /^calc\(\s*\)$/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 特定类型尺寸
|
|
23
|
+
*/
|
|
24
|
+
export const enumSizeMap = ['max-content']
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @typedef {Object} EchoCode
|
|
28
|
+
* @property {string|Function|Array<string|Function>} [x] - echo event name
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @typedef {Object} ElementProp
|
|
33
|
+
* @property {string} [left] - 元素距离容器左边界的距离
|
|
34
|
+
* @property {string} [top] - 元素距离容器上边界的距离
|
|
35
|
+
* @property {string} [width] - 元素宽度
|
|
36
|
+
* @property {string} [height] - 元素高度
|
|
37
|
+
* @property {string|number[]} [margin] - 元素与其他元素的间距
|
|
38
|
+
* @property {string|number[]} [padding] - 元素与容器的间距
|
|
39
|
+
* @property {number|string} [flex] - 子元素弹性比例
|
|
40
|
+
* @property {boolean} [flexEnd] - 是否将元素放置在容器末尾
|
|
41
|
+
* @property {EchoCode} [echoCode] - 元素事件回调处理器
|
|
42
|
+
* @property {Object} [extraCustom] - 额外自定义属性
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
export class Element {
|
|
46
|
+
/**
|
|
47
|
+
* 创建 Element 实例
|
|
48
|
+
* @constructor
|
|
49
|
+
* @param {ElementProp} options - 元素配置选项
|
|
50
|
+
* @param {string} [options.left=''] - 元素距离容器左边界的距离
|
|
51
|
+
* @param {string} [options.top=''] - 元素距离容器上边界的距离
|
|
52
|
+
* @param {string} [options.width=''] - 元素宽度
|
|
53
|
+
* @param {string} [options.height=''] - 元素高度
|
|
54
|
+
* @param {string|number[]} [options.margin=''] - 元素与其他元素的间距
|
|
55
|
+
* @param {string|number[]} [options.padding=''] - 元素与容器的间距
|
|
56
|
+
* @param {number|string} [options.flex=''] - 子元素弹性比例
|
|
57
|
+
* @param {boolean} [options.flexEnd=false] - 是否将元素放置在容器末尾
|
|
58
|
+
* @param {EchoCode} [options.echoCode={}] - 元素事件回调处理器
|
|
59
|
+
* @param {Object} [options.extraCustom] - 额外自定义属性
|
|
60
|
+
* @throws {TypeError} 当 ElementProp 中存在非法值时抛出
|
|
61
|
+
* @throws {TypeError} 当 echoCode 中存在非法值时抛出
|
|
62
|
+
*/
|
|
63
|
+
constructor(options) {
|
|
64
|
+
const {
|
|
65
|
+
left = '',
|
|
66
|
+
top = '',
|
|
67
|
+
width = '',
|
|
68
|
+
height = '',
|
|
69
|
+
margin = '',
|
|
70
|
+
padding = '',
|
|
71
|
+
flex = '',
|
|
72
|
+
flexEnd = false,
|
|
73
|
+
echoCode = {},
|
|
74
|
+
...extraCustom
|
|
75
|
+
} = options
|
|
76
|
+
|
|
77
|
+
// 元素长度属性校验
|
|
78
|
+
const distanceValueValidSet = [left, top, width, height]
|
|
79
|
+
if (distanceValueValidSet.some(value => !this.isDinstanceValue(value))) {
|
|
80
|
+
throw new TypeError('ElementProp 中存在非法值')
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 边距属性校验
|
|
84
|
+
const roundDistanceValueValidSet = [margin, padding]
|
|
85
|
+
if (roundDistanceValueValidSet.some(value => {
|
|
86
|
+
if (Array.isArray(value)) {
|
|
87
|
+
return !value.every(v => typeof v === 'number')
|
|
88
|
+
} else {
|
|
89
|
+
return this.isDinstanceValue(value) && !value.split(' ').every(p => this.isDinstanceValue(p))
|
|
90
|
+
}
|
|
91
|
+
})) {
|
|
92
|
+
throw new TypeError('ElementProp 中存在非法值, 请检查 margin 和 padding')
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// EchoCode 校验
|
|
96
|
+
if (!(echoCode instanceof Object)) {
|
|
97
|
+
throw new TypeError('echoCode 中存在非法值')
|
|
98
|
+
} else {
|
|
99
|
+
Object.keys(echoCode).forEach(eventName => {
|
|
100
|
+
const eventEcho = echoCode[eventName]
|
|
101
|
+
if (Array.isArray(eventEcho) && !eventEcho.every(value => ['string', 'function'].includes(typeof value))) {
|
|
102
|
+
throw new TypeError('echoCode 中存在非法值')
|
|
103
|
+
} else if (!Array.isArray(eventEcho) && !['string', 'function'].includes(typeof eventEcho)) {
|
|
104
|
+
throw new TypeError('echoCode 中存在非法值')
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
this.left = left
|
|
110
|
+
this.top = top
|
|
111
|
+
this.width = width
|
|
112
|
+
this.height = height
|
|
113
|
+
this.margin = margin
|
|
114
|
+
this.padding = padding
|
|
115
|
+
this.flex = flex
|
|
116
|
+
this.flexEnd = flexEnd
|
|
117
|
+
this.echoCode = echoCode
|
|
118
|
+
this.extraCustom = extraCustom
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* 返回类属性值
|
|
123
|
+
* @param {string} field
|
|
124
|
+
* @returns {*} 元素中的属性值
|
|
125
|
+
*/
|
|
126
|
+
getProperty(field) {
|
|
127
|
+
return this[field]
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* 属性 Getter 传递
|
|
132
|
+
* @param {Object} prop 构造入参
|
|
133
|
+
* @param {string} field 字段名
|
|
134
|
+
*/
|
|
135
|
+
propertyGetter(prop, field) {
|
|
136
|
+
const desc = Object.getOwnPropertyDescriptor(prop, field)
|
|
137
|
+
if (desc?.get) {
|
|
138
|
+
Object.defineProperty(this, field, {
|
|
139
|
+
...desc,
|
|
140
|
+
get() { return prop[field] }
|
|
141
|
+
})
|
|
142
|
+
} else {
|
|
143
|
+
this[field] = prop[field]
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* 设置类属性值
|
|
149
|
+
* @param {string} field
|
|
150
|
+
* @param {*} value
|
|
151
|
+
*/
|
|
152
|
+
setProperty(field, value) {
|
|
153
|
+
this[field] = value
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* 合并类属性值
|
|
158
|
+
* @param {string} field
|
|
159
|
+
* @param {Object} value
|
|
160
|
+
*/
|
|
161
|
+
assignProperty(field, value) {
|
|
162
|
+
Object.assign(this[field], value)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* 判断传入值是否为 '' 或者为 '100%'/'32px'/'max-content' 此类 css 长度
|
|
167
|
+
* @param {string} value - 传入值
|
|
168
|
+
* @returns {Boolean}
|
|
169
|
+
*/
|
|
170
|
+
isDinstanceValue(value) {
|
|
171
|
+
return !value || elasticSizeReg.test(value) || pixcelSizeReg.test(value) || enumSizeMap.includes(value)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* 判断传入值是否符合弹性布局组成元素
|
|
176
|
+
* @param {string} value 传入值
|
|
177
|
+
* @returns {boolean} 是否符合弹性布局组成元素
|
|
178
|
+
*/
|
|
179
|
+
isflexRangeValue(value) {
|
|
180
|
+
return !value || (elasticSizeReg.test(value) || pixcelSizeReg.test(value) || flexRangeReg.test(value))
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* 判定 Icon 类型
|
|
185
|
+
* @param {string} icon - icon 名
|
|
186
|
+
* @returns {string} - icon 类型 ('' | 'elIcon' | 'svgIcon')
|
|
187
|
+
*/
|
|
188
|
+
iconType(icon) {
|
|
189
|
+
if (icon.startsWith('el-icon')) {
|
|
190
|
+
return 'elIcon'
|
|
191
|
+
} else {
|
|
192
|
+
return ''
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
refresh() {}
|
|
197
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Element, ElementProp } from './element.js'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {Object} LayoutExtraProp
|
|
5
|
+
* @property {Element[]} children - 子元素列表
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {ElementProp & LayoutExtraProp} LayoutProp
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Layout 布局类 - 继承自 Element
|
|
13
|
+
* @extends Element
|
|
14
|
+
*/
|
|
15
|
+
export class Layout extends Element {
|
|
16
|
+
/**
|
|
17
|
+
* 创建 Layout 实例
|
|
18
|
+
* @constructor
|
|
19
|
+
* @param {LayoutProp} options - 布局配置选项
|
|
20
|
+
* @param {any[]} [options.children=[]] - 子元素列表
|
|
21
|
+
* @throws {TypeError} 当未传入组件列表时抛出
|
|
22
|
+
* @throws {TypeError} 当存在非 Element 实例时抛出
|
|
23
|
+
*/
|
|
24
|
+
constructor(options) {
|
|
25
|
+
const { children = [], ...boxProp } = options
|
|
26
|
+
super(boxProp)
|
|
27
|
+
|
|
28
|
+
if (!Array.isArray(children)) {
|
|
29
|
+
throw new TypeError('Layout 中必须传入组件列表')
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
this.children = children
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @override 布局内容刷新,转发子元素刷新方法
|
|
37
|
+
*/
|
|
38
|
+
refresh() {
|
|
39
|
+
this.children.forEach(child => child.refresh())
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 获取元素索引组,按照给定判定方法对给定数组进行索引分组
|
|
44
|
+
* @template T
|
|
45
|
+
* @param {Array<T>} arr - 值数组
|
|
46
|
+
* @param {function(T): boolean} [validPredicate] - 判定元素通过方法,默认判断值是否为真
|
|
47
|
+
* @param {function(T): boolean} [passPredicate] - 判定元素跳过方法,默认与 validPredicate 相反
|
|
48
|
+
* @returns {Array<Array<number>>} 索引分组数组
|
|
49
|
+
* @throws {TypeError} 当传入非数组对象时抛出
|
|
50
|
+
*/
|
|
51
|
+
getIndexsGroup(
|
|
52
|
+
arr,
|
|
53
|
+
validPredicate = (v) => !!v,
|
|
54
|
+
passPredicate = (v) => !validPredicate(v)
|
|
55
|
+
) {
|
|
56
|
+
if (!Array.isArray(arr)) {
|
|
57
|
+
throw new TypeError('传入非数组对象')
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return arr.reduce((acc, value, index) => {
|
|
61
|
+
if (passPredicate(value)) {
|
|
62
|
+
if (acc[acc.length - 1].length > 0) acc.push([])
|
|
63
|
+
} else if (validPredicate(value)) {
|
|
64
|
+
acc[acc.length - 1].push(index)
|
|
65
|
+
}
|
|
66
|
+
return acc
|
|
67
|
+
}, [[]]).filter(arr => arr.length > 0)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 获取各子元素中指定属性值集合
|
|
72
|
+
* @param {string} field - 属性名
|
|
73
|
+
* @returns {Array<string>} 属性值数组
|
|
74
|
+
* @example
|
|
75
|
+
* const widths = layout.getFieldSizeList('width')
|
|
76
|
+
*/
|
|
77
|
+
getFieldSizeList(field) {
|
|
78
|
+
return this.children.map(item => item[field] || '')
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 轻量级 Vue i18n 插件(不依赖 vue-i18n)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// 响应式语言存储
|
|
6
|
+
let currentLocale = 'zh-CN'
|
|
7
|
+
let fallbackLocale = 'zh-CN'
|
|
8
|
+
let messages = {}
|
|
9
|
+
let VueConstructor = null
|
|
10
|
+
|
|
11
|
+
// 创建响应式语言对象
|
|
12
|
+
function createReactiveLocale() {
|
|
13
|
+
if (!VueConstructor) return
|
|
14
|
+
return new VueConstructor({
|
|
15
|
+
data: {
|
|
16
|
+
locale: currentLocale
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let reactiveLocale = null
|
|
22
|
+
|
|
23
|
+
// 翻译函数
|
|
24
|
+
function translate(key, params = {}) {
|
|
25
|
+
const locale = reactiveLocale ? reactiveLocale.locale : currentLocale
|
|
26
|
+
const keys = key.split('.')
|
|
27
|
+
|
|
28
|
+
// 从当前语言查找
|
|
29
|
+
let value = getMessage(locale, keys)
|
|
30
|
+
|
|
31
|
+
// 回退到备用语言
|
|
32
|
+
if (value === undefined && locale !== fallbackLocale) {
|
|
33
|
+
value = getMessage(fallbackLocale, keys)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// 未找到返回原 key
|
|
37
|
+
if (value === undefined) {
|
|
38
|
+
return key
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// 参数替换 {name} 格式
|
|
42
|
+
if (typeof value === 'string') {
|
|
43
|
+
return value.replace(/\{(\w+)\}/g, (_, paramKey) => {
|
|
44
|
+
return params[paramKey] !== undefined ? params[paramKey] : `{${paramKey}}`
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return value
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 获取嵌套消息
|
|
52
|
+
function getMessage(locale, keys) {
|
|
53
|
+
let msg = messages[locale]
|
|
54
|
+
if (!msg) return undefined
|
|
55
|
+
|
|
56
|
+
for (const key of keys) {
|
|
57
|
+
if (msg === undefined || msg === null) return undefined
|
|
58
|
+
msg = msg[key]
|
|
59
|
+
}
|
|
60
|
+
return msg
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// 设置语言
|
|
64
|
+
function setLocale(locale) {
|
|
65
|
+
if (!messages[locale]) {
|
|
66
|
+
console.warn(`[i18n] Locale "${locale}" not found, fallback to "${fallbackLocale}"`)
|
|
67
|
+
locale = fallbackLocale
|
|
68
|
+
}
|
|
69
|
+
if (reactiveLocale) {
|
|
70
|
+
reactiveLocale.locale = locale
|
|
71
|
+
}
|
|
72
|
+
currentLocale = locale
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// 获取当前语言
|
|
76
|
+
function getLocale() {
|
|
77
|
+
return reactiveLocale ? reactiveLocale.locale : currentLocale
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// 注册语言包
|
|
81
|
+
function registerMessages(locale, msg) {
|
|
82
|
+
messages[locale] = msg
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Vue 插件安装
|
|
86
|
+
export default {
|
|
87
|
+
install(Vue, options = {}) {
|
|
88
|
+
VueConstructor = Vue
|
|
89
|
+
reactiveLocale = createReactiveLocale()
|
|
90
|
+
|
|
91
|
+
// 初始化配置
|
|
92
|
+
currentLocale = options.locale || 'zh-CN'
|
|
93
|
+
fallbackLocale = options.fallbackLocale || 'zh-CN'
|
|
94
|
+
messages = options.messages || {}
|
|
95
|
+
|
|
96
|
+
// 全局注入 $t 方法
|
|
97
|
+
Vue.prototype.$t = translate
|
|
98
|
+
Vue.prototype.$locale = getLocale
|
|
99
|
+
Vue.prototype.$setLocale = setLocale
|
|
100
|
+
|
|
101
|
+
// 添加计算属性支持
|
|
102
|
+
Vue.mixin({
|
|
103
|
+
computed: {
|
|
104
|
+
$localeCode() {
|
|
105
|
+
return getLocale()
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
// 监听语言变化(可选)
|
|
111
|
+
if (reactiveLocale) {
|
|
112
|
+
reactiveLocale.$watch('locale', (newVal, oldVal) => {
|
|
113
|
+
Vue.prototype.$locale = getLocale
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// 导出工具函数
|
|
120
|
+
export {
|
|
121
|
+
translate,
|
|
122
|
+
setLocale,
|
|
123
|
+
getLocale,
|
|
124
|
+
registerMessages
|
|
125
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// Import global styles
|
|
2
|
+
@import './variables.scss';
|
|
3
|
+
@import './reset.scss';
|
|
4
|
+
// @import '../../dist/theme-chalk/index.scss';
|
|
5
|
+
|
|
6
|
+
// Global Color Transition
|
|
7
|
+
// $--transition-duration: .2s;
|
|
8
|
+
// * {
|
|
9
|
+
// transition:
|
|
10
|
+
// color $--transition-duration,
|
|
11
|
+
// border-color $--transition-duration,
|
|
12
|
+
// border-top-color $--transition-duration,
|
|
13
|
+
// border-bottom-color $--transition-duration,
|
|
14
|
+
// border-left-color $--transition-duration,
|
|
15
|
+
// border-right-color $--transition-duration,
|
|
16
|
+
// background $--transition-duration,
|
|
17
|
+
// background-color $--transition-duration;
|
|
18
|
+
// }
|
|
19
|
+
|
|
20
|
+
// Scrollbar Style
|
|
21
|
+
::-webkit-scrollbar {
|
|
22
|
+
width: 8px;
|
|
23
|
+
height: 8px;
|
|
24
|
+
border: 0;
|
|
25
|
+
background: var(--md-bg);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
::-webkit-scrollbar-thumb {
|
|
29
|
+
background: var(--fr-text);
|
|
30
|
+
border-radius: 8px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Global UI Style
|
|
34
|
+
.global-ui {
|
|
35
|
+
.go-to-top {
|
|
36
|
+
color: var(--primary-blue) !important;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// BEM naming convention helper
|
|
41
|
+
// ----------------------------
|
|
42
|
+
|
|
43
|
+
// Block modifier
|
|
44
|
+
@mixin b($block) {
|
|
45
|
+
.ui-#{$block} {
|
|
46
|
+
@content;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Element
|
|
51
|
+
@mixin e($element) {
|
|
52
|
+
&__#{$element} {
|
|
53
|
+
@content;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Modifier
|
|
58
|
+
@mixin m($modifier) {
|
|
59
|
+
&--#{$modifier} {
|
|
60
|
+
@content;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Block element modifier
|
|
65
|
+
@mixin bem($block, $element, $modifier) {
|
|
66
|
+
.ui-#{$block}__#{$element}--#{$modifier} {
|
|
67
|
+
@content;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Common mixins
|
|
72
|
+
// -------------
|
|
73
|
+
|
|
74
|
+
// Clearfix
|
|
75
|
+
@mixin clearfix {
|
|
76
|
+
&::after {
|
|
77
|
+
content: '';
|
|
78
|
+
display: table;
|
|
79
|
+
clear: both;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Text ellipsis
|
|
84
|
+
@mixin ellipsis {
|
|
85
|
+
overflow: hidden;
|
|
86
|
+
text-overflow: ellipsis;
|
|
87
|
+
white-space: nowrap;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Multi-line ellipsis
|
|
91
|
+
@mixin multi-ellipsis($lines: 2) {
|
|
92
|
+
display: -webkit-box;
|
|
93
|
+
-webkit-box-orient: vertical;
|
|
94
|
+
-webkit-line-clamp: $lines;
|
|
95
|
+
overflow: hidden;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Responsive utilities
|
|
99
|
+
@mixin respond-to($breakpoint) {
|
|
100
|
+
@if $breakpoint == phone {
|
|
101
|
+
@media (max-width: 767px) { @content; }
|
|
102
|
+
}
|
|
103
|
+
@if $breakpoint == tablet {
|
|
104
|
+
@media (min-width: 768px) and (max-width: 1023px) { @content; }
|
|
105
|
+
}
|
|
106
|
+
@if $breakpoint == desktop {
|
|
107
|
+
@media (min-width: 1024px) { @content; }
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Focus styles
|
|
112
|
+
@mixin focus() {
|
|
113
|
+
outline: none;
|
|
114
|
+
box-shadow: 0 0 0 2px rgba(var(--ui-color-primary, #409eff), 0.5);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Disabled state
|
|
118
|
+
@mixin disabled() {
|
|
119
|
+
cursor: not-allowed;
|
|
120
|
+
opacity: 0.7;
|
|
121
|
+
pointer-events: none;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Transition helper
|
|
125
|
+
@mixin transition($properties: all, $duration: var(--ui-transition-duration, $--transition-duration)) {
|
|
126
|
+
transition: $properties $duration ease;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Box shadow
|
|
130
|
+
@mixin box-shadow($level: base) {
|
|
131
|
+
@if $level == base {
|
|
132
|
+
box-shadow: var(--ui-box-shadow-base, $--box-shadow-base);
|
|
133
|
+
} @else if $level == light {
|
|
134
|
+
box-shadow: var(--ui-box-shadow-light, $--box-shadow-light);
|
|
135
|
+
} @else if $level == dark {
|
|
136
|
+
box-shadow: var(--ui-box-shadow-dark, $--box-shadow-dark);
|
|
137
|
+
}
|
|
138
|
+
}
|