@oinone/kunlun-vue-ui-antd 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/oinone-kunlun-vue-ui-antd.css +1 -0
- package/dist/oinone-kunlun-vue-ui-antd.esm.js +16 -0
- package/dist/oinone-kunlun-vue-ui-antd.scss +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/src/component/index.d.ts +31 -0
- package/dist/types/src/component/oio-block/index.d.ts +3 -0
- package/dist/types/src/component/oio-block/oio-block.vue.d.ts +39 -0
- package/dist/types/src/component/oio-block/oio-col.vue.d.ts +86 -0
- package/dist/types/src/component/oio-block/oio-row.vue.d.ts +34 -0
- package/dist/types/src/component/oio-breadcrumb/index.d.ts +2 -0
- package/dist/types/src/component/oio-breadcrumb/oio-breadcrumb-item.vue.d.ts +14 -0
- package/dist/types/src/component/oio-breadcrumb/oio-breadcrumb.vue.d.ts +14 -0
- package/dist/types/src/component/oio-button/index.d.ts +1 -0
- package/dist/types/src/component/oio-button/oio-button.vue.d.ts +136 -0
- package/dist/types/src/component/oio-cascader/index.d.ts +1 -0
- package/dist/types/src/component/oio-cascader/oio-cascader.vue.d.ts +236 -0
- package/dist/types/src/component/oio-checkbox/index.d.ts +1 -0
- package/dist/types/src/component/oio-checkbox/oio-checkbox.vue.d.ts +56 -0
- package/dist/types/src/component/oio-collapse/index.d.ts +2 -0
- package/dist/types/src/component/oio-collapse/oio-collapse-panel.vue.d.ts +86 -0
- package/dist/types/src/component/oio-collapse/oio-collapse.vue.d.ts +103 -0
- package/dist/types/src/component/oio-date-time-picker/index.d.ts +5 -0
- package/dist/types/src/component/oio-date-time-picker/oio-date-picker.vue.d.ts +182 -0
- package/dist/types/src/component/oio-date-time-picker/oio-date-time-picker.vue.d.ts +240 -0
- package/dist/types/src/component/oio-date-time-picker/oio-time-picker.vue.d.ts +176 -0
- package/dist/types/src/component/oio-date-time-picker/oio-year-picker.vue.d.ts +139 -0
- package/dist/types/src/component/oio-date-time-picker/use-date-time-picker-props.d.ts +15 -0
- package/dist/types/src/component/oio-date-time-range-picker/index.d.ts +5 -0
- package/dist/types/src/component/oio-date-time-range-picker/oio-date-range-picker.vue.d.ts +139 -0
- package/dist/types/src/component/oio-date-time-range-picker/oio-date-time-range-picker.vue.d.ts +195 -0
- package/dist/types/src/component/oio-date-time-range-picker/oio-time-range-picker.vue.d.ts +139 -0
- package/dist/types/src/component/oio-date-time-range-picker/oio-year-range-picker.vue.d.ts +124 -0
- package/dist/types/src/component/oio-date-time-range-picker/use-date-time-range-picker-props.d.ts +12 -0
- package/dist/types/src/component/oio-divider/index.d.ts +2 -0
- package/dist/types/src/component/oio-divider/oio-divider.vue.d.ts +38 -0
- package/dist/types/src/component/oio-drawer/index.d.ts +1 -0
- package/dist/types/src/component/oio-drawer/oio-drawer.vue.d.ts +227 -0
- package/dist/types/src/component/oio-dropdown/index.d.ts +1 -0
- package/dist/types/src/component/oio-dropdown/oio-dropdown.vue.d.ts +78 -0
- package/dist/types/src/component/oio-empty/index.d.ts +1 -0
- package/dist/types/src/component/oio-empty/oio-empty-data.vue.d.ts +42 -0
- package/dist/types/src/component/oio-form/index.d.ts +2 -0
- package/dist/types/src/component/oio-form/oio-form-item.vue.d.ts +126 -0
- package/dist/types/src/component/oio-form/oio-form.vue.d.ts +100 -0
- package/dist/types/src/component/oio-gallery/index.d.ts +1 -0
- package/dist/types/src/component/oio-gallery/oio-gallery.vue.d.ts +98 -0
- package/dist/types/src/component/oio-group/index.d.ts +2 -0
- package/dist/types/src/component/oio-group/oio-group-help.vue.d.ts +65 -0
- package/dist/types/src/component/oio-group/oio-group.vue.d.ts +113 -0
- package/dist/types/src/component/oio-inner-popup/index.d.ts +1 -0
- package/dist/types/src/component/oio-inner-popup/oio-inner-popup.vue.d.ts +195 -0
- package/dist/types/src/component/oio-input/index.d.ts +5 -0
- package/dist/types/src/component/oio-input/oio-input-group.vue.d.ts +16 -0
- package/dist/types/src/component/oio-input/oio-input-number.vue.d.ts +167 -0
- package/dist/types/src/component/oio-input/oio-input-password.vue.d.ts +111 -0
- package/dist/types/src/component/oio-input/oio-input-search.vue.d.ts +106 -0
- package/dist/types/src/component/oio-input/oio-input.vue.d.ts +107 -0
- package/dist/types/src/component/oio-modal/index.d.ts +1 -0
- package/dist/types/src/component/oio-modal/oio-modal.vue.d.ts +230 -0
- package/dist/types/src/component/oio-notification/index.d.ts +116 -0
- package/dist/types/src/component/oio-pagination/index.d.ts +1 -0
- package/dist/types/src/component/oio-pagination/oio-pagination.vue.d.ts +107 -0
- package/dist/types/src/component/oio-popconfirm/index.d.ts +1 -0
- package/dist/types/src/component/oio-popconfirm/oio-popconfirm.vue.d.ts +119 -0
- package/dist/types/src/component/oio-select/index.d.ts +1 -0
- package/dist/types/src/component/oio-select/oio-select.vue.d.ts +153 -0
- package/dist/types/src/component/oio-slider/index.d.ts +1 -0
- package/dist/types/src/component/oio-slider/oio-slider.vue.d.ts +155 -0
- package/dist/types/src/component/oio-spin/index.d.ts +1 -0
- package/dist/types/src/component/oio-spin/oio-spin.vue.d.ts +54 -0
- package/dist/types/src/component/oio-switch/index.d.ts +1 -0
- package/dist/types/src/component/oio-switch/oio-switch.vue.d.ts +92 -0
- package/dist/types/src/component/oio-tabs/index.d.ts +3 -0
- package/dist/types/src/component/oio-tabs/oio-tab.vue.d.ts +67 -0
- package/dist/types/src/component/oio-tabs/oio-tabs.vue.d.ts +93 -0
- package/dist/types/src/component/oio-tabs/use-tab-bar.d.ts +5 -0
- package/dist/types/src/component/oio-textarea/index.d.ts +1 -0
- package/dist/types/src/component/oio-textarea/oio-textarea.vue.d.ts +100 -0
- package/dist/types/src/component/oio-tooltip/index.d.ts +2 -0
- package/dist/types/src/component/oio-tooltip/oio-tooltip-help.vue.d.ts +12 -0
- package/dist/types/src/component/oio-tooltip/oio-tooltip.vue.d.ts +76 -0
- package/dist/types/src/component/oio-tree/index.d.ts +1 -0
- package/dist/types/src/component/oio-tree/oio-tree.vue.d.ts +171 -0
- package/dist/types/src/component/oio-tree-select/index.d.ts +1 -0
- package/dist/types/src/component/oio-tree-select/oio-tree-select.vue.d.ts +226 -0
- package/dist/types/src/component/oio-upload/index.d.ts +1 -0
- package/dist/types/src/component/oio-upload/oio-upload.vue.d.ts +187 -0
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/theme/index.d.ts +1 -0
- package/dist/types/src/vc-component/index.d.ts +1 -0
- package/dist/types/src/vc-component/use-max-tag-placeholder.d.ts +7 -0
- package/index.ts +3 -0
- package/package.json +36 -0
- package/rollup.config.js +15 -0
- package/src/component/index.ts +32 -0
- package/src/component/oio-block/index.ts +3 -0
- package/src/component/oio-block/oio-block.vue +77 -0
- package/src/component/oio-block/oio-col.vue +32 -0
- package/src/component/oio-block/oio-row.vue +42 -0
- package/src/component/oio-block/style/a-col.scss +18 -0
- package/src/component/oio-block/style/index.scss +42 -0
- package/src/component/oio-block/style/parameters.scss +13 -0
- package/src/component/oio-breadcrumb/index.ts +2 -0
- package/src/component/oio-breadcrumb/oio-breadcrumb-item.vue +30 -0
- package/src/component/oio-breadcrumb/oio-breadcrumb.vue +30 -0
- package/src/component/oio-button/index.ts +1 -0
- package/src/component/oio-button/oio-button.vue +154 -0
- package/src/component/oio-button/style/a-button.scss +210 -0
- package/src/component/oio-button/style/index.scss +21 -0
- package/src/component/oio-button/style/parameters.scss +5 -0
- package/src/component/oio-cascader/index.ts +1 -0
- package/src/component/oio-cascader/oio-cascader.vue +171 -0
- package/src/component/oio-cascader/style/index.scss +59 -0
- package/src/component/oio-cascader/style/parameters.scss +5 -0
- package/src/component/oio-checkbox/index.ts +1 -0
- package/src/component/oio-checkbox/oio-checkbox.vue +69 -0
- package/src/component/oio-checkbox/style/index.scss +8 -0
- package/src/component/oio-checkbox/style/parameters.scss +5 -0
- package/src/component/oio-collapse/index.ts +2 -0
- package/src/component/oio-collapse/oio-collapse-panel.vue +92 -0
- package/src/component/oio-collapse/oio-collapse.vue +138 -0
- package/src/component/oio-collapse/style/index.scss +59 -0
- package/src/component/oio-collapse/style/parameters.scss +5 -0
- package/src/component/oio-date-time-picker/index.ts +5 -0
- package/src/component/oio-date-time-picker/oio-date-picker.vue +34 -0
- package/src/component/oio-date-time-picker/oio-date-time-picker.vue +91 -0
- package/src/component/oio-date-time-picker/oio-time-picker.vue +34 -0
- package/src/component/oio-date-time-picker/oio-year-picker.vue +34 -0
- package/src/component/oio-date-time-picker/style/index.scss +348 -0
- package/src/component/oio-date-time-picker/style/mixin.scss +16 -0
- package/src/component/oio-date-time-picker/style/parameters.scss +5 -0
- package/src/component/oio-date-time-picker/use-date-time-picker-props.ts +151 -0
- package/src/component/oio-date-time-range-picker/index.ts +5 -0
- package/src/component/oio-date-time-range-picker/oio-date-range-picker.vue +29 -0
- package/src/component/oio-date-time-range-picker/oio-date-time-range-picker.vue +82 -0
- package/src/component/oio-date-time-range-picker/oio-time-range-picker.vue +29 -0
- package/src/component/oio-date-time-range-picker/oio-year-range-picker.vue +29 -0
- package/src/component/oio-date-time-range-picker/style/index.scss +227 -0
- package/src/component/oio-date-time-range-picker/style/parameters.scss +5 -0
- package/src/component/oio-date-time-range-picker/use-date-time-range-picker-props.ts +138 -0
- package/src/component/oio-divider/index.ts +3 -0
- package/src/component/oio-divider/oio-divider.vue +31 -0
- package/src/component/oio-divider/style/index.scss +7 -0
- package/src/component/oio-divider/style/parameters.scss +5 -0
- package/src/component/oio-drawer/index.ts +1 -0
- package/src/component/oio-drawer/oio-drawer.vue +120 -0
- package/src/component/oio-drawer/style/index.scss +93 -0
- package/src/component/oio-drawer/style/parameters.scss +5 -0
- package/src/component/oio-dropdown/index.ts +1 -0
- package/src/component/oio-dropdown/oio-dropdown.vue +81 -0
- package/src/component/oio-dropdown/style/index.scss +30 -0
- package/src/component/oio-dropdown/style/parameters.scss +5 -0
- package/src/component/oio-empty/index.ts +1 -0
- package/src/component/oio-empty/oio-empty-data.vue +47 -0
- package/src/component/oio-empty/style/index.scss +6 -0
- package/src/component/oio-form/index.ts +2 -0
- package/src/component/oio-form/oio-form-item.vue +81 -0
- package/src/component/oio-form/oio-form.vue +102 -0
- package/src/component/oio-form/style/animation.scss +17 -0
- package/src/component/oio-form/style/index.scss +135 -0
- package/src/component/oio-form/style/parameters.scss +9 -0
- package/src/component/oio-gallery/index.ts +1 -0
- package/src/component/oio-gallery/oio-gallery.vue +158 -0
- package/src/component/oio-group/index.ts +2 -0
- package/src/component/oio-group/oio-group-help.vue +28 -0
- package/src/component/oio-group/oio-group.vue +140 -0
- package/src/component/oio-group/style/index.scss +98 -0
- package/src/component/oio-group/style/parameters.scss +5 -0
- package/src/component/oio-inner-popup/index.ts +1 -0
- package/src/component/oio-inner-popup/oio-inner-popup.vue +230 -0
- package/src/component/oio-inner-popup/style/index.scss +147 -0
- package/src/component/oio-inner-popup/style/parameters.scss +5 -0
- package/src/component/oio-input/index.ts +5 -0
- package/src/component/oio-input/oio-input-group.vue +40 -0
- package/src/component/oio-input/oio-input-number.vue +374 -0
- package/src/component/oio-input/oio-input-password.vue +67 -0
- package/src/component/oio-input/oio-input-search.vue +107 -0
- package/src/component/oio-input/oio-input.vue +124 -0
- package/src/component/oio-input/style/a-input.scss +103 -0
- package/src/component/oio-input/style/index.scss +198 -0
- package/src/component/oio-input/style/mixin.scss +50 -0
- package/src/component/oio-input/style/oio-input-group.scss +31 -0
- package/src/component/oio-input/style/oio-input-number.scss +13 -0
- package/src/component/oio-input/style/oio-input-search.scss +94 -0
- package/src/component/oio-input/style/parameters.scss +21 -0
- package/src/component/oio-modal/index.ts +1 -0
- package/src/component/oio-modal/index.zh-CN.md +167 -0
- package/src/component/oio-modal/oio-modal.vue +184 -0
- package/src/component/oio-modal/style/index.scss +167 -0
- package/src/component/oio-modal/style/parameters.scss +5 -0
- package/src/component/oio-notification/index.ts +197 -0
- package/src/component/oio-notification/style/index.scss +67 -0
- package/src/component/oio-notification/style/parameters.scss +5 -0
- package/src/component/oio-pagination/index.ts +1 -0
- package/src/component/oio-pagination/oio-pagination.vue +105 -0
- package/src/component/oio-pagination/style/index.scss +181 -0
- package/src/component/oio-pagination/style/parameters.scss +5 -0
- package/src/component/oio-popconfirm/index.ts +1 -0
- package/src/component/oio-popconfirm/oio-popconfirm.vue +192 -0
- package/src/component/oio-popconfirm/style/index.scss +54 -0
- package/src/component/oio-popconfirm/style/parameters.scss +5 -0
- package/src/component/oio-popover/style/index.scss +16 -0
- package/src/component/oio-popover/style/parameters.scss +5 -0
- package/src/component/oio-radio/style/index.scss +24 -0
- package/src/component/oio-radio/style/parameters.scss +5 -0
- package/src/component/oio-select/index.ts +1 -0
- package/src/component/oio-select/oio-select.vue +104 -0
- package/src/component/oio-select/style/a-select.scss +102 -0
- package/src/component/oio-select/style/index.scss +129 -0
- package/src/component/oio-select/style/mixin.scss +18 -0
- package/src/component/oio-select/style/parameters.scss +5 -0
- package/src/component/oio-slider/index.ts +1 -0
- package/src/component/oio-slider/oio-slider.vue +81 -0
- package/src/component/oio-slider/style/index.scss +100 -0
- package/src/component/oio-slider/style/parameters.scss +5 -0
- package/src/component/oio-spin/index.ts +1 -0
- package/src/component/oio-spin/oio-spin.vue +87 -0
- package/src/component/oio-spin/style/index.scss +48 -0
- package/src/component/oio-spin/style/parameters.scss +5 -0
- package/src/component/oio-switch/index.ts +1 -0
- package/src/component/oio-switch/oio-switch.vue +42 -0
- package/src/component/oio-switch/style/index.scss +36 -0
- package/src/component/oio-switch/style/parameters.scss +5 -0
- package/src/component/oio-tabs/index.ts +3 -0
- package/src/component/oio-tabs/oio-tab.vue +99 -0
- package/src/component/oio-tabs/oio-tabs.vue +188 -0
- package/src/component/oio-tabs/style/index.scss +274 -0
- package/src/component/oio-tabs/style/parameters.scss +9 -0
- package/src/component/oio-tabs/use-tab-bar.ts +69 -0
- package/src/component/oio-textarea/index.ts +1 -0
- package/src/component/oio-textarea/oio-textarea.vue +76 -0
- package/src/component/oio-textarea/style/index.scss +108 -0
- package/src/component/oio-textarea/style/parameters.scss +5 -0
- package/src/component/oio-tooltip/index.ts +2 -0
- package/src/component/oio-tooltip/oio-tooltip-help.vue +40 -0
- package/src/component/oio-tooltip/oio-tooltip.vue +59 -0
- package/src/component/oio-tooltip/style/index.scss +8 -0
- package/src/component/oio-tooltip/style/parameters.scss +9 -0
- package/src/component/oio-tree/index.ts +1 -0
- package/src/component/oio-tree/oio-tree.vue +181 -0
- package/src/component/oio-tree/style/index.scss +51 -0
- package/src/component/oio-tree/style/parameters.scss +5 -0
- package/src/component/oio-tree-select/index.ts +1 -0
- package/src/component/oio-tree-select/oio-tree-select.vue +180 -0
- package/src/component/oio-tree-select/style/index.scss +92 -0
- package/src/component/oio-tree-select/style/parameters.scss +5 -0
- package/src/component/oio-upload/index.ts +1 -0
- package/src/component/oio-upload/oio-upload.vue +232 -0
- package/src/component/oio-upload/style/index.scss +66 -0
- package/src/component/oio-upload/style/parameters.scss +5 -0
- package/src/index.ts +3 -0
- package/src/shim-translate.d.ts +7 -0
- package/src/shim-vue.d.ts +6 -0
- package/src/style/global-parameters.scss +9 -0
- package/src/style/index.scss +31 -0
- package/src/style/mixin.scss +135 -0
- package/src/theme/index.ts +1 -0
- package/src/vc-component/index.ts +1 -0
- package/src/vc-component/use-max-tag-placeholder.ts +38 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { OioSwitchProps, PropRecordHelper } from '@oinone/kunlun-vue-ui-common';
|
|
3
|
+
import { Switch as ASwitch } from 'ant-design-vue';
|
|
4
|
+
import { createVNode, defineComponent } from 'vue';
|
|
5
|
+
import { DEFAULT_PREFIX } from '../../theme';
|
|
6
|
+
|
|
7
|
+
export default defineComponent({
|
|
8
|
+
name: 'OioSwitch',
|
|
9
|
+
components: {
|
|
10
|
+
ASwitch
|
|
11
|
+
},
|
|
12
|
+
inheritAttrs: false,
|
|
13
|
+
props: {
|
|
14
|
+
...OioSwitchProps
|
|
15
|
+
},
|
|
16
|
+
slots: ['checkedChildren', 'uncheckedChildren'],
|
|
17
|
+
emits: ['update:checked', 'change'],
|
|
18
|
+
render() {
|
|
19
|
+
return createVNode(
|
|
20
|
+
ASwitch,
|
|
21
|
+
{
|
|
22
|
+
autofocus: this.autofocus,
|
|
23
|
+
checked: this.checked,
|
|
24
|
+
loading: this.loading,
|
|
25
|
+
size: this.size,
|
|
26
|
+
disabled: this.disabled,
|
|
27
|
+
checkedValue: this.checkedValue,
|
|
28
|
+
unCheckedValue: this.uncheckedValue,
|
|
29
|
+
...PropRecordHelper.collectionBasicProps(this.$attrs, [`${DEFAULT_PREFIX}-switch`]),
|
|
30
|
+
'onUpdate:checked': (val) => {
|
|
31
|
+
this.$emit('update:checked', val);
|
|
32
|
+
},
|
|
33
|
+
onChange: (val) => this.$emit('change', val)
|
|
34
|
+
},
|
|
35
|
+
PropRecordHelper.collectionRenderSlots(this, [
|
|
36
|
+
'checkedChildren',
|
|
37
|
+
{ origin: 'uncheckedChildren', target: 'unCheckedChildren' }
|
|
38
|
+
])
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
@import './parameters.scss';
|
|
2
|
+
|
|
3
|
+
.#{$switchClassPrefix} {
|
|
4
|
+
&.ant-switch {
|
|
5
|
+
height: 24px;
|
|
6
|
+
border-radius: 12px;
|
|
7
|
+
background-color: var(--oio-switch-background);
|
|
8
|
+
.ant-switch-handle {
|
|
9
|
+
top: 3px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&:focus {
|
|
13
|
+
box-shadow: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&:after {
|
|
17
|
+
width: 20px;
|
|
18
|
+
height: 20px;
|
|
19
|
+
background: #ffffff;
|
|
20
|
+
box-shadow: 0 0 2px 0 rgba(0, 0, 0, 0.2), 0 2px 9px 0 rgba(0, 0, 0, 0.08), -1px 2px 2px 0px rgba(0, 0, 0, 0.1);
|
|
21
|
+
}
|
|
22
|
+
&-small {
|
|
23
|
+
height: 18px;
|
|
24
|
+
line-height: 16px;
|
|
25
|
+
min-width: 30px;
|
|
26
|
+
&:after {
|
|
27
|
+
width: 14px;
|
|
28
|
+
height: 14px;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&.ant-switch-checked {
|
|
34
|
+
background-color: var($parameterPrefix + -primary-color);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
getVNodeKey,
|
|
4
|
+
OioTabProps,
|
|
5
|
+
PropRecordHelper,
|
|
6
|
+
TabHTMLNode,
|
|
7
|
+
useInjectOioTabsContext,
|
|
8
|
+
useOioFormLayoutContext
|
|
9
|
+
} from '@oinone/kunlun-vue-ui-common';
|
|
10
|
+
import { TabPane as ATabPane } from 'ant-design-vue';
|
|
11
|
+
import { createVNode, defineComponent, onUpdated, watch } from 'vue';
|
|
12
|
+
import { onTabInvisibleChange } from './use-tab-bar';
|
|
13
|
+
|
|
14
|
+
export default defineComponent({
|
|
15
|
+
name: 'OioTab',
|
|
16
|
+
components: {
|
|
17
|
+
ATabPane
|
|
18
|
+
},
|
|
19
|
+
inheritAttrs: false,
|
|
20
|
+
props: {
|
|
21
|
+
...OioTabProps
|
|
22
|
+
},
|
|
23
|
+
slots: ['default', 'tab'],
|
|
24
|
+
setup(props) {
|
|
25
|
+
useOioFormLayoutContext(props);
|
|
26
|
+
|
|
27
|
+
const tabKey = getVNodeKey();
|
|
28
|
+
|
|
29
|
+
const tabsContext = useInjectOioTabsContext();
|
|
30
|
+
|
|
31
|
+
const onInvisibleChange = (nodes: TabHTMLNode[], moreNodes: TabHTMLNode[], invisible: boolean | undefined) => {
|
|
32
|
+
if (!tabKey) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const index = nodes.findIndex((tab) => tab.key === tabKey);
|
|
36
|
+
if (index == null || index === -1) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
onTabInvisibleChange(nodes, index, invisible);
|
|
40
|
+
const targetId = `${tabsContext.id.value}-more-popup-${tabKey}`;
|
|
41
|
+
const targetIndex = moreNodes.findIndex((v) => v.el.id === targetId);
|
|
42
|
+
if (targetIndex !== -1) {
|
|
43
|
+
onTabInvisibleChange(moreNodes, targetIndex, invisible);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
watch(
|
|
48
|
+
() => ({
|
|
49
|
+
value: props.invisible,
|
|
50
|
+
nodes: tabsContext.nodes.value,
|
|
51
|
+
moreNodes: tabsContext.moreNodes.value
|
|
52
|
+
}),
|
|
53
|
+
(val) => {
|
|
54
|
+
onInvisibleChange(val.nodes, val.moreNodes, val.value);
|
|
55
|
+
},
|
|
56
|
+
{ immediate: true }
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
onUpdated(() => {
|
|
60
|
+
onInvisibleChange(tabsContext.nodes.value, tabsContext.moreNodes.value, props.invisible);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
tabPosition: tabsContext.tabPosition
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
render() {
|
|
68
|
+
const slots = PropRecordHelper.collectionSlots(this.$slots, [
|
|
69
|
+
{
|
|
70
|
+
origin: 'default',
|
|
71
|
+
isNotNull: true
|
|
72
|
+
}
|
|
73
|
+
]);
|
|
74
|
+
return createVNode(
|
|
75
|
+
ATabPane,
|
|
76
|
+
{
|
|
77
|
+
...PropRecordHelper.collectionBasicProps(this.$attrs),
|
|
78
|
+
...(this.componentData || {}),
|
|
79
|
+
...this.$attrs,
|
|
80
|
+
forceRender: this.forceRender,
|
|
81
|
+
disabled: this.disabled
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
default: () => {
|
|
85
|
+
return [
|
|
86
|
+
createVNode('div', { class: 'oio-tab' }, [
|
|
87
|
+
createVNode(
|
|
88
|
+
'div',
|
|
89
|
+
{ class: ['oio-tab-content', `oio-tab-${this.tabPosition}-content`] },
|
|
90
|
+
{ default: () => slots.default() }
|
|
91
|
+
)
|
|
92
|
+
])
|
|
93
|
+
];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
</script>
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { BooleanHelper, CSSStyle, uniqueKeyGenerator } from '@oinone/kunlun-shared';
|
|
3
|
+
import {
|
|
4
|
+
CleanableEvent,
|
|
5
|
+
OioTabPosition,
|
|
6
|
+
OioTabsProps,
|
|
7
|
+
PropRecordHelper,
|
|
8
|
+
StyleHelper,
|
|
9
|
+
TabHTMLNode,
|
|
10
|
+
useCleanableEvent,
|
|
11
|
+
useOioFormLayoutContext,
|
|
12
|
+
useProviderOioTabsContext
|
|
13
|
+
} from '@oinone/kunlun-vue-ui-common';
|
|
14
|
+
import { Tabs as ATabs } from 'ant-design-vue';
|
|
15
|
+
import useConfigInject from 'ant-design-vue/lib/_util/hooks/useConfigInject.js';
|
|
16
|
+
import { isNil } from 'lodash-es';
|
|
17
|
+
import { computed, createVNode, defineComponent, onMounted, onUnmounted, ref, unref, vShow, withDirectives } from 'vue';
|
|
18
|
+
import { DEFAULT_PREFIX } from '../../theme';
|
|
19
|
+
|
|
20
|
+
export default defineComponent({
|
|
21
|
+
name: 'OioTabs',
|
|
22
|
+
components: {
|
|
23
|
+
ATabs
|
|
24
|
+
},
|
|
25
|
+
inheritAttrs: false,
|
|
26
|
+
props: {
|
|
27
|
+
...OioTabsProps
|
|
28
|
+
},
|
|
29
|
+
emits: ['update:active-key'],
|
|
30
|
+
slots: ['default', 'tabBarLeftExtraContent', 'tabBarExtraContent'],
|
|
31
|
+
setup(props, context) {
|
|
32
|
+
useOioFormLayoutContext(props);
|
|
33
|
+
|
|
34
|
+
const id = props.id || uniqueKeyGenerator();
|
|
35
|
+
const { prefixCls } = useConfigInject('tabs', {});
|
|
36
|
+
|
|
37
|
+
const origin = ref();
|
|
38
|
+
const tabHTMLNodes = ref<TabHTMLNode[]>([]);
|
|
39
|
+
const moreTabHTMLNodes = ref<TabHTMLNode[]>([]);
|
|
40
|
+
|
|
41
|
+
const onUpdateActiveKey = (val) => {
|
|
42
|
+
context.emit('update:active-key', val);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
let moreButtonMousemove: CleanableEvent | undefined;
|
|
46
|
+
|
|
47
|
+
const moreButtonChange = () => {
|
|
48
|
+
const moreNodes: TabHTMLNode[] = [];
|
|
49
|
+
let index = 0;
|
|
50
|
+
const moreTabList = document.getElementById(`${id}-more-popup`)?.children as HTMLCollection;
|
|
51
|
+
if (moreTabList) {
|
|
52
|
+
for (const element of moreTabList) {
|
|
53
|
+
if (element.classList.contains('ant-tabs-dropdown-menu-item')) {
|
|
54
|
+
moreNodes.push({
|
|
55
|
+
el: element as HTMLElement,
|
|
56
|
+
index: index++
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
moreTabHTMLNodes.value = moreNodes;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
onMounted(() => {
|
|
65
|
+
const pre = unref(prefixCls);
|
|
66
|
+
const tabPrefix = `${pre}-tab`;
|
|
67
|
+
const tabBarList = origin.value.$el?.children?.[0]?.children?.[0]?.children?.[0]?.children as HTMLCollection;
|
|
68
|
+
const nodes: TabHTMLNode[] = [];
|
|
69
|
+
let index = 0;
|
|
70
|
+
if (tabBarList) {
|
|
71
|
+
for (const element of tabBarList) {
|
|
72
|
+
if (element.classList.contains(tabPrefix)) {
|
|
73
|
+
const tabEl = element as HTMLElement;
|
|
74
|
+
const tabKey = (element as any).__vnode?.props?.key;
|
|
75
|
+
nodes.push({
|
|
76
|
+
el: tabEl,
|
|
77
|
+
key: tabKey,
|
|
78
|
+
index: index++
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
tabHTMLNodes.value = nodes;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const moreButton = document.getElementById(`${id}-more`);
|
|
86
|
+
if (moreButton) {
|
|
87
|
+
const moreButtonExpandedListener = {
|
|
88
|
+
expanded: false,
|
|
89
|
+
checker: (): boolean => {
|
|
90
|
+
if (!moreTabHTMLNodes.value.length) {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
const current = !!BooleanHelper.toBoolean(moreButton.getAttribute('aria-expanded'));
|
|
94
|
+
if (current !== moreButtonExpandedListener.expanded) {
|
|
95
|
+
moreButtonExpandedListener.expanded = current;
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
return false;
|
|
99
|
+
},
|
|
100
|
+
listener: () => {
|
|
101
|
+
if (moreButtonExpandedListener.checker()) {
|
|
102
|
+
moreButtonChange();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
moreButtonMousemove = useCleanableEvent(origin.value.$el, 'mousemove', moreButtonExpandedListener.listener);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
onUnmounted(() => {
|
|
111
|
+
moreButtonMousemove?.remove();
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
useProviderOioTabsContext({
|
|
115
|
+
id: computed(() => id),
|
|
116
|
+
nodes: computed(() => tabHTMLNodes.value),
|
|
117
|
+
moreNodes: computed(() => moreTabHTMLNodes.value),
|
|
118
|
+
tabPosition: computed(() => props.tabPosition)
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
id,
|
|
123
|
+
origin,
|
|
124
|
+
onUpdateActiveKey
|
|
125
|
+
};
|
|
126
|
+
},
|
|
127
|
+
render() {
|
|
128
|
+
const {
|
|
129
|
+
invisible,
|
|
130
|
+
disabled,
|
|
131
|
+
componentData,
|
|
132
|
+
|
|
133
|
+
id,
|
|
134
|
+
activeKey,
|
|
135
|
+
tabPosition,
|
|
136
|
+
verticalHeight,
|
|
137
|
+
destroyInactiveTabPane,
|
|
138
|
+
type
|
|
139
|
+
} = this;
|
|
140
|
+
|
|
141
|
+
const style = {} as CSSStyle;
|
|
142
|
+
if (tabPosition !== OioTabPosition.TOP) {
|
|
143
|
+
if (!isNil(verticalHeight)) {
|
|
144
|
+
style.height = StyleHelper.px(verticalHeight) as string;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const classNames = [`${DEFAULT_PREFIX}-tabs`];
|
|
149
|
+
if (disabled) {
|
|
150
|
+
classNames.push(`${DEFAULT_PREFIX}-tabs-disabled`);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return withDirectives(
|
|
154
|
+
createVNode(
|
|
155
|
+
ATabs,
|
|
156
|
+
{
|
|
157
|
+
animated: true,
|
|
158
|
+
...PropRecordHelper.collectionBasicProps(this.$attrs, classNames, style),
|
|
159
|
+
...(componentData || {}),
|
|
160
|
+
ref: 'origin',
|
|
161
|
+
id,
|
|
162
|
+
activeKey,
|
|
163
|
+
tabPosition,
|
|
164
|
+
verticalHeight,
|
|
165
|
+
destroyInactiveTabPane,
|
|
166
|
+
type,
|
|
167
|
+
'onUpdate:activeKey': this.onUpdateActiveKey
|
|
168
|
+
},
|
|
169
|
+
PropRecordHelper.collectionSlots(this.$slots, [
|
|
170
|
+
{
|
|
171
|
+
origin: 'default',
|
|
172
|
+
isNotNull: true
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
origin: 'tabBarLeftExtraContent',
|
|
176
|
+
target: 'leftExtra'
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
origin: 'tabBarExtraContent',
|
|
180
|
+
target: 'rightExtra'
|
|
181
|
+
}
|
|
182
|
+
])
|
|
183
|
+
),
|
|
184
|
+
[[vShow, !invisible]]
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
</script>
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
@import '../../../style/mixin.scss';
|
|
2
|
+
@import './parameters.scss';
|
|
3
|
+
|
|
4
|
+
.#{$tabsClassPrefix} {
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
background: var(--oio-background);
|
|
8
|
+
box-shadow: 0 0 var(--oio-box-shadow-size) 0 var(--oio-border-color);
|
|
9
|
+
border-radius: 4px;
|
|
10
|
+
overflow: initial;
|
|
11
|
+
|
|
12
|
+
.ant-tabs-nav:before,
|
|
13
|
+
& > .ant-tabs-content-holder,
|
|
14
|
+
& > div > .ant-tabs-content-holder {
|
|
15
|
+
border-color: var(--oio-border-color);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.#{$tabClassPrefix}-bar {
|
|
19
|
+
position: relative;
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: row;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
align-items: center;
|
|
24
|
+
|
|
25
|
+
.#{$tabClassPrefix}-options {
|
|
26
|
+
width: 22px;
|
|
27
|
+
height: 100%;
|
|
28
|
+
position: absolute;
|
|
29
|
+
display: inline-flex;
|
|
30
|
+
justify-content: flex-end;
|
|
31
|
+
align-items: center;
|
|
32
|
+
|
|
33
|
+
&-hide {
|
|
34
|
+
display: none;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&-top {
|
|
38
|
+
top: 0;
|
|
39
|
+
right: -16px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&-left {
|
|
43
|
+
top: 0;
|
|
44
|
+
right: -16px;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.#{$tabClassPrefix}-close-icon {
|
|
49
|
+
display: inline-flex;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
align-items: center;
|
|
52
|
+
font-size: 8px;
|
|
53
|
+
width: 14px;
|
|
54
|
+
height: 14px;
|
|
55
|
+
background-color: #f1f1f1;
|
|
56
|
+
border-radius: 50%;
|
|
57
|
+
margin: 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.#{$tabClassPrefix}-title {
|
|
61
|
+
display: inline-block;
|
|
62
|
+
max-width: 120px;
|
|
63
|
+
white-space: nowrap;
|
|
64
|
+
overflow: hidden;
|
|
65
|
+
text-overflow: ellipsis;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&-invisible {
|
|
69
|
+
display: none;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&.ant-tabs {
|
|
74
|
+
color: var($parameterPrefix + -text-color);
|
|
75
|
+
|
|
76
|
+
.ant-tabs-tab-prev {
|
|
77
|
+
display: none;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.ant-tabs-tab-next {
|
|
81
|
+
display: none;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.ant-tabs-nav {
|
|
85
|
+
.ant-tabs-tab {
|
|
86
|
+
color: var($parameterPrefix + -text-color);
|
|
87
|
+
font-weight: var($parameterPrefix + -font-weight);
|
|
88
|
+
|
|
89
|
+
&:hover {
|
|
90
|
+
color: var($parameterPrefix + -primary-color);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&.ant-tabs-tab-active {
|
|
94
|
+
color: var($parameterPrefix + -primary-color);
|
|
95
|
+
font-weight: 400;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.anticon {
|
|
99
|
+
margin-right: 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&.ant-tabs-tab-disabled {
|
|
103
|
+
color: var($parameterPrefix + -disabled-color);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&-top {
|
|
109
|
+
.ant-tabs-nav-container {
|
|
110
|
+
height: var($parameterPrefix + -height);
|
|
111
|
+
margin: var($parameterPrefix + -margin-md) var($parameterPrefix + -margin-lg) 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.ant-tabs-nav {
|
|
115
|
+
padding-left: var(--oio-padding);
|
|
116
|
+
margin-bottom: 0;
|
|
117
|
+
|
|
118
|
+
.ant-tabs-tab {
|
|
119
|
+
padding: var(--oio-padding) 0;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&-left {
|
|
125
|
+
.ant-tabs-content-left {
|
|
126
|
+
padding: 0;
|
|
127
|
+
height: 100%;
|
|
128
|
+
overflow: hidden auto;
|
|
129
|
+
@include oio-scrollbar();
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.ant-tabs-nav {
|
|
133
|
+
.ant-tabs-tab {
|
|
134
|
+
.#{$tabClassPrefix}-title {
|
|
135
|
+
max-width: 56px;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&.ant-tabs-card {
|
|
143
|
+
& > .ant-tabs-nav .ant-tabs-tab,
|
|
144
|
+
& > div > .ant-tabs-nav .ant-tabs-tab {
|
|
145
|
+
padding: 8px 16px;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&.ant-tabs-top .ant-tabs-nav {
|
|
149
|
+
padding-left: 0;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.ant-tabs-content {
|
|
154
|
+
border: none;
|
|
155
|
+
padding: 0;
|
|
156
|
+
margin: 0;
|
|
157
|
+
|
|
158
|
+
&.ant-tabs-content-animated {
|
|
159
|
+
transition: none;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.ant-tabs-top-bar {
|
|
164
|
+
border-bottom: none;
|
|
165
|
+
|
|
166
|
+
.ant-tabs-tab {
|
|
167
|
+
padding: 0;
|
|
168
|
+
margin: 0 12px 0;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.ant-tabs-tab:first-child {
|
|
172
|
+
padding-left: 0;
|
|
173
|
+
margin-left: 0;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.ant-tabs-extra-content {
|
|
177
|
+
padding-right: var($parameterPrefix + -padding-lg);
|
|
178
|
+
height: var($parameterPrefix + -height);
|
|
179
|
+
line-height: var($parameterPrefix + -height);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.ant-tabs-left-bar {
|
|
184
|
+
border-right: 1px solid var(--oio-border-color);
|
|
185
|
+
width: 100px;
|
|
186
|
+
|
|
187
|
+
.ant-tabs-tab {
|
|
188
|
+
padding: 12px 28px 12px 12px;
|
|
189
|
+
margin: 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.ant-tabs-tab-active {
|
|
193
|
+
border-right: 2px solid var(--oio-primary-color);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.#{$tabClassPrefix} {
|
|
198
|
+
&-content {
|
|
199
|
+
width: 100%;
|
|
200
|
+
padding: 16px 24px 0;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&-top {
|
|
204
|
+
&-content {
|
|
205
|
+
padding: var(--oio-padding);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
&-left {
|
|
210
|
+
&-content {
|
|
211
|
+
padding: var(--oio-padding);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn {
|
|
217
|
+
color: var(--oio-primary-color);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.ant-tabs-dropdown-menu {
|
|
222
|
+
@include oio-scrollbar();
|
|
223
|
+
|
|
224
|
+
.#{$tabClassPrefix}-bar {
|
|
225
|
+
display: flex;
|
|
226
|
+
flex-direction: row;
|
|
227
|
+
align-items: center;
|
|
228
|
+
|
|
229
|
+
.#{$tabClassPrefix}-options {
|
|
230
|
+
margin-left: 2px;
|
|
231
|
+
display: inline-flex;
|
|
232
|
+
justify-content: flex-end;
|
|
233
|
+
align-items: center;
|
|
234
|
+
|
|
235
|
+
&-hide {
|
|
236
|
+
display: none;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
&-top {
|
|
240
|
+
top: 0;
|
|
241
|
+
right: -16px;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
&-left {
|
|
245
|
+
top: 0;
|
|
246
|
+
right: -16px;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.#{$tabClassPrefix}-close-icon {
|
|
251
|
+
display: inline-flex;
|
|
252
|
+
justify-content: center;
|
|
253
|
+
align-items: center;
|
|
254
|
+
font-size: 8px;
|
|
255
|
+
width: 14px;
|
|
256
|
+
height: 14px;
|
|
257
|
+
background-color: #f1f1f1;
|
|
258
|
+
border-radius: 50%;
|
|
259
|
+
margin: 0;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.#{$tabClassPrefix}-title {
|
|
263
|
+
display: inline-block;
|
|
264
|
+
max-width: 120px;
|
|
265
|
+
white-space: nowrap;
|
|
266
|
+
overflow: hidden;
|
|
267
|
+
text-overflow: ellipsis;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
&-invisible {
|
|
271
|
+
display: none;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
@import '../../../style/global-parameters.scss';
|
|
2
|
+
|
|
3
|
+
$tabsPrefix: $prefix + -tabs;
|
|
4
|
+
$tabsParameterPrefix: $parameterPrefix + -tabs;
|
|
5
|
+
$tabsClassPrefix: $tabsPrefix;
|
|
6
|
+
|
|
7
|
+
$tabPrefix: $prefix + -tab;
|
|
8
|
+
$tabParameterPrefix: $parameterPrefix + -tab;
|
|
9
|
+
$tabClassPrefix: $tabPrefix;
|