@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,180 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { CastHelper, StringHelper } from '@oinone/kunlun-shared';
|
|
3
|
+
import {
|
|
4
|
+
defaultTreeSelectProperties,
|
|
5
|
+
fillTreeSelectNodesProperties,
|
|
6
|
+
OioTreeSelectProps,
|
|
7
|
+
PropRecordHelper,
|
|
8
|
+
SelectMode,
|
|
9
|
+
SimpleTreeSelected,
|
|
10
|
+
TreeSelectNode,
|
|
11
|
+
TreeSelectNodeChangeEvent,
|
|
12
|
+
TreeSelectProperties
|
|
13
|
+
} from '@oinone/kunlun-vue-ui-common';
|
|
14
|
+
import { Popover as APopover, TreeSelect as ATreeSelect } from 'ant-design-vue';
|
|
15
|
+
import { computed, createVNode, defineComponent } from 'vue';
|
|
16
|
+
import { DEFAULT_PREFIX } from '../../theme';
|
|
17
|
+
import { useMaxTagPlaceholder } from '../../vc-component';
|
|
18
|
+
import { OioEmptyData } from '../oio-empty';
|
|
19
|
+
|
|
20
|
+
export default defineComponent({
|
|
21
|
+
name: 'OioTreeSelect',
|
|
22
|
+
components: {
|
|
23
|
+
ATreeSelect,
|
|
24
|
+
APopover
|
|
25
|
+
},
|
|
26
|
+
inheritAttrs: false,
|
|
27
|
+
props: {
|
|
28
|
+
...OioTreeSelectProps
|
|
29
|
+
},
|
|
30
|
+
slots: ['title'],
|
|
31
|
+
emits: ['update:value', 'update:expanded-keys', 'update:search-value', 'change', 'search'],
|
|
32
|
+
setup(props, context) {
|
|
33
|
+
const internalProperties = computed<TreeSelectProperties>(() => {
|
|
34
|
+
return {
|
|
35
|
+
...defaultTreeSelectProperties,
|
|
36
|
+
...(props.properties || {})
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const internalOptions = computed<TreeSelectNode[]>(() => {
|
|
41
|
+
const options = props.options || [];
|
|
42
|
+
if (props.mappingOptions) {
|
|
43
|
+
return fillTreeSelectNodesProperties(options, internalProperties.value, props.customFillProperties) || [];
|
|
44
|
+
}
|
|
45
|
+
return CastHelper.cast(options);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const multiple = computed(() => {
|
|
49
|
+
return props.mode === SelectMode.multiple;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const onChange = (
|
|
53
|
+
selectedValues: SimpleTreeSelected | SimpleTreeSelected[],
|
|
54
|
+
matchKeys: null,
|
|
55
|
+
selectedEvent: { triggerValue: string; checked: boolean }
|
|
56
|
+
) => {
|
|
57
|
+
const event: TreeSelectNodeChangeEvent = {
|
|
58
|
+
targetValue: selectedEvent.triggerValue,
|
|
59
|
+
checked: selectedEvent.checked,
|
|
60
|
+
origin: selectedEvent
|
|
61
|
+
};
|
|
62
|
+
context.emit('update:value', selectedValues);
|
|
63
|
+
context.emit('change', selectedValues, event);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const onUpdateExpandedKeys = (val) => {
|
|
67
|
+
context.emit('update:expanded-keys', val);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const onUpdateSearchValue = (val) => {
|
|
71
|
+
context.emit('update:search-value', val);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const onSearch = (val) => {
|
|
75
|
+
context.emit('search', val);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
internalProperties,
|
|
80
|
+
internalOptions,
|
|
81
|
+
multiple,
|
|
82
|
+
|
|
83
|
+
...useMaxTagPlaceholder(),
|
|
84
|
+
|
|
85
|
+
onChange,
|
|
86
|
+
onUpdateExpandedKeys,
|
|
87
|
+
onUpdateSearchValue,
|
|
88
|
+
onSearch
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
render() {
|
|
92
|
+
const {
|
|
93
|
+
value,
|
|
94
|
+
options,
|
|
95
|
+
filterOption,
|
|
96
|
+
mappingOptions,
|
|
97
|
+
placeholder,
|
|
98
|
+
allowClear,
|
|
99
|
+
readonly,
|
|
100
|
+
disabled,
|
|
101
|
+
searchValue,
|
|
102
|
+
enableSearch,
|
|
103
|
+
dropdownClassName,
|
|
104
|
+
getTriggerContainer,
|
|
105
|
+
multipleCheckedStrategy,
|
|
106
|
+
treeCheckStrictly,
|
|
107
|
+
expandedKeys,
|
|
108
|
+
|
|
109
|
+
loading,
|
|
110
|
+
loadData,
|
|
111
|
+
|
|
112
|
+
internalProperties,
|
|
113
|
+
internalOptions,
|
|
114
|
+
multiple,
|
|
115
|
+
|
|
116
|
+
tagRender,
|
|
117
|
+
maxTagCount,
|
|
118
|
+
maxTagPlaceholder,
|
|
119
|
+
defaultMaxTagPlaceholder,
|
|
120
|
+
|
|
121
|
+
onChange,
|
|
122
|
+
onUpdateExpandedKeys,
|
|
123
|
+
onUpdateSearchValue,
|
|
124
|
+
onSearch
|
|
125
|
+
} = this;
|
|
126
|
+
|
|
127
|
+
const classNames = [`${DEFAULT_PREFIX}-select`, `${DEFAULT_PREFIX}-tree-select`];
|
|
128
|
+
if (readonly) {
|
|
129
|
+
classNames.push(`${DEFAULT_PREFIX}-select-readonly`);
|
|
130
|
+
}
|
|
131
|
+
if (disabled) {
|
|
132
|
+
classNames.push(`${DEFAULT_PREFIX}-select-disabled`);
|
|
133
|
+
}
|
|
134
|
+
if (multiple) {
|
|
135
|
+
classNames.push(`${DEFAULT_PREFIX}-select-multiple`);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const children = PropRecordHelper.collectionSlots(this.$slots, ['title']);
|
|
139
|
+
|
|
140
|
+
return createVNode(
|
|
141
|
+
ATreeSelect,
|
|
142
|
+
{
|
|
143
|
+
placeholder,
|
|
144
|
+
allowClear,
|
|
145
|
+
disabled: readonly || disabled,
|
|
146
|
+
dropdownClassName: StringHelper.append(
|
|
147
|
+
[`${DEFAULT_PREFIX}-select-dropdown`, `${DEFAULT_PREFIX}-tree-select-dropdown`],
|
|
148
|
+
dropdownClassName
|
|
149
|
+
).join(' '),
|
|
150
|
+
getPopupContainer: getTriggerContainer,
|
|
151
|
+
labelInValue: true,
|
|
152
|
+
value,
|
|
153
|
+
searchValue,
|
|
154
|
+
showSearch: enableSearch,
|
|
155
|
+
treeData: mappingOptions ? internalOptions : options,
|
|
156
|
+
filterTreeNode: filterOption,
|
|
157
|
+
treeNodeFilterProp: internalProperties.filterProp,
|
|
158
|
+
multiple,
|
|
159
|
+
treeCheckable: multiple,
|
|
160
|
+
showCheckedStrategy: multipleCheckedStrategy,
|
|
161
|
+
treeCheckStrictly,
|
|
162
|
+
treeExpandedKeys: expandedKeys,
|
|
163
|
+
loading,
|
|
164
|
+
loadData,
|
|
165
|
+
tagRender,
|
|
166
|
+
maxTagCount,
|
|
167
|
+
maxTagPlaceholder: maxTagPlaceholder || defaultMaxTagPlaceholder,
|
|
168
|
+
notFoundContent: createVNode(OioEmptyData, { loading }),
|
|
169
|
+
...PropRecordHelper.collectionBasicProps(this.$attrs, classNames),
|
|
170
|
+
'onUpdate:value': undefined,
|
|
171
|
+
'onUpdate:tree-expanded-keys': onUpdateExpandedKeys,
|
|
172
|
+
'onUpdate:search-value': onUpdateSearchValue,
|
|
173
|
+
onChange,
|
|
174
|
+
onSearch
|
|
175
|
+
},
|
|
176
|
+
children
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
</script>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
@import './parameters.scss';
|
|
2
|
+
|
|
3
|
+
.#{$treeSelectClassPrefix} {
|
|
4
|
+
height: var(--oio-height);
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
&.ant-select.oio-select-multiple {
|
|
7
|
+
min-height: var(--oio-height);
|
|
8
|
+
height: auto;
|
|
9
|
+
.ant-select-selector {
|
|
10
|
+
position: relative;
|
|
11
|
+
line-height: var(--oio-height);
|
|
12
|
+
height: auto;
|
|
13
|
+
&::after {
|
|
14
|
+
line-height: var($treeSelectParameterPrefix + -selection-line-height);
|
|
15
|
+
}
|
|
16
|
+
.ant-select-selection-placeholder {
|
|
17
|
+
top: 50%;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ant-select-selection-item,
|
|
23
|
+
.ant-select-selection-search,
|
|
24
|
+
.ant-select-selection-placeholder {
|
|
25
|
+
height: var($treeSelectParameterPrefix + -selection-height);
|
|
26
|
+
line-height: var($treeSelectParameterPrefix + -selection-line-height);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.#{$treeSelectClassPrefix}-dropdown {
|
|
33
|
+
.ant-select-tree-checkbox-indeterminate .ant-select-tree-checkbox-inner {
|
|
34
|
+
&:after {
|
|
35
|
+
background-color: var($parameterPrefix + -primary-color);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.ant-select-tree {
|
|
40
|
+
background: var(--oio-select-dropdown-background);
|
|
41
|
+
.ant-select-tree-title {
|
|
42
|
+
color: var(--oio-text-color);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ant-select-tree-checkbox:not(.ant-select-tree-checkbox-checked) {
|
|
46
|
+
background: var(--oio-checkbox-background);
|
|
47
|
+
.ant-select-tree-checkbox-inner {
|
|
48
|
+
background-color: var(--oio-background);
|
|
49
|
+
border: 1px solid var(--oio-border-color);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.anticon.anticon-caret-down {
|
|
54
|
+
color: var(--oio-icon-color);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.ant-select-tree-checkbox-checked .ant-select-tree-checkbox-inner {
|
|
59
|
+
background-color: var($parameterPrefix + -primary-color);
|
|
60
|
+
border-color: var($parameterPrefix + -primary-color);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.ant-select-tree-checkbox-input:focus + .ant-select-tree-checkbox-inner,
|
|
64
|
+
.ant-select-tree-checkbox-wrapper:hover .ant-select-tree-checkbox-inner,
|
|
65
|
+
.ant-select-tree-checkbox:hover .ant-select-tree-checkbox-inner {
|
|
66
|
+
border-color: var($parameterPrefix + -primary-color);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.ant-select-tree-node-content-wrapper {
|
|
70
|
+
&:hover {
|
|
71
|
+
background-color: rgba(var($parameterPrefix + -primary-color-rgb), 0.1);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&.ant-select-tree-node-selected {
|
|
75
|
+
background-color: rgba(var($parameterPrefix + -primary-color-rgb), 0.1);
|
|
76
|
+
|
|
77
|
+
.ant-select-tree-title {
|
|
78
|
+
color: var($parameterPrefix + -primary-color);
|
|
79
|
+
font-weight: 500;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&:after {
|
|
83
|
+
position: absolute;
|
|
84
|
+
right: 8px;
|
|
85
|
+
top: 0;
|
|
86
|
+
content: '✓';
|
|
87
|
+
color: var($parameterPrefix + -primary-color);
|
|
88
|
+
font-weight: 500;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as OioUpload } from './oio-upload.vue';
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ReturnPromise, ReturnVoid } from '@oinone/kunlun-shared';
|
|
3
|
+
import { FileModel, IUploadMethod, OioUploadProps, PropRecordHelper, useUploadFileEvent } from '@oinone/kunlun-vue-ui-common';
|
|
4
|
+
import { Upload as AUpload } from 'ant-design-vue';
|
|
5
|
+
import { isArray, isNil, isString } from 'lodash-es';
|
|
6
|
+
import { computed, createVNode, defineComponent, nextTick, ref, watch } from 'vue';
|
|
7
|
+
import { DEFAULT_PREFIX } from '../../theme';
|
|
8
|
+
import { OioMessage } from '../oio-notification';
|
|
9
|
+
|
|
10
|
+
interface FileItem {
|
|
11
|
+
uid: string;
|
|
12
|
+
size: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default defineComponent({
|
|
16
|
+
name: 'OioUpload',
|
|
17
|
+
components: {
|
|
18
|
+
AUpload
|
|
19
|
+
},
|
|
20
|
+
inheritAttrs: false,
|
|
21
|
+
props: {
|
|
22
|
+
...OioUploadProps
|
|
23
|
+
},
|
|
24
|
+
emits: ['success', 'failure'],
|
|
25
|
+
setup(props, context) {
|
|
26
|
+
const uploadList = ref<FileModel[]>([]);
|
|
27
|
+
const refreshKey = ref<number>(0);
|
|
28
|
+
const isUpload = ref<boolean>(false);
|
|
29
|
+
|
|
30
|
+
const continuedUpload = ref(() => {});
|
|
31
|
+
|
|
32
|
+
watch(
|
|
33
|
+
() => ({
|
|
34
|
+
list: props.uploadList,
|
|
35
|
+
isUpload: isUpload.value
|
|
36
|
+
}),
|
|
37
|
+
(val) => {
|
|
38
|
+
if (val && val.list && !isUpload.value) {
|
|
39
|
+
uploadList.value = val.list;
|
|
40
|
+
refreshKey.value++;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{ immediate: true }
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const deleteFile = (file: FileItem, fileList: FileItem[]) => {
|
|
47
|
+
if (props.manual) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const uid = file.uid;
|
|
51
|
+
const index = fileList.findIndex((v) => v.uid === uid);
|
|
52
|
+
if (index !== -1) {
|
|
53
|
+
fileList.splice(index, 1);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const beforeUpload = (file: FileItem, fileList: FileItem[]): boolean => {
|
|
58
|
+
const limitSize = props.limitSize;
|
|
59
|
+
if (limitSize && limitSize > 0) {
|
|
60
|
+
if (file.size > limitSize * 1024 * 1024) {
|
|
61
|
+
OioMessage.error(`单个文件大小不允许超过${limitSize}MB`);
|
|
62
|
+
deleteFile(file, fileList);
|
|
63
|
+
nextTick(() => {
|
|
64
|
+
refreshKey.value++;
|
|
65
|
+
});
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const res = props.beforeUpload?.(file, fileList);
|
|
70
|
+
if (res != null) {
|
|
71
|
+
if (!res) {
|
|
72
|
+
deleteFile(file, fileList);
|
|
73
|
+
nextTick(() => {
|
|
74
|
+
refreshKey.value++;
|
|
75
|
+
});
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return res;
|
|
80
|
+
}
|
|
81
|
+
return true;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
let timer: any = null;
|
|
85
|
+
|
|
86
|
+
const customRequest = props.customRequest
|
|
87
|
+
? props.customRequest
|
|
88
|
+
: async ({ file, onSuccess, onError, onProgress }) => {
|
|
89
|
+
// 上传成功的回调
|
|
90
|
+
const success = async (result, downloadUrl) => {
|
|
91
|
+
const submitFileObject = result;
|
|
92
|
+
if (submitFileObject && submitFileObject.url) {
|
|
93
|
+
onSuccess(
|
|
94
|
+
{
|
|
95
|
+
...submitFileObject,
|
|
96
|
+
uid: file.uid
|
|
97
|
+
},
|
|
98
|
+
file
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
submitFileObject.uid = file.uid;
|
|
102
|
+
context.emit('success', submitFileObject);
|
|
103
|
+
timer = setTimeout(() => {
|
|
104
|
+
isUpload.value = false;
|
|
105
|
+
}, 100);
|
|
106
|
+
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// 上传失败的回调
|
|
112
|
+
const error = (...arg) => {
|
|
113
|
+
onError(...arg);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// 上传中的回调
|
|
117
|
+
const progress = (...arg) => {
|
|
118
|
+
isUpload.value = true;
|
|
119
|
+
onProgress(...arg);
|
|
120
|
+
if (timer) {
|
|
121
|
+
clearTimeout(timer);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const continued =
|
|
126
|
+
(await useUploadFileEvent({
|
|
127
|
+
file,
|
|
128
|
+
accept: realAccept.value,
|
|
129
|
+
managed: props.managed,
|
|
130
|
+
cdnKey: props.cdnKey,
|
|
131
|
+
uploadMethod: IUploadMethod.Multipart,
|
|
132
|
+
partSize: props.partSize,
|
|
133
|
+
parallel: props.parallel,
|
|
134
|
+
chunkUploadThreshold: props.chunkUploadThreshold,
|
|
135
|
+
onSuccess: success,
|
|
136
|
+
onError: error,
|
|
137
|
+
onProgress: progress
|
|
138
|
+
})) || ({} as any);
|
|
139
|
+
|
|
140
|
+
if (continued) {
|
|
141
|
+
continuedUpload.value = continued;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const remove = (file): ReturnPromise<boolean | ReturnVoid> => {
|
|
146
|
+
if (props.removeCallback) {
|
|
147
|
+
return props.removeCallback(file);
|
|
148
|
+
}
|
|
149
|
+
return true;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const realAccept = computed<string>(() => {
|
|
153
|
+
const val = props.accept;
|
|
154
|
+
if (isNil(val)) {
|
|
155
|
+
return '';
|
|
156
|
+
}
|
|
157
|
+
if (isString(val)) {
|
|
158
|
+
return val;
|
|
159
|
+
}
|
|
160
|
+
if (isArray(val)) {
|
|
161
|
+
return val.join(',');
|
|
162
|
+
}
|
|
163
|
+
return '';
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
return {
|
|
167
|
+
uploadList,
|
|
168
|
+
refreshKey,
|
|
169
|
+
realAccept,
|
|
170
|
+
beforeUpload,
|
|
171
|
+
customRequest,
|
|
172
|
+
remove,
|
|
173
|
+
continuedUpload
|
|
174
|
+
};
|
|
175
|
+
},
|
|
176
|
+
render() {
|
|
177
|
+
const uploadClassList = [`${DEFAULT_PREFIX}-upload`];
|
|
178
|
+
if (this.readonly) {
|
|
179
|
+
uploadClassList.push(`${DEFAULT_PREFIX}-upload-readonly`);
|
|
180
|
+
}
|
|
181
|
+
if (this.disabled) {
|
|
182
|
+
uploadClassList.push(`${DEFAULT_PREFIX}-upload-disabled`);
|
|
183
|
+
}
|
|
184
|
+
let showUploadList: boolean | { showPreviewIcon?: boolean; showRemoveIcon?: boolean } | undefined =
|
|
185
|
+
this.showUploadList;
|
|
186
|
+
if (isNil(showUploadList)) {
|
|
187
|
+
showUploadList = {
|
|
188
|
+
showPreviewIcon: true,
|
|
189
|
+
showRemoveIcon: !this.readonly
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
const slots = PropRecordHelper.collectionSlots(this.$slots, [
|
|
193
|
+
{
|
|
194
|
+
origin: 'default',
|
|
195
|
+
isNotNull: true
|
|
196
|
+
},
|
|
197
|
+
'itemRender'
|
|
198
|
+
]) as Record<string, any>;
|
|
199
|
+
|
|
200
|
+
const mapSlotIfPresent = (slotName, context) => {
|
|
201
|
+
if (this.$slots[slotName]) {
|
|
202
|
+
slots[slotName] = (arg) => this.$slots[slotName]?.({ ...arg, ...context });
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
mapSlotIfPresent('previewIcon', { continuedUpload: this.continuedUpload });
|
|
207
|
+
mapSlotIfPresent('removeIcon', { continuedUpload: this.continuedUpload });
|
|
208
|
+
|
|
209
|
+
return createVNode(
|
|
210
|
+
AUpload,
|
|
211
|
+
{
|
|
212
|
+
key: this.refreshKey,
|
|
213
|
+
defaultFileList: this.uploadList,
|
|
214
|
+
limit: this.limit,
|
|
215
|
+
accept: this.realAccept,
|
|
216
|
+
onReject: this.onReject,
|
|
217
|
+
multiple: this.multiple,
|
|
218
|
+
listType: this.listType,
|
|
219
|
+
progress: this.progress,
|
|
220
|
+
showUploadList,
|
|
221
|
+
customRequest: this.customRequest,
|
|
222
|
+
onRemove: this.remove,
|
|
223
|
+
disabled: this.disabled,
|
|
224
|
+
beforeUpload: this.beforeUpload,
|
|
225
|
+
onDrop: this.onDrop,
|
|
226
|
+
...PropRecordHelper.collectionBasicProps(this.$attrs, uploadClassList)
|
|
227
|
+
},
|
|
228
|
+
slots
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
</script>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
@import './parameters.scss';
|
|
2
|
+
@import '../../../style/mixin.scss';
|
|
3
|
+
|
|
4
|
+
.#{$uploadClassPrefix} {
|
|
5
|
+
&.ant-upload-picture-card-wrapper {
|
|
6
|
+
.ant-upload-list-picture-card {
|
|
7
|
+
.ant-upload-list-item:hover {
|
|
8
|
+
.ant-upload-list-item-card-actions-btn,
|
|
9
|
+
.anticon-close {
|
|
10
|
+
border-color: transparent;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
.ant-upload-select-picture-card {
|
|
15
|
+
@include oio-appearance($uploadParameterPrefix);
|
|
16
|
+
margin: 0;
|
|
17
|
+
|
|
18
|
+
.ant-upload {
|
|
19
|
+
color: var(--oio-upload-text-color);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&:hover {
|
|
23
|
+
@include oio-hover($uploadParameterPrefix);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.ant-upload-disabled {
|
|
27
|
+
cursor: unset;
|
|
28
|
+
background-color: var($parameterPrefix + -disabled-bg);
|
|
29
|
+
|
|
30
|
+
&:hover {
|
|
31
|
+
border-color: var($uploadParameterPrefix + -border-color);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.ant-upload-list {
|
|
38
|
+
.ant-upload-list-item-card-actions .anticon {
|
|
39
|
+
color: var(--oio-icon-color);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.ant-btn:focus,
|
|
43
|
+
.ant-btn:hover {
|
|
44
|
+
border: none;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.#{$uploadClassPrefix}-disabled {
|
|
50
|
+
}
|
|
51
|
+
.#{$uploadClassPrefix}-readonly {
|
|
52
|
+
.ant-upload-select {
|
|
53
|
+
pointer-events: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.ant-upload-select-picture-card {
|
|
57
|
+
pointer-events: none;
|
|
58
|
+
background-color: var(--oio-readonly-bg);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.ant-upload-list-item-actions {
|
|
62
|
+
span[aria-label='delete'] {
|
|
63
|
+
display: none;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
@import '../component/oio-block/style/index.scss';
|
|
2
|
+
@import '../component/oio-button/style/index.scss';
|
|
3
|
+
@import '../component/oio-cascader/style/index.scss';
|
|
4
|
+
@import '../component/oio-date-time-picker/style/index.scss';
|
|
5
|
+
@import '../component/oio-date-time-range-picker/style/index.scss';
|
|
6
|
+
@import '../component/oio-divider/style/index.scss';
|
|
7
|
+
@import '../component/oio-drawer/style/index.scss';
|
|
8
|
+
@import '../component/oio-dropdown/style/index.scss';
|
|
9
|
+
@import '../component/oio-empty/style/index.scss';
|
|
10
|
+
@import '../component/oio-form/style/index.scss';
|
|
11
|
+
@import '../component/oio-group/style/index.scss';
|
|
12
|
+
@import '../component/oio-inner-popup/style/index.scss';
|
|
13
|
+
@import '../component/oio-input/style/index.scss';
|
|
14
|
+
@import '../component/oio-modal/style/index.scss';
|
|
15
|
+
@import '../component/oio-notification/style/index.scss';
|
|
16
|
+
@import '../component/oio-pagination/style/index.scss';
|
|
17
|
+
@import '../component/oio-popconfirm/style/index.scss';
|
|
18
|
+
@import '../component/oio-select/style/index.scss';
|
|
19
|
+
@import '../component/oio-slider/style/index.scss';
|
|
20
|
+
@import '../component/oio-spin/style/index.scss';
|
|
21
|
+
@import '../component/oio-switch/style/index.scss';
|
|
22
|
+
@import '../component/oio-tabs/style/index.scss';
|
|
23
|
+
@import '../component/oio-textarea/style/index.scss';
|
|
24
|
+
@import '../component/oio-tooltip/style/index.scss';
|
|
25
|
+
@import '../component/oio-tree/style/index.scss';
|
|
26
|
+
@import '../component/oio-tree-select/style/index.scss';
|
|
27
|
+
@import '../component/oio-upload/style/index.scss';
|
|
28
|
+
@import '../component/oio-checkbox/style/index.scss';
|
|
29
|
+
@import '../component/oio-radio/style/index.scss';
|
|
30
|
+
@import '../component/oio-popover/style/index.scss';
|
|
31
|
+
@import '../component/oio-collapse/style/index.scss';
|