hf-sheet 1.0.1

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.
Files changed (75) hide show
  1. package/README.md +156 -0
  2. package/dist/hf-sheet.css +2 -0
  3. package/dist/hf-sheet.js +243 -0
  4. package/dist/hf-sheet.umd.cjs +1 -0
  5. package/dist/index.d.ts +160 -0
  6. package/dist/luckysheet/assets/iconfont/Anton-Regular.ttf +0 -0
  7. package/dist/luckysheet/assets/iconfont/HanaleiFill-Regular.ttf +0 -0
  8. package/dist/luckysheet/assets/iconfont/Pacifico-Regular.ttf +0 -0
  9. package/dist/luckysheet/assets/iconfont/demo.css +539 -0
  10. package/dist/luckysheet/assets/iconfont/demo_index.html +2700 -0
  11. package/dist/luckysheet/assets/iconfont/iconfont.css +457 -0
  12. package/dist/luckysheet/assets/iconfont/iconfont.eot +0 -0
  13. package/dist/luckysheet/assets/iconfont/iconfont.js +1 -0
  14. package/dist/luckysheet/assets/iconfont/iconfont.json +779 -0
  15. package/dist/luckysheet/assets/iconfont/iconfont.svg +356 -0
  16. package/dist/luckysheet/assets/iconfont/iconfont.ttf +0 -0
  17. package/dist/luckysheet/assets/iconfont/iconfont.woff +0 -0
  18. package/dist/luckysheet/assets/iconfont/iconfont.woff2 +0 -0
  19. package/dist/luckysheet/css/EwaAntH.gif +0 -0
  20. package/dist/luckysheet/css/EwaAntV.gif +0 -0
  21. package/dist/luckysheet/css/arrow-down.png +0 -0
  22. package/dist/luckysheet/css/loading.gif +0 -0
  23. package/dist/luckysheet/css/luckysheet.css +7998 -0
  24. package/dist/luckysheet/css/menuSprite.svg +505 -0
  25. package/dist/luckysheet/css/paint_16px.ico +0 -0
  26. package/dist/luckysheet/css/paint_24px.ico +0 -0
  27. package/dist/luckysheet/css/paint_32px.ico +0 -0
  28. package/dist/luckysheet/css/sprite38.svg +528 -0
  29. package/dist/luckysheet/css/waffle_sprite.png +0 -0
  30. package/dist/luckysheet/demoData/chat.js +410 -0
  31. package/dist/luckysheet/demoData/demoFeature.js +42 -0
  32. package/dist/luckysheet/demoData/getTargetData.js +5496 -0
  33. package/dist/luckysheet/demoData/sheetCell.js +1578 -0
  34. package/dist/luckysheet/demoData/sheetChart.js +4918 -0
  35. package/dist/luckysheet/demoData/sheetComment.js +67 -0
  36. package/dist/luckysheet/demoData/sheetConditionFormat.js +6568 -0
  37. package/dist/luckysheet/demoData/sheetDataVerification.js +579 -0
  38. package/dist/luckysheet/demoData/sheetFormula.js +6600 -0
  39. package/dist/luckysheet/demoData/sheetPicture.js +159 -0
  40. package/dist/luckysheet/demoData/sheetPivotTable.js +189 -0
  41. package/dist/luckysheet/demoData/sheetPivotTableData.js +741 -0
  42. package/dist/luckysheet/demoData/sheetSparkline.js +7066 -0
  43. package/dist/luckysheet/demoData/sheetTable.js +1068 -0
  44. package/dist/luckysheet/expendPlugins/chart/chartmix.css +1 -0
  45. package/dist/luckysheet/expendPlugins/chart/chartmix.umd.min.js +12 -0
  46. package/dist/luckysheet/expendPlugins/chart/chartmix.umd.min.js.map +1 -0
  47. package/dist/luckysheet/expendPlugins/print/print.css +46 -0
  48. package/dist/luckysheet/expendPlugins/print/print.js +0 -0
  49. package/dist/luckysheet/fonts/FontAwesome.otf +0 -0
  50. package/dist/luckysheet/fonts/fontawesome-webfont.eot +0 -0
  51. package/dist/luckysheet/fonts/fontawesome-webfont.svg +2671 -0
  52. package/dist/luckysheet/fonts/fontawesome-webfont.ttf +0 -0
  53. package/dist/luckysheet/fonts/fontawesome-webfont.woff +0 -0
  54. package/dist/luckysheet/fonts/fontawesome-webfont.woff2 +0 -0
  55. package/dist/luckysheet/index.html +1965 -0
  56. package/dist/luckysheet/luckyexcel.cjs.js +4722 -0
  57. package/dist/luckysheet/luckyexcel.esm.js +4715 -0
  58. package/dist/luckysheet/luckyexcel.umd.js +7399 -0
  59. package/dist/luckysheet/luckysheet.umd.js +4511 -0
  60. package/dist/luckysheet/luckysheet.umd.js.map +7 -0
  61. package/dist/luckysheet/plugins/css/pluginsCss.css +1 -0
  62. package/dist/luckysheet/plugins/images/CFcolorGradation.png +0 -0
  63. package/dist/luckysheet/plugins/images/CFdataBar.png +0 -0
  64. package/dist/luckysheet/plugins/images/CFicons.png +0 -0
  65. package/dist/luckysheet/plugins/images/icon_dropCell.png +0 -0
  66. package/dist/luckysheet/plugins/images/js.png +0 -0
  67. package/dist/luckysheet/plugins/images/ui-icons_444444_256x240.png +0 -0
  68. package/dist/luckysheet/plugins/images/ui-icons_555555_256x240.png +0 -0
  69. package/dist/luckysheet/plugins/images/ui-icons_777620_256x240.png +0 -0
  70. package/dist/luckysheet/plugins/images/ui-icons_777777_256x240.png +0 -0
  71. package/dist/luckysheet/plugins/images/ui-icons_cc0000_256x240.png +0 -0
  72. package/dist/luckysheet/plugins/images/ui-icons_ffffff_256x240.png +0 -0
  73. package/dist/luckysheet/plugins/js/plugin.js +1 -0
  74. package/dist/luckysheet/plugins/plugins.css +10 -0
  75. package/package.json +53 -0
