tor-univer-sheet 1.0.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 +2 -0
- package/dist/App.vue.d.ts +2 -0
- package/dist/components/ContentWrap/index.d.ts +2 -0
- package/dist/components/ContentWrap/src/ContentWrap.vue.d.ts +57 -0
- package/dist/components/Form/src/componentMap.d.ts +4 -0
- package/dist/components/Form/src/components/InputNumberWrapper.vue.d.ts +2 -0
- package/dist/components/Form/src/types.d.ts +16 -0
- package/dist/components/GlobalLoading/GlobalLoading.vue.d.ts +8 -0
- package/dist/components/GlobalLoading/index.d.ts +7 -0
- package/dist/components/IndicatorPointSelect/IndicatorPointSelect.vue.d.ts +2 -0
- package/dist/components/UniverSheet/UniverSheet.data.d.ts +23 -0
- package/dist/components/UniverSheet/UniverSheet.vue.d.ts +515 -0
- package/dist/components/UniverSheet/data.d.ts +9 -0
- package/dist/components/UniverSheet/plugins/Plugins.d.ts +29 -0
- package/dist/components/UniverSheet/plugins/importFile/ImportFileIcon.vue.d.ts +2 -0
- package/dist/components/UniverSheet/plugins/importFile/ImportFilePlugin.d.ts +14 -0
- package/dist/components/UniverSheet/plugins/index.d.ts +2 -0
- package/dist/components/UniverSheet/plugins/indicatorsContextMenu/IndicatorsContextMenuPlugin.d.ts +16 -0
- package/dist/components/UniverSheet/plugins/indicatorsContextMenu/components/IndicatorsMenu.vue.d.ts +2 -0
- package/dist/components/UniverSheet/plugins/indicatorsContextMenu/components/IndicatorsUniverSheetConfigDialog.vue.d.ts +234 -0
- package/dist/components/UniverSheet/plugins/saveButton/ButtonIcon.vue.d.ts +2 -0
- package/dist/components/UniverSheet/plugins/saveButton/SaveButton.d.ts +14 -0
- package/dist/components/UniverSheet/plugins/syncContextMenu/SyncContextMenu.vue.d.ts +2 -0
- package/dist/components/UniverSheet/plugins/syncContextMenu/SyncContextMenuPlugin.d.ts +14 -0
- package/dist/components/UniverSheet/plugins/timeConfigContextMenu/TimeConfigContextMenuPlugin.d.ts +16 -0
- package/dist/components/UniverSheet/plugins/timeConfigContextMenu/components/TimeConfigMenu.vue.d.ts +2 -0
- package/dist/components/UniverSheet/plugins/timeConfigContextMenu/components/TimeConfigUniverSheetConfigDialog.vue.d.ts +234 -0
- package/dist/favicon.ico +0 -0
- package/dist/hooks/useMessage.d.ts +18 -0
- package/dist/index.d.ts +2 -0
- package/dist/main.d.ts +0 -0
- package/dist/tor-univer-sheet.es.js +213 -0
- package/dist/tor-univer-sheet.umd.js +1 -0
- package/dist/types/components.d.ts +52 -0
- package/dist/types/external-components.d.ts +14 -0
- package/dist/types/form.d.ts +51 -0
- package/dist/utils/decimal.d.ts +59 -0
- package/dist/utils/fileHelp.d.ts +8 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/is.d.ts +33 -0
- package/dist/utils/propTypes.d.ts +10 -0
- package/package.json +88 -0
- package/src/App.vue +16 -0
- package/src/components/ContentWrap/index.ts +3 -0
- package/src/components/ContentWrap/src/ContentWrap.vue +50 -0
- package/src/components/Form/src/componentMap.ts +51 -0
- package/src/components/Form/src/components/InputNumberWrapper.vue +12 -0
- package/src/components/Form/src/types.ts +18 -0
- package/src/components/GlobalLoading/GlobalLoading.vue +89 -0
- package/src/components/GlobalLoading/index.ts +45 -0
- package/src/components/IndicatorPointSelect/IndicatorPointSelect.vue +9 -0
- package/src/components/UniverSheet/UniverSheet.data.ts +521 -0
- package/src/components/UniverSheet/UniverSheet.vue +339 -0
- package/src/components/UniverSheet/data.ts +18 -0
- package/src/components/UniverSheet/plugins/Plugins.ts +246 -0
- package/src/components/UniverSheet/plugins/importFile/ImportFileIcon.vue +26 -0
- package/src/components/UniverSheet/plugins/importFile/ImportFilePlugin.ts +109 -0
- package/src/components/UniverSheet/plugins/index.ts +10 -0
- package/src/components/UniverSheet/plugins/indicatorsContextMenu/IndicatorsContextMenuPlugin.ts +134 -0
- package/src/components/UniverSheet/plugins/indicatorsContextMenu/components/IndicatorsMenu.vue +49 -0
- package/src/components/UniverSheet/plugins/indicatorsContextMenu/components/IndicatorsUniverSheetConfigDialog.vue +153 -0
- package/src/components/UniverSheet/plugins/saveButton/ButtonIcon.vue +19 -0
- package/src/components/UniverSheet/plugins/saveButton/SaveButton.ts +68 -0
- package/src/components/UniverSheet/plugins/syncContextMenu/SyncContextMenu.vue +24 -0
- package/src/components/UniverSheet/plugins/syncContextMenu/SyncContextMenuPlugin.ts +65 -0
- package/src/components/UniverSheet/plugins/timeConfigContextMenu/TimeConfigContextMenuPlugin.ts +133 -0
- package/src/components/UniverSheet/plugins/timeConfigContextMenu/components/TimeConfigMenu.vue +10 -0
- package/src/components/UniverSheet/plugins/timeConfigContextMenu/components/TimeConfigUniverSheetConfigDialog.vue +152 -0
- package/src/hooks/useMessage.ts +93 -0
- package/src/index.ts +10 -0
- package/src/main.ts +14 -0
- package/src/types/components.d.ts +52 -0
- package/src/types/external-components.d.ts +16 -0
- package/src/types/form.d.ts +52 -0
- package/src/utils/decimal.ts +98 -0
- package/src/utils/fileHelp.ts +71 -0
- package/src/utils/index.ts +32 -0
- package/src/utils/is.ts +168 -0
- package/src/utils/propTypes.ts +24 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { h as r } from "vue";
|
|
2
|
+
const i = (e, n) => {
|
|
3
|
+
for (const o of n)
|
|
4
|
+
e[o] = null;
|
|
5
|
+
};
|
|
6
|
+
let t = {};
|
|
7
|
+
function m(e) {
|
|
8
|
+
t = { ...t, ...e };
|
|
9
|
+
}
|
|
10
|
+
function c(e) {
|
|
11
|
+
return t[e];
|
|
12
|
+
}
|
|
13
|
+
const d = [
|
|
14
|
+
{ label: "无", value: "no" },
|
|
15
|
+
{ label: "年", value: "year" },
|
|
16
|
+
{ label: "月", value: "month" },
|
|
17
|
+
{ label: "周", value: "week" },
|
|
18
|
+
{ label: "天", value: "day" },
|
|
19
|
+
{ label: "班组", value: "shift" },
|
|
20
|
+
{ label: "小时", value: "hour" },
|
|
21
|
+
{ label: "半小时", value: "half_hour" }
|
|
22
|
+
], l = [
|
|
23
|
+
{
|
|
24
|
+
title: "基本信息",
|
|
25
|
+
schemas: [
|
|
26
|
+
{
|
|
27
|
+
label: "指标名称",
|
|
28
|
+
field: "indicatorName",
|
|
29
|
+
component: "Input",
|
|
30
|
+
formItemProps: {
|
|
31
|
+
rules: [{ required: !0, message: "请输入指标名称", trigger: "blur" }]
|
|
32
|
+
},
|
|
33
|
+
render: ({ formModel: e }) => {
|
|
34
|
+
const n = c("IndicatorPointSelect");
|
|
35
|
+
return r(n, {
|
|
36
|
+
modelValue: e.indicatorName,
|
|
37
|
+
onSelect: (o) => {
|
|
38
|
+
const a = {
|
|
39
|
+
indicatorName: o?.indicatorName,
|
|
40
|
+
indicatorCode: o?.indicatorCoding,
|
|
41
|
+
indicatorId: o?.id,
|
|
42
|
+
indicatorDimensionName: o?.indicatorDimensionName,
|
|
43
|
+
indicatorDimensionConfig: o?.indicatorDimensionConfig
|
|
44
|
+
};
|
|
45
|
+
Object.assign(e, a);
|
|
46
|
+
},
|
|
47
|
+
onClear: () => {
|
|
48
|
+
i(e, [
|
|
49
|
+
"indicatorName",
|
|
50
|
+
"indicatorCode",
|
|
51
|
+
"indicatorId",
|
|
52
|
+
"indicatorDimensionName",
|
|
53
|
+
"indicatorDimensionConfig"
|
|
54
|
+
]);
|
|
55
|
+
},
|
|
56
|
+
"onUpdate:modelValue": (o) => {
|
|
57
|
+
e.indicatorName = o;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: "指标编码",
|
|
64
|
+
field: "indicatorCode",
|
|
65
|
+
component: "Input",
|
|
66
|
+
componentProps: {
|
|
67
|
+
disabled: !0
|
|
68
|
+
},
|
|
69
|
+
formItemProps: {
|
|
70
|
+
rules: [{ required: !0, message: "请输入指标编码", trigger: "blur" }]
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
label: "指标ID",
|
|
75
|
+
field: "indicatorId",
|
|
76
|
+
component: "Input",
|
|
77
|
+
componentProps: {
|
|
78
|
+
disabled: !0
|
|
79
|
+
},
|
|
80
|
+
formItemProps: {
|
|
81
|
+
rules: [{ required: !0, message: "请输入指标指标ID", trigger: "blur" }]
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
label: "维度名称",
|
|
86
|
+
field: "indicatorDimensionName",
|
|
87
|
+
component: "Input",
|
|
88
|
+
componentProps: {
|
|
89
|
+
disabled: !0
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
label: "维度编码",
|
|
94
|
+
field: "indicatorDimensionConfig",
|
|
95
|
+
component: "Input",
|
|
96
|
+
componentProps: {
|
|
97
|
+
disabled: !0
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
label: "是否必填",
|
|
102
|
+
field: "required",
|
|
103
|
+
component: "ElCheckbox"
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
title: "时间条件",
|
|
109
|
+
schemas: [
|
|
110
|
+
{
|
|
111
|
+
label: "周期类型",
|
|
112
|
+
field: "cycleType",
|
|
113
|
+
component: "Select",
|
|
114
|
+
componentProps: (e) => ({
|
|
115
|
+
options: d.filter(
|
|
116
|
+
(n) => ![
|
|
117
|
+
"no",
|
|
118
|
+
"half_hour",
|
|
119
|
+
"shift",
|
|
120
|
+
"week"
|
|
121
|
+
/* 周 */
|
|
122
|
+
].includes(n.value)
|
|
123
|
+
),
|
|
124
|
+
onChange: (n) => {
|
|
125
|
+
e.cycleType = n, e.timeIncrement = 0, e.defaultShift = !1, e.forwardPush = !1;
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
label: "时间递增量",
|
|
131
|
+
field: "timeIncrement",
|
|
132
|
+
component: "InputNumber",
|
|
133
|
+
value: 0,
|
|
134
|
+
componentProps: {
|
|
135
|
+
min: 0,
|
|
136
|
+
precision: 0
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
label: "默认排班班次",
|
|
141
|
+
field: "defaultShift",
|
|
142
|
+
component: "ElCheckbox",
|
|
143
|
+
componentProps: (e) => ({
|
|
144
|
+
onChange: (n) => {
|
|
145
|
+
e.defaultShift = n, e.forwardPush = !1;
|
|
146
|
+
}
|
|
147
|
+
}),
|
|
148
|
+
hidden: (e) => ![
|
|
149
|
+
"day",
|
|
150
|
+
"hour"
|
|
151
|
+
/* 小时 */
|
|
152
|
+
].includes(e.cycleType)
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
label: "向前推7天",
|
|
156
|
+
field: "forwardPush",
|
|
157
|
+
component: "ElCheckbox",
|
|
158
|
+
componentProps: (e) => ({
|
|
159
|
+
disabled: e.defaultShift
|
|
160
|
+
}),
|
|
161
|
+
hidden: (e) => e.cycleType !== "day"
|
|
162
|
+
/* 天 */
|
|
163
|
+
}
|
|
164
|
+
// {
|
|
165
|
+
// label: '初始时间',
|
|
166
|
+
// field: 'initialHour',
|
|
167
|
+
// component: 'TimePicker',
|
|
168
|
+
// componentProps: {
|
|
169
|
+
// valueFormat: 'HH:00:00'
|
|
170
|
+
// },
|
|
171
|
+
// hidden: (formModel) => formModel.cycleType !== CycleTypeEnum.小时
|
|
172
|
+
// }
|
|
173
|
+
]
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
title: "拓展形式",
|
|
177
|
+
schemas: [
|
|
178
|
+
{
|
|
179
|
+
label: "复制方式",
|
|
180
|
+
field: "copyType",
|
|
181
|
+
component: "Select",
|
|
182
|
+
componentProps: (e) => ({
|
|
183
|
+
options: [
|
|
184
|
+
{ label: "向右", value: "right" },
|
|
185
|
+
{ label: "向下", value: "down" }
|
|
186
|
+
],
|
|
187
|
+
onClear: () => {
|
|
188
|
+
i(e, ["copyType", "copyInterval"]);
|
|
189
|
+
}
|
|
190
|
+
}),
|
|
191
|
+
value: null
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
label: "跨多少(行/列)复制",
|
|
195
|
+
field: "copyInterval",
|
|
196
|
+
component: "InputNumber",
|
|
197
|
+
value: 0,
|
|
198
|
+
componentProps: {
|
|
199
|
+
min: 0,
|
|
200
|
+
precision: 0
|
|
201
|
+
},
|
|
202
|
+
formItemProps: {
|
|
203
|
+
labelWidth: 130
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
], p = l, u = l.filter((e) => e.title !== "基本信息");
|
|
209
|
+
export {
|
|
210
|
+
p as indicatorsFormSchemas,
|
|
211
|
+
m as registerExternalComponents,
|
|
212
|
+
u as timeConfigFormSchemas
|
|
213
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(n,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(n=typeof globalThis<"u"?globalThis:n||self,i(n.TorUniverSheet={},n.Vue))})(this,(function(n,i){"use strict";const r=(e,o)=>{for(const t of o)e[t]=null};let l={};function c(e){l={...l,...e}}function d(e){return l[e]}const s=[{label:"无",value:"no"},{label:"年",value:"year"},{label:"月",value:"month"},{label:"周",value:"week"},{label:"天",value:"day"},{label:"班组",value:"shift"},{label:"小时",value:"hour"},{label:"半小时",value:"half_hour"}],a=[{title:"基本信息",schemas:[{label:"指标名称",field:"indicatorName",component:"Input",formItemProps:{rules:[{required:!0,message:"请输入指标名称",trigger:"blur"}]},render:({formModel:e})=>{const o=d("IndicatorPointSelect");return i.h(o,{modelValue:e.indicatorName,onSelect:t=>{const p={indicatorName:t?.indicatorName,indicatorCode:t?.indicatorCoding,indicatorId:t?.id,indicatorDimensionName:t?.indicatorDimensionName,indicatorDimensionConfig:t?.indicatorDimensionConfig};Object.assign(e,p)},onClear:()=>{r(e,["indicatorName","indicatorCode","indicatorId","indicatorDimensionName","indicatorDimensionConfig"])},"onUpdate:modelValue":t=>{e.indicatorName=t}})}},{label:"指标编码",field:"indicatorCode",component:"Input",componentProps:{disabled:!0},formItemProps:{rules:[{required:!0,message:"请输入指标编码",trigger:"blur"}]}},{label:"指标ID",field:"indicatorId",component:"Input",componentProps:{disabled:!0},formItemProps:{rules:[{required:!0,message:"请输入指标指标ID",trigger:"blur"}]}},{label:"维度名称",field:"indicatorDimensionName",component:"Input",componentProps:{disabled:!0}},{label:"维度编码",field:"indicatorDimensionConfig",component:"Input",componentProps:{disabled:!0}},{label:"是否必填",field:"required",component:"ElCheckbox"}]},{title:"时间条件",schemas:[{label:"周期类型",field:"cycleType",component:"Select",componentProps:e=>({options:s.filter(o=>!["no","half_hour","shift","week"].includes(o.value)),onChange:o=>{e.cycleType=o,e.timeIncrement=0,e.defaultShift=!1,e.forwardPush=!1}})},{label:"时间递增量",field:"timeIncrement",component:"InputNumber",value:0,componentProps:{min:0,precision:0}},{label:"默认排班班次",field:"defaultShift",component:"ElCheckbox",componentProps:e=>({onChange:o=>{e.defaultShift=o,e.forwardPush=!1}}),hidden:e=>!["day","hour"].includes(e.cycleType)},{label:"向前推7天",field:"forwardPush",component:"ElCheckbox",componentProps:e=>({disabled:e.defaultShift}),hidden:e=>e.cycleType!=="day"}]},{title:"拓展形式",schemas:[{label:"复制方式",field:"copyType",component:"Select",componentProps:e=>({options:[{label:"向右",value:"right"},{label:"向下",value:"down"}],onClear:()=>{r(e,["copyType","copyInterval"])}}),value:null},{label:"跨多少(行/列)复制",field:"copyInterval",component:"InputNumber",value:0,componentProps:{min:0,precision:0},formItemProps:{labelWidth:130}}]}],u=a,m=a.filter(e=>e.title!=="基本信息");n.indicatorsFormSchemas=u,n.registerExternalComponents=c,n.timeConfigFormSchemas=m,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export type ComponentName =
|
|
2
|
+
| 'Radio'
|
|
3
|
+
| 'RadioButton'
|
|
4
|
+
| 'Checkbox'
|
|
5
|
+
| 'ElCheckbox'
|
|
6
|
+
| 'CheckboxButton'
|
|
7
|
+
| 'Input'
|
|
8
|
+
| 'Autocomplete'
|
|
9
|
+
| 'InputNumber'
|
|
10
|
+
| 'Select'
|
|
11
|
+
| 'Cascader'
|
|
12
|
+
| 'Switch'
|
|
13
|
+
| 'Slider'
|
|
14
|
+
| 'TimePicker'
|
|
15
|
+
| 'DatePicker'
|
|
16
|
+
| 'Rate'
|
|
17
|
+
| 'ColorPicker'
|
|
18
|
+
| 'Transfer'
|
|
19
|
+
| 'Divider'
|
|
20
|
+
| 'TimeSelect'
|
|
21
|
+
| 'SelectV2'
|
|
22
|
+
| 'TreeSelect'
|
|
23
|
+
|
|
24
|
+
export type ColProps = {
|
|
25
|
+
span?: number
|
|
26
|
+
xs?: number
|
|
27
|
+
sm?: number
|
|
28
|
+
md?: number
|
|
29
|
+
lg?: number
|
|
30
|
+
xl?: number
|
|
31
|
+
tag?: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type ComponentOptions = {
|
|
35
|
+
label?: string
|
|
36
|
+
value?: FormValueType
|
|
37
|
+
disabled?: boolean
|
|
38
|
+
key?: string | number
|
|
39
|
+
children?: ComponentOptions[]
|
|
40
|
+
options?: ComponentOptions[]
|
|
41
|
+
} & Recordable
|
|
42
|
+
|
|
43
|
+
export type ComponentOptionsAlias = {
|
|
44
|
+
labelField?: string
|
|
45
|
+
valueField?: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type ComponentProps = {
|
|
49
|
+
optionsAlias?: ComponentOptionsAlias
|
|
50
|
+
options?: ComponentOptions[]
|
|
51
|
+
optionsSlot?: boolean
|
|
52
|
+
} & Recordable
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
export interface IndicatorPointSelectProps {
|
|
3
|
+
modelValue?: string | number
|
|
4
|
+
type?: 'radio' | 'checkbox'
|
|
5
|
+
callback?: () => boolean
|
|
6
|
+
extra?: Record<string, any>
|
|
7
|
+
onSelect?: (data: Recordable) => void
|
|
8
|
+
onClear?: () => void
|
|
9
|
+
'onUpdate:modelValue'?: (value: string | number) => void
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ExternalComponents {
|
|
13
|
+
IndicatorPointSelect?: Component
|
|
14
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { CSSProperties } from 'vue';
|
|
2
|
+
import { ColProps, ComponentProps, ComponentName } from './components';
|
|
3
|
+
import { FormItemProps as ELementFormItemProps } from 'element-plus';
|
|
4
|
+
export type FormSetPropsType = {
|
|
5
|
+
field: string
|
|
6
|
+
path: string
|
|
7
|
+
value: any
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type FormValueType = string | number | string[] | number[] | boolean | undefined | null
|
|
11
|
+
|
|
12
|
+
export type FormItemProps = {
|
|
13
|
+
labelWidth?: string | number
|
|
14
|
+
required?: boolean
|
|
15
|
+
rules?: Recordable
|
|
16
|
+
error?: string
|
|
17
|
+
showMessage?: boolean
|
|
18
|
+
inlineMessage?: boolean
|
|
19
|
+
style?: CSSProperties
|
|
20
|
+
labelPosition?: 'left' | 'right' | 'top'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type FormItemPropsFnParams = {
|
|
24
|
+
schema: FormItemProps
|
|
25
|
+
formModel: Recordable
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type FormSchema = {
|
|
29
|
+
// 唯一值
|
|
30
|
+
field: string
|
|
31
|
+
// 标题
|
|
32
|
+
label?: string
|
|
33
|
+
// 提示
|
|
34
|
+
labelMessage?: string
|
|
35
|
+
// col组件属性
|
|
36
|
+
colProps?: ColProps
|
|
37
|
+
// 表单组件属性,slots对应的是表单组件的插槽,规则:${field}-xxx,具体可以查看element-plus文档
|
|
38
|
+
componentProps?: { slots?: Recordable } & ComponentProps | ((formModel: Recordable) => Recordable)
|
|
39
|
+
// formItem组件属性
|
|
40
|
+
formItemProps?: FormItemProps | ((params: FormItemPropsFnParams) => FormItemProps)
|
|
41
|
+
// 渲染的组件
|
|
42
|
+
component?: ComponentName
|
|
43
|
+
// 初始值
|
|
44
|
+
value?: FormValueType
|
|
45
|
+
// 是否隐藏
|
|
46
|
+
hidden?: boolean | ((formModel: Recordable) => boolean)
|
|
47
|
+
// 远程加载下拉项
|
|
48
|
+
api?: <T = any>() => Promise<T>
|
|
49
|
+
// 自定义渲染
|
|
50
|
+
render?: ({ schema, formModel }: { schema: FormSchema; formModel: Recordable }) => VNode
|
|
51
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { default as Decimal } from 'decimal.js';
|
|
2
|
+
declare class DecimalChain {
|
|
3
|
+
private value;
|
|
4
|
+
constructor(value: string | number | Decimal);
|
|
5
|
+
/**
|
|
6
|
+
* 加法运算
|
|
7
|
+
* @param num 要加的数
|
|
8
|
+
* @returns DecimalChain 实例,支持链式调用
|
|
9
|
+
*/
|
|
10
|
+
add(num: string | number | Decimal): DecimalChain;
|
|
11
|
+
/**
|
|
12
|
+
* 减法运算
|
|
13
|
+
* @param num 要减的数
|
|
14
|
+
* @returns DecimalChain 实例,支持链式调用
|
|
15
|
+
*/
|
|
16
|
+
subtract(num: string | number | Decimal): DecimalChain;
|
|
17
|
+
/**
|
|
18
|
+
* 乘法运算
|
|
19
|
+
* @param num 要乘的数
|
|
20
|
+
* @returns DecimalChain 实例,支持链式调用
|
|
21
|
+
*/
|
|
22
|
+
multiply(num: string | number | Decimal): DecimalChain;
|
|
23
|
+
/**
|
|
24
|
+
* 除法运算
|
|
25
|
+
* @param num 要除的数
|
|
26
|
+
* @returns DecimalChain 实例,支持链式调用
|
|
27
|
+
* @throws 当除数为0时抛出错误
|
|
28
|
+
*/
|
|
29
|
+
divide(num: string | number | Decimal): DecimalChain;
|
|
30
|
+
/**
|
|
31
|
+
* 保留小数位数
|
|
32
|
+
* @param dp 保留的小数位数
|
|
33
|
+
* @param rounding 舍入模式,默认为四舍五入
|
|
34
|
+
* @returns DecimalChain 实例,支持链式调用
|
|
35
|
+
*/
|
|
36
|
+
toFixed(dp: number, rounding?: Decimal.Rounding): DecimalChain;
|
|
37
|
+
/**
|
|
38
|
+
* 返回当前值
|
|
39
|
+
* @returns Decimal 实例
|
|
40
|
+
*/
|
|
41
|
+
valueOf(): Decimal;
|
|
42
|
+
/**
|
|
43
|
+
* 转换为字符串
|
|
44
|
+
* @returns 字符串表示
|
|
45
|
+
*/
|
|
46
|
+
toString(): string;
|
|
47
|
+
/**
|
|
48
|
+
* 转换为数字
|
|
49
|
+
* @returns 数字表示
|
|
50
|
+
*/
|
|
51
|
+
toNumber(): number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 创建一个支持链式调用的 Decimal 实例
|
|
55
|
+
* @param value 初始值
|
|
56
|
+
* * @returns DecimalChain 实例
|
|
57
|
+
*/
|
|
58
|
+
export declare function decimal(value?: string | number | Decimal): DecimalChain;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function openMultipleFileSelector(acceptTypes?: string, multiple?: boolean): Promise<unknown>;
|
|
2
|
+
export declare function getXlsxData(file: File): Promise<unknown>;
|
|
3
|
+
/**
|
|
4
|
+
* 下载axios导出的文件
|
|
5
|
+
* @param res
|
|
6
|
+
* @param _filename
|
|
7
|
+
*/
|
|
8
|
+
export declare const downloadBlobRes: (res: any, _filename?: string | undefined) => void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const is: (val: unknown, type: string) => boolean;
|
|
2
|
+
export declare const isDef: <T = unknown>(val?: T) => val is T;
|
|
3
|
+
export declare const isUnDef: <T = unknown>(val?: T) => val is T;
|
|
4
|
+
export declare const isObject: (val: any) => val is Record<any, any>;
|
|
5
|
+
export declare const isEmpty: (val: any) => boolean;
|
|
6
|
+
export declare const isDate: (val: unknown) => val is Date;
|
|
7
|
+
export declare const isNull: (val: unknown) => val is null;
|
|
8
|
+
export declare const isNullAndUnDef: (val: unknown) => val is null | undefined;
|
|
9
|
+
export declare const isNullOrUnDef: (val: unknown) => val is null | undefined;
|
|
10
|
+
export declare const isNumber: (val: unknown) => val is number;
|
|
11
|
+
export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
|
|
12
|
+
export declare const isString: (val: unknown) => val is string;
|
|
13
|
+
export declare const isFunction: (val: unknown) => val is Function;
|
|
14
|
+
export declare const isBoolean: (val: unknown) => val is boolean;
|
|
15
|
+
export declare const isRegExp: (val: unknown) => val is RegExp;
|
|
16
|
+
export declare const isArray: (val: any) => val is Array<any>;
|
|
17
|
+
export declare const isWindow: (val: any) => val is Window;
|
|
18
|
+
export declare const isElement: (val: unknown) => val is Element;
|
|
19
|
+
export declare const isMap: (val: unknown) => val is Map<any, any>;
|
|
20
|
+
export declare const isServer: boolean;
|
|
21
|
+
export declare const isClient: boolean;
|
|
22
|
+
export declare const isUrl: (path: string) => boolean;
|
|
23
|
+
export declare const isDark: () => boolean;
|
|
24
|
+
export declare const isImgPath: (path: string) => boolean;
|
|
25
|
+
export declare const isPasswordComplex: (value: string) => boolean;
|
|
26
|
+
export declare const isValidPassword: (value: string) => boolean;
|
|
27
|
+
export declare const isEmptyVal: (val: any) => boolean;
|
|
28
|
+
export declare const isContainsChinese: (val: string) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* @description 判断是否为windows环境
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
export declare function isWindows(): boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { VueTypeValidableDef, VueTypesInterface } from 'vue-types';
|
|
2
|
+
import { CSSProperties } from 'vue';
|
|
3
|
+
type PropTypes = VueTypesInterface & {
|
|
4
|
+
readonly style: VueTypeValidableDef<CSSProperties>;
|
|
5
|
+
};
|
|
6
|
+
declare const newPropTypes: PropTypes;
|
|
7
|
+
declare class propTypes extends newPropTypes {
|
|
8
|
+
static get style(): VueTypeValidableDef<any, import('node_modules/vue-types/dist/shared/vue-types.d8e57a80.mjs').b<any>>;
|
|
9
|
+
}
|
|
10
|
+
export { propTypes };
|
package/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tor-univer-sheet",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "基于 Univer 的 Vue3 电子表格组件",
|
|
5
|
+
"author": "tortormore",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./dist/tor-univer-sheet.umd.js",
|
|
9
|
+
"module": "./dist/tor-univer-sheet.es.js",
|
|
10
|
+
"types": "./dist/types/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/tor-univer-sheet.es.js",
|
|
14
|
+
"require": "./dist/tor-univer-sheet.umd.js",
|
|
15
|
+
"types": "./dist/index.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./dist/style.css": "./dist/style.css"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"src"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"dev": "vite",
|
|
25
|
+
"build": "run-p type-check \"build-only {@}\" --",
|
|
26
|
+
"preview": "vite preview",
|
|
27
|
+
"test:unit": "vitest",
|
|
28
|
+
"build-only": "vite build",
|
|
29
|
+
"type-check": "vue-tsc --build",
|
|
30
|
+
"lint": "run-s lint:*",
|
|
31
|
+
"lint:oxlint": "oxlint . --fix",
|
|
32
|
+
"lint:eslint": "eslint . --fix --cache",
|
|
33
|
+
"format": "prettier --write --experimental-cli src/"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"dayjs": "^1.11.20",
|
|
37
|
+
"decimal.js": "^10.6.0",
|
|
38
|
+
"element-plus": "^2.13.5",
|
|
39
|
+
"vue": "^3.5.0",
|
|
40
|
+
"xlsx": "^0.18.5"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@univerjs/core": "^0.15.5",
|
|
44
|
+
"@univerjs/preset-sheets-advanced": "^0.15.5",
|
|
45
|
+
"@univerjs/preset-sheets-core": "^0.15.5",
|
|
46
|
+
"@univerjs/preset-sheets-drawing": "^0.15.5",
|
|
47
|
+
"@univerjs/preset-sheets-note": "^0.15.5",
|
|
48
|
+
"@univerjs/presets": "^0.15.5",
|
|
49
|
+
"@univerjs/ui": "^0.15.5",
|
|
50
|
+
"@univerjs/ui-adapter-vue3": "^0.15.5",
|
|
51
|
+
"vite-plugin-dts": "^4.5.4",
|
|
52
|
+
"vue-types": "^6.0.0"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@tsconfig/node24": "^24.0.4",
|
|
56
|
+
"@types/jsdom": "^28.0.0",
|
|
57
|
+
"@types/node": "^24.11.0",
|
|
58
|
+
"@vitejs/plugin-vue": "^6.0.4",
|
|
59
|
+
"@vitejs/plugin-vue-jsx": "^5.1.4",
|
|
60
|
+
"@vitest/eslint-plugin": "^1.6.9",
|
|
61
|
+
"@vue/eslint-config-typescript": "^14.7.0",
|
|
62
|
+
"@vue/test-utils": "^2.4.6",
|
|
63
|
+
"@vue/tsconfig": "^0.8.1",
|
|
64
|
+
"dayjs": "^1.11.20",
|
|
65
|
+
"decimal.js": "^10.6.0",
|
|
66
|
+
"element-plus": "^2.13.5",
|
|
67
|
+
"eslint": "^10.0.2",
|
|
68
|
+
"eslint-config-prettier": "^10.1.8",
|
|
69
|
+
"eslint-plugin-oxlint": "~1.50.0",
|
|
70
|
+
"eslint-plugin-vue": "~10.8.0",
|
|
71
|
+
"jiti": "^2.6.1",
|
|
72
|
+
"jsdom": "^28.1.0",
|
|
73
|
+
"npm-run-all2": "^8.0.4",
|
|
74
|
+
"oxlint": "~1.50.0",
|
|
75
|
+
"prettier": "3.8.1",
|
|
76
|
+
"typescript": "~5.9.3",
|
|
77
|
+
"vite": "^7.3.1",
|
|
78
|
+
"vite-plugin-vue-devtools": "^8.0.6",
|
|
79
|
+
"vitest": "^4.0.18",
|
|
80
|
+
"vue": "^3.5.29",
|
|
81
|
+
"vue-tsc": "^3.2.5",
|
|
82
|
+
"vue-types": "^6.0.0",
|
|
83
|
+
"xlsx": "^0.18.5"
|
|
84
|
+
},
|
|
85
|
+
"engines": {
|
|
86
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
87
|
+
}
|
|
88
|
+
}
|
package/src/App.vue
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="width: 100%; height: 100vh">
|
|
3
|
+
<UniverSheet
|
|
4
|
+
:mode="ModeEnum.edit"
|
|
5
|
+
:license="''"
|
|
6
|
+
show-import-file-plugin
|
|
7
|
+
show-indicators-context-menu-plugin
|
|
8
|
+
show-time-config-context-menu-plugin
|
|
9
|
+
></UniverSheet>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import UniverSheet from './components/UniverSheet/UniverSheet.vue'
|
|
15
|
+
import { ModeEnum } from './components/UniverSheet/UniverSheet.data'
|
|
16
|
+
</script>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { propTypes } from '@/utils/propTypes'
|
|
3
|
+
import { ElCard, ElTooltip } from 'element-plus'
|
|
4
|
+
|
|
5
|
+
defineOptions({ name: 'ContentWrap' })
|
|
6
|
+
|
|
7
|
+
const prefixCls = 'content-wrap'
|
|
8
|
+
|
|
9
|
+
defineProps({
|
|
10
|
+
title: propTypes.string.def(''),
|
|
11
|
+
message: propTypes.string.def(''),
|
|
12
|
+
bodyStyle: propTypes.object.def({ padding: '10px' }),
|
|
13
|
+
})
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<ElCard :body-style="bodyStyle" :class="[prefixCls, 'mb-15px']" shadow="never">
|
|
18
|
+
<template v-if="title" #header>
|
|
19
|
+
<div class="flex items-center">
|
|
20
|
+
<span class="text-16px font-700">{{ title }}</span>
|
|
21
|
+
<ElTooltip v-if="message" effect="dark" placement="right">
|
|
22
|
+
<template #content>
|
|
23
|
+
<div class="max-w-200px">{{ message }}</div>
|
|
24
|
+
</template>
|
|
25
|
+
<!-- <Icon :size="14" class="ml-5px" icon="ep:question-filled" /> -->
|
|
26
|
+
</ElTooltip>
|
|
27
|
+
<div class="flex flex-grow pl-20px">
|
|
28
|
+
<slot name="header"></slot>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
<div>
|
|
32
|
+
<slot name="right-btns"></slot>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
<template v-else-if="$slots.header" #header>
|
|
36
|
+
<slot name="header"></slot>
|
|
37
|
+
</template>
|
|
38
|
+
<slot></slot>
|
|
39
|
+
<template v-if="$slots.footer" #footer>
|
|
40
|
+
<slot name="footer"></slot>
|
|
41
|
+
</template>
|
|
42
|
+
</ElCard>
|
|
43
|
+
</template>
|
|
44
|
+
<style scoped>
|
|
45
|
+
.el-card__header {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
justify-content: space-between;
|
|
49
|
+
}
|
|
50
|
+
</style>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Component } from 'vue'
|
|
2
|
+
import {
|
|
3
|
+
ElCascader,
|
|
4
|
+
ElCheckbox,
|
|
5
|
+
ElCheckboxGroup,
|
|
6
|
+
ElColorPicker,
|
|
7
|
+
ElDatePicker,
|
|
8
|
+
ElInput,
|
|
9
|
+
ElInputNumber,
|
|
10
|
+
ElRadioGroup,
|
|
11
|
+
ElRate,
|
|
12
|
+
ElSelect,
|
|
13
|
+
ElSelectV2,
|
|
14
|
+
ElTreeSelect,
|
|
15
|
+
ElSlider,
|
|
16
|
+
ElSwitch,
|
|
17
|
+
ElTimePicker,
|
|
18
|
+
ElTimeSelect,
|
|
19
|
+
ElTransfer,
|
|
20
|
+
ElAutocomplete,
|
|
21
|
+
ElDivider
|
|
22
|
+
} from 'element-plus'
|
|
23
|
+
import { ComponentName } from '@/types/components'
|
|
24
|
+
import InputNumberWrapper from './components/InputNumberWrapper.vue'
|
|
25
|
+
|
|
26
|
+
const componentMap: Recordable<Component, ComponentName> = {
|
|
27
|
+
Radio: ElRadioGroup,
|
|
28
|
+
ElCheckbox: ElCheckbox,
|
|
29
|
+
Checkbox: ElCheckboxGroup,
|
|
30
|
+
CheckboxButton: ElCheckboxGroup,
|
|
31
|
+
Input: ElInput,
|
|
32
|
+
Autocomplete: ElAutocomplete,
|
|
33
|
+
// InputNumber: ElInputNumber,
|
|
34
|
+
InputNumber: InputNumberWrapper,
|
|
35
|
+
Select: ElSelect,
|
|
36
|
+
Cascader: ElCascader,
|
|
37
|
+
Switch: ElSwitch,
|
|
38
|
+
Slider: ElSlider,
|
|
39
|
+
TimePicker: ElTimePicker,
|
|
40
|
+
DatePicker: ElDatePicker,
|
|
41
|
+
Rate: ElRate,
|
|
42
|
+
ColorPicker: ElColorPicker,
|
|
43
|
+
Transfer: ElTransfer,
|
|
44
|
+
Divider: ElDivider,
|
|
45
|
+
TimeSelect: ElTimeSelect,
|
|
46
|
+
SelectV2: ElSelectV2,
|
|
47
|
+
TreeSelect: ElTreeSelect,
|
|
48
|
+
RadioButton: ElRadioGroup,
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { componentMap }
|