@opentiny/vue-renderless 3.19.5 → 3.20.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/base-select/index.js +11 -74
- package/base-select/vue.js +10 -10
- package/bulletin-board/index.js +5 -1
- package/bulletin-board/vue.js +5 -4
- package/button/index.js +11 -3
- package/button/vue.js +6 -2
- package/button-group/index.js +1 -1
- package/color-picker/index.js +4 -4
- package/color-picker/utils/color.js +358 -83
- package/color-picker/utils/hsv-to-rgb.js +59 -0
- package/color-picker/vue.js +27 -8
- package/color-select-panel/alpha-select/index.js +65 -14
- package/color-select-panel/alpha-select/vue.js +29 -44
- package/color-select-panel/hue-select/index.js +47 -61
- package/color-select-panel/hue-select/vue.js +29 -47
- package/color-select-panel/index.js +230 -80
- package/color-select-panel/sv-select/index.js +68 -0
- package/color-select-panel/sv-select/vue.js +32 -0
- package/color-select-panel/utils/color.js +345 -82
- package/color-select-panel/utils/getClientXY.js +54 -0
- package/color-select-panel/vue.js +48 -72
- package/common/deps/popper.js +1 -1
- package/common/deps/useUserAgent.js +16 -0
- package/common/event.js +21 -0
- package/common/index.js +1 -1
- package/common/runtime.js +1 -1
- package/date-picker-mobile/index.js +4 -4
- package/dialog-box/index.js +1 -1
- package/dropdown/index.js +5 -1
- package/dropdown/vue.js +2 -2
- package/file-upload/vue.js +1 -0
- package/flowchart/index.js +3 -2
- package/form/index.js +2 -2
- package/form-item/index.js +4 -1
- package/grid-select/index.js +82 -0
- package/grid-select/vue.js +30 -0
- package/input/index.js +2 -2
- package/menu/vue.js +5 -1
- package/modal/index.js +2 -0
- package/numeric/index.js +29 -9
- package/option/index.js +6 -0
- package/option/vue.js +12 -2
- package/package.json +1 -1
- package/picker/index.js +1 -1
- package/recycle-scroller/index.js +43 -27
- package/recycle-scroller/vue.js +9 -4
- package/rich-text/index.js +13 -0
- package/rich-text/vue.js +4 -2
- package/select/index.js +71 -23
- package/select/vue.js +12 -4
- package/select-dropdown/vue.js +1 -1
- package/tabbar/index.js +4 -1
- package/tabbar/vue.js +1 -1
- package/tabs/index.js +8 -5
- package/tabs/vue.js +4 -1
- package/time-panel/vue.js +1 -1
- package/tooltip/vue.js +1 -0
- package/tree-menu/index.js +5 -1
- package/tree-node/index.js +5 -4
- package/tree-select/index.js +77 -1
- package/tree-select/vue.js +21 -7
- package/types/button.type.d.ts +7 -3
- package/types/color-select-panel.type.d.ts +23 -1
- package/types/file-upload.type.d.ts +1 -1
- package/types/numeric.type.d.ts +5 -5
- package/types/tree-menu.type.d.ts +1 -1
- package/types/upload-dragger.type.d.ts +1 -1
- package/types/{upload-list.type-26173587.d.ts → upload-list.type-1257e07a.d.ts} +4 -0
- package/types/upload-list.type.d.ts +1 -1
- package/types/upload.type.d.ts +1 -1
- package/types/user-head.type.d.ts +4 -0
- package/user-head/index.js +1 -1
- package/year-table/index.js +14 -29
- package/year-table/vue.js +17 -5
package/tree-select/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
__spreadProps,
|
|
3
3
|
__spreadValues
|
|
4
4
|
} from "../chunk-G2ADBYYC.js";
|
|
5
|
+
import { find } from "../common/array";
|
|
5
6
|
const filter = ({ vm }) => (value) => {
|
|
6
7
|
vm.$refs.treeRef.filter(value);
|
|
7
8
|
};
|
|
@@ -27,7 +28,8 @@ const check = ({ props, vm, emit }) => (data, { checkedNodes }) => {
|
|
|
27
28
|
currentValue.push(node[props.valueField]);
|
|
28
29
|
return __spreadProps(__spreadValues({}, node), {
|
|
29
30
|
currentLabel: node[props.textField],
|
|
30
|
-
value: node[props.valueField]
|
|
31
|
+
value: node[props.valueField],
|
|
32
|
+
isTree: true
|
|
31
33
|
});
|
|
32
34
|
})
|
|
33
35
|
);
|
|
@@ -35,8 +37,82 @@ const check = ({ props, vm, emit }) => (data, { checkedNodes }) => {
|
|
|
35
37
|
emit("update:modelValue", currentValue);
|
|
36
38
|
}
|
|
37
39
|
};
|
|
40
|
+
const getTreeData = ({ props, state }) => (data) => {
|
|
41
|
+
const nodes = [];
|
|
42
|
+
const getChild = (data2, pId) => {
|
|
43
|
+
data2.forEach((node) => {
|
|
44
|
+
node.pId = pId;
|
|
45
|
+
nodes.push(node);
|
|
46
|
+
if (node[state.childrenName] && node[state.childrenName].length > 0) {
|
|
47
|
+
getChild(node[state.childrenName], node[props.valueField]);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
getChild(data, null);
|
|
52
|
+
return nodes;
|
|
53
|
+
};
|
|
54
|
+
const getPluginOption = ({ api, props, state }) => (value) => {
|
|
55
|
+
const isRemote = (props.filterable || props.searchable) && props.remote && (typeof props.remoteMethod === "function" || typeof props.initQuery === "function");
|
|
56
|
+
const { textField, valueField } = props;
|
|
57
|
+
const sourceData = isRemote ? state.remoteData : api.getTreeData(state.treeData);
|
|
58
|
+
const selNode = find(sourceData, (item) => item[valueField] === value);
|
|
59
|
+
const items = [];
|
|
60
|
+
if (selNode) {
|
|
61
|
+
selNode.currentLabel = selNode[textField];
|
|
62
|
+
items.push(selNode);
|
|
63
|
+
}
|
|
64
|
+
return items;
|
|
65
|
+
};
|
|
66
|
+
const getCheckedData = ({ props, state }) => () => {
|
|
67
|
+
const checkedKey = [];
|
|
68
|
+
if (!Array.isArray(state.selected)) {
|
|
69
|
+
return props.modelValue ? [props.modelValue] : [state.selected[props.valueField]];
|
|
70
|
+
} else {
|
|
71
|
+
state.selected.length > 0 && state.selected.forEach((item) => {
|
|
72
|
+
checkedKey.push(item[props.valueField]);
|
|
73
|
+
});
|
|
74
|
+
return checkedKey;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const mounted = ({ api, state, props, vm }) => () => {
|
|
78
|
+
if (!state.value || state.value.length === 0)
|
|
79
|
+
return;
|
|
80
|
+
if (props.multiple) {
|
|
81
|
+
let initialNodes = [];
|
|
82
|
+
if (Array.isArray(state.value)) {
|
|
83
|
+
state.value.forEach((value) => {
|
|
84
|
+
const option = api.getPluginOption(value);
|
|
85
|
+
initialNodes = initialNodes.concat(option);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
vm.$refs.baseSelectRef.updateSelectedData(
|
|
89
|
+
initialNodes.map((node) => {
|
|
90
|
+
return __spreadProps(__spreadValues({}, node), {
|
|
91
|
+
currentLabel: node[props.textField],
|
|
92
|
+
value: node[props.valueField],
|
|
93
|
+
isTree: true
|
|
94
|
+
});
|
|
95
|
+
})
|
|
96
|
+
);
|
|
97
|
+
state.defaultCheckedKeys = api.getCheckedData()[0];
|
|
98
|
+
} else {
|
|
99
|
+
const data = api.getPluginOption(state.value)[0];
|
|
100
|
+
vm.$refs.baseSelectRef.updateSelectedData(__spreadProps(__spreadValues({}, data), {
|
|
101
|
+
currentLabel: data[props.textField],
|
|
102
|
+
value: data[props.valueField],
|
|
103
|
+
state: {
|
|
104
|
+
currentLabel: data[props.textField]
|
|
105
|
+
}
|
|
106
|
+
}));
|
|
107
|
+
state.currentKey = data[props.valueField];
|
|
108
|
+
}
|
|
109
|
+
};
|
|
38
110
|
export {
|
|
39
111
|
check,
|
|
40
112
|
filter,
|
|
113
|
+
getCheckedData,
|
|
114
|
+
getPluginOption,
|
|
115
|
+
getTreeData,
|
|
116
|
+
mounted,
|
|
41
117
|
nodeClick
|
|
42
118
|
};
|
package/tree-select/vue.js
CHANGED
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
import { filter,
|
|
3
|
-
const api = ["state", "
|
|
4
|
-
const renderless = (props, { reactive, computed }, { vm, emit }) => {
|
|
2
|
+
import { check, filter, getCheckedData, getPluginOption, getTreeData, mounted, nodeClick } from "./index";
|
|
3
|
+
const api = ["state", "check", "filter", "nodeClick"];
|
|
4
|
+
const renderless = (props, { reactive, computed, watch, onMounted }, { vm, emit }) => {
|
|
5
5
|
const api2 = {};
|
|
6
6
|
const state = reactive({
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
childrenName: computed(() => props.treeOp.props && props.treeOp.props.children || "children"),
|
|
8
|
+
currentKey: props.modelValue,
|
|
9
|
+
defaultCheckedKeys: [],
|
|
10
|
+
remoteData: [],
|
|
11
|
+
treeData: props.treeOp.data,
|
|
12
|
+
value: computed(() => props.modelValue)
|
|
9
13
|
});
|
|
10
14
|
Object.assign(api2, {
|
|
11
15
|
state,
|
|
16
|
+
check: check({ props, vm, emit }),
|
|
12
17
|
filter: filter({ vm }),
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
getCheckedData: getCheckedData({ props, state }),
|
|
19
|
+
getPluginOption: getPluginOption({ api: api2, props, state }),
|
|
20
|
+
getTreeData: getTreeData({ props, state }),
|
|
21
|
+
mounted: mounted({ api: api2, state, props, vm }),
|
|
22
|
+
nodeClick: nodeClick({ props, vm, emit })
|
|
15
23
|
});
|
|
24
|
+
watch(
|
|
25
|
+
() => props.treeOp.data,
|
|
26
|
+
(data) => data && (state.treeData = data),
|
|
27
|
+
{ immediate: true, deep: true }
|
|
28
|
+
);
|
|
29
|
+
onMounted(api2.mounted);
|
|
16
30
|
return api2;
|
|
17
31
|
};
|
|
18
32
|
export {
|
package/types/button.type.d.ts
CHANGED
|
@@ -44,7 +44,10 @@ declare const buttonProps: {
|
|
|
44
44
|
validator(val: string): boolean;
|
|
45
45
|
};
|
|
46
46
|
/** 是否圆角按钮 */
|
|
47
|
-
round:
|
|
47
|
+
round: {
|
|
48
|
+
type: BooleanConstructor;
|
|
49
|
+
default: undefined;
|
|
50
|
+
};
|
|
48
51
|
/** 是否朴素按钮 */
|
|
49
52
|
plain: BooleanConstructor;
|
|
50
53
|
/** 是否圆形按钮 */
|
|
@@ -74,7 +77,7 @@ declare const buttonProps: {
|
|
|
74
77
|
tiny_mode: StringConstructor;
|
|
75
78
|
tiny_mode_root: BooleanConstructor;
|
|
76
79
|
tiny_template: (FunctionConstructor | ObjectConstructor)[];
|
|
77
|
-
tiny_renderless: FunctionConstructor;
|
|
80
|
+
tiny_renderless: FunctionConstructor; /** 是否圆形按钮 */
|
|
78
81
|
tiny_theme: StringConstructor;
|
|
79
82
|
tiny_chart_theme: ObjectConstructor;
|
|
80
83
|
};
|
|
@@ -91,13 +94,14 @@ declare const buttonProps: {
|
|
|
91
94
|
*
|
|
92
95
|
*/
|
|
93
96
|
|
|
94
|
-
declare const handleClick: ({ emit, props, state }: Pick<IButtonRenderlessParams, 'emit' | 'props' | 'state'>) => (event: MouseEvent) => void;
|
|
97
|
+
declare const handleClick: ({ emit, props, state, designConfig }: Pick<IButtonRenderlessParams, 'emit' | 'props' | 'state' | 'designConfig'>) => (event: MouseEvent) => void;
|
|
95
98
|
declare const clearTimer: (state: IButtonState) => () => void;
|
|
96
99
|
|
|
97
100
|
interface IButtonState {
|
|
98
101
|
timer: number;
|
|
99
102
|
disabled: boolean;
|
|
100
103
|
plain: ComputedRef<boolean>;
|
|
104
|
+
round: ComputedRef<boolean>;
|
|
101
105
|
formDisabled: ComputedRef<boolean>;
|
|
102
106
|
buttonDisabled: ComputedRef<boolean>;
|
|
103
107
|
}
|
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
interface IColorSelectPanelRef<T> {
|
|
2
2
|
value: T;
|
|
3
3
|
}
|
|
4
|
+
interface IColorSelectPanelProps {
|
|
5
|
+
visible: boolean;
|
|
6
|
+
alpha: boolean;
|
|
7
|
+
history: string[];
|
|
8
|
+
predefine: string[];
|
|
9
|
+
format: ('hsl' | 'hsv' | 'hex' | 'rgb')[];
|
|
10
|
+
modelValue: string;
|
|
11
|
+
enableHistory: boolean;
|
|
12
|
+
enablePredefineColor: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface IColorSelectPanelAlphProps<C> {
|
|
15
|
+
color: C;
|
|
16
|
+
}
|
|
17
|
+
interface IColorSelectPanelSVProps<C> {
|
|
18
|
+
color: C;
|
|
19
|
+
}
|
|
20
|
+
interface IColorSelectPanelHueProps<C> {
|
|
21
|
+
color: C;
|
|
22
|
+
}
|
|
23
|
+
interface IColorSelectPanelAlphaPanel<C> {
|
|
24
|
+
color: C;
|
|
25
|
+
}
|
|
4
26
|
|
|
5
|
-
export { IColorSelectPanelRef };
|
|
27
|
+
export { IColorSelectPanelAlphProps, IColorSelectPanelAlphaPanel, IColorSelectPanelHueProps, IColorSelectPanelProps, IColorSelectPanelRef, IColorSelectPanelSVProps };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'vue';
|
|
2
|
-
export { C as IFileUploadAfterDownload, m as IFileUploadApi, D as IFileUploadBatchSegmentDownload, y as IFileUploadBatchSegmentUpload, a as IFileUploadConstants, w as IFileUploadDownloadFileInner, x as IFileUploadDownloadFileSingle, u as IFileUploadDownloadFileSingleInner, t as IFileUploadEdmDownload, s as IFileUploadFile, A as IFileUploadGetFormData, v as IFileUploadLargeDocumentDownload, r as IFileUploadModalVm, o as IFileUploadProps, p as IFileUploadRenderlessParamUtils, q as IFileUploadRenderlessParams, z as IFileUploadSegmentUploadInner, n as IFileUploadService, B as IFileUploadSetWriterFile, E as IFileUploadSliceDownloadChunk, l as IFileUploadState, F as IFileUploadStreamsaver, I as IFileUploadVm } from './upload-list.type-
|
|
2
|
+
export { C as IFileUploadAfterDownload, m as IFileUploadApi, D as IFileUploadBatchSegmentDownload, y as IFileUploadBatchSegmentUpload, a as IFileUploadConstants, w as IFileUploadDownloadFileInner, x as IFileUploadDownloadFileSingle, u as IFileUploadDownloadFileSingleInner, t as IFileUploadEdmDownload, s as IFileUploadFile, A as IFileUploadGetFormData, v as IFileUploadLargeDocumentDownload, r as IFileUploadModalVm, o as IFileUploadProps, p as IFileUploadRenderlessParamUtils, q as IFileUploadRenderlessParams, z as IFileUploadSegmentUploadInner, n as IFileUploadService, B as IFileUploadSetWriterFile, E as IFileUploadSliceDownloadChunk, l as IFileUploadState, F as IFileUploadStreamsaver, I as IFileUploadVm } from './upload-list.type-1257e07a.js';
|
|
3
3
|
import './shared.type.js';
|
package/types/numeric.type.d.ts
CHANGED
|
@@ -104,7 +104,7 @@ declare const numericProps: {
|
|
|
104
104
|
};
|
|
105
105
|
size: StringConstructor;
|
|
106
106
|
step: {
|
|
107
|
-
type: (StringConstructor | NumberConstructor)[];
|
|
107
|
+
type: (StringConstructor | ObjectConstructor | NumberConstructor)[];
|
|
108
108
|
default: number;
|
|
109
109
|
};
|
|
110
110
|
stepStrictly: {
|
|
@@ -199,12 +199,12 @@ declare const toPrecision: (state: INumericState) => ({ num, precision }: {
|
|
|
199
199
|
}) => number;
|
|
200
200
|
declare const getPrecision: () => (value: number) => number;
|
|
201
201
|
declare const internalIncrease: ({ api, state }: Pick<INumericRenderlessParams, 'api' | 'state'>) => ({ val, step }: {
|
|
202
|
-
val: number;
|
|
203
|
-
step: number;
|
|
202
|
+
val: number | string;
|
|
203
|
+
step: number | string;
|
|
204
204
|
}) => string;
|
|
205
205
|
declare const internalDecrease: ({ api, state }: Pick<INumericRenderlessParams, 'api' | 'state'>) => ({ val, step }: {
|
|
206
|
-
val: number;
|
|
207
|
-
step: number;
|
|
206
|
+
val: number | string;
|
|
207
|
+
step: number | string;
|
|
208
208
|
}) => string | number;
|
|
209
209
|
declare const increase: ({ api, props, state }: Pick<INumericRenderlessParams, 'api' | 'props' | 'state'>) => () => void;
|
|
210
210
|
declare const decrease: ({ api, props, state }: Pick<INumericRenderlessParams, 'api' | 'props' | 'state'>) => () => void;
|
|
@@ -143,7 +143,7 @@ declare const nodeClick: ({ emit, props, state }: {
|
|
|
143
143
|
}) => (nodeData: any, node: any) => void;
|
|
144
144
|
declare const checkChange: (emit: any) => (data: any, checked: any, indeterminate: any) => void;
|
|
145
145
|
declare const check: (emit: any) => (data: any, checkedStatus: any) => void;
|
|
146
|
-
declare const currentChange: (emit: any) => (data: any, node: any) => void;
|
|
146
|
+
declare const currentChange: (emit: any) => (data: any, node: any, e: any) => void;
|
|
147
147
|
declare const getTitle: (props: any) => (label: any) => any;
|
|
148
148
|
declare const collapseChange: ({ state, props, emit }: {
|
|
149
149
|
state: any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExtractPropTypes } from 'vue';
|
|
2
2
|
import { ISharedRenderlessParamUtils, ISharedRenderlessFunctionParams } from './shared.type.js';
|
|
3
|
-
import { I as IFileUploadVm, a as IFileUploadConstants } from './upload-list.type-
|
|
3
|
+
import { I as IFileUploadVm, a as IFileUploadConstants } from './upload-list.type-1257e07a.js';
|
|
4
4
|
|
|
5
5
|
declare const UploadDraggerProps: {
|
|
6
6
|
disabled: BooleanConstructor;
|
|
@@ -691,6 +691,10 @@ declare const uploadProps: {
|
|
|
691
691
|
type: BooleanConstructor;
|
|
692
692
|
default: boolean;
|
|
693
693
|
};
|
|
694
|
+
showFileList: {
|
|
695
|
+
type: BooleanConstructor;
|
|
696
|
+
default: boolean;
|
|
697
|
+
};
|
|
694
698
|
tiny_mode: StringConstructor;
|
|
695
699
|
tiny_mode_root: BooleanConstructor;
|
|
696
700
|
tiny_template: (FunctionConstructor | ObjectConstructor)[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'vue';
|
|
2
|
-
export { H as IUploadListApi, J as IUploadListProps, K as IUploadListRenderlessParamUtils, L as IUploadListRenderlessParams, G as IUploadListState, M as IUploadListVideoParam } from './upload-list.type-
|
|
2
|
+
export { H as IUploadListApi, J as IUploadListProps, K as IUploadListRenderlessParamUtils, L as IUploadListRenderlessParams, G as IUploadListState, M as IUploadListVideoParam } from './upload-list.type-1257e07a.js';
|
|
3
3
|
import './shared.type.js';
|
package/types/upload.type.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'vue';
|
|
2
|
-
export { d as IUploadApi, i as IUploadFormData, k as IUploadOptionsOfHwh5, j as IUploadOptionsOfPost, e as IUploadProps, h as IUploadRenderlessOtherParams, f as IUploadRenderlessParamUtils, g as IUploadRenderlessParams, c as IUploadState, b as IUploadStateHeader } from './upload-list.type-
|
|
2
|
+
export { d as IUploadApi, i as IUploadFormData, k as IUploadOptionsOfHwh5, j as IUploadOptionsOfPost, e as IUploadProps, h as IUploadRenderlessOtherParams, f as IUploadRenderlessParamUtils, g as IUploadRenderlessParams, c as IUploadState, b as IUploadStateHeader } from './upload-list.type-1257e07a.js';
|
|
3
3
|
import './shared.type.js';
|
|
@@ -83,6 +83,10 @@ declare const userHeadProps: {
|
|
|
83
83
|
tiny_mode: StringConstructor;
|
|
84
84
|
tiny_mode_root: BooleanConstructor;
|
|
85
85
|
tiny_template: (FunctionConstructor | ObjectConstructor)[];
|
|
86
|
+
/**
|
|
87
|
+
* @property {String} - 头像资源
|
|
88
|
+
* type=icon 时为图标类名,type=label时为字体串,type=image时为资源路径
|
|
89
|
+
*/
|
|
86
90
|
tiny_renderless: FunctionConstructor;
|
|
87
91
|
tiny_theme: StringConstructor;
|
|
88
92
|
tiny_chart_theme: ObjectConstructor;
|
package/user-head/index.js
CHANGED
package/year-table/index.js
CHANGED
|
@@ -1,36 +1,17 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
2
|
import { toDate } from "../common/date";
|
|
3
|
-
import { range, nextDate, getDayCountOfYear } from "../common/deps/date-util";
|
|
4
3
|
import { arrayFindIndex, coerceTruthyValueToArray, arrayFind } from "../date-table";
|
|
5
4
|
import { DATEPICKER } from "../common";
|
|
6
|
-
const
|
|
7
|
-
const numOfDays = getDayCountOfYear(year);
|
|
8
|
-
const firstDay = new Date(year, 0, 1);
|
|
9
|
-
return range(numOfDays).map((n) => nextDate(firstDay, n));
|
|
10
|
-
};
|
|
11
|
-
const getCellStyle = ({ props, state }) => (cell) => {
|
|
5
|
+
const getIsDefault = ({ props }) => (year) => {
|
|
12
6
|
const { defaultValue } = props;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
return Array.isArray(defaultValue) ? defaultValue.some((v) => v && v.getFullYear() === year) : defaultValue && defaultValue.getFullYear() === year;
|
|
8
|
+
};
|
|
9
|
+
const getIsDisabled = ({ props }) => (year) => {
|
|
10
|
+
return props.selectionMode.startsWith("year") && typeof props.disabledDate === "function" ? props.disabledDate(year) : false;
|
|
11
|
+
};
|
|
12
|
+
const getIsCurrent = ({ props }) => (year) => {
|
|
17
13
|
const execDate = typeof props.value === "object" ? props.value : toDate(props.value);
|
|
18
|
-
|
|
19
|
-
style.today = today.getFullYear() === year;
|
|
20
|
-
style.default = Array.isArray(defaultValue) ? defaultValue.some((v) => v && v.getFullYear() === year) : defaultValue && defaultValue.getFullYear() === year;
|
|
21
|
-
if (cell.inRange) {
|
|
22
|
-
style[DATEPICKER.InRange] = true;
|
|
23
|
-
}
|
|
24
|
-
if (cell.start) {
|
|
25
|
-
style[DATEPICKER.StartDate] = true;
|
|
26
|
-
}
|
|
27
|
-
if (cell.end) {
|
|
28
|
-
style[DATEPICKER.EndDate] = true;
|
|
29
|
-
}
|
|
30
|
-
for (const key in style) {
|
|
31
|
-
state[key] = style[key];
|
|
32
|
-
}
|
|
33
|
-
return style;
|
|
14
|
+
return arrayFindIndex(coerceTruthyValueToArray(execDate), (date) => date.getFullYear() === year) >= 0;
|
|
34
15
|
};
|
|
35
16
|
const clearDate = (date) => {
|
|
36
17
|
return new Date(date.getFullYear(), date.getMonth());
|
|
@@ -67,7 +48,9 @@ const getRows = ({ props, state, vm }) => () => {
|
|
|
67
48
|
const isToday = year === now;
|
|
68
49
|
cell.text = year;
|
|
69
50
|
cell.type = isToday ? DATEPICKER.Today : DATEPICKER.Normal;
|
|
70
|
-
|
|
51
|
+
if (props.selectionMode.startsWith("year")) {
|
|
52
|
+
cell.disabled = typeof disabledDate === "function" && disabledDate(year);
|
|
53
|
+
}
|
|
71
54
|
if (selectionMode === DATEPICKER.YearRange) {
|
|
72
55
|
const minYear = typeof minDate === "object" && minDate ? minDate.getFullYear() : minDate;
|
|
73
56
|
const maxYear = typeof maxDate === "object" && maxDate ? maxDate.getFullYear() : maxDate;
|
|
@@ -190,7 +173,9 @@ const handleMouseMove = ({ emit, props, state }) => (event) => {
|
|
|
190
173
|
};
|
|
191
174
|
export {
|
|
192
175
|
clearDate,
|
|
193
|
-
|
|
176
|
+
getIsCurrent,
|
|
177
|
+
getIsDefault,
|
|
178
|
+
getIsDisabled,
|
|
194
179
|
getMonthTimestamp,
|
|
195
180
|
getRows,
|
|
196
181
|
handleMouseMove,
|
package/year-table/vue.js
CHANGED
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
import "../chunk-G2ADBYYC.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
getRows,
|
|
4
|
+
handleYearTableClick,
|
|
5
|
+
watchDate,
|
|
6
|
+
markRange,
|
|
7
|
+
handleMouseMove,
|
|
8
|
+
getIsDisabled,
|
|
9
|
+
getIsCurrent,
|
|
10
|
+
getIsDefault
|
|
11
|
+
} from "./index";
|
|
12
|
+
const api = ["state", "handleYearTableClick", "handleMouseMove", "getIsDisabled", "getIsCurrent", "getIsDefault"];
|
|
4
13
|
const renderless = (props, { computed, reactive, watch }, { emit, vm }) => {
|
|
5
14
|
const api2 = {};
|
|
6
15
|
const state = reactive({
|
|
7
16
|
tableRows: [[], [], []],
|
|
8
|
-
rows: computed(() => api2.getRows())
|
|
17
|
+
rows: computed(() => api2.getRows()),
|
|
18
|
+
currentYear: (/* @__PURE__ */ new Date()).getFullYear()
|
|
9
19
|
});
|
|
10
20
|
Object.assign(api2, {
|
|
11
21
|
state,
|
|
12
|
-
getCellStyle: getCellStyle({ props, state }),
|
|
13
22
|
handleYearTableClick: handleYearTableClick({ emit, props, state }),
|
|
14
23
|
markRange: markRange({ props, state }),
|
|
15
24
|
watchDate: watchDate({ api: api2, props }),
|
|
16
25
|
getRows: getRows({ props, state, vm }),
|
|
17
|
-
handleMouseMove: handleMouseMove({ api: api2, emit, props, state })
|
|
26
|
+
handleMouseMove: handleMouseMove({ api: api2, emit, props, state }),
|
|
27
|
+
getIsDisabled: getIsDisabled({ props }),
|
|
28
|
+
getIsCurrent: getIsCurrent({ props }),
|
|
29
|
+
getIsDefault: getIsDefault({ props })
|
|
18
30
|
});
|
|
19
31
|
watch(
|
|
20
32
|
() => props.rangeState,
|