@jspreadsheet/vue 9.4.9 → 9.5.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 (2) hide show
  1. package/dist/index.js +41 -37
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,55 +1,59 @@
1
- import { h, ref, onMounted } from 'vue';
1
+ import { h, getCurrentInstance } from 'vue';
2
2
  import jss from "jspreadsheet";
3
3
 
4
4
  import "jspreadsheet/dist/jspreadsheet.css";
5
5
  import "jsuites/dist/jsuites.css";
6
6
 
7
7
  export const Worksheet = {
8
- name: 'Worksheet',
8
+ name: 'Worksheet',
9
9
  }
10
10
 
11
11
  export const Spreadsheet = {
12
- setup(props, { attrs, slots }) {
13
- const spreadsheet = ref(null);
14
- let options = {
15
- ...attrs
16
- };
17
- if (slots && typeof(slots.default) === 'function') {
18
- options.worksheets = slots.default().reduce((acc, vnode) => {
19
- if (vnode.type.name === "Worksheet") {
20
- acc.push({ minDimensions:[10,10], ...vnode.props});
12
+ inheritAttrs: false,
13
+ mounted() {
14
+ const { attrs, slots } = getCurrentInstance();
15
+
16
+ let options = {
17
+ ...attrs
18
+ };
19
+ if (slots && typeof(slots.default) === 'function') {
20
+ options.worksheets = slots.default().reduce((acc, vnode) => {
21
+ if (vnode.type.name === "Worksheet") {
22
+ acc.push({
23
+ minDimensions: [4, 4],
24
+ ...vnode.props
25
+ });
26
+ }
27
+ return acc;
28
+ }, []);
29
+ } else {
30
+ if (attrs.worksheets) {
31
+ options.worksheets = attrs.worksheets;
32
+ }
21
33
  }
22
- return acc;
23
- }, []);
24
- } else {
25
- if (attrs.worksheets) {
26
- options.worksheets = attrs.worksheets;
27
- }
28
- }
29
34
 
30
- if (attrs.license) {
31
- jss.setLicense(attrs.license);
32
- }
33
- if (attrs.extensions) {
34
- jss.setExtensions(attrs.extensions);
35
- }
35
+ if (attrs.license) {
36
+ jss.setLicense(attrs.license);
37
+ }
38
+ if (attrs.extensions) {
39
+ jss.setExtensions(attrs.extensions);
40
+ }
41
+ if (attrs.id) {
42
+ this.$refs.container.id = attrs.id;
43
+ }
36
44
 
37
- let containerProps = {
38
- ref: spreadsheet
39
- };
45
+ this.el = this.$refs.container;
40
46
 
41
- if (attrs.id) {
42
- containerProps.id = attrs.id;
47
+ this.current = jss(this.$refs.container, options);
48
+ },
49
+ setup() {
50
+ let containerProps = {
51
+ ref: 'container'
52
+ };
53
+ return () => h('div', containerProps);
43
54
  }
44
-
45
- onMounted(() => {
46
- jss(spreadsheet.value, options);
47
- });
48
-
49
- return () => h('div', containerProps);
50
- }
51
55
  }
52
56
 
53
57
  export let jspreadsheet = jss;
54
58
 
55
- export default { Worksheet, Spreadsheet, jspreadsheet }
59
+ export default { Worksheet, Spreadsheet, jspreadsheet };
package/package.json CHANGED
@@ -24,5 +24,5 @@
24
24
  },
25
25
  "main": "dist/index.js",
26
26
  "types": "dist/index.d.ts",
27
- "version": "9.4.9"
27
+ "version": "9.5.1"
28
28
  }