sone-ui-component-3.2.4 2.1.50 → 2.1.52

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sone-ui-component-3.2.4",
3
- "version": "2.1.50",
3
+ "version": "2.1.52",
4
4
  "private": false,
5
5
  "main": "lib/sone-ui.common.js",
6
6
  "files": [
@@ -0,0 +1,15 @@
1
+ /*
2
+ * @Descripttion: your project
3
+ * @version: 1.0
4
+ * @Author: lw
5
+ * @Date: 2025-02-28 10:22:13
6
+ * @LastEditors: lw
7
+ * @LastEditTime: 2025-02-28 10:23:12
8
+ */
9
+ import LuckySheet from './src/main';
10
+
11
+ LuckySheet.install = function (Vue) {
12
+ Vue.component(LuckySheet.name, LuckySheet);
13
+ };
14
+
15
+ export default LuckySheet;
@@ -0,0 +1,98 @@
1
+ <template>
2
+ <div>
3
+ <iframe
4
+ ref="luckysheet"
5
+ src="/luckySheet/index.html"
6
+ frameborder="0"
7
+ style="width: 100%"
8
+ :style="{ height: height }"
9
+ />
10
+ </div>
11
+ </template>
12
+ <script>
13
+ import { deepClone, throttle } from "sone-ui-component/src/utils/util";
14
+ const initialData = [
15
+ {
16
+ name: "sheet1", //工作表名称
17
+ index: 0, //工作表索引
18
+ status: 1, //激活状态
19
+ order: 0, //工作表的下标
20
+ celldata: [], //初始化使用的单元格数据
21
+ config: {},
22
+ calcChain: [],
23
+ },
24
+ ];
25
+ export default {
26
+ name: "SoneLuckySheet",
27
+ props: {
28
+ disabled: {
29
+ type: Boolean,
30
+ default: false,
31
+ },
32
+ height: {
33
+ type: String,
34
+ default: "700px",
35
+ },
36
+ value: {
37
+ type: Array,
38
+ default: () => initialData,
39
+ },
40
+ options: {
41
+ type: Object,
42
+ default: () => {},
43
+ },
44
+ },
45
+ data() {
46
+ return {};
47
+ },
48
+ watch: {
49
+ disabled: {
50
+ immediate: true,
51
+ handler: "intEditor",
52
+ },
53
+ value: {
54
+ immediate: true,
55
+ deep: true,
56
+ handler: "intEditor",
57
+ },
58
+ },
59
+ methods: {
60
+ getData() {
61
+ let data = this.$refs.luckysheet?.contentWindow?.getData();
62
+ return data;
63
+ },
64
+ exitEditMode() {
65
+ this.$refs.luckysheet?.contentWindow?.exitEditMode();
66
+ },
67
+ // 获取坐标值
68
+ getCellIndex() {
69
+ let index = this.$refs.luckysheet?.contentWindow?.getCellIndex();
70
+ return index;
71
+ },
72
+ // 设置单元格的值
73
+ setCellValue(row, col, value) {
74
+ this.$refs.luckysheet?.contentWindow?.setCellValue(row, col, value);
75
+ },
76
+ intEditor: throttle(async function() {
77
+ await this.$nextTick();
78
+ if (
79
+ typeof this.$refs.luckysheet.contentWindow.createEditor === "function"
80
+ ) {
81
+ this.$refs.luckysheet.contentWindow.createEditor(
82
+ this.value ? deepClone(this.value) : deepClone(initialData),
83
+ this.disabled
84
+ );
85
+ } else {
86
+ setTimeout(() => {
87
+ this.intEditor();
88
+ }, 500);
89
+ }
90
+ }, 200),
91
+
92
+ getRangeHtml() {
93
+ const html = this.$refs.luckysheet.contentWindow.getRangeHtml();
94
+ return html;
95
+ },
96
+ },
97
+ };
98
+ </script>
package/src/index.js CHANGED
@@ -17,7 +17,8 @@ import Editor from '../packages/editor/index.js';
17
17
  import InputNumber from '../packages/inputNumber/index.js';
18
18
  import Cascader from '../packages/cascader/index.js';
19
19
  import Autocomplete from '../packages/autocomplete/index.js';
20
- import FileUpload from '../packages/fileUpload/index.js';
20
+ import FileUpload from '../packages/fileUpload/index.js';
21
+ import LuckySheet from '../packages/luckySheet/index.js';
21
22
  import locale from 'sone-ui-component/src/locale';
22
23
  import 'sone-ui-component/src/utils/directives.js';
23
24
  const components = [
@@ -37,7 +38,8 @@ const components = [
37
38
  InputNumber,
38
39
  Cascader,
39
40
  Autocomplete,
40
- FileUpload
41
+ FileUpload,
42
+ LuckySheet
41
43
  ];
42
44
 
43
45
  const install = function(Vue, opts = {}) {
@@ -57,7 +59,7 @@ if (typeof window !== 'undefined' && window.Vue) {
57
59
  }
58
60
 
59
61
  export default {
60
- version: '2.1.50',
62
+ version: '2.1.52',
61
63
  locale: locale.use,
62
64
  i18n: locale.i18n,
63
65
  install,
@@ -78,5 +80,6 @@ export default {
78
80
  InputNumber,
79
81
  Cascader,
80
82
  Autocomplete,
81
- FileUpload
83
+ FileUpload,
84
+ LuckySheet
82
85
  };
package/src/utils/util.js CHANGED
@@ -284,3 +284,18 @@ export const deepClone = data => {
284
284
  }
285
285
  return obj
286
286
  }
287
+
288
+ export const throttle=(fn, time)=> {
289
+ let timer = null
290
+ time = time || 1000
291
+ return function (...args) {
292
+ if (timer) {
293
+ return
294
+ }
295
+ const _this = this
296
+ timer = setTimeout(() => {
297
+ timer = null
298
+ }, time)
299
+ fn.apply(_this, args)
300
+ }
301
+ }
package/lib/demo.html DELETED
@@ -1,10 +0,0 @@
1
- <meta charset="utf-8">
2
- <title>sone-ui demo</title>
3
- <script src="./sone-ui.umd.js"></script>
4
-
5
- <link rel="stylesheet" href="./sone-ui.css">
6
-
7
-
8
- <script>
9
- console.log(sone-ui)
10
- </script>
@@ -1,26 +0,0 @@
1
- (function (global, factory) {
2
- if (typeof define === "function" && define.amd) {
3
- define('sone/locale/en', ['module', 'exports'], factory);
4
- } else if (typeof exports !== "undefined") {
5
- factory(module, exports);
6
- } else {
7
- var mod = {
8
- exports: {}
9
- };
10
- factory(mod, mod.exports);
11
- global.SONE.lang = global.SONE.lang || {};
12
- global.SONE.lang.en = mod.exports;
13
- }
14
- })(this, function (module, exports) {
15
- 'use strict';
16
-
17
- exports.__esModule = true;
18
- exports.default = {
19
- sone: {
20
- empty: {
21
- description: 'No Data'
22
- }
23
- }
24
- };
25
- module.exports = exports['default'];
26
- });
@@ -1,26 +0,0 @@
1
- (function (global, factory) {
2
- if (typeof define === "function" && define.amd) {
3
- define('sone/locale/zh-CN', ['module', 'exports'], factory);
4
- } else if (typeof exports !== "undefined") {
5
- factory(module, exports);
6
- } else {
7
- var mod = {
8
- exports: {}
9
- };
10
- factory(mod, mod.exports);
11
- global.SONE.lang = global.SONE.lang || {};
12
- global.SONE.lang.zhCN = mod.exports;
13
- }
14
- })(this, function (module, exports) {
15
- 'use strict';
16
-
17
- exports.__esModule = true;
18
- exports.default = {
19
- sone: {
20
- empty: {
21
- description: '暂无数据'
22
- }
23
- }
24
- };
25
- module.exports = exports['default'];
26
- });