@ecan-bi/sheet 0.0.3 → 0.0.6

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/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
- import { defineComponent as c, computed as s, isVue2 as i, isVue3 as l, getCurrentInstance as d, h as a } from "vue-demi";
2
- const r = "Luckysheet", m = c({
1
+ import { defineComponent as c, computed as r, isVue2 as p, getCurrentInstance as h, h as d } from "vue-demi";
2
+ const e = "Luckysheet", a = c({
3
3
  inheritAttrs: !1,
4
4
  props: {
5
5
  option: {
@@ -8,35 +8,35 @@ const r = "Luckysheet", m = c({
8
8
  }
9
9
  }
10
10
  },
11
- setup(e, { attrs: t }) {
12
- const o = s(() => {
13
- var n;
14
- if (console.log("isVue2", i), console.log("isVue3", l), i) {
15
- const u = (n = d()) == null ? void 0 : n.proxy.$listeners;
11
+ setup(t, { attrs: n }) {
12
+ const s = r(() => {
13
+ var o;
14
+ if (p) {
15
+ const u = (o = h()) == null ? void 0 : o.proxy.$listeners;
16
16
  return {
17
- attrs: t,
17
+ attrs: { ...n, id: e },
18
18
  on: u
19
19
  };
20
20
  }
21
- return t;
22
- }), p = s(() => ({
23
- ...e.option,
24
- container: r
21
+ return n;
22
+ }), i = r(() => ({
23
+ lang: "zh",
24
+ ...t.option,
25
+ container: e
25
26
  }));
26
- return console.log(o.value), {
27
- myAttrs: o,
28
- myOption: p
27
+ return {
28
+ myAttrs: s,
29
+ myOption: i
29
30
  };
30
31
  },
31
32
  mounted() {
32
- window.luckysheet.create(this.myOption);
33
+ const t = window.luckysheet;
34
+ if (t == null)
35
+ throw new Error("\u672A\u5F15\u5165 luckysheet \u63D2\u4EF6");
36
+ t.create(this.myOption);
33
37
  },
34
38
  render() {
35
- return a("div", {
36
- id: r,
37
- attrs: {
38
- id: "Luckysheet"
39
- },
39
+ const t = {
40
40
  style: {
41
41
  margin: "0",
42
42
  padding: "0",
@@ -45,10 +45,14 @@ const r = "Luckysheet", m = c({
45
45
  height: "100%",
46
46
  left: "0",
47
47
  top: "0"
48
- }
49
- });
48
+ },
49
+ ...this.myAttrs,
50
+ id: e
51
+ };
52
+ return d("div", t);
50
53
  }
51
54
  });
52
55
  export {
53
- m as default
56
+ a as default
54
57
  };
58
+ //# sourceMappingURL=index.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.es.js","sources":["../src/constant.ts","../src/Sheet.ts"],"sourcesContent":["export const LUCKYSHEET_ID = 'Luckysheet'\n","import { defineComponent, h, computed, getCurrentInstance, isVue2 } from 'vue-demi'\nimport { LUCKYSHEET_ID } from './constant'\nexport default defineComponent({\n inheritAttrs: false,\n props: {\n option: {\n type: Object,\n default: () => {}\n }\n },\n setup (props, { attrs }) {\n const myAttrs = computed(() => {\n if (isVue2) {\n // @ts-expect-error\n const on = getCurrentInstance()?.proxy.$listeners\n return {\n attrs: { ...attrs, id: LUCKYSHEET_ID },\n on\n }\n }\n return attrs\n })\n const myOption = computed(() => ({\n lang: 'zh',\n ...props.option,\n container: LUCKYSHEET_ID\n }))\n return {\n myAttrs,\n myOption\n }\n },\n mounted () {\n // @ts-ignore\n const luckysheet = window.luckysheet\n if (luckysheet == null) {\n throw new Error('未引入 luckysheet 插件')\n }\n luckysheet.create(this.myOption)\n },\n render () {\n const attrs: { [key:string]: any } = {\n style: {\n margin: '0',\n padding: '0',\n position: 'absolute',\n width: '100%',\n height: '100%',\n left: '0',\n top: '0'\n },\n ...this.myAttrs,\n id: LUCKYSHEET_ID\n }\n return h('div', attrs)\n }\n})\n"],"names":["LUCKYSHEET_ID","Sheet","defineComponent","props","attrs","myAttrs","computed","isVue2","on","_a","getCurrentInstance","myOption","luckysheet","h"],"mappings":";AAAO,MAAMA,IAAgB,cCE7BC,IAAeC,EAAgB;AAAA,EAC7B,cAAc;AAAA,EACd,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,SAAS,MAAM;AAAA,MAAC;AAAA,IAClB;AAAA,EACF;AAAA,EACA,MAAOC,GAAO,EAAE,OAAAC,KAAS;AACjB,UAAAC,IAAUC,EAAS,MAAM;;AAC7B,UAAIC,GAAQ;AAEJ,cAAAC,KAAKC,IAAAC,QAAA,gBAAAD,EAAsB,MAAM;AAChC,eAAA;AAAA,UACL,OAAO,EAAE,GAAGL,GAAO,IAAIJ,EAAc;AAAA,UACrC,IAAAQ;AAAA,QAAA;AAAA,MAEJ;AACO,aAAAJ;AAAA,IAAA,CACR,GACKO,IAAWL,EAAS,OAAO;AAAA,MAC/B,MAAM;AAAA,MACN,GAAGH,EAAM;AAAA,MACT,WAAWH;AAAA,IACX,EAAA;AACK,WAAA;AAAA,MACL,SAAAK;AAAA,MACA,UAAAM;AAAA,IAAA;AAAA,EAEJ;AAAA,EACA,UAAW;AAET,UAAMC,IAAa,OAAO;AAC1B,QAAIA,KAAc;AACV,YAAA,IAAI,MAAM,4CAAmB;AAE1B,IAAAA,EAAA,OAAO,KAAK,QAAQ;AAAA,EACjC;AAAA,EACA,SAAU;AACR,UAAMR,IAA+B;AAAA,MACnC,OAAO;AAAA,QACL,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,UAAU;AAAA,QACV,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,MAAM;AAAA,QACN,KAAK;AAAA,MACP;AAAA,MACA,GAAG,KAAK;AAAA,MACR,IAAIJ;AAAA,IAAA;AAEC,WAAAa,EAAE,OAAOT,CAAK;AAAA,EACvB;AACF,CAAC;"}
package/dist/index.umd.js CHANGED
@@ -1 +1,2 @@
1
- (function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue-demi")):typeof define=="function"&&define.amd?define(["exports","vue-demi"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t["@ecan/bi-sheet"]={},t["vue-demi"]))})(this,function(t,e){"use strict";const o="Luckysheet",d=e.defineComponent({inheritAttrs:!1,props:{option:{type:Object,default:()=>{}}},setup(n,{attrs:s}){const i=e.computed(()=>{var u;if(console.log("isVue2",e.isVue2),console.log("isVue3",e.isVue3),e.isVue2){const p=(u=e.getCurrentInstance())==null?void 0:u.proxy.$listeners;return{attrs:s,on:p}}return s}),r=e.computed(()=>({...n.option,container:o}));return console.log(i.value),{myAttrs:i,myOption:r}},mounted(){window.luckysheet.create(this.myOption)},render(){const n={id:o,attrs:{id:"Luckysheet"},style:{margin:"0",padding:"0",position:"absolute",width:"100%",height:"100%",left:"0",top:"0"}};return e.h("div",n)}});t.default=d,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue-demi")):typeof define=="function"&&define.amd?define(["exports","vue-demi"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t["@ecan/bi-sheet"]={},t["vue-demi"]))})(this,function(t,e){"use strict";const o="Luckysheet",r=e.defineComponent({inheritAttrs:!1,props:{option:{type:Object,default:()=>{}}},setup(n,{attrs:i}){const u=e.computed(()=>{var s;if(e.isVue2){const c=(s=e.getCurrentInstance())==null?void 0:s.proxy.$listeners;return{attrs:{...i,id:o},on:c}}return i}),d=e.computed(()=>({lang:"zh",...n.option,container:o}));return{myAttrs:u,myOption:d}},mounted(){const n=window.luckysheet;if(n==null)throw new Error("\u672A\u5F15\u5165 luckysheet \u63D2\u4EF6");n.create(this.myOption)},render(){const n={style:{margin:"0",padding:"0",position:"absolute",width:"100%",height:"100%",left:"0",top:"0"},...this.myAttrs,id:o};return e.h("div",n)}});t.default=r,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
2
+ //# sourceMappingURL=index.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.umd.js","sources":["../src/constant.ts","../src/Sheet.ts"],"sourcesContent":["export const LUCKYSHEET_ID = 'Luckysheet'\n","import { defineComponent, h, computed, getCurrentInstance, isVue2 } from 'vue-demi'\nimport { LUCKYSHEET_ID } from './constant'\nexport default defineComponent({\n inheritAttrs: false,\n props: {\n option: {\n type: Object,\n default: () => {}\n }\n },\n setup (props, { attrs }) {\n const myAttrs = computed(() => {\n if (isVue2) {\n // @ts-expect-error\n const on = getCurrentInstance()?.proxy.$listeners\n return {\n attrs: { ...attrs, id: LUCKYSHEET_ID },\n on\n }\n }\n return attrs\n })\n const myOption = computed(() => ({\n lang: 'zh',\n ...props.option,\n container: LUCKYSHEET_ID\n }))\n return {\n myAttrs,\n myOption\n }\n },\n mounted () {\n // @ts-ignore\n const luckysheet = window.luckysheet\n if (luckysheet == null) {\n throw new Error('未引入 luckysheet 插件')\n }\n luckysheet.create(this.myOption)\n },\n render () {\n const attrs: { [key:string]: any } = {\n style: {\n margin: '0',\n padding: '0',\n position: 'absolute',\n width: '100%',\n height: '100%',\n left: '0',\n top: '0'\n },\n ...this.myAttrs,\n id: LUCKYSHEET_ID\n }\n return h('div', attrs)\n }\n})\n"],"names":["LUCKYSHEET_ID","Sheet","defineComponent","props","attrs","myAttrs","computed","isVue2","on","getCurrentInstance","myOption","luckysheet","h"],"mappings":"wRAAO,MAAMA,EAAgB,aCE7BC,EAAeC,kBAAgB,CAC7B,aAAc,GACd,MAAO,CACL,OAAQ,CACN,KAAM,OACN,QAAS,IAAM,CAAC,CAClB,CACF,EACA,MAAOC,EAAO,CAAE,MAAAC,GAAS,CACjB,MAAAC,EAAUC,EAAAA,SAAS,IAAM,OAC7B,GAAIC,SAAQ,CAEJ,MAAAC,GAAKC,EAAAA,EAAAA,uBAAAA,YAAAA,EAAsB,MAAM,WAChC,MAAA,CACL,MAAO,CAAE,GAAGL,EAAO,GAAIJ,CAAc,EACrC,GAAAQ,CAAA,CAEJ,CACO,OAAAJ,CAAA,CACR,EACKM,EAAWJ,EAAAA,SAAS,KAAO,CAC/B,KAAM,KACN,GAAGH,EAAM,OACT,UAAWH,CACX,EAAA,EACK,MAAA,CACL,QAAAK,EACA,SAAAK,CAAA,CAEJ,EACA,SAAW,CAET,MAAMC,EAAa,OAAO,WAC1B,GAAIA,GAAc,KACV,MAAA,IAAI,MAAM,4CAAmB,EAE1BA,EAAA,OAAO,KAAK,QAAQ,CACjC,EACA,QAAU,CACR,MAAMP,EAA+B,CACnC,MAAO,CACL,OAAQ,IACR,QAAS,IACT,SAAU,WACV,MAAO,OACP,OAAQ,OACR,KAAM,IACN,IAAK,GACP,EACA,GAAG,KAAK,QACR,GAAIJ,CAAA,EAEC,OAAAY,EAAA,EAAE,MAAOR,CAAK,CACvB,CACF,CAAC"}
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@ecan-bi/sheet",
3
- "version": "0.0.3",
3
+ "version": "0.0.6",
4
4
  "description": "",
5
5
  "main": "./dist/index.umd.js",
6
6
  "module": "./dist/index.es.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
9
- "dev": "vite build -wc vite.config.js",
10
- "build": "vite build -wc vite.config.js"
9
+ "dev": "npm run clean && vite build -wc vite.config.js",
10
+ "build": "npm run clean && vite build -wc vite.config.js",
11
+ "clean": "rimraf ./dist ./types"
11
12
  },
12
13
  "keywords": [],
13
14
  "author": "ayuan",
@@ -35,9 +36,9 @@
35
36
  "eslint-plugin-promise": "^5.1.1",
36
37
  "eslint-plugin-vue": "^7.20.0",
37
38
  "less": "^4.1.3",
38
- "luckysheet": "^2.1.13",
39
39
  "typescript": "4.4.4",
40
40
  "vite": "^3.0.5",
41
+ "vite-babel-plugin": "^0.0.2",
41
42
  "vite-plugin-dts": "^1.4.1",
42
43
  "vite-plugin-eslint": "^1.6.1",
43
44
  "vue": "3.2.27"
package/types/Sheet.d.ts CHANGED
@@ -1,63 +1,22 @@
1
- declare const _default: import("vue").ComponentOptionsBase<Vue$1, import("@vue/composition-api").ShallowUnwrapRef<{
2
- myOption: import("@vue/composition-api").ComputedRef<{
3
- container: string;
4
- }>;
5
- }> & import("@vue/composition-api").Data, {}, {}, {
6
- option: {
7
- type: ObjectConstructor;
8
- default: () => void;
9
- };
10
- }, import("@vue/composition-api").ExtractPropTypes<{
1
+ declare const _default: import("vue-demi").DefineComponent<{
11
2
  option: {
12
3
  type: ObjectConstructor;
13
4
  default: () => void;
14
5
  };
15
- }>, any, any, string, {}> & ThisType<import("vue").CreateComponentPublicInstance<{}, import("@vue/composition-api").ShallowUnwrapRef<{
16
- myOption: import("@vue/composition-api").ComputedRef<{
17
- container: string;
6
+ }, {
7
+ myAttrs: import("vue-demi").ComputedRef<{
8
+ [x: string]: unknown;
18
9
  }>;
19
- }> & import("@vue/composition-api").Data, {}, {}, {
20
- option: {
21
- type: ObjectConstructor;
22
- default: () => void;
23
- };
24
- }, import("@vue/composition-api").ExtractPropTypes<{
25
- option: {
26
- type: ObjectConstructor;
27
- default: () => void;
28
- };
29
- }>, any, any, Vue$1, {}, false, {
30
- P: {};
31
- B: {};
32
- D: {};
33
- C: import("vue").ComputedOptions;
34
- M: import("vue").MethodOptions;
35
- Defaults: {};
36
- } & {
37
- P: {};
38
- B: {};
39
- D: {};
40
- C: {};
41
- M: {};
42
- Defaults: {};
43
- }, {}, import("@vue/composition-api").ShallowUnwrapRef<{
44
- myOption: import("@vue/composition-api").ComputedRef<{
10
+ myOption: import("vue-demi").ComputedRef<{
45
11
  container: string;
12
+ lang: string;
46
13
  }>;
47
- }> & import("@vue/composition-api").Data, {}, import("vue").ComputedOptions, import("vue").MethodOptions & {
14
+ }, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, Record<string, any>, string, import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
48
15
  option: {
49
16
  type: ObjectConstructor;
50
17
  default: () => void;
51
18
  };
52
- }, {}>> & Omit<VueConstructor, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
53
- option: Record<string, any>;
54
- } & {}, import("@vue/composition-api").ShallowUnwrapRef<{
55
- myOption: import("@vue/composition-api").ComputedRef<{
56
- container: string;
57
- }>;
58
- }>, import("@vue/composition-api").Data, {}, {}, {}, {}, {}, {
59
- option: Record<string, any>;
60
- } & {}, {
19
+ }>>, {
61
20
  option: Record<string, any>;
62
- }, true>);
21
+ }>;
63
22
  export default _default;
@@ -0,0 +1 @@
1
+ export declare const LUCKYSHEET_ID = "Luckysheet";
@@ -1,14 +0,0 @@
1
- declare const _sfc_main: import("vue-demi").DefineComponent<{
2
- option: {
3
- type: ObjectConstructor;
4
- default: () => void;
5
- };
6
- }, {}, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, Record<string, any>, string, import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
7
- option: {
8
- type: ObjectConstructor;
9
- default: () => void;
10
- };
11
- }>>, {
12
- option: Record<string, any>;
13
- }>;
14
- export default _sfc_main;
@@ -1 +0,0 @@
1
- export {}
package/types/types.d.ts DELETED
@@ -1,14 +0,0 @@
1
- // 声明 vue 文件
2
- declare module '*.vue' {
3
- import type { DefineComponent } from 'vue'
4
- const component: DefineComponent<{}, {}, any>
5
- export default component
6
- }
7
-
8
- // @ts-ignore
9
- interface MyWindow extends Window {
10
- luckysheet: any;
11
- }
12
- // @ts-ignore
13
- // eslint-disable-next-line
14
- declare const Window: MyWindow