@opentiny/vue-renderless 3.26.0 → 3.27.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/calendar-view/index.js +6 -3
- package/calendar-view/vue.js +9 -5
- package/color-picker/vue.js +4 -0
- package/color-select-panel/alpha-select/index.js +17 -12
- package/color-select-panel/alpha-select/vue.js +4 -2
- package/color-select-panel/hue-select/index.js +42 -11
- package/color-select-panel/hue-select/vue.js +32 -6
- package/color-select-panel/index.js +223 -39
- package/color-select-panel/linear-gradient/index.js +131 -0
- package/color-select-panel/linear-gradient/vue.js +21 -0
- package/color-select-panel/sv-select/index.js +12 -9
- package/color-select-panel/sv-select/vue.js +4 -2
- package/color-select-panel/utils/color-map.js +154 -0
- package/color-select-panel/utils/color-points.js +86 -0
- package/color-select-panel/utils/color.js +1 -1
- package/color-select-panel/utils/context.js +14 -0
- package/color-select-panel/vue.js +3 -3
- package/common/deps/infinite-scroll.js +1 -1
- package/dialog-box/index.js +3 -3
- package/dialog-box/vue.js +1 -0
- package/file-upload/index.js +3 -2
- package/form-item/vue.js +1 -1
- package/guide/index.js +3 -3
- package/input/vue.js +2 -1
- package/package.json +3 -3
- package/picker/vue.js +10 -0
- package/select/index.js +30 -13
- package/select/vue.js +29 -9
- package/slider/vue.js +7 -0
- package/space/index.js +30 -0
- package/space/vue.js +39 -0
- package/tab-nav/index.js +2 -2
- package/tabs-mf/vue-nav.js +9 -18
- package/tabs-mf/vue-slider-bar.js +24 -0
- package/tabs-mf/vue.js +3 -1
- package/tag/index.js +1 -1
- package/tree-menu/index.js +4 -0
- package/tree-menu/vue.js +3 -0
- package/types/color-select-panel.type.d.ts +197 -1
- package/types/numeric.type.d.ts +1 -1
- package/types/picker.type.d.ts +4 -0
- package/types/space.type.d.ts +31 -0
- package/types/switch.type.d.ts +1 -1
package/select/index.js
CHANGED
|
@@ -179,8 +179,8 @@ const handleMenuEnter = ({ api, nextTick, state, props }) => () => {
|
|
|
179
179
|
nextTick(() => api.scrollToOption(state.selected));
|
|
180
180
|
}
|
|
181
181
|
};
|
|
182
|
-
const emitChange = ({ emit, props, state, constants }) => (value, changed) => {
|
|
183
|
-
if (state.device === "mb" && props.multiple && !changed)
|
|
182
|
+
const emitChange = ({ emit, props, state, constants, isMobileFirstMode }) => (value, changed) => {
|
|
183
|
+
if (isMobileFirstMode && state.device === "mb" && props.multiple && !changed)
|
|
184
184
|
return;
|
|
185
185
|
const seekItem = (val, arr, items, flag) => {
|
|
186
186
|
if (constants.TYPE.Tree === flag) {
|
|
@@ -220,8 +220,8 @@ const emitChange = ({ emit, props, state, constants }) => (value, changed) => {
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
};
|
|
223
|
-
const directEmitChange = ({ emit, props, state }) => (value, key) => {
|
|
224
|
-
if (state.device === "mb" && props.multiple)
|
|
223
|
+
const directEmitChange = ({ emit, props, state, isMobileFirstMode }) => (value, key) => {
|
|
224
|
+
if (isMobileFirstMode && state.device === "mb" && props.multiple)
|
|
225
225
|
return;
|
|
226
226
|
emit("change", value, key);
|
|
227
227
|
};
|
|
@@ -1101,7 +1101,7 @@ const toHide = ({ constants, state, props, vm, api }) => () => {
|
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
1103
1103
|
};
|
|
1104
|
-
const watchVisible = ({ api, constants, emit, state, vm, props }) => (value) => {
|
|
1104
|
+
const watchVisible = ({ api, constants, emit, state, vm, props, isMobileFirstMode }) => (value) => {
|
|
1105
1105
|
var _a;
|
|
1106
1106
|
if ((props.filterable || props.searchable || props.remote) && !value) {
|
|
1107
1107
|
(_a = vm.$refs.reference) == null ? void 0 : _a.blur();
|
|
@@ -1109,7 +1109,7 @@ const watchVisible = ({ api, constants, emit, state, vm, props }) => (value) =>
|
|
|
1109
1109
|
if (api.onCopying()) {
|
|
1110
1110
|
return;
|
|
1111
1111
|
}
|
|
1112
|
-
if (value && props.multiple && state.device === "mb") {
|
|
1112
|
+
if (value && props.multiple && isMobileFirstMode && state.device === "mb") {
|
|
1113
1113
|
state.selectedCopy = state.selected.slice();
|
|
1114
1114
|
}
|
|
1115
1115
|
setTimeout(() => {
|
|
@@ -1147,12 +1147,28 @@ const watchOptions = ({ api, constants, nextTick, parent, props, state }) => ()
|
|
|
1147
1147
|
api.resetInputHeight();
|
|
1148
1148
|
}
|
|
1149
1149
|
nextTick(() => {
|
|
1150
|
-
|
|
1150
|
+
var _a;
|
|
1151
|
+
if (parent.$el.querySelector("input") !== document.activeElement && // filterable时, 从 input 框离开了
|
|
1152
|
+
!(((_a = document.activeElement) == null ? void 0 : _a.classList.contains("tiny-input__inner")) && // 并且当前不在下拉面板的searchable 的input中时, 才需要更新一下setSelect
|
|
1153
|
+
document.activeElement.closest(".tiny-select-dropdown__search"))) {
|
|
1151
1154
|
api.setSelected();
|
|
1152
1155
|
}
|
|
1153
1156
|
});
|
|
1154
1157
|
api.getOptionIndexArr();
|
|
1155
1158
|
};
|
|
1159
|
+
const watchOptionsWhenAutoSelect = ({ nextTick, props, state, api }) => () => {
|
|
1160
|
+
if (props.autoSelect && props.remote) {
|
|
1161
|
+
nextTick(() => {
|
|
1162
|
+
var _a, _b;
|
|
1163
|
+
if (((_a = props.options) == null ? void 0 : _a.length) === 1 || state.options.length === 1) {
|
|
1164
|
+
const { valueField } = props;
|
|
1165
|
+
const option = ((_b = props.options) == null ? void 0 : _b.length) === 1 ? props.options[0] : state.options[0];
|
|
1166
|
+
api.updateModelValue(props.multiple ? [option[props.valueField]] : option[props.valueField]);
|
|
1167
|
+
state.visible = false;
|
|
1168
|
+
}
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
};
|
|
1156
1172
|
const getOptionIndexArr = ({ props, state, api }) => () => {
|
|
1157
1173
|
setTimeout(() => {
|
|
1158
1174
|
state.optionIndexArr = api.queryVisibleOptions().map((item) => Number(item.getAttribute("data-index")));
|
|
@@ -1586,9 +1602,9 @@ const computeMultipleLimit = ({ props, state }) => () => {
|
|
|
1586
1602
|
const { optimizeOpts } = state;
|
|
1587
1603
|
return optmzApis.natural(multiple && optimization ? multipleLimit || optimizeOpts.limit : multipleLimit);
|
|
1588
1604
|
};
|
|
1589
|
-
const updateModelValue = ({ props, emit, state }) => (value, needUpdate) => {
|
|
1605
|
+
const updateModelValue = ({ props, emit, state, isMobileFirstMode }) => (value, needUpdate) => {
|
|
1590
1606
|
state.isClickChoose = true;
|
|
1591
|
-
if (state.device === "mb" && props.multiple && !needUpdate) {
|
|
1607
|
+
if (isMobileFirstMode && state.device === "mb" && props.multiple && !needUpdate) {
|
|
1592
1608
|
state.modelValue = value;
|
|
1593
1609
|
} else {
|
|
1594
1610
|
emit("update:modelValue", value);
|
|
@@ -1626,17 +1642,17 @@ const computedTagsStyle = ({ props, parent, state, vm }) => () => {
|
|
|
1626
1642
|
}
|
|
1627
1643
|
return tagsStyle;
|
|
1628
1644
|
};
|
|
1629
|
-
const computedReadonly = ({ props, state }) => () => {
|
|
1645
|
+
const computedReadonly = ({ props, state, isMobileFirstMode }) => () => {
|
|
1630
1646
|
if (state.isIOS && props.filterable) {
|
|
1631
1647
|
return false;
|
|
1632
1648
|
} else {
|
|
1633
|
-
return state.device === "mb" || props.readonly || !(props.filterable || props.searchable) || props.multiple || browserInfo.name !== BROWSER_NAME.IE && browserInfo.name !== BROWSER_NAME.Edge && !state.visible;
|
|
1649
|
+
return isMobileFirstMode && state.device === "mb" || props.readonly || !(props.filterable || props.searchable) || props.multiple || browserInfo.name !== BROWSER_NAME.IE && browserInfo.name !== BROWSER_NAME.Edge && !state.visible;
|
|
1634
1650
|
}
|
|
1635
1651
|
};
|
|
1636
1652
|
const computedShowClose = ({ props, state }) => () => props.clearable && !state.selectDisabled && (state.inputHovering || props.multiple && state.visible) && (props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : !isNull(props.modelValue) && props.modelValue !== "");
|
|
1637
1653
|
const computedCollapseTagSize = (state) => () => state.selectSize;
|
|
1638
|
-
const computedShowNewOption = ({ props, state }) => () => {
|
|
1639
|
-
const query = state.device === "mb" ? state.queryValue : state.query;
|
|
1654
|
+
const computedShowNewOption = ({ props, state, isMobileFirstMode }) => () => {
|
|
1655
|
+
const query = isMobileFirstMode && state.device === "mb" ? state.queryValue : state.query;
|
|
1640
1656
|
return (props.filterable || props.searchable) && props.allowCreate && query && !state.options.filter((option) => !option.created).some((option) => option.state.currentLabel === state.query);
|
|
1641
1657
|
};
|
|
1642
1658
|
const computedShowCopy = ({ props, state }) => () => props.multiple && props.copyable && state.inputHovering && state.selected.length;
|
|
@@ -1845,6 +1861,7 @@ export {
|
|
|
1845
1861
|
watchInputHover,
|
|
1846
1862
|
watchOptimizeOpts,
|
|
1847
1863
|
watchOptions,
|
|
1864
|
+
watchOptionsWhenAutoSelect,
|
|
1848
1865
|
watchPropsOption,
|
|
1849
1866
|
watchShowClose,
|
|
1850
1867
|
watchValue,
|
package/select/vue.js
CHANGED
|
@@ -113,7 +113,8 @@ import {
|
|
|
113
113
|
computedIsExpand,
|
|
114
114
|
computedShowTagText,
|
|
115
115
|
isTagClosable,
|
|
116
|
-
computedCurrentSizeMap
|
|
116
|
+
computedCurrentSizeMap,
|
|
117
|
+
watchOptionsWhenAutoSelect
|
|
117
118
|
} from "./index";
|
|
118
119
|
import { debounce } from "@opentiny/utils";
|
|
119
120
|
import { isNumber } from "@opentiny/utils";
|
|
@@ -183,7 +184,19 @@ const api = [
|
|
|
183
184
|
"computedShowTagText",
|
|
184
185
|
"isTagClosable"
|
|
185
186
|
];
|
|
186
|
-
const initState = ({
|
|
187
|
+
const initState = ({
|
|
188
|
+
reactive,
|
|
189
|
+
computed,
|
|
190
|
+
props,
|
|
191
|
+
api: api2,
|
|
192
|
+
emitter,
|
|
193
|
+
parent,
|
|
194
|
+
constants,
|
|
195
|
+
isMobileFirstMode,
|
|
196
|
+
useBreakpoint,
|
|
197
|
+
vm,
|
|
198
|
+
designConfig
|
|
199
|
+
}) => {
|
|
187
200
|
const stateAdd = initStateAdd({ computed, props, api: api2, parent });
|
|
188
201
|
const state = reactive(__spreadProps(__spreadValues({}, stateAdd), {
|
|
189
202
|
selectEmitter: emitter(),
|
|
@@ -224,10 +237,13 @@ const initState = ({ reactive, computed, props, api: api2, emitter, parent, cons
|
|
|
224
237
|
selectedCopy: [],
|
|
225
238
|
compareValue: null,
|
|
226
239
|
selectedVal: computed(
|
|
227
|
-
() => state.device === "mb" && props.multiple && state.visible ? state.selectedCopy : state.selected
|
|
240
|
+
() => isMobileFirstMode && state.device === "mb" && props.multiple && state.visible ? state.selectedCopy : state.selected
|
|
228
241
|
),
|
|
229
242
|
displayOnlyContent: computed(() => {
|
|
230
243
|
var _a;
|
|
244
|
+
if (vm.$slots.reference) {
|
|
245
|
+
return "";
|
|
246
|
+
}
|
|
231
247
|
if (props.multiple) {
|
|
232
248
|
if (Array.isArray(state.selected)) {
|
|
233
249
|
if (state.isDisplayOnly && props.options && props.options.length > 0) {
|
|
@@ -372,8 +388,8 @@ const initApi = ({
|
|
|
372
388
|
getChildValue: getChildValue(),
|
|
373
389
|
getOption: getOption({ props, state, api: api2 }),
|
|
374
390
|
getSelectedOption: getSelectedOption({ props, state }),
|
|
375
|
-
emitChange: emitChange({ emit, props, state, constants }),
|
|
376
|
-
directEmitChange: directEmitChange({ emit, props, state, constants }),
|
|
391
|
+
emitChange: emitChange({ emit, props, state, constants, isMobileFirstMode }),
|
|
392
|
+
directEmitChange: directEmitChange({ emit, props, state, constants, isMobileFirstMode }),
|
|
377
393
|
toggleMenu: toggleMenu({ vm, state, props, api: api2, isMobileFirstMode }),
|
|
378
394
|
showTip: showTip({ props, state, vm }),
|
|
379
395
|
onOptionDestroy: onOptionDestroy(state),
|
|
@@ -414,12 +430,12 @@ const initApi = ({
|
|
|
414
430
|
computeMultipleLimit: computeMultipleLimit({ props, state }),
|
|
415
431
|
watchInputHover: watchInputHover({ vm }),
|
|
416
432
|
initQuery: initQuery({ props, state, constants, vm }),
|
|
417
|
-
updateModelValue: updateModelValue({ props, emit, state }),
|
|
433
|
+
updateModelValue: updateModelValue({ props, emit, state, isMobileFirstMode }),
|
|
418
434
|
computedTagsStyle: computedTagsStyle({ props, parent, state, vm }),
|
|
419
|
-
computedReadonly: computedReadonly({ props, state }),
|
|
435
|
+
computedReadonly: computedReadonly({ props, state, isMobileFirstMode }),
|
|
420
436
|
computedShowClose: computedShowClose({ props, state }),
|
|
421
437
|
computedCollapseTagSize: computedCollapseTagSize(state),
|
|
422
|
-
computedShowNewOption: computedShowNewOption({ props, state }),
|
|
438
|
+
computedShowNewOption: computedShowNewOption({ props, state, isMobileFirstMode }),
|
|
423
439
|
computedShowCopy: computedShowCopy({ props, state }),
|
|
424
440
|
computedOptionsAllDisabled: computedOptionsAllDisabled(state),
|
|
425
441
|
computedDisabledTooltipContent: computedDisabledTooltipContent({ props, state }),
|
|
@@ -435,7 +451,8 @@ const initApi = ({
|
|
|
435
451
|
clearNoMatchValue: clearNoMatchValue({ props, emit }),
|
|
436
452
|
computedShowTagText: computedShowTagText({ state }),
|
|
437
453
|
isTagClosable: isTagClosable(),
|
|
438
|
-
computedCurrentSizeMap: computedCurrentSizeMap({ state, designConfig })
|
|
454
|
+
computedCurrentSizeMap: computedCurrentSizeMap({ state, designConfig }),
|
|
455
|
+
watchOptionsWhenAutoSelect: watchOptionsWhenAutoSelect({ state, props, nextTick, api: api2 })
|
|
439
456
|
});
|
|
440
457
|
addApi({ api: api2, props, state, emit, constants, parent, nextTick, dispatch, vm, isMobileFirstMode, designConfig });
|
|
441
458
|
};
|
|
@@ -571,6 +588,8 @@ const initWatch = ({ watch, props, api: api2, state, nextTick }) => {
|
|
|
571
588
|
};
|
|
572
589
|
const addWatch = ({ watch, props, api: api2, state, nextTick }) => {
|
|
573
590
|
watch(() => [...state.options], api2.watchOptions);
|
|
591
|
+
watch(() => state.options, api2.watchOptionsWhenAutoSelect);
|
|
592
|
+
props.options && watch(() => props.options, api2.watchOptionsWhenAutoSelect);
|
|
574
593
|
if (props.renderType === "grid" && !props.optimization) {
|
|
575
594
|
watch(() => state.gridData, api2.setSelected, { immediate: true });
|
|
576
595
|
}
|
|
@@ -597,6 +616,7 @@ const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, wat
|
|
|
597
616
|
emitter,
|
|
598
617
|
parent,
|
|
599
618
|
constants,
|
|
619
|
+
isMobileFirstMode,
|
|
600
620
|
useBreakpoint,
|
|
601
621
|
vm,
|
|
602
622
|
designConfig
|
package/slider/vue.js
CHANGED
|
@@ -172,6 +172,13 @@ const renderless = (props, { computed, onBeforeUnmount, onMounted, reactive, wat
|
|
|
172
172
|
api2.setActiveButtonValue(value);
|
|
173
173
|
}
|
|
174
174
|
);
|
|
175
|
+
watch(
|
|
176
|
+
() => props.vertical,
|
|
177
|
+
() => {
|
|
178
|
+
api2.setBarStyle();
|
|
179
|
+
api2.setButtonStyle();
|
|
180
|
+
}
|
|
181
|
+
);
|
|
175
182
|
watch(
|
|
176
183
|
() => state.leftBtnValue,
|
|
177
184
|
(newVal) => {
|
package/space/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
const sizeMap = {
|
|
3
|
+
small: "8px",
|
|
4
|
+
medium: "16px",
|
|
5
|
+
large: "24px"
|
|
6
|
+
};
|
|
7
|
+
const parseGap = (gap) => {
|
|
8
|
+
if (typeof gap === "number")
|
|
9
|
+
return `${gap}px`;
|
|
10
|
+
if (gap in sizeMap)
|
|
11
|
+
return sizeMap[gap];
|
|
12
|
+
if (typeof gap === "string")
|
|
13
|
+
return gap;
|
|
14
|
+
return "0px";
|
|
15
|
+
};
|
|
16
|
+
const getGapStyle = (props) => {
|
|
17
|
+
const gapProp = props.size;
|
|
18
|
+
if (Array.isArray(gapProp)) {
|
|
19
|
+
const [horizontal, vertical] = gapProp;
|
|
20
|
+
return {
|
|
21
|
+
gap: `${parseGap(vertical)} ${parseGap(horizontal)}`
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
gap: parseGap(gapProp)
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
getGapStyle
|
|
30
|
+
};
|
package/space/vue.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
import { getGapStyle } from "./index";
|
|
3
|
+
const api = ["state", "orderedChildren"];
|
|
4
|
+
function isVNodeFn(node) {
|
|
5
|
+
return !!(node && (node.__v_isVNode || node.componentOptions));
|
|
6
|
+
}
|
|
7
|
+
const renderless = (props, hooks, { slots }) => {
|
|
8
|
+
const { reactive, computed } = hooks;
|
|
9
|
+
const state = reactive({
|
|
10
|
+
gapStyle: computed(() => getGapStyle(props))
|
|
11
|
+
});
|
|
12
|
+
const orderedChildren = computed(() => {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
const children = ((_a = slots.default) == null ? void 0 : _a.call(slots)) || [];
|
|
15
|
+
const validChildren = children.filter((v) => {
|
|
16
|
+
if (!isVNodeFn(v))
|
|
17
|
+
return false;
|
|
18
|
+
const type = v.type;
|
|
19
|
+
return type !== "Comment" && type !== Symbol.for("v-comment");
|
|
20
|
+
});
|
|
21
|
+
if (!((_b = props.order) == null ? void 0 : _b.length))
|
|
22
|
+
return validChildren;
|
|
23
|
+
const map = {};
|
|
24
|
+
validChildren.forEach((child) => {
|
|
25
|
+
var _a2, _b2, _c;
|
|
26
|
+
const key = (_c = child.key) != null ? _c : Array.isArray((_a2 = child.props) == null ? void 0 : _a2.class) ? child.props.class.join(" ") : (_b2 = child.props) == null ? void 0 : _b2.class;
|
|
27
|
+
if (key)
|
|
28
|
+
map[String(key)] = child;
|
|
29
|
+
});
|
|
30
|
+
const sorted = props.order.map((k) => map[k]).filter(Boolean);
|
|
31
|
+
const rest = validChildren.filter((v) => !props.order.includes(String(v.key)));
|
|
32
|
+
return [...sorted, ...rest];
|
|
33
|
+
});
|
|
34
|
+
return { state, orderedChildren };
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
api,
|
|
38
|
+
renderless
|
|
39
|
+
};
|
package/tab-nav/index.js
CHANGED
|
@@ -301,11 +301,11 @@ const watchCurrentName = ({ nextTick, vm, state }) => () => {
|
|
|
301
301
|
});
|
|
302
302
|
};
|
|
303
303
|
const handleTitleMouseenter = ({ state, vm, props }) => (e, title) => {
|
|
304
|
-
const dom = e.target;
|
|
305
|
-
const el = title == null ? void 0 : title.el;
|
|
306
304
|
if (props.tooltipConfig) {
|
|
307
305
|
return;
|
|
308
306
|
}
|
|
307
|
+
const dom = e.target;
|
|
308
|
+
const el = title == null ? void 0 : title.el;
|
|
309
309
|
if (dom && el && el.scrollWidth > el.offsetWidth) {
|
|
310
310
|
const tooltip = vm.$refs.tooltip;
|
|
311
311
|
tooltip.state.referenceElm = dom;
|
package/tabs-mf/vue-nav.js
CHANGED
|
@@ -6,37 +6,28 @@ const renderless = (props, { reactive, inject, computed, onMounted, onBeforeUnmo
|
|
|
6
6
|
navItems: computed(() => tabs.state.items),
|
|
7
7
|
currentNav: computed(() => tabs.state.navs[state.currentIndex]),
|
|
8
8
|
currentIndex: computed(
|
|
9
|
-
() => tabs.state.navs.findIndex((item) => tabs.state.
|
|
9
|
+
() => tabs.state.navs.findIndex((item) => tabs.state.cacheCurrentItem && tabs.state.cacheCurrentItem.name === item.name)
|
|
10
10
|
),
|
|
11
11
|
currentWidth: 0,
|
|
12
12
|
currentPosition: 0
|
|
13
13
|
});
|
|
14
|
-
let
|
|
14
|
+
let observer;
|
|
15
15
|
onMounted(() => {
|
|
16
16
|
observer = new MutationObserver((mutationsList) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
cancelAnimationFrame(rafId);
|
|
21
|
-
}
|
|
22
|
-
rafId = requestAnimationFrame(() => {
|
|
23
|
-
const nav = state.currentNav;
|
|
24
|
-
state.currentWidth = nav && nav.$el.offsetWidth || 0;
|
|
25
|
-
state.currentPosition = nav && nav.$el.offsetLeft || 0;
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
17
|
+
const nav = state.currentNav;
|
|
18
|
+
state.currentWidth = nav && nav.$el.offsetWidth || 0;
|
|
19
|
+
state.currentPosition = nav && nav.$el.offsetLeft || 0;
|
|
29
20
|
});
|
|
30
21
|
observer.observe(vm.$el, { attributes: true, subtree: true });
|
|
31
22
|
});
|
|
32
23
|
onBeforeUnmount(() => {
|
|
33
|
-
if (rafId) {
|
|
34
|
-
cancelAnimationFrame(rafId);
|
|
35
|
-
}
|
|
36
24
|
observer.disconnect();
|
|
37
25
|
observer = null;
|
|
38
26
|
});
|
|
39
|
-
|
|
27
|
+
Object.assign(api, {
|
|
28
|
+
state
|
|
29
|
+
});
|
|
30
|
+
return api;
|
|
40
31
|
};
|
|
41
32
|
export {
|
|
42
33
|
api,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "../chunk-G2ADBYYC.js";
|
|
2
|
+
const api = ["state"];
|
|
3
|
+
const renderless = (props, { reactive, inject, computed, onMounted, onUnmounted, onUpdated }, { vm, emit }) => {
|
|
4
|
+
const tabs = inject("tabs", null);
|
|
5
|
+
const state = reactive({
|
|
6
|
+
currentNav: computed(() => props.currentNav || null),
|
|
7
|
+
currentWidth: computed(() => props.currentWidth + "px"),
|
|
8
|
+
currentPosition: computed(() => props.currentPosition + "px")
|
|
9
|
+
});
|
|
10
|
+
const handleTransitionEnd = () => {
|
|
11
|
+
tabs.state.currentItem = tabs.state.cacheCurrentItem;
|
|
12
|
+
};
|
|
13
|
+
onMounted(() => {
|
|
14
|
+
vm.$el.addEventListener("transitionend", handleTransitionEnd);
|
|
15
|
+
});
|
|
16
|
+
onUnmounted(() => {
|
|
17
|
+
vm.$el.removeEventListener("transitionend", handleTransitionEnd);
|
|
18
|
+
});
|
|
19
|
+
return { state };
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
api,
|
|
23
|
+
renderless
|
|
24
|
+
};
|
package/tabs-mf/vue.js
CHANGED
|
@@ -37,7 +37,8 @@ const renderless = (props, hooks, { vm, emit, nextTick }) => {
|
|
|
37
37
|
const state = reactive({
|
|
38
38
|
items: [],
|
|
39
39
|
navs: [],
|
|
40
|
-
currentItem:
|
|
40
|
+
currentItem: null,
|
|
41
|
+
cacheCurrentItem: computed(() => state.items.find((item) => item.selected)),
|
|
41
42
|
key: computed(() => state.currentItem ? state.currentItem.name : random()),
|
|
42
43
|
separator: props.separator,
|
|
43
44
|
swipeable: computed(() => api2.computedSwipeable()),
|
|
@@ -83,6 +84,7 @@ const renderless = (props, hooks, { vm, emit, nextTick }) => {
|
|
|
83
84
|
);
|
|
84
85
|
onMounted(() => {
|
|
85
86
|
nextTick(() => api2.observeTabSwipeSize());
|
|
87
|
+
state.currentItem = state.cacheCurrentItem;
|
|
86
88
|
props.activeName && api2.scrollTo(props.activeName);
|
|
87
89
|
props.modelValue && api2.scrollTo(props.modelValue);
|
|
88
90
|
});
|
package/tag/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const handleClose = ({ emit, props, state }) => (event) => {
|
|
|
8
8
|
props.beforeDelete ? props.beforeDelete(close) : close();
|
|
9
9
|
};
|
|
10
10
|
const handleClick = ({ emit, props, parent, state }) => (event) => {
|
|
11
|
-
if (props.
|
|
11
|
+
if (props.disabled)
|
|
12
12
|
return;
|
|
13
13
|
parent.$parent && parent.$parent.tagSelectable && event.stopPropagation();
|
|
14
14
|
state.selected = !state.selected;
|
package/tree-menu/index.js
CHANGED
|
@@ -56,6 +56,9 @@ const watchFilterText = ({ vm }) => (value) => {
|
|
|
56
56
|
const nodeDragStart = (emit) => (node, event) => {
|
|
57
57
|
emit("node-drag-start", node, event);
|
|
58
58
|
};
|
|
59
|
+
const inputChange = ({ emit, state }) => () => {
|
|
60
|
+
emit("input-change", state.filterText);
|
|
61
|
+
};
|
|
59
62
|
const nodeDragEnter = (emit) => (dragNode, dropNode, event) => {
|
|
60
63
|
emit("node-drag-enter", dragNode, dropNode, event);
|
|
61
64
|
};
|
|
@@ -155,6 +158,7 @@ export {
|
|
|
155
158
|
getTree,
|
|
156
159
|
handleToggleMenu,
|
|
157
160
|
initData,
|
|
161
|
+
inputChange,
|
|
158
162
|
nodeClick,
|
|
159
163
|
nodeCollapse,
|
|
160
164
|
nodeDragEnd,
|
package/tree-menu/vue.js
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
watchFilterText,
|
|
7
7
|
nodeDragStart,
|
|
8
8
|
nodeDragEnter,
|
|
9
|
+
inputChange,
|
|
9
10
|
nodeDragOver,
|
|
10
11
|
nodeDragEnd,
|
|
11
12
|
nodeDrop,
|
|
@@ -35,6 +36,7 @@ const api = [
|
|
|
35
36
|
"filterNode",
|
|
36
37
|
"nodeDragStart",
|
|
37
38
|
"nodeDragEnter",
|
|
39
|
+
"inputChange",
|
|
38
40
|
"nodeDragOver",
|
|
39
41
|
"nodeDragEnd",
|
|
40
42
|
"nodeDrop",
|
|
@@ -86,6 +88,7 @@ const renderless = (props, { computed, watch, reactive, onMounted }, { t, servic
|
|
|
86
88
|
nodeDragOver: nodeDragOver(emit),
|
|
87
89
|
nodeDragStart: nodeDragStart(emit),
|
|
88
90
|
nodeDragEnter: nodeDragEnter(emit),
|
|
91
|
+
inputChange: inputChange({ emit, state }),
|
|
89
92
|
currentChange: currentChange(emit),
|
|
90
93
|
watchFilterText: watchFilterText({ vm }),
|
|
91
94
|
getTitle: getTitle(props),
|
|
@@ -1,3 +1,78 @@
|
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
interface LinearGradientState {
|
|
4
|
+
linearGradientBarBackground: string;
|
|
5
|
+
}
|
|
6
|
+
interface ColorOptions {
|
|
7
|
+
enableAlpha: boolean;
|
|
8
|
+
format: string;
|
|
9
|
+
value?: string;
|
|
10
|
+
}
|
|
11
|
+
interface HSVColor {
|
|
12
|
+
h: number;
|
|
13
|
+
s: number;
|
|
14
|
+
v: number;
|
|
15
|
+
}
|
|
16
|
+
interface RGBColor {
|
|
17
|
+
r: number;
|
|
18
|
+
g: number;
|
|
19
|
+
b: number;
|
|
20
|
+
}
|
|
21
|
+
interface HSLColor {
|
|
22
|
+
hue: number;
|
|
23
|
+
sat: number;
|
|
24
|
+
light: number;
|
|
25
|
+
}
|
|
26
|
+
interface IColor {
|
|
27
|
+
enableAlpha: boolean;
|
|
28
|
+
format: string;
|
|
29
|
+
value: string;
|
|
30
|
+
selected?: boolean;
|
|
31
|
+
get(prop: string): number;
|
|
32
|
+
set(props: {
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
}): void;
|
|
35
|
+
set(prop: string, value: number): void;
|
|
36
|
+
compare(color: IColor): boolean;
|
|
37
|
+
isHSL(value: string): boolean;
|
|
38
|
+
isHsv(value: string): boolean;
|
|
39
|
+
isRgb(value: string): boolean;
|
|
40
|
+
isHex(value: string): boolean;
|
|
41
|
+
onHsv(value: string): void;
|
|
42
|
+
onRgb(value: string): void;
|
|
43
|
+
onHex(value: string): void;
|
|
44
|
+
onHsl(value: string): void;
|
|
45
|
+
fromHSV(hsv: HSVColor): void;
|
|
46
|
+
fromString(value: string): void;
|
|
47
|
+
toRgb(): RGBColor;
|
|
48
|
+
onChange(): void;
|
|
49
|
+
}
|
|
50
|
+
interface ColorUtils {
|
|
51
|
+
rgb2hsv(rgb: RGBColor): HSVColor;
|
|
52
|
+
hsv2rgb(hsv: HSVColor): RGBColor;
|
|
53
|
+
hsv2hsl(hsv: {
|
|
54
|
+
hue: number;
|
|
55
|
+
sat: number;
|
|
56
|
+
val: number;
|
|
57
|
+
}): [number, number, number];
|
|
58
|
+
hsl2hsv(hsl: HSLColor): HSVColor;
|
|
59
|
+
toHex(rgb: RGBColor): string;
|
|
60
|
+
parseHex(hex: string): number;
|
|
61
|
+
hexOne(value: number): string;
|
|
62
|
+
}
|
|
63
|
+
interface IColorPoint {
|
|
64
|
+
color: IColor;
|
|
65
|
+
cursorLeft: number;
|
|
66
|
+
}
|
|
67
|
+
interface ColorPanelContext {
|
|
68
|
+
colorMode: ComputedRef<IColorSelectPanelProps['colorMode']>;
|
|
69
|
+
activeColor: Ref<IColorPoint>;
|
|
70
|
+
bar: Ref<HTMLElement | null>;
|
|
71
|
+
colorPoints: Ref<IColorPoint[]>;
|
|
72
|
+
linearGardientValue: Ref<string>;
|
|
73
|
+
deg: Ref<number>;
|
|
74
|
+
}
|
|
75
|
+
type IColorSelectPanelMaybeRef<T> = IColorSelectPanelRef<T> | T;
|
|
1
76
|
interface IColorSelectPanelRef<T> {
|
|
2
77
|
value: T;
|
|
3
78
|
}
|
|
@@ -7,6 +82,7 @@ interface IColorSelectPanelProps {
|
|
|
7
82
|
history: string[];
|
|
8
83
|
predefine: string[];
|
|
9
84
|
format: ('hsl' | 'hsv' | 'hex' | 'rgb')[];
|
|
85
|
+
colorMode: 'linear-gradient' | 'monochrome';
|
|
10
86
|
modelValue: string;
|
|
11
87
|
enableHistory: boolean;
|
|
12
88
|
enablePredefineColor: boolean;
|
|
@@ -23,5 +99,125 @@ interface IColorSelectPanelHueProps<C> {
|
|
|
23
99
|
interface IColorSelectPanelAlphaPanel<C> {
|
|
24
100
|
color: C;
|
|
25
101
|
}
|
|
102
|
+
interface UseColorPointsRet {
|
|
103
|
+
onClick: (element: Element, point: IColorPoint) => void;
|
|
104
|
+
linearGradientValue: Readonly<Ref<string>>;
|
|
105
|
+
updateDeg: (_deg: number) => void;
|
|
106
|
+
removePoint: (point: IColorPoint) => void;
|
|
107
|
+
addPoint: (point: IColorPoint) => void;
|
|
108
|
+
setActivePoint: (point: IColorPoint) => void;
|
|
109
|
+
getActviePoint: () => Ref<IColorPoint>;
|
|
110
|
+
}
|
|
111
|
+
interface ColorSelectPanelExtends {
|
|
112
|
+
parse: parse;
|
|
113
|
+
}
|
|
114
|
+
interface LinearGradientNode {
|
|
115
|
+
type: 'linear-gradient';
|
|
116
|
+
orientation?: DirectionalNode | AngularNode | undefined;
|
|
117
|
+
colorStops: ColorStop[];
|
|
118
|
+
}
|
|
119
|
+
interface RepeatingLinearGradientNode {
|
|
120
|
+
type: 'repeating-linear-gradient';
|
|
121
|
+
orientation?: DirectionalNode | AngularNode | undefined;
|
|
122
|
+
colorStops: ColorStop[];
|
|
123
|
+
}
|
|
124
|
+
interface RadialGradientNode {
|
|
125
|
+
type: 'radial-gradient';
|
|
126
|
+
orientation?: Array<ShapeNode | DefaultRadialNode | ExtentKeywordNode> | undefined;
|
|
127
|
+
colorStops: ColorStop[];
|
|
128
|
+
}
|
|
129
|
+
interface RepeatingRadialGradientNode {
|
|
130
|
+
type: 'repeating-radial-gradient';
|
|
131
|
+
orientation?: Array<ShapeNode | DefaultRadialNode | ExtentKeywordNode> | undefined;
|
|
132
|
+
colorStops: ColorStop[];
|
|
133
|
+
}
|
|
134
|
+
interface DirectionalNode {
|
|
135
|
+
type: 'directional';
|
|
136
|
+
value: 'left' | 'top' | 'bottom' | 'right' | 'left top' | 'top left' | 'left bottom' | 'bottom left' | 'right top' | 'top right' | 'right bottom' | 'bottom right';
|
|
137
|
+
}
|
|
138
|
+
interface AngularNode {
|
|
139
|
+
type: 'angular';
|
|
140
|
+
value: string;
|
|
141
|
+
}
|
|
142
|
+
interface LiteralNode {
|
|
143
|
+
type: 'literal';
|
|
144
|
+
value: string;
|
|
145
|
+
length?: PxNode | EmNode | PercentNode | CalcNode | undefined;
|
|
146
|
+
}
|
|
147
|
+
interface HexNode {
|
|
148
|
+
type: 'hex';
|
|
149
|
+
value: string;
|
|
150
|
+
length?: PxNode | EmNode | PercentNode | CalcNode | undefined;
|
|
151
|
+
}
|
|
152
|
+
interface RgbNode {
|
|
153
|
+
type: 'rgb';
|
|
154
|
+
value: [string, string, string];
|
|
155
|
+
length?: PxNode | EmNode | PercentNode | CalcNode | undefined;
|
|
156
|
+
}
|
|
157
|
+
interface RgbaNode {
|
|
158
|
+
type: 'rgba';
|
|
159
|
+
value: [string, string, string, string?];
|
|
160
|
+
length?: PxNode | EmNode | PercentNode | CalcNode | undefined;
|
|
161
|
+
}
|
|
162
|
+
interface HslNode {
|
|
163
|
+
type: 'hsl';
|
|
164
|
+
value: [string, string, string];
|
|
165
|
+
length?: PxNode | EmNode | PercentNode | CalcNode | undefined;
|
|
166
|
+
}
|
|
167
|
+
interface HslaNode {
|
|
168
|
+
type: 'hsla';
|
|
169
|
+
value: [string, string, string, string?];
|
|
170
|
+
length?: PxNode | EmNode | PercentNode | CalcNode | undefined;
|
|
171
|
+
}
|
|
172
|
+
interface VarNode {
|
|
173
|
+
type: 'var';
|
|
174
|
+
value: string;
|
|
175
|
+
length?: PxNode | EmNode | PercentNode | CalcNode | undefined;
|
|
176
|
+
}
|
|
177
|
+
interface ShapeNode {
|
|
178
|
+
type: 'shape';
|
|
179
|
+
style?: ExtentKeywordNode | PxNode | EmNode | PercentNode | PositionKeywordNode | CalcNode | undefined;
|
|
180
|
+
value: 'ellipse' | 'circle';
|
|
181
|
+
at?: PositionNode | undefined;
|
|
182
|
+
}
|
|
183
|
+
interface DefaultRadialNode {
|
|
184
|
+
type: 'default-radial';
|
|
185
|
+
at: PositionNode;
|
|
186
|
+
}
|
|
187
|
+
interface PositionKeywordNode {
|
|
188
|
+
type: 'position-keyword';
|
|
189
|
+
value: 'center' | 'left' | 'top' | 'bottom' | 'right';
|
|
190
|
+
}
|
|
191
|
+
interface PositionNode {
|
|
192
|
+
type: 'position';
|
|
193
|
+
value: {
|
|
194
|
+
x: ExtentKeywordNode | PxNode | EmNode | PercentNode | PositionKeywordNode | CalcNode;
|
|
195
|
+
y: ExtentKeywordNode | PxNode | EmNode | PercentNode | PositionKeywordNode | CalcNode;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
interface ExtentKeywordNode {
|
|
199
|
+
type: 'extent-keyword';
|
|
200
|
+
value: 'closest-side' | 'closest-corner' | 'farthest-side' | 'farthest-corner' | 'contain' | 'cover';
|
|
201
|
+
at?: PositionNode | undefined;
|
|
202
|
+
}
|
|
203
|
+
interface PxNode {
|
|
204
|
+
type: 'px';
|
|
205
|
+
value: string;
|
|
206
|
+
}
|
|
207
|
+
interface EmNode {
|
|
208
|
+
type: 'em';
|
|
209
|
+
value: string;
|
|
210
|
+
}
|
|
211
|
+
interface PercentNode {
|
|
212
|
+
type: '%';
|
|
213
|
+
value: string;
|
|
214
|
+
}
|
|
215
|
+
interface CalcNode {
|
|
216
|
+
type: 'calc';
|
|
217
|
+
value: string;
|
|
218
|
+
}
|
|
219
|
+
type ColorStop = LiteralNode | HexNode | RgbNode | RgbaNode | HslNode | HslaNode | VarNode;
|
|
220
|
+
type GradientNode = LinearGradientNode | RepeatingLinearGradientNode | RadialGradientNode | RepeatingRadialGradientNode;
|
|
221
|
+
type parse = (value: string) => GradientNode[];
|
|
26
222
|
|
|
27
|
-
export { IColorSelectPanelAlphProps, IColorSelectPanelAlphaPanel, IColorSelectPanelHueProps, IColorSelectPanelProps, IColorSelectPanelRef, IColorSelectPanelSVProps };
|
|
223
|
+
export { AngularNode, CalcNode, ColorOptions, ColorPanelContext, ColorSelectPanelExtends, ColorStop, ColorUtils, DefaultRadialNode, DirectionalNode, EmNode, ExtentKeywordNode, GradientNode, HSLColor, HSVColor, HexNode, HslNode, HslaNode, IColor, IColorPoint, IColorSelectPanelAlphProps, IColorSelectPanelAlphaPanel, IColorSelectPanelHueProps, IColorSelectPanelMaybeRef, IColorSelectPanelProps, IColorSelectPanelRef, IColorSelectPanelSVProps, LinearGradientNode, LinearGradientState, LiteralNode, PercentNode, PositionKeywordNode, PositionNode, PxNode, RGBColor, RadialGradientNode, RepeatingLinearGradientNode, RepeatingRadialGradientNode, RgbNode, RgbaNode, ShapeNode, UseColorPointsRet, VarNode, parse };
|
package/types/numeric.type.d.ts
CHANGED
|
@@ -74,7 +74,7 @@ declare const numericProps: {
|
|
|
74
74
|
type: BooleanConstructor;
|
|
75
75
|
default: boolean;
|
|
76
76
|
};
|
|
77
|
-
modelValue: (StringConstructor | NumberConstructor
|
|
77
|
+
modelValue: (StringConstructor | NumberConstructor)[];
|
|
78
78
|
mouseWheel: BooleanConstructor;
|
|
79
79
|
name: StringConstructor;
|
|
80
80
|
placeholder: StringConstructor;
|