@sdata/web-vue 1.7.1 → 1.9.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/dist/sd.css +182 -1
- package/dist/sd.min.css +1 -1
- package/es/_components/input-label/input-label.js +30 -24
- package/es/_components/select-view/interface.d.ts +1 -0
- package/es/_components/select-view/select-view.d.ts +12 -3
- package/es/_components/select-view/select-view.js +38 -28
- package/es/_components/select-view/style/index.css +45 -0
- package/es/_hooks/use-allow-clear.d.ts +4 -0
- package/es/_hooks/use-allow-clear.js +20 -0
- package/es/_hooks/use-trigger.d.ts +4 -6
- package/es/_hooks/use-trigger.js +7 -5
- package/es/_utils/color.js +1 -18
- package/es/auto-complete/auto-complete.d.ts +1 -1
- package/es/auto-complete/auto-complete.js +4 -2
- package/es/auto-complete/index.d.ts +3 -3
- package/es/badge/badge.d.ts +1 -1
- package/es/badge/index.d.ts +3 -3
- package/es/carousel/carousel-arrow.vue.d.ts +1 -1
- package/es/carousel/carousel.d.ts +2 -2
- package/es/carousel/index.d.ts +6 -6
- package/es/cascader/cascader-panel.vue.d.ts +2 -2
- package/es/cascader/cascader.js +1 -1
- package/es/cascader/cascader.vue.d.ts +21 -11
- package/es/cascader/cascader.vue_vue_type_script_lang.js +4 -1
- package/es/cascader/index.d.ts +47 -26
- package/es/color-picker/color-picker.d.ts +115 -40
- package/es/color-picker/color-picker.js +146 -102
- package/es/color-picker/index.d.ts +217 -69
- package/es/color-picker/interface.d.ts +41 -0
- package/es/color-picker/palette.js +1 -1
- package/es/color-picker/panel.d.ts +73 -34
- package/es/color-picker/panel.js +423 -89
- package/es/color-picker/style/index.css +92 -1
- package/es/color-picker/style/index.scss +107 -1
- package/es/color-picker/utils.d.ts +89 -0
- package/es/color-picker/utils.js +456 -0
- package/es/config-provider/config-provider.vue.d.ts +10 -1
- package/es/config-provider/config-provider.vue_vue_type_script_lang.js +6 -1
- package/es/config-provider/context.d.ts +1 -0
- package/es/config-provider/index.d.ts +18 -3
- package/es/date-picker/index.d.ts +7 -6
- package/es/date-picker/picker.js +1 -1
- package/es/date-picker/picker.vue.d.ts +7 -6
- package/es/date-picker/picker.vue_vue_type_script_lang.js +4 -1
- package/es/date-picker/range-picker.js +1 -1
- package/es/date-picker/range-picker.vue.d.ts +7 -6
- package/es/date-picker/range-picker.vue_vue_type_script_lang.js +4 -1
- package/es/descriptions/descriptions.d.ts +2 -2
- package/es/descriptions/index.d.ts +6 -6
- package/es/drawer/drawer.vue_vue_type_script_lang.js +1 -1
- package/es/dropdown/dropdown-button.vue.d.ts +8 -8
- package/es/dropdown/dropdown-panel.vue.d.ts +2 -2
- package/es/dropdown/dropdown-submenu.vue.d.ts +8 -8
- package/es/dropdown/dropdown.vue.d.ts +8 -8
- package/es/dropdown/index.d.ts +32 -32
- package/es/ellipsis/ellipsis.vue.d.ts +13 -13
- package/es/ellipsis/ellipsis.vue_vue_type_script_lang.js +1 -1
- package/es/ellipsis/index.d.ts +56 -56
- package/es/ellipsis/performant-ellipsis.vue.d.ts +14 -14
- package/es/form/form-item-label.vue.d.ts +12 -12
- package/es/form/form-item.vue.d.ts +12 -12
- package/es/form/index.d.ts +12 -12
- package/es/grid/grid.vue.d.ts +1 -1
- package/es/grid/index.d.ts +3 -3
- package/es/image/image.vue.d.ts +12 -12
- package/es/image/preview-action.d.ts +12 -12
- package/es/image/preview-group.vue.d.ts +12 -12
- package/es/image/preview-toolbar.vue.d.ts +12 -12
- package/es/image/preview.vue.d.ts +12 -12
- package/es/index.css +182 -1
- package/es/index.js +2 -2
- package/es/input/input.js +4 -2
- package/es/input-number/input-number.js +4 -2
- package/es/input-tag/index.d.ts +6 -6
- package/es/input-tag/input-tag.d.ts +3 -3
- package/es/input-tag/input-tag.js +183 -32
- package/es/input-tag/style/index.css +45 -0
- package/es/input-tag/style/input-tag.scss +53 -0
- package/es/list/index.d.ts +3 -3
- package/es/list/list.d.ts +1 -1
- package/es/mention/mention.js +4 -2
- package/es/menu/sub-menu-pop.vue.d.ts +6 -6
- package/es/modal/modal.vue_vue_type_script_lang.js +1 -1
- package/es/overflow-list/index.d.ts +3 -3
- package/es/overflow-list/overflow-list.d.ts +1 -1
- package/es/pagination/page-options.vue.d.ts +188 -98
- package/es/popconfirm/index.d.ts +12 -12
- package/es/popconfirm/popconfirm.vue.d.ts +6 -6
- package/es/popover/index.d.ts +12 -12
- package/es/popover/popover.vue.d.ts +6 -6
- package/es/progress/index.d.ts +5 -5
- package/es/progress/line.vue.d.ts +1 -1
- package/es/progress/progress.vue.d.ts +2 -2
- package/es/rate/rate.js +4 -2
- package/es/scrollbar/index.d.ts +2 -2
- package/es/scrollbar/scrollbar.vue.d.ts +1 -1
- package/es/scrollbar/thumb.vue.d.ts +1 -1
- package/es/sd-vue.js +2 -2
- package/es/select/hooks/use-options.d.ts +9 -4
- package/es/select/hooks/use-options.js +2 -2
- package/es/select/hooks/use-select.d.ts +9 -4
- package/es/select/index.d.ts +188 -98
- package/es/select/interface.d.ts +57 -46
- package/es/select/select-dropdown.vue.d.ts +2 -2
- package/es/select/select.d.ts +107 -59
- package/es/select/select.js +182 -126
- package/es/select/utils.d.ts +1 -1
- package/es/select/utils.js +28 -10
- package/es/skeleton/index.d.ts +1 -1
- package/es/skeleton/line.vue.d.ts +1 -1
- package/es/slider/index.d.ts +27 -27
- package/es/slider/slider-button.vue.d.ts +12 -12
- package/es/slider/slider.vue.d.ts +13 -13
- package/es/space/index.d.ts +3 -3
- package/es/space/space.d.ts +1 -1
- package/es/statistic/index.d.ts +6 -6
- package/es/statistic/statistic.vue.d.ts +2 -2
- package/es/table/index.d.ts +6 -6
- package/es/table/table.d.ts +2 -2
- package/es/tabs/index.d.ts +9 -9
- package/es/tabs/tabs.d.ts +3 -3
- package/es/tag/index.d.ts +3 -3
- package/es/tag/tag.vue.d.ts +1 -1
- package/es/textarea/index.d.ts +3 -3
- package/es/textarea/textarea.vue.d.ts +1 -1
- package/es/textarea/textarea.vue_vue_type_script_lang.js +6 -2
- package/es/time-picker/index.d.ts +15 -12
- package/es/time-picker/time-picker.js +1 -1
- package/es/time-picker/time-picker.vue.d.ts +7 -6
- package/es/time-picker/time-picker.vue_vue_type_script_lang.js +4 -1
- package/es/tooltip/index.d.ts +12 -12
- package/es/tooltip/tooltip.vue.d.ts +6 -6
- package/es/transfer/index.d.ts +10 -10
- package/es/transfer/transfer-view.vue.d.ts +5 -5
- package/es/transfer/transfer.vue.d.ts +5 -5
- package/es/tree/index.d.ts +6 -6
- package/es/tree/tree.vue.d.ts +2 -2
- package/es/tree-select/hooks/use-selected-state.d.ts +2 -0
- package/es/tree-select/hooks/use-selected-state.js +26 -8
- package/es/tree-select/index.d.ts +268 -61
- package/es/tree-select/interface.d.ts +16 -3
- package/es/tree-select/panel.d.ts +6 -6
- package/es/tree-select/tree-select.js +29 -16
- package/es/tree-select/tree-select.vue.d.ts +144 -30
- package/es/tree-select/tree-select.vue_vue_type_script_lang.js +102 -22
- package/es/trigger/index.d.ts +6 -6
- package/es/trigger/trigger.d.ts +2 -2
- package/es/typography/operations.vue.d.ts +12 -12
- package/json/vetur-attributes.json +82 -178
- package/json/vetur-tags.json +24 -52
- package/json/web-types.json +164 -387
- package/package.json +9 -7
- package/es/color-picker/input-alpha.js +0 -32
- package/es/color-picker/input-hex.js +0 -73
- package/es/color-picker/input-rgb.js +0 -55
|
@@ -1,154 +1,198 @@
|
|
|
1
|
+
import { _objectSpread2 } from "../_virtual/_@oxc-project_runtime@0.124.0/helpers/objectSpread2.js";
|
|
1
2
|
import { getPrefixCls } from "../_utils/global-config.js";
|
|
2
|
-
import
|
|
3
|
+
import Input from "../input/index.js";
|
|
3
4
|
import Trigger from "../trigger/index.js";
|
|
4
|
-
import { formatInputToHSVA, hsvToRgb, rgbToHex, rgbaToHex } from "../_utils/color.js";
|
|
5
5
|
import { colors } from "./colors.js";
|
|
6
|
+
import { formatColorState, getColorBackground, getColorObject, normalizeFormat, parseColorState } from "./utils.js";
|
|
6
7
|
import panel_default from "./panel.js";
|
|
7
|
-
import { computed, createVNode, defineComponent, mergeProps,
|
|
8
|
+
import { computed, createVNode, defineComponent, mergeProps, ref } from "vue";
|
|
8
9
|
//#region components/color-picker/color-picker.tsx
|
|
9
10
|
var color_picker_default = /* @__PURE__ */ defineComponent({
|
|
10
11
|
name: "ColorPicker",
|
|
11
12
|
props: {
|
|
13
|
+
borderless: Boolean,
|
|
14
|
+
clearable: Boolean,
|
|
15
|
+
colorModes: {
|
|
16
|
+
type: Array,
|
|
17
|
+
default: () => ["monochrome"]
|
|
18
|
+
},
|
|
19
|
+
enableMultipleGradient: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: true
|
|
22
|
+
},
|
|
23
|
+
value: String,
|
|
12
24
|
modelValue: String,
|
|
13
|
-
defaultValue: {
|
|
14
|
-
|
|
25
|
+
defaultValue: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: ""
|
|
28
|
+
},
|
|
29
|
+
format: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: "RGB"
|
|
32
|
+
},
|
|
15
33
|
size: {
|
|
16
34
|
type: String,
|
|
17
35
|
default: "medium"
|
|
18
36
|
},
|
|
19
|
-
|
|
37
|
+
enableAlpha: Boolean,
|
|
38
|
+
showPrimaryColorPreview: {
|
|
20
39
|
type: Boolean,
|
|
21
|
-
default:
|
|
40
|
+
default: true
|
|
22
41
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
42
|
+
inputProps: { type: Object },
|
|
43
|
+
recentColors: {
|
|
44
|
+
type: [Array, Boolean],
|
|
45
|
+
default: void 0
|
|
26
46
|
},
|
|
27
|
-
|
|
28
|
-
type: Boolean,
|
|
29
|
-
default:
|
|
47
|
+
defaultRecentColors: {
|
|
48
|
+
type: [Array, Boolean],
|
|
49
|
+
default: () => []
|
|
30
50
|
},
|
|
31
|
-
|
|
32
|
-
type:
|
|
33
|
-
default:
|
|
51
|
+
swatchColors: {
|
|
52
|
+
type: Array,
|
|
53
|
+
default: void 0
|
|
34
54
|
},
|
|
35
|
-
|
|
55
|
+
disabled: {
|
|
36
56
|
type: Boolean,
|
|
37
57
|
default: false
|
|
38
58
|
},
|
|
39
|
-
hideTrigger:
|
|
59
|
+
hideTrigger: Boolean,
|
|
40
60
|
triggerProps: { type: Object },
|
|
41
61
|
historyColors: { type: Array },
|
|
42
|
-
presetColors: {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
62
|
+
presetColors: { type: Array },
|
|
63
|
+
showText: Boolean,
|
|
64
|
+
showHistory: Boolean,
|
|
65
|
+
showPreset: Boolean,
|
|
66
|
+
disabledAlpha: Boolean,
|
|
67
|
+
selectInputProps: { type: Object }
|
|
46
68
|
},
|
|
47
69
|
emits: {
|
|
48
70
|
"update:modelValue": (_value) => true,
|
|
49
|
-
"
|
|
50
|
-
"
|
|
71
|
+
"update:value": (_value) => true,
|
|
72
|
+
"change": (_value, _context) => true,
|
|
73
|
+
"popup-visible-change": (_visible, _value) => true,
|
|
74
|
+
"clear": (_context) => true,
|
|
75
|
+
"palette-bar-change": (_context) => true,
|
|
76
|
+
"recent-colors-change": (_value) => true
|
|
51
77
|
},
|
|
52
78
|
setup(props, { emit, slots }) {
|
|
53
79
|
const prefixCls = getPrefixCls("color-picker");
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return formatInputToHSVA(mergeValue.value || "");
|
|
80
|
+
const innerValue = ref(props.defaultValue);
|
|
81
|
+
const innerRecentColors = ref(Array.isArray(props.defaultRecentColors) ? props.defaultRecentColors : []);
|
|
82
|
+
const mergedValue = computed(() => {
|
|
83
|
+
var _ref, _props$modelValue;
|
|
84
|
+
return (_ref = (_props$modelValue = props.modelValue) !== null && _props$modelValue !== void 0 ? _props$modelValue : props.value) !== null && _ref !== void 0 ? _ref : innerValue.value;
|
|
60
85
|
});
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
86
|
+
const mergedEnableAlpha = computed(() => props.enableAlpha || !props.disabledAlpha);
|
|
87
|
+
const normalizedFormat = computed(() => normalizeFormat(props.format, mergedEnableAlpha.value));
|
|
88
|
+
const mergedRecentColors = computed(() => {
|
|
89
|
+
if (props.showHistory && props.historyColors) return props.historyColors;
|
|
90
|
+
if (props.recentColors === null || props.recentColors === false) return props.recentColors;
|
|
91
|
+
if (Array.isArray(props.recentColors)) return props.recentColors;
|
|
92
|
+
return innerRecentColors.value;
|
|
66
93
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
const color = computed(() => {
|
|
78
|
-
const rgb = hsvToRgb(hsv.value.h, hsv.value.s, hsv.value.v);
|
|
79
|
-
const hex = rgbToHex(rgb.r, rgb.g, rgb.b);
|
|
80
|
-
return {
|
|
81
|
-
hsv: hsv.value,
|
|
82
|
-
rgb,
|
|
83
|
-
hex
|
|
84
|
-
};
|
|
94
|
+
const mergedSwatchColors = computed(() => {
|
|
95
|
+
var _props$presetColors;
|
|
96
|
+
if (props.showPreset) return (_props$presetColors = props.presetColors) !== null && _props$presetColors !== void 0 ? _props$presetColors : colors;
|
|
97
|
+
if (props.swatchColors === null) return null;
|
|
98
|
+
if (Array.isArray(props.swatchColors)) return props.swatchColors;
|
|
99
|
+
if (props.swatchColors === void 0 && props.showPreset === false) return null;
|
|
100
|
+
return colors;
|
|
85
101
|
});
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
102
|
+
const colorState = computed(() => parseColorState(mergedValue.value, props.colorModes));
|
|
103
|
+
const triggerInputValue = computed(() => {
|
|
104
|
+
if (!mergedValue.value) return "";
|
|
105
|
+
return formatColorState(colorState.value, normalizedFormat.value, mergedEnableAlpha.value);
|
|
89
106
|
});
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
return alpha.value < 1 && !props.disabledAlpha ? `#${rgbaToHex(r, g, b, alpha.value)}` : `#${rgbToHex(r, g, b)}`;
|
|
107
|
+
const previewStyle = computed(() => {
|
|
108
|
+
const background = getColorBackground(colorState.value);
|
|
109
|
+
return colorState.value.mode === "linear-gradient" ? { backgroundImage: background } : { backgroundColor: background };
|
|
94
110
|
});
|
|
95
|
-
|
|
111
|
+
const syncValue = (value) => {
|
|
112
|
+
if (props.modelValue === void 0 && props.value === void 0) innerValue.value = value;
|
|
96
113
|
emit("update:modelValue", value);
|
|
97
|
-
emit("
|
|
98
|
-
}
|
|
99
|
-
const
|
|
100
|
-
|
|
114
|
+
emit("update:value", value);
|
|
115
|
+
};
|
|
116
|
+
const syncRecentColors = (value) => {
|
|
117
|
+
if (props.recentColors === void 0) innerRecentColors.value = value;
|
|
118
|
+
emit("recent-colors-change", value);
|
|
101
119
|
};
|
|
102
|
-
const
|
|
103
|
-
|
|
120
|
+
const emitChange = (value, trigger) => {
|
|
121
|
+
syncValue(value);
|
|
122
|
+
emit("change", value, {
|
|
123
|
+
color: getColorObject(parseColorState(value, props.colorModes)),
|
|
124
|
+
trigger
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
const handleColorChange = (value, trigger) => {
|
|
128
|
+
if (props.disabled) return;
|
|
129
|
+
emitChange(value, trigger);
|
|
130
|
+
};
|
|
131
|
+
const handleClear = (event) => {
|
|
132
|
+
syncValue("");
|
|
133
|
+
emit("clear", { e: event });
|
|
134
|
+
emit("change", "", {
|
|
135
|
+
color: getColorObject(parseColorState("", props.colorModes)),
|
|
136
|
+
trigger: "clear"
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
const handleTriggerInputChange = (value) => {
|
|
140
|
+
if (!value) {
|
|
141
|
+
handleClear(new MouseEvent("click"));
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
handleColorChange(formatColorState(parseColorState(value, props.colorModes), normalizedFormat.value, mergedEnableAlpha.value), "input");
|
|
104
145
|
};
|
|
105
146
|
const onPopupVisibleChange = (visible) => {
|
|
106
|
-
emit("popup-visible-change", visible,
|
|
147
|
+
emit("popup-visible-change", visible, triggerInputValue.value);
|
|
107
148
|
};
|
|
108
|
-
const
|
|
149
|
+
const mergedTriggerProps = computed(() => _objectSpread2({
|
|
150
|
+
trigger: "click",
|
|
151
|
+
position: "bl",
|
|
152
|
+
disabled: props.disabled,
|
|
153
|
+
popupOffset: 4,
|
|
154
|
+
animationName: "slide-dynamic-origin"
|
|
155
|
+
}, props.triggerProps));
|
|
156
|
+
const renderTriggerInput = () => {
|
|
109
157
|
return createVNode("div", { "class": {
|
|
110
158
|
[prefixCls]: true,
|
|
111
159
|
[`${prefixCls}-size-${props.size}`]: props.size,
|
|
112
|
-
[`${prefixCls}-disabled`]: props.disabled
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
160
|
+
[`${prefixCls}-disabled`]: props.disabled,
|
|
161
|
+
[`${prefixCls}-borderless`]: props.borderless
|
|
162
|
+
} }, [createVNode(Input, mergeProps({
|
|
163
|
+
"class": `${prefixCls}-trigger-input`,
|
|
164
|
+
"size": props.size === "mini" ? "mini" : props.size,
|
|
165
|
+
"allowClear": props.clearable,
|
|
166
|
+
"disabled": props.disabled,
|
|
167
|
+
"modelValue": triggerInputValue.value,
|
|
168
|
+
"onChange": handleTriggerInputChange,
|
|
169
|
+
"onClear": handleClear
|
|
170
|
+
}, props.inputProps), { prefix: () => createVNode("div", {
|
|
171
|
+
"class": `${prefixCls}-preview`,
|
|
172
|
+
"style": previewStyle.value
|
|
173
|
+
}, null) })]);
|
|
125
174
|
};
|
|
126
175
|
const renderPanel = () => {
|
|
127
176
|
return createVNode(panel_default, {
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
"showHistory": props.showHistory,
|
|
134
|
-
"showPreset": props.showPreset,
|
|
177
|
+
"value": mergedValue.value,
|
|
178
|
+
"colorModes": props.colorModes,
|
|
179
|
+
"enableMultipleGradient": props.enableMultipleGradient,
|
|
180
|
+
"recentColors": mergedRecentColors.value,
|
|
181
|
+
"swatchColors": mergedSwatchColors.value,
|
|
135
182
|
"disabled": props.disabled,
|
|
136
|
-
"
|
|
137
|
-
"format":
|
|
138
|
-
"
|
|
139
|
-
"
|
|
183
|
+
"enableAlpha": mergedEnableAlpha.value,
|
|
184
|
+
"format": normalizedFormat.value,
|
|
185
|
+
"showPrimaryColorPreview": props.showPrimaryColorPreview,
|
|
186
|
+
"onChange": handleColorChange,
|
|
187
|
+
"onRecentColorsChange": syncRecentColors,
|
|
188
|
+
"onPaletteBarChange": (context) => {
|
|
189
|
+
emit("palette-bar-change", context);
|
|
190
|
+
}
|
|
140
191
|
}, null);
|
|
141
192
|
};
|
|
142
193
|
return () => {
|
|
143
|
-
return props.hideTrigger ? renderPanel() : createVNode(Trigger, mergeProps({
|
|
144
|
-
|
|
145
|
-
"position": "bl",
|
|
146
|
-
"animationName": "slide-dynamic-origin",
|
|
147
|
-
"popupOffset": 4,
|
|
148
|
-
"disabled": props.disabled,
|
|
149
|
-
"onPopupVisibleChange": onPopupVisibleChange
|
|
150
|
-
}, props.triggerProps), {
|
|
151
|
-
default: () => [slots.default ? slots.default() : renderInput()],
|
|
194
|
+
return props.hideTrigger ? renderPanel() : createVNode(Trigger, mergeProps({ "onPopupVisibleChange": onPopupVisibleChange }, mergedTriggerProps.value), {
|
|
195
|
+
default: () => [slots.default ? slots.default() : renderTriggerInput()],
|
|
152
196
|
content: renderPanel
|
|
153
197
|
});
|
|
154
198
|
};
|