package/README.md ADDED
@@ -0,0 +1,156 @@
1
+ # hf-sheet
2
+
3
+ 基于 Luckysheet 的 Vue3 电子表格组件
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ npm install hf-sheet
9
+ ```
10
+
11
+
12
+
13
+ ```bash
14
+ pnpm install hf-sheet
15
+ ```
16
+
17
+ ## 使用
18
+
19
+ ### 方式一:在 HTML 中引入(推荐)
20
+
21
+ 在你的 HTML 文件中引入必要的依赖文件:
22
+
23
+ ```html
24
+ <!-- 引入 Luckysheet 样式(从 hf-sheet 包中引入) -->
25
+ <link rel="stylesheet" href="/node_modules/hf-sheet/dist/luckysheet/plugins/css/pluginsCss.css" />
26
+ <link rel="stylesheet" href="/node_modules/hf-sheet/dist/luckysheet/plugins/plugins.css" />
27
+ <link rel="stylesheet" href="/node_modules/hf-sheet/dist/luckysheet/css/luckysheet.css" />
28
+ <link rel="stylesheet" href="/node_modules/hf-sheet/dist/luckysheet/assets/iconfont/iconfont.css" />
29
+
30
+ <!-- 引入 Luckysheet 脚本(从 hf-sheet 包中引入) -->
31
+ <script src="/node_modules/hf-sheet/dist/luckysheet/plugins/js/plugin.js"></script>
32
+ <script src="/node_modules/hf-sheet/dist/luckysheet/luckysheet.umd.js"></script>
33
+ <script src="/node_modules/hf-sheet/dist/luckysheet/luckyexcel.umd.js"></script>
34
+ ```
35
+
36
+ ### 方式二:在 Vite 项目中使用
37
+
38
+ 如果你的项目使用 Vite,可以在 `vite.config.js` 中配置静态资源别名:
39
+
40
+ ```javascript
41
+ import { defineConfig } from 'vite'
42
+ import vue from '@vitejs/plugin-vue'
43
+
44
+ export default defineConfig({
45
+ plugins: [vue()],
46
+ resolve: {
47
+ alias: {
48
+ '@': '/src',
49
+ 'luckysheet': '/node_modules/hf-sheet/dist/luckysheet'
50
+ }
51
+ }
52
+ })
53
+ ```
54
+
55
+ 然后在你的入口文件(如 `main.js` 或 `App.vue`)中引入:
56
+
57
+ ```javascript
58
+ import 'luckysheet/plugins/css/pluginsCss.css'
59
+ import 'luckysheet/plugins/plugins.css'
60
+ import 'luckysheet/css/luckysheet.css'
61
+ import 'luckysheet/assets/iconfont/iconfont.css'
62
+
63
+ import 'luckysheet/plugins/js/plugin.js'
64
+ import 'luckysheet/luckysheet.umd.js'
65
+ import 'luckysheet/luckyexcel.umd.js'
66
+ ```
67
+
68
+ ### 全局注册组件
69
+
70
+ ```javascript
71
+ import { createApp } from "vue";
72
+ import LuckySheet from "hf-sheet";
73
+ import "hf-sheet/dist/hf-sheet.css";
74
+
75
+ const app = createApp(App);
76
+ app.use(LuckySheet);
77
+ ```
78
+
79
+ ### 局部使用组件
80
+
81
+ ```vue
82
+ <template>
83
+ <LuckySheet
84
+ :dataSourceOptionsFn="getDataSourceOptions"
85
+ @syncUpdate="handleSyncUpdate"
86
+ @back="handleBack"
87
+ />
88
+ </template>
89
+
90
+ <script setup lang="ts">
91
+ import { ref } from "vue";
92
+ import LuckySheet from "hf-sheet";
93
+
94
+ const getDataSourceOptions = async () => {
95
+ // 返回数据源选项
96
+ return [
97
+ { label: "数据源1", value: "source1" },
98
+ { label: "数据源2", value: "source2" },
99
+ ];
100
+ };
101
+
102
+ const handleSyncUpdate = (data) => {
103
+ console.log("数据更新:", data);
104
+ };
105
+
106
+ const handleBack = () => {
107
+ console.log("返回");
108
+ };
109
+ </script>
110
+ ```
111
+
112
+ ## Props
113
+
114
+ | 参数 | 说明 | 类型 | 必填 | 默认值 |
115
+ | ------------------- | -------------------- | -------- | ---- | ------ |
116
+ | dataSourceOptionsFn | 获取数据源选项的函数 | Function | 是 | - |
117
+
118
+ ## Events
119
+
120
+ | 事件名 | 说明 | 回调参数 |
121
+ | ---------- | ------------------ | ------------------- |
122
+ | syncUpdate | 数据同步更新时触发 | (data: any) => void |
123
+ | back | 返回按钮点击时触发 | () => void |
124
+
125
+ ## 开发
126
+
127
+ ```bash
128
+ # 安装依赖
129
+ npm install
130
+
131
+ # 启动开发服务器
132
+ npm run dev
133
+
134
+ # 构建生产版本
135
+ npm run build
136
+
137
+ # 预览构建结果
138
+ npm run preview
139
+ ```
140
+
141
+ ## 依赖
142
+
143
+ - Vue 3.5+
144
+ - Element Plus 2.13+
145
+ - Luckysheet 2.1.13+
146
+ - jQuery 3.6.0+
147
+ - jQuery Mousewheel 3.1.12+
148
+ - UUID 8.3.2+
149
+
150
+ ## License
151
+
152
+ MIT
153
+
154
+ ## Author
155
+
156
+ alan
@@ -0,0 +1,2 @@
1
+ .flex[data-v-bd7de71b]{padding:10px;display:flex}.mb-2[data-v-bd7de71b]{margin-bottom:2px}.justify-end[data-v-bd7de71b]{justify-content:flex-end}.gap-10[data-v-bd7de71b]{gap:10px}.mb[data-v-bd7de71b]{margin-top:10px;margin-bottom:10px}.justify-between[data-v-bd7de71b]{justify-content:space-between}.luckysheet-container[data-v-bd7de71b]{width:100%;min-height:800px;margin:0 10px 0 0}
2
+ /*$vite$:1*/
@@ -0,0 +1,243 @@
1
+ import { Fragment as e, createBlock as t, createElementBlock as n, createElementVNode as r, createTextVNode as i, createVNode as a, defineComponent as o, onBeforeUnmount as s, onMounted as c, openBlock as l, reactive as u, ref as d, renderList as f, toDisplayString as p, unref as m, withCtx as h } from "vue";
2
+ import { ElButton as g, ElCard as _, ElForm as v, ElFormItem as y, ElInput as b, ElMessage as x, ElOption as S, ElSelect as C, ElSwitch as w } from "element-plus";
3
+ //#region src/components/LuckySheet.vue?vue&type=script&setup=true&lang.ts
4
+ var T = { class: "flex justify-end gap-10 mb" }, E = { class: "flex justify-between" }, D = { class: "w-[300px] flex gap-10 mb-2" }, O = /* @__PURE__ */ ((e, t) => {
5
+ let n = e.__vccOpts || e;
6
+ for (let [e, r] of t) n[e] = r;
7
+ return n;
8
+ })(/* @__PURE__ */ o({
9
+ name: "LuckySheet",
10
+ __name: "LuckySheet",
11
+ props: { dataSourceOptionsFn: {
12
+ type: Function,
13
+ required: !0
14
+ } },
15
+ emits: ["syncUpdate", "back"],
16
+ setup(o, { expose: O, emit: k }) {
17
+ let A = o, j = d(), M = k, N = u({
18
+ line: "",
19
+ column: "",
20
+ dataSource: "",
21
+ name: "",
22
+ code: "",
23
+ type: "",
24
+ readOnly: !1
25
+ }), P = u({
26
+ dataSource: "",
27
+ name: "",
28
+ code: "",
29
+ type: "",
30
+ readOnly: !1
31
+ }), F = d([]), I = d([{
32
+ label: "文本框",
33
+ value: "General"
34
+ }, {
35
+ label: "下拉框",
36
+ value: "select"
37
+ }]), L = {
38
+ container: "luckysheet",
39
+ lang: "zh",
40
+ showinfobar: !0,
41
+ sheetFormulaBar: !1,
42
+ cellRightClickConfig: {
43
+ copy: !1,
44
+ copyAs: !1,
45
+ paste: !1,
46
+ insertRow: !0,
47
+ insertColumn: !1,
48
+ deleteRow: !0,
49
+ deleteColumn: !1,
50
+ deleteCell: !1,
51
+ hideRow: !1,
52
+ hideColumn: !1,
53
+ rowHeight: !0,
54
+ columnWidth: !0,
55
+ clear: !1,
56
+ matrix: !1,
57
+ sort: !1,
58
+ filter: !1,
59
+ chart: !1,
60
+ image: !1,
61
+ link: !1,
62
+ data: !1,
63
+ cellFormat: !1
64
+ },
65
+ showstatisticBarConfig: {
66
+ count: !1,
67
+ view: !0,
68
+ zoom: !0
69
+ },
70
+ hook: {
71
+ cellMousedownBefore: (e) => !e?.p?.r,
72
+ rangeSelect: async (e, t) => {
73
+ let n = t[0].row_focus, r = t[0].column_focus, i = luckysheet?.getRangeValue(n, r)[0][0];
74
+ N.line = n, N.column = r;
75
+ let a = {
76
+ columnIndex: r,
77
+ rowIndex: n,
78
+ p: i?.p ?? void 0
79
+ };
80
+ if (j.value?.resetFields(), a?.p !== void 0) {
81
+ let e = Object.assign({}, a.p), t = {
82
+ dataSource: e.s,
83
+ name: e.n,
84
+ code: e.c,
85
+ type: e.t,
86
+ readOnly: e.r
87
+ };
88
+ P.code = t.code, P.name = t.name, P.type = t.type, P.dataSource = t.dataSource, P.readOnly = t.readOnly;
89
+ return;
90
+ }
91
+ P.code = "", P.name = "", P.type = "", P.dataSource = "", P.readOnly = !1;
92
+ },
93
+ cellUpdateBefore: (e, t) => {
94
+ if (console.info(e.c), (luckysheet?.getRangeValue(e, t)[0][0])?.p?.r) return !1;
95
+ }
96
+ }
97
+ };
98
+ async function R() {
99
+ if (!luckysheet) {
100
+ x.error("Luckysheet 未初始化");
101
+ return;
102
+ }
103
+ for (let e of luckysheet.getRangeAxis()) {
104
+ let t = luckysheet.getRangeValue(e);
105
+ for (let e of t) for (let [t, n] of e.entries()) if (e[t].p = {
106
+ s: P?.dataSource ?? "",
107
+ c: P?.code ?? "",
108
+ n: P?.name ?? "",
109
+ r: P?.readOnly ?? !1,
110
+ t: P?.type ?? ""
111
+ }, n.mc) break;
112
+ luckysheet.setRangeValue(t, { range: e }), console.info(t);
113
+ }
114
+ x.success("提交成功");
115
+ }
116
+ function z() {
117
+ if (!luckysheet) {
118
+ x.error("Luckysheet 未初始化");
119
+ return;
120
+ }
121
+ let { data: e } = luckysheet.toJson();
122
+ localStorage.setItem("luckysheet-data", JSON.stringify(e)), console.info(luckysheet.getAllSheets()), M("syncUpdate", luckysheet.getAllSheets());
123
+ }
124
+ function B(e) {
125
+ if (!luckysheet) {
126
+ x.error("Luckysheet 未初始化");
127
+ return;
128
+ }
129
+ luckysheet.destroy(), luckysheet.create({
130
+ title: "测试表",
131
+ allowEdit: !0,
132
+ data: e,
133
+ ...L
134
+ });
135
+ }
136
+ async function V() {
137
+ F.value = await A.dataSourceOptionsFn();
138
+ }
139
+ return c(() => {
140
+ V();
141
+ }), s(() => {
142
+ luckysheet && luckysheet.destroy();
143
+ }), O({ setSheetData: B }), (o, s) => (l(), n(e, null, [r("div", T, [a(m(g), {
144
+ type: "primary",
145
+ onClick: z
146
+ }, {
147
+ default: h(() => [...s[6] ||= [i("同步更新", -1)]]),
148
+ _: 1
149
+ }), a(m(g), { onClick: s[0] ||= (e) => o.$emit("back") }, {
150
+ default: h(() => [...s[7] ||= [i(" 返回 ", -1)]]),
151
+ _: 1
152
+ })]), r("div", E, [s[10] ||= r("div", {
153
+ id: "luckysheet",
154
+ class: "luckysheet-container"
155
+ }, null, -1), a(m(_), { shadow: "never" }, {
156
+ header: h(() => [...s[8] ||= [r("span", null, "属性编辑", -1)]]),
157
+ default: h(() => [
158
+ r("div", D, [r("div", null, "行:" + p(N.line), 1), r("div", null, "列:" + p(N.column), 1)]),
159
+ a(m(v), {
160
+ ref_key: "elFormRef",
161
+ ref: j,
162
+ model: P,
163
+ "label-width": "120px"
164
+ }, {
165
+ default: h(() => [
166
+ a(m(y), { label: "数据源" }, {
167
+ default: h(() => [a(m(C), {
168
+ modelValue: P.dataSource,
169
+ "onUpdate:modelValue": s[1] ||= (e) => P.dataSource = e,
170
+ placeholder: "请选择数据源"
171
+ }, {
172
+ default: h(() => [(l(!0), n(e, null, f(F.value, (e) => (l(), t(m(S), {
173
+ key: e.value,
174
+ label: e.label,
175
+ value: e.value
176
+ }, null, 8, ["label", "value"]))), 128))]),
177
+ _: 1
178
+ }, 8, ["modelValue"])]),
179
+ _: 1
180
+ }),
181
+ a(m(y), { label: "名称" }, {
182
+ default: h(() => [a(m(b), {
183
+ modelValue: P.name,
184
+ "onUpdate:modelValue": s[2] ||= (e) => P.name = e,
185
+ placeholder: "请输入名称"
186
+ }, null, 8, ["modelValue"])]),
187
+ _: 1
188
+ }),
189
+ a(m(y), { label: "编码" }, {
190
+ default: h(() => [a(m(b), {
191
+ modelValue: P.code,
192
+ "onUpdate:modelValue": s[3] ||= (e) => P.code = e,
193
+ placeholder: "请输入编码"
194
+ }, null, 8, ["modelValue"])]),
195
+ _: 1
196
+ }),
197
+ a(m(y), { label: "类型" }, {
198
+ default: h(() => [a(m(C), {
199
+ modelValue: P.type,
200
+ "onUpdate:modelValue": s[4] ||= (e) => P.type = e,
201
+ placeholder: "请选择类型"
202
+ }, {
203
+ default: h(() => [(l(!0), n(e, null, f(I.value, (e) => (l(), t(m(S), {
204
+ key: e.value,
205
+ label: e.label,
206
+ value: e.value
207
+ }, null, 8, ["label", "value"]))), 128))]),
208
+ _: 1
209
+ }, 8, ["modelValue"])]),
210
+ _: 1
211
+ }),
212
+ a(m(y), { label: "只读" }, {
213
+ default: h(() => [a(m(w), {
214
+ modelValue: P.readOnly,
215
+ "onUpdate:modelValue": s[5] ||= (e) => P.readOnly = e
216
+ }, null, 8, ["modelValue"])]),
217
+ _: 1
218
+ })
219
+ ]),
220
+ _: 1
221
+ }, 8, ["model"]),
222
+ a(m(g), {
223
+ type: "primary",
224
+ onClick: R
225
+ }, {
226
+ default: h(() => [...s[9] ||= [i("保存", -1)]]),
227
+ _: 1
228
+ })
229
+ ]),
230
+ _: 1
231
+ })])], 64));
232
+ }
233
+ }), [["__scopeId", "data-v-bd7de71b"]]);
234
+ //#endregion
235
+ //#region src/components/index.ts
236
+ console.info(O);
237
+ var k = [O], A = { install: function(e) {
238
+ k.forEach((t) => {
239
+ e.component(t.name, t);
240
+ });
241
+ } };
242
+ //#endregion
243
+ export { O as LuckySheet, A as default };
@@ -0,0 +1 @@
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`vue`),require(`element-plus`)):typeof define==`function`&&define.amd?define([`exports`,`vue`,`element-plus`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.LuckySheet={},e.Vue,e.ElementPlus))})(this,function(e,t,n){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var r={class:`flex justify-end gap-10 mb`},i={class:`flex justify-between`},a={class:`w-[300px] flex gap-10 mb-2`},o=((e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n})((0,t.defineComponent)({name:`LuckySheet`,__name:`LuckySheet`,props:{dataSourceOptionsFn:{type:Function,required:!0}},emits:[`syncUpdate`,`back`],setup(e,{expose:o,emit:s}){let c=e,l=(0,t.ref)(),u=s,d=(0,t.reactive)({line:``,column:``,dataSource:``,name:``,code:``,type:``,readOnly:!1}),f=(0,t.reactive)({dataSource:``,name:``,code:``,type:``,readOnly:!1}),p=(0,t.ref)([]),m=(0,t.ref)([{label:`文本框`,value:`General`},{label:`下拉框`,value:`select`}]),h={container:`luckysheet`,lang:`zh`,showinfobar:!0,sheetFormulaBar:!1,cellRightClickConfig:{copy:!1,copyAs:!1,paste:!1,insertRow:!0,insertColumn:!1,deleteRow:!0,deleteColumn:!1,deleteCell:!1,hideRow:!1,hideColumn:!1,rowHeight:!0,columnWidth:!0,clear:!1,matrix:!1,sort:!1,filter:!1,chart:!1,image:!1,link:!1,data:!1,cellFormat:!1},showstatisticBarConfig:{count:!1,view:!0,zoom:!0},hook:{cellMousedownBefore:e=>!e?.p?.r,rangeSelect:async(e,t)=>{let n=t[0].row_focus,r=t[0].column_focus,i=luckysheet?.getRangeValue(n,r)[0][0];d.line=n,d.column=r;let a={columnIndex:r,rowIndex:n,p:i?.p??void 0};if(l.value?.resetFields(),a?.p!==void 0){let e=Object.assign({},a.p),t={dataSource:e.s,name:e.n,code:e.c,type:e.t,readOnly:e.r};f.code=t.code,f.name=t.name,f.type=t.type,f.dataSource=t.dataSource,f.readOnly=t.readOnly;return}f.code=``,f.name=``,f.type=``,f.dataSource=``,f.readOnly=!1},cellUpdateBefore:(e,t)=>{if(console.info(e.c),(luckysheet?.getRangeValue(e,t)[0][0])?.p?.r)return!1}}};async function g(){if(!luckysheet){n.ElMessage.error(`Luckysheet 未初始化`);return}for(let e of luckysheet.getRangeAxis()){let t=luckysheet.getRangeValue(e);for(let e of t)for(let[t,n]of e.entries())if(e[t].p={s:f?.dataSource??``,c:f?.code??``,n:f?.name??``,r:f?.readOnly??!1,t:f?.type??``},n.mc)break;luckysheet.setRangeValue(t,{range:e}),console.info(t)}n.ElMessage.success(`提交成功`)}function _(){if(!luckysheet){n.ElMessage.error(`Luckysheet 未初始化`);return}let{data:e}=luckysheet.toJson();localStorage.setItem(`luckysheet-data`,JSON.stringify(e)),console.info(luckysheet.getAllSheets()),u(`syncUpdate`,luckysheet.getAllSheets())}function v(e){if(!luckysheet){n.ElMessage.error(`Luckysheet 未初始化`);return}luckysheet.destroy(),luckysheet.create({title:`测试表`,allowEdit:!0,data:e,...h})}async function y(){p.value=await c.dataSourceOptionsFn()}return(0,t.onMounted)(()=>{y()}),(0,t.onBeforeUnmount)(()=>{luckysheet&&luckysheet.destroy()}),o({setSheetData:v}),(e,o)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.createElementVNode)(`div`,r,[(0,t.createVNode)((0,t.unref)(n.ElButton),{type:`primary`,onClick:_},{default:(0,t.withCtx)(()=>[...o[6]||=[(0,t.createTextVNode)(`同步更新`,-1)]]),_:1}),(0,t.createVNode)((0,t.unref)(n.ElButton),{onClick:o[0]||=t=>e.$emit(`back`)},{default:(0,t.withCtx)(()=>[...o[7]||=[(0,t.createTextVNode)(` 返回 `,-1)]]),_:1})]),(0,t.createElementVNode)(`div`,i,[o[10]||=(0,t.createElementVNode)(`div`,{id:`luckysheet`,class:`luckysheet-container`},null,-1),(0,t.createVNode)((0,t.unref)(n.ElCard),{shadow:`never`},{header:(0,t.withCtx)(()=>[...o[8]||=[(0,t.createElementVNode)(`span`,null,`属性编辑`,-1)]]),default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,a,[(0,t.createElementVNode)(`div`,null,`行:`+(0,t.toDisplayString)(d.line),1),(0,t.createElementVNode)(`div`,null,`列:`+(0,t.toDisplayString)(d.column),1)]),(0,t.createVNode)((0,t.unref)(n.ElForm),{ref_key:`elFormRef`,ref:l,model:f,"label-width":`120px`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElFormItem),{label:`数据源`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElSelect),{modelValue:f.dataSource,"onUpdate:modelValue":o[1]||=e=>f.dataSource=e,placeholder:`请选择数据源`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(p.value,e=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElOption),{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`])]),_:1}),(0,t.createVNode)((0,t.unref)(n.ElFormItem),{label:`名称`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElInput),{modelValue:f.name,"onUpdate:modelValue":o[2]||=e=>f.name=e,placeholder:`请输入名称`},null,8,[`modelValue`])]),_:1}),(0,t.createVNode)((0,t.unref)(n.ElFormItem),{label:`编码`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElInput),{modelValue:f.code,"onUpdate:modelValue":o[3]||=e=>f.code=e,placeholder:`请输入编码`},null,8,[`modelValue`])]),_:1}),(0,t.createVNode)((0,t.unref)(n.ElFormItem),{label:`类型`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElSelect),{modelValue:f.type,"onUpdate:modelValue":o[4]||=e=>f.type=e,placeholder:`请选择类型`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(m.value,e=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(n.ElOption),{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`])]),_:1}),(0,t.createVNode)((0,t.unref)(n.ElFormItem),{label:`只读`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(n.ElSwitch),{modelValue:f.readOnly,"onUpdate:modelValue":o[5]||=e=>f.readOnly=e},null,8,[`modelValue`])]),_:1})]),_:1},8,[`model`]),(0,t.createVNode)((0,t.unref)(n.ElButton),{type:`primary`,onClick:g},{default:(0,t.withCtx)(()=>[...o[9]||=[(0,t.createTextVNode)(`保存`,-1)]]),_:1})]),_:1})])],64))}}),[[`__scopeId`,`data-v-bd7de71b`]]);console.info(o);var s=[o];e.LuckySheet=o,e.default={install:function(e){s.forEach(t=>{e.component(t.name,t)})}}});
@@ -0,0 +1,160 @@
1
+ import { AllowedComponentProps } from 'vue';
2
+ import { Arrayable } from 'element-plus/es/utils/typescript.mjs';
3
+ import { Attrs } from 'vue';
4
+ import { ComponentCustomProperties } from 'vue';
5
+ import { ComponentCustomProps } from 'vue';
6
+ import { ComponentInternalInstance } from 'vue';
7
+ import { ComponentOptionsBase } from 'vue';
8
+ import { ComponentOptionsMixin } from 'vue';
9
+ import { ComponentProvideOptions } from 'vue';
10
+ import { ComponentPublicInstance } from 'vue';
11
+ import { ComponentSize } from 'element-plus';
12
+ import { DebuggerEvent } from 'vue';
13
+ import { DefineComponent } from 'vue';
14
+ import { ExtractPropTypes } from 'vue';
15
+ import { FormItemContext } from 'element-plus';
16
+ import { FormItemProp } from 'element-plus';
17
+ import { FormProps } from 'element-plus';
18
+ import { FormRules } from 'element-plus';
19
+ import { FormValidateCallback } from 'element-plus';
20
+ import { FormValidationResult } from 'element-plus';
21
+ import { GlobalComponents } from 'vue';
22
+ import { GlobalDirectives } from 'vue';
23
+ import { nextTick } from 'vue';
24
+ import { OnCleanup } from '@vue/reactivity';
25
+ import { PublicProps } from 'vue';
26
+ import { Reactive } from 'vue';
27
+ import { ShallowUnwrapRef } from 'vue';
28
+ import { Slot } from 'vue';
29
+ import { VNodeProps } from 'vue';
30
+ import { WatchOptions } from 'vue';
31
+ import { WatchStopHandle } from 'vue';
32
+
33
+ declare const _default: {
34
+ install: (App: any) => void;
35
+ };
36
+ export default _default;
37
+
38
+ export declare const LuckySheet: DefineComponent<ExtractPropTypes< {
39
+ dataSourceOptionsFn: {
40
+ type: FunctionConstructor;
41
+ required: true;
42
+ };
43
+ }>, {
44
+ setSheetData: typeof setSheetData;
45
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
46
+ syncUpdate: (...args: any[]) => void;
47
+ back: (...args: any[]) => void;
48
+ }, string, PublicProps, Readonly<ExtractPropTypes< {
49
+ dataSourceOptionsFn: {
50
+ type: FunctionConstructor;
51
+ required: true;
52
+ };
53
+ }>> & Readonly<{
54
+ onSyncUpdate?: ((...args: any[]) => any) | undefined;
55
+ onBack?: ((...args: any[]) => any) | undefined;
56
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {
57
+ elFormRef: ({
58
+ $: ComponentInternalInstance;
59
+ $data: {};
60
+ $props: {
61
+ readonly model?: Record<string, any> | undefined;
62
+ readonly rules?: FormRules | undefined;
63
+ readonly labelPosition?: "left" | "right" | "top" | undefined;
64
+ readonly requireAsteriskPosition?: "left" | "right" | undefined;
65
+ readonly labelWidth?: string | number | undefined;
66
+ readonly labelSuffix?: string | undefined;
67
+ readonly inline?: boolean | undefined;
68
+ readonly inlineMessage?: boolean | undefined;
69
+ readonly statusIcon?: boolean | undefined;
70
+ readonly showMessage?: boolean | undefined;
71
+ readonly validateOnRuleChange?: boolean | undefined;
72
+ readonly hideRequiredAsterisk?: boolean | undefined;
73
+ readonly scrollToError?: boolean | undefined;
74
+ readonly scrollIntoViewOptions?: (ScrollIntoViewOptions | boolean) | undefined;
75
+ readonly size?: ComponentSize | undefined;
76
+ readonly disabled?: boolean | undefined;
77
+ readonly onValidate?: ((prop: FormItemProp, isValid: boolean, message: string) => any) | undefined | undefined;
78
+ } & VNodeProps & AllowedComponentProps & ComponentCustomProps;
79
+ $attrs: Attrs;
80
+ $refs: {
81
+ [x: string]: unknown;
82
+ };
83
+ $slots: Readonly<{
84
+ [name: string]: Slot<any> | undefined;
85
+ }>;
86
+ $root: ComponentPublicInstance | null;
87
+ $parent: ComponentPublicInstance | null;
88
+ $host: Element | null;
89
+ $emit: (event: "validate", prop: FormItemProp, isValid: boolean, message: string) => void;
90
+ $el: any;
91
+ $options: ComponentOptionsBase<Readonly<FormProps> & Readonly<{
92
+ onValidate?: ((prop: FormItemProp, isValid: boolean, message: string) => any) | undefined;
93
+ }>, {
94
+ validate: (callback?: FormValidateCallback) => FormValidationResult;
95
+ validateField: (props?: Arrayable<FormItemProp>, callback?: FormValidateCallback) => FormValidationResult;
96
+ resetFields: (props?: Arrayable<FormItemProp>) => void;
97
+ clearValidate: (props?: Arrayable<FormItemProp>) => void;
98
+ scrollToField: (prop: FormItemProp) => void;
99
+ getField: (prop: FormItemProp) => FormItemContext | undefined;
100
+ fields: Reactive<FormItemContext[]>;
101
+ setInitialValues: (initModel: Record<string, any>) => void;
102
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
103
+ validate: (prop: FormItemProp, isValid: boolean, message: string) => void;
104
+ }, string, {
105
+ scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
106
+ labelWidth: string | number;
107
+ labelPosition: "left" | "right" | "top";
108
+ requireAsteriskPosition: "left" | "right";
109
+ labelSuffix: string;
110
+ showMessage: boolean;
111
+ validateOnRuleChange: boolean;
112
+ }, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & {
113
+ beforeCreate?: (() => void) | (() => void)[];
114
+ created?: (() => void) | (() => void)[];
115
+ beforeMount?: (() => void) | (() => void)[];
116
+ mounted?: (() => void) | (() => void)[];
117
+ beforeUpdate?: (() => void) | (() => void)[];
118
+ updated?: (() => void) | (() => void)[];
119
+ activated?: (() => void) | (() => void)[];
120
+ deactivated?: (() => void) | (() => void)[];
121
+ beforeDestroy?: (() => void) | (() => void)[];
122
+ beforeUnmount?: (() => void) | (() => void)[];
123
+ destroyed?: (() => void) | (() => void)[];
124
+ unmounted?: (() => void) | (() => void)[];
125
+ renderTracked?: ((e: DebuggerEvent) => void) | ((e: DebuggerEvent) => void)[];
126
+ renderTriggered?: ((e: DebuggerEvent) => void) | ((e: DebuggerEvent) => void)[];
127
+ errorCaptured?: ((err: unknown, instance: ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: ComponentPublicInstance | null, info: string) => boolean | void)[];
128
+ };
129
+ $forceUpdate: () => void;
130
+ $nextTick: nextTick;
131
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, OnCleanup]) => any : (...args: [any, any, OnCleanup]) => any, options?: WatchOptions): WatchStopHandle;
132
+ } & Readonly<{
133
+ scrollIntoViewOptions: ScrollIntoViewOptions | boolean;
134
+ labelWidth: string | number;
135
+ labelPosition: "left" | "right" | "top";
136
+ requireAsteriskPosition: "left" | "right";
137
+ labelSuffix: string;
138
+ showMessage: boolean;
139
+ validateOnRuleChange: boolean;
140
+ }> & Omit<Readonly<FormProps> & Readonly<{
141
+ onValidate?: ((prop: FormItemProp, isValid: boolean, message: string) => any) | undefined;
142
+ }>, "labelPosition" | "requireAsteriskPosition" | "labelWidth" | "labelSuffix" | "showMessage" | "validateOnRuleChange" | "scrollIntoViewOptions" | "validate" | "validateField" | "resetFields" | "clearValidate" | "scrollToField" | "getField" | "fields" | "setInitialValues"> & ShallowUnwrapRef< {
143
+ validate: (callback?: FormValidateCallback) => FormValidationResult;
144
+ validateField: (props?: Arrayable<FormItemProp>, callback?: FormValidateCallback) => FormValidationResult;
145
+ resetFields: (props?: Arrayable<FormItemProp>) => void;
146
+ clearValidate: (props?: Arrayable<FormItemProp>) => void;
147
+ scrollToField: (prop: FormItemProp) => void;
148
+ getField: (prop: FormItemProp) => FormItemContext | undefined;
149
+ fields: Reactive<FormItemContext[]>;
150
+ setInitialValues: (initModel: Record<string, any>) => void;
151
+ }> & {} & ComponentCustomProperties & {} & {
152
+ $slots: {
153
+ default?: (props: {}) => any;
154
+ };
155
+ }) | null;
156
+ }, any>;
157
+
158
+ declare function setSheetData(json: any): void;
159
+
160
+ export { }