@quickbi/bi-open-vue-sdk 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 ADDED
@@ -0,0 +1,3 @@
1
+ # 说明
2
+
3
+ 基于 vue 框架的开放组件 sdk
package/cjs/index.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ // Generated by dts-bundle v0.7.3
2
+ // Dependencies for this module:
3
+ // ../../../../../../../../../../@quickbi/bi-open
4
+ // ../../../../../../../../../../vue
5
+
6
+ declare module '@quickbi/bi-open-vue-sdk' {
7
+ export { I18n, formatNumberWithConfig, formatNumber, LATEST_VERSION, revisal, OLDEST_VERSION, getRevisalRange, } from '@quickbi/bi-open';
8
+ export type { Interfaces } from '@quickbi/bi-open';
9
+ export { createBIComponent } from '@quickbi/bi-open-vue-sdk/wrapper';
10
+ }
11
+
12
+ declare module '@quickbi/bi-open-vue-sdk/wrapper' {
13
+ /**
14
+ * @flie 开放组件入口文件
15
+ */
16
+ import type { VNode } from 'vue';
17
+ import type { Interfaces } from '@quickbi/bi-open';
18
+ export function createBIComponent({ element: RawComponent }: {
19
+ element: VNode;
20
+ }): {
21
+ bootstrap: Interfaces.LifecycleBootstrap<Interfaces.ComponentProps>;
22
+ mount: Interfaces.LifecycleMount<Interfaces.ComponentProps>;
23
+ unmount: Interfaces.LifecycleUnmount<Interfaces.ComponentProps>;
24
+ update: Interfaces.LifecycleUpdate<Interfaces.ComponentProps>;
25
+ };
26
+ }
27
+
package/cjs/index.js ADDED
@@ -0,0 +1,101 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/basic/bi-open/packages/bi-open-vue-sdk/src/index.ts
20
+ var src_exports = {};
21
+ __export(src_exports, {
22
+ I18n: () => import_bi_open.I18n,
23
+ LATEST_VERSION: () => import_bi_open.LATEST_VERSION,
24
+ OLDEST_VERSION: () => import_bi_open.OLDEST_VERSION,
25
+ createBIComponent: () => createBIComponent,
26
+ formatNumber: () => import_bi_open.formatNumber,
27
+ formatNumberWithConfig: () => import_bi_open.formatNumberWithConfig,
28
+ getRevisalRange: () => import_bi_open.getRevisalRange,
29
+ revisal: () => import_bi_open.revisal
30
+ });
31
+ module.exports = __toCommonJS(src_exports);
32
+ var import_bi_open = require("@quickbi/bi-open");
33
+
34
+ // src/basic/bi-open/packages/bi-open-vue-sdk/src/wrapper.ts
35
+ var import_vue = require("vue");
36
+ function getRandId() {
37
+ return Math.random().toString(32).slice(2);
38
+ }
39
+ function createBIComponent(param) {
40
+ var RawComponent = param.element;
41
+ var instance = /* @__PURE__ */ new WeakMap();
42
+ var id = getRandId();
43
+ var CUSTOM_COMPONENT_CHANGE_EVENT = "CUSTOM_COMPONENT_CHANGE_EVENT_".concat(id);
44
+ var bootstrap = function() {
45
+ };
46
+ var mount = function(props) {
47
+ if (props.container) {
48
+ var vueInstance = (0, import_vue.createApp)({
49
+ data: function data() {
50
+ return {
51
+ container: props.container,
52
+ customProps: props.customProps
53
+ };
54
+ },
55
+ mounted: function mounted() {
56
+ props.container.addEventListener(CUSTOM_COMPONENT_CHANGE_EVENT, this.handlePropsChange);
57
+ },
58
+ beforeUnmount: function beforeUnmount() {
59
+ props.container.removeEventListener(CUSTOM_COMPONENT_CHANGE_EVENT, this.handlePropsChange);
60
+ },
61
+ methods: {
62
+ handlePropsChange: function handlePropsChange(e) {
63
+ if (e.detail) {
64
+ this.customProps = e.detail;
65
+ }
66
+ }
67
+ },
68
+ render: function render() {
69
+ return (0, import_vue.h)(RawComponent, {
70
+ container: this.container,
71
+ customProps: this.customProps
72
+ });
73
+ }
74
+ });
75
+ vueInstance.mount(props.container);
76
+ instance.set(props.container, vueInstance);
77
+ }
78
+ };
79
+ var update = function(props) {
80
+ if (props.container) {
81
+ props.container.dispatchEvent(new CustomEvent(CUSTOM_COMPONENT_CHANGE_EVENT, {
82
+ detail: props.customProps
83
+ }));
84
+ }
85
+ };
86
+ var unmount = function(props) {
87
+ if (props.container) {
88
+ var vueInstance = instance.get(props.container);
89
+ if (vueInstance) {
90
+ vueInstance.unmount();
91
+ instance.delete(props.container);
92
+ }
93
+ }
94
+ };
95
+ return {
96
+ bootstrap,
97
+ mount,
98
+ unmount,
99
+ update
100
+ };
101
+ }
package/esm/index.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ // Generated by dts-bundle v0.7.3
2
+ // Dependencies for this module:
3
+ // ../../../../../../../../../../@quickbi/bi-open
4
+ // ../../../../../../../../../../vue
5
+
6
+ declare module '@quickbi/bi-open-vue-sdk' {
7
+ export { I18n, formatNumberWithConfig, formatNumber, LATEST_VERSION, revisal, OLDEST_VERSION, getRevisalRange, } from '@quickbi/bi-open';
8
+ export type { Interfaces } from '@quickbi/bi-open';
9
+ export { createBIComponent } from '@quickbi/bi-open-vue-sdk/wrapper';
10
+ }
11
+
12
+ declare module '@quickbi/bi-open-vue-sdk/wrapper' {
13
+ /**
14
+ * @flie 开放组件入口文件
15
+ */
16
+ import type { VNode } from 'vue';
17
+ import type { Interfaces } from '@quickbi/bi-open';
18
+ export function createBIComponent({ element: RawComponent }: {
19
+ element: VNode;
20
+ }): {
21
+ bootstrap: Interfaces.LifecycleBootstrap<Interfaces.ComponentProps>;
22
+ mount: Interfaces.LifecycleMount<Interfaces.ComponentProps>;
23
+ unmount: Interfaces.LifecycleUnmount<Interfaces.ComponentProps>;
24
+ update: Interfaces.LifecycleUpdate<Interfaces.ComponentProps>;
25
+ };
26
+ }
27
+
package/esm/index.mjs ADDED
@@ -0,0 +1,81 @@
1
+ // src/basic/bi-open/packages/bi-open-vue-sdk/src/index.ts
2
+ import { I18n, formatNumberWithConfig, formatNumber, LATEST_VERSION, revisal, OLDEST_VERSION, getRevisalRange } from "@quickbi/bi-open";
3
+
4
+ // src/basic/bi-open/packages/bi-open-vue-sdk/src/wrapper.ts
5
+ import { createApp, h } from "vue";
6
+ function getRandId() {
7
+ return Math.random().toString(32).slice(2);
8
+ }
9
+ function createBIComponent(param) {
10
+ var RawComponent = param.element;
11
+ var instance = /* @__PURE__ */ new WeakMap();
12
+ var id = getRandId();
13
+ var CUSTOM_COMPONENT_CHANGE_EVENT = "CUSTOM_COMPONENT_CHANGE_EVENT_".concat(id);
14
+ var bootstrap = function() {
15
+ };
16
+ var mount = function(props) {
17
+ if (props.container) {
18
+ var vueInstance = createApp({
19
+ data: function data() {
20
+ return {
21
+ container: props.container,
22
+ customProps: props.customProps
23
+ };
24
+ },
25
+ mounted: function mounted() {
26
+ props.container.addEventListener(CUSTOM_COMPONENT_CHANGE_EVENT, this.handlePropsChange);
27
+ },
28
+ beforeUnmount: function beforeUnmount() {
29
+ props.container.removeEventListener(CUSTOM_COMPONENT_CHANGE_EVENT, this.handlePropsChange);
30
+ },
31
+ methods: {
32
+ handlePropsChange: function handlePropsChange(e) {
33
+ if (e.detail) {
34
+ this.customProps = e.detail;
35
+ }
36
+ }
37
+ },
38
+ render: function render() {
39
+ return h(RawComponent, {
40
+ container: this.container,
41
+ customProps: this.customProps
42
+ });
43
+ }
44
+ });
45
+ vueInstance.mount(props.container);
46
+ instance.set(props.container, vueInstance);
47
+ }
48
+ };
49
+ var update = function(props) {
50
+ if (props.container) {
51
+ props.container.dispatchEvent(new CustomEvent(CUSTOM_COMPONENT_CHANGE_EVENT, {
52
+ detail: props.customProps
53
+ }));
54
+ }
55
+ };
56
+ var unmount = function(props) {
57
+ if (props.container) {
58
+ var vueInstance = instance.get(props.container);
59
+ if (vueInstance) {
60
+ vueInstance.unmount();
61
+ instance.delete(props.container);
62
+ }
63
+ }
64
+ };
65
+ return {
66
+ bootstrap,
67
+ mount,
68
+ unmount,
69
+ update
70
+ };
71
+ }
72
+ export {
73
+ I18n,
74
+ LATEST_VERSION,
75
+ OLDEST_VERSION,
76
+ createBIComponent,
77
+ formatNumber,
78
+ formatNumberWithConfig,
79
+ getRevisalRange,
80
+ revisal
81
+ };
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@quickbi/bi-open-vue-sdk",
3
+ "version": "1.0.0",
4
+ "dependencies": {
5
+ "@quickbi/bi-open": "4.0.0"
6
+ },
7
+ "publishConfig": {
8
+ "registry": "https://registry.npmjs.org",
9
+ "access": "public"
10
+ },
11
+ "sideEffects": false,
12
+ "files": [
13
+ "esm",
14
+ "cjs",
15
+ "README.md"
16
+ ],
17
+ "author": "Quick BI team",
18
+ "peerDependencies": {
19
+ "vue": "^3.0.11"
20
+ },
21
+ "main": "./cjs/index.js",
22
+ "module": "./esm/index.mjs",
23
+ "browser": "./esm/index.mjs",
24
+ "exports": {
25
+ ".": {
26
+ "import": "./esm/index.mjs",
27
+ "require": "./cjs/index.js",
28
+ "default": "./esm/index.mjs",
29
+ "types": "./esm/index.d.ts"
30
+ },
31
+ "./*.css": {
32
+ "import": "./esm/*.css",
33
+ "require": "./cjs/*.css",
34
+ "default": "./esm/*.css"
35
+ }
36
+ },
37
+ "revisalInfo": {
38
+ "version": "4.1"
39
+ }
40
+ }