@quickbi/bi-open-react-sdk 3.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 +3 -0
- package/cjs/index.d.ts +27 -0
- package/cjs/index.js +149 -0
- package/esm/index.d.ts +27 -0
- package/esm/index.mjs +119 -0
- package/package.json +41 -0
package/README.md
ADDED
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
|
+
// ../../../../../../../../../../react
|
|
5
|
+
|
|
6
|
+
declare module '@quickbi/bi-open-react-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-react-sdk/wrapper';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare module '@quickbi/bi-open-react-sdk/wrapper' {
|
|
13
|
+
/**
|
|
14
|
+
* @flie 开放组件入口文件
|
|
15
|
+
*/
|
|
16
|
+
import * as React from 'react';
|
|
17
|
+
import type { Interfaces } from '@quickbi/bi-open';
|
|
18
|
+
export function createBIComponent<T = Interfaces.ComponentProps>({ element: RawComponent, }: {
|
|
19
|
+
element: React.ComponentType<T>;
|
|
20
|
+
}): {
|
|
21
|
+
bootstrap: Interfaces.LifecycleBootstrap<T>;
|
|
22
|
+
mount: Interfaces.LifecycleMount<T>;
|
|
23
|
+
unmount: Interfaces.LifecycleUnmount<T>;
|
|
24
|
+
update: Interfaces.LifecycleUpdate<T>;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
package/cjs/index.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/basic/bi-open/packages/bi-open-react-sdk/src/index.ts
|
|
30
|
+
var src_exports = {};
|
|
31
|
+
__export(src_exports, {
|
|
32
|
+
I18n: () => import_bi_open.I18n,
|
|
33
|
+
LATEST_VERSION: () => import_bi_open.LATEST_VERSION,
|
|
34
|
+
OLDEST_VERSION: () => import_bi_open.OLDEST_VERSION,
|
|
35
|
+
createBIComponent: () => createBIComponent,
|
|
36
|
+
formatNumber: () => import_bi_open.formatNumber,
|
|
37
|
+
formatNumberWithConfig: () => import_bi_open.formatNumberWithConfig,
|
|
38
|
+
getRevisalRange: () => import_bi_open.getRevisalRange,
|
|
39
|
+
revisal: () => import_bi_open.revisal
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(src_exports);
|
|
42
|
+
var import_bi_open = require("@quickbi/bi-open");
|
|
43
|
+
|
|
44
|
+
// src/basic/bi-open/packages/bi-open-react-sdk/src/wrapper.tsx
|
|
45
|
+
var React = __toESM(require("react"));
|
|
46
|
+
var ReactDOM = __toESM(require("react-dom"));
|
|
47
|
+
function _array_like_to_array(arr, len) {
|
|
48
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
49
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
50
|
+
return arr2;
|
|
51
|
+
}
|
|
52
|
+
function _array_with_holes(arr) {
|
|
53
|
+
if (Array.isArray(arr)) return arr;
|
|
54
|
+
}
|
|
55
|
+
function _iterable_to_array_limit(arr, i) {
|
|
56
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
57
|
+
if (_i == null) return;
|
|
58
|
+
var _arr = [];
|
|
59
|
+
var _n = true;
|
|
60
|
+
var _d = false;
|
|
61
|
+
var _s, _e;
|
|
62
|
+
try {
|
|
63
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
64
|
+
_arr.push(_s.value);
|
|
65
|
+
if (i && _arr.length === i) break;
|
|
66
|
+
}
|
|
67
|
+
} catch (err) {
|
|
68
|
+
_d = true;
|
|
69
|
+
_e = err;
|
|
70
|
+
} finally {
|
|
71
|
+
try {
|
|
72
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
73
|
+
} finally {
|
|
74
|
+
if (_d) throw _e;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return _arr;
|
|
78
|
+
}
|
|
79
|
+
function _non_iterable_rest() {
|
|
80
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
81
|
+
}
|
|
82
|
+
function _sliced_to_array(arr, i) {
|
|
83
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
84
|
+
}
|
|
85
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
86
|
+
if (!o) return;
|
|
87
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
88
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
89
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
90
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
91
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
92
|
+
}
|
|
93
|
+
function getRandId() {
|
|
94
|
+
return Math.random().toString(32).slice(2);
|
|
95
|
+
}
|
|
96
|
+
function createBIComponent(param) {
|
|
97
|
+
var RawComponent = param.element;
|
|
98
|
+
var id = getRandId();
|
|
99
|
+
var CUSTOM_COMPONENT_CHANGE_EVENT = "CUSTOM_COMPONENT_CHANGE_EVENT_".concat(id);
|
|
100
|
+
var EnhancedBIComponent = function(props) {
|
|
101
|
+
var _React_useState = _sliced_to_array(React.useState(props.initProps), 2), rootProps = _React_useState[0], setRootProps = _React_useState[1];
|
|
102
|
+
React.useEffect(function() {
|
|
103
|
+
var handlePropsChange = function(e) {
|
|
104
|
+
if (e.detail) {
|
|
105
|
+
setRootProps(e.detail);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
if (props.container) {
|
|
109
|
+
props.container.addEventListener(CUSTOM_COMPONENT_CHANGE_EVENT, handlePropsChange);
|
|
110
|
+
}
|
|
111
|
+
return function() {
|
|
112
|
+
if (props.container) {
|
|
113
|
+
props.container.removeEventListener(CUSTOM_COMPONENT_CHANGE_EVENT, handlePropsChange);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
}, [
|
|
117
|
+
props.container
|
|
118
|
+
]);
|
|
119
|
+
return /* @__PURE__ */ React.createElement(RawComponent, rootProps);
|
|
120
|
+
};
|
|
121
|
+
var bootstrap = function() {
|
|
122
|
+
};
|
|
123
|
+
var mount = function(props) {
|
|
124
|
+
if (props.container) {
|
|
125
|
+
ReactDOM.render(/* @__PURE__ */ React.createElement(EnhancedBIComponent, {
|
|
126
|
+
container: props.container,
|
|
127
|
+
initProps: props.customProps
|
|
128
|
+
}), props.container);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
var update = function(props) {
|
|
132
|
+
if (props.container) {
|
|
133
|
+
props.container.dispatchEvent(new CustomEvent(CUSTOM_COMPONENT_CHANGE_EVENT, {
|
|
134
|
+
detail: props.customProps
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
var unmount = function(props) {
|
|
139
|
+
if (props.container) {
|
|
140
|
+
ReactDOM.unmountComponentAtNode(props.container);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
return {
|
|
144
|
+
bootstrap,
|
|
145
|
+
mount,
|
|
146
|
+
unmount,
|
|
147
|
+
update
|
|
148
|
+
};
|
|
149
|
+
}
|
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
|
+
// ../../../../../../../../../../react
|
|
5
|
+
|
|
6
|
+
declare module '@quickbi/bi-open-react-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-react-sdk/wrapper';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare module '@quickbi/bi-open-react-sdk/wrapper' {
|
|
13
|
+
/**
|
|
14
|
+
* @flie 开放组件入口文件
|
|
15
|
+
*/
|
|
16
|
+
import * as React from 'react';
|
|
17
|
+
import type { Interfaces } from '@quickbi/bi-open';
|
|
18
|
+
export function createBIComponent<T = Interfaces.ComponentProps>({ element: RawComponent, }: {
|
|
19
|
+
element: React.ComponentType<T>;
|
|
20
|
+
}): {
|
|
21
|
+
bootstrap: Interfaces.LifecycleBootstrap<T>;
|
|
22
|
+
mount: Interfaces.LifecycleMount<T>;
|
|
23
|
+
unmount: Interfaces.LifecycleUnmount<T>;
|
|
24
|
+
update: Interfaces.LifecycleUpdate<T>;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
package/esm/index.mjs
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// src/basic/bi-open/packages/bi-open-react-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-react-sdk/src/wrapper.tsx
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import * as ReactDOM from "react-dom";
|
|
7
|
+
function _array_like_to_array(arr, len) {
|
|
8
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
9
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
10
|
+
return arr2;
|
|
11
|
+
}
|
|
12
|
+
function _array_with_holes(arr) {
|
|
13
|
+
if (Array.isArray(arr)) return arr;
|
|
14
|
+
}
|
|
15
|
+
function _iterable_to_array_limit(arr, i) {
|
|
16
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
17
|
+
if (_i == null) return;
|
|
18
|
+
var _arr = [];
|
|
19
|
+
var _n = true;
|
|
20
|
+
var _d = false;
|
|
21
|
+
var _s, _e;
|
|
22
|
+
try {
|
|
23
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
24
|
+
_arr.push(_s.value);
|
|
25
|
+
if (i && _arr.length === i) break;
|
|
26
|
+
}
|
|
27
|
+
} catch (err) {
|
|
28
|
+
_d = true;
|
|
29
|
+
_e = err;
|
|
30
|
+
} finally {
|
|
31
|
+
try {
|
|
32
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
33
|
+
} finally {
|
|
34
|
+
if (_d) throw _e;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return _arr;
|
|
38
|
+
}
|
|
39
|
+
function _non_iterable_rest() {
|
|
40
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
41
|
+
}
|
|
42
|
+
function _sliced_to_array(arr, i) {
|
|
43
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
44
|
+
}
|
|
45
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
46
|
+
if (!o) return;
|
|
47
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
48
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
49
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
50
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
51
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
52
|
+
}
|
|
53
|
+
function getRandId() {
|
|
54
|
+
return Math.random().toString(32).slice(2);
|
|
55
|
+
}
|
|
56
|
+
function createBIComponent(param) {
|
|
57
|
+
var RawComponent = param.element;
|
|
58
|
+
var id = getRandId();
|
|
59
|
+
var CUSTOM_COMPONENT_CHANGE_EVENT = "CUSTOM_COMPONENT_CHANGE_EVENT_".concat(id);
|
|
60
|
+
var EnhancedBIComponent = function(props) {
|
|
61
|
+
var _React_useState = _sliced_to_array(React.useState(props.initProps), 2), rootProps = _React_useState[0], setRootProps = _React_useState[1];
|
|
62
|
+
React.useEffect(function() {
|
|
63
|
+
var handlePropsChange = function(e) {
|
|
64
|
+
if (e.detail) {
|
|
65
|
+
setRootProps(e.detail);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
if (props.container) {
|
|
69
|
+
props.container.addEventListener(CUSTOM_COMPONENT_CHANGE_EVENT, handlePropsChange);
|
|
70
|
+
}
|
|
71
|
+
return function() {
|
|
72
|
+
if (props.container) {
|
|
73
|
+
props.container.removeEventListener(CUSTOM_COMPONENT_CHANGE_EVENT, handlePropsChange);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}, [
|
|
77
|
+
props.container
|
|
78
|
+
]);
|
|
79
|
+
return /* @__PURE__ */ React.createElement(RawComponent, rootProps);
|
|
80
|
+
};
|
|
81
|
+
var bootstrap = function() {
|
|
82
|
+
};
|
|
83
|
+
var mount = function(props) {
|
|
84
|
+
if (props.container) {
|
|
85
|
+
ReactDOM.render(/* @__PURE__ */ React.createElement(EnhancedBIComponent, {
|
|
86
|
+
container: props.container,
|
|
87
|
+
initProps: props.customProps
|
|
88
|
+
}), props.container);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var update = function(props) {
|
|
92
|
+
if (props.container) {
|
|
93
|
+
props.container.dispatchEvent(new CustomEvent(CUSTOM_COMPONENT_CHANGE_EVENT, {
|
|
94
|
+
detail: props.customProps
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var unmount = function(props) {
|
|
99
|
+
if (props.container) {
|
|
100
|
+
ReactDOM.unmountComponentAtNode(props.container);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
bootstrap,
|
|
105
|
+
mount,
|
|
106
|
+
unmount,
|
|
107
|
+
update
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
I18n,
|
|
112
|
+
LATEST_VERSION,
|
|
113
|
+
OLDEST_VERSION,
|
|
114
|
+
createBIComponent,
|
|
115
|
+
formatNumber,
|
|
116
|
+
formatNumberWithConfig,
|
|
117
|
+
getRevisalRange,
|
|
118
|
+
revisal
|
|
119
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@quickbi/bi-open-react-sdk",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"registry": "https://registry.npmjs.org",
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@quickbi/bi-open": "4.0.0"
|
|
10
|
+
},
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"files": [
|
|
13
|
+
"esm",
|
|
14
|
+
"cjs",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"author": "Quick BI team",
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"react": ">=16.14.0",
|
|
20
|
+
"react-dom": ">=16.14.0"
|
|
21
|
+
},
|
|
22
|
+
"main": "./cjs/index.js",
|
|
23
|
+
"module": "./esm/index.mjs",
|
|
24
|
+
"browser": "./esm/index.mjs",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"import": "./esm/index.mjs",
|
|
28
|
+
"require": "./cjs/index.js",
|
|
29
|
+
"default": "./esm/index.mjs",
|
|
30
|
+
"types": "./esm/index.d.ts"
|
|
31
|
+
},
|
|
32
|
+
"./*.css": {
|
|
33
|
+
"import": "./esm/*.css",
|
|
34
|
+
"require": "./cjs/*.css",
|
|
35
|
+
"default": "./esm/*.css"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"revisalInfo": {
|
|
39
|
+
"version": "4.1"
|
|
40
|
+
}
|
|
41
|
+
}
|