@titaui/pc 1.10.47 → 1.10.50
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/lib/components/dialog-confirm/index.css +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-chart/index.js +10 -47
- package/lib/components/dynamic/dynamic-item/dynamic-chart/utils.js +61 -0
- package/lib/components/rich-editor/plugins/extension/placeholder/index.js +126 -0
- package/lib/components/rich-editor/plugins/extension/placeholder/styles.js +19 -0
- package/lib/components/rich-editor/plugins/inline/color/consts.js +2 -2
- package/lib/components/rich-editor/plugins/inline/color/selector.js +8 -8
- package/lib/components/rich-editor/plugins/inline/link/ui/index.css +5 -0
- package/lib/components/rich-editor/plugins/util.js +6 -3
- package/lib/components/rich-editor/ui/editor/index.css +41 -7
- package/lib/components/rich-editor/ui/editor/index.js +9 -4
- package/lib/components/rich-editor/utils/document.js +51 -0
- package/lib/components/superset-charts/components/chart/index.js +12 -22
- package/lib/components/superset-charts/{init/insert-assets.js → fetch-assets-and-append/append-assets.js} +29 -24
- package/lib/components/superset-charts/{init/use-get-assets.js → fetch-assets-and-append/get-assets-with-cache.js} +26 -20
- package/lib/components/superset-charts/fetch-assets-and-append/index.js +79 -0
- package/lib/components/superset-charts/utils/axios.js +6 -2
- package/package.json +1 -1
- package/yarn-error.log +22184 -0
- package/lib/components/superset-charts/init/index.js +0 -61
|
@@ -11,7 +11,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
11
11
|
|
|
12
12
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var appendJs = function appendJs(assets) {
|
|
15
15
|
return new Promise(function (resolve, reject) {
|
|
16
16
|
var script = document.createElement("script");
|
|
17
17
|
var r = false;
|
|
@@ -37,65 +37,70 @@ var generateScript = function generateScript(assets) {
|
|
|
37
37
|
});
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
var
|
|
40
|
+
var appendCss = function appendCss(assets) {
|
|
41
41
|
var el = document.createElement("link");
|
|
42
42
|
el.href = assets.uri;
|
|
43
43
|
return el;
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
var
|
|
47
|
-
function
|
|
46
|
+
var AppendAssetsList = /*#__PURE__*/function () {
|
|
47
|
+
function AppendAssetsList() {
|
|
48
48
|
var _this = this;
|
|
49
49
|
|
|
50
|
-
_classCallCheck(this,
|
|
51
|
-
|
|
52
|
-
this.generateAssets = function (assets) {
|
|
53
|
-
var _this$strategy$type, _this$strategy;
|
|
50
|
+
_classCallCheck(this, AppendAssetsList);
|
|
54
51
|
|
|
52
|
+
this.appendAssets = function (assets) {
|
|
55
53
|
var type = assets.type;
|
|
56
|
-
return
|
|
54
|
+
return _this.strategy[type](assets);
|
|
57
55
|
};
|
|
58
56
|
|
|
59
|
-
this.
|
|
57
|
+
this.appendAssetsList = function () {
|
|
60
58
|
if (!_this.assetsList.length) return undefined;
|
|
61
59
|
|
|
62
60
|
if (!_this.init) {
|
|
63
61
|
_this.init = true;
|
|
64
62
|
var fragment = document.createDocumentFragment();
|
|
65
63
|
|
|
66
|
-
_this.assetsList.filter(function (
|
|
67
|
-
return
|
|
68
|
-
}).forEach(function (
|
|
69
|
-
|
|
64
|
+
_this.assetsList.filter(function (assets) {
|
|
65
|
+
return assets.type !== "js";
|
|
66
|
+
}).forEach(function (assets) {
|
|
67
|
+
if (!assets.type || !_this.strategy[assets.type]) {
|
|
68
|
+
// eslint-disable-next-line no-console
|
|
69
|
+
console.error("assets type is not expected");
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var el = _this.appendAssets(assets);
|
|
74
|
+
|
|
70
75
|
fragment.appendChild(el);
|
|
71
76
|
});
|
|
72
77
|
|
|
73
|
-
return Promise.all(_this.assetsList.filter(function (
|
|
74
|
-
return
|
|
75
|
-
}).map(function (
|
|
76
|
-
return
|
|
78
|
+
return Promise.all(_this.assetsList.filter(function (assets) {
|
|
79
|
+
return assets.type === "js";
|
|
80
|
+
}).map(function (assets) {
|
|
81
|
+
return appendJs(assets);
|
|
77
82
|
}));
|
|
78
83
|
}
|
|
79
84
|
|
|
80
|
-
return Promise.resolve(
|
|
85
|
+
return Promise.resolve();
|
|
81
86
|
};
|
|
82
87
|
|
|
83
88
|
this.init = false;
|
|
84
89
|
this.strategy = {
|
|
85
|
-
js:
|
|
86
|
-
css:
|
|
90
|
+
js: appendJs,
|
|
91
|
+
css: appendCss
|
|
87
92
|
};
|
|
88
93
|
}
|
|
89
94
|
|
|
90
|
-
_createClass(
|
|
95
|
+
_createClass(AppendAssetsList, [{
|
|
91
96
|
key: "setAssets",
|
|
92
97
|
value: function setAssets(assets) {
|
|
93
98
|
this.assetsList = assets;
|
|
94
99
|
}
|
|
95
100
|
}]);
|
|
96
101
|
|
|
97
|
-
return
|
|
102
|
+
return AppendAssetsList;
|
|
98
103
|
}();
|
|
99
104
|
|
|
100
|
-
var _default =
|
|
105
|
+
var _default = AppendAssetsList;
|
|
101
106
|
exports["default"] = _default;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.transMetasToTableData = exports.
|
|
6
|
+
exports.transMetasToTableData = exports.fetchAssetsVersion = exports.fetchAssetsUri = exports.domain = exports["default"] = void 0;
|
|
7
7
|
|
|
8
8
|
var _axios = _interopRequireDefault(require("../utils/axios"));
|
|
9
9
|
|
|
@@ -34,7 +34,7 @@ var transMetasToTableData = function transMetasToTableData() {
|
|
|
34
34
|
exports.transMetasToTableData = transMetasToTableData;
|
|
35
35
|
var storageKey = "DEMO_CHART_URI_";
|
|
36
36
|
|
|
37
|
-
var
|
|
37
|
+
var fetchAssetsVersion = function fetchAssetsVersion() {
|
|
38
38
|
return _axios["default"].post("".concat(domain, "/api/v1/metas/list"), {
|
|
39
39
|
filter: {
|
|
40
40
|
fields: [],
|
|
@@ -50,9 +50,9 @@ var getAssetsVersion = function getAssetsVersion() {
|
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
exports.
|
|
53
|
+
exports.fetchAssetsVersion = fetchAssetsVersion;
|
|
54
54
|
|
|
55
|
-
var
|
|
55
|
+
var fetchAssetsUri = function fetchAssetsUri(version) {
|
|
56
56
|
return _axios["default"].post("".concat(domain, "/api/v1/metas/list"), {
|
|
57
57
|
filter: {
|
|
58
58
|
fields: [{
|
|
@@ -74,42 +74,47 @@ var getAssetsUri = function getAssetsUri(version) {
|
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
exports.
|
|
77
|
+
exports.fetchAssetsUri = fetchAssetsUri;
|
|
78
78
|
|
|
79
|
-
var
|
|
80
|
-
var
|
|
81
|
-
|
|
79
|
+
var hasCachedAssets = function hasCachedAssets(resVersion) {
|
|
80
|
+
var _JSON$parse$;
|
|
81
|
+
|
|
82
|
+
var cacheAssets = localStorage.getItem("".concat(storageKey, "version"));
|
|
83
|
+
var cacheVersion = cacheAssets && ((_JSON$parse$ = JSON.parse(cacheAssets)[0]) === null || _JSON$parse$ === void 0 ? void 0 : _JSON$parse$.version);
|
|
84
|
+
return cacheAssets !== null && cacheVersion === resVersion;
|
|
85
|
+
};
|
|
82
86
|
|
|
83
|
-
|
|
87
|
+
var getAssetsWithCache = /*#__PURE__*/function () {
|
|
88
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
89
|
+
var res, cacheAssets, resVersion, assetsUri;
|
|
84
90
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
85
91
|
while (1) {
|
|
86
92
|
switch (_context.prev = _context.next) {
|
|
87
93
|
case 0:
|
|
88
94
|
_context.next = 2;
|
|
89
|
-
return
|
|
95
|
+
return fetchAssetsVersion();
|
|
90
96
|
|
|
91
97
|
case 2:
|
|
92
98
|
res = _context.sent;
|
|
93
99
|
cacheAssets = localStorage.getItem("".concat(storageKey, "version"));
|
|
94
|
-
cacheVersion = cacheAssets && ((_JSON$parse$ = JSON.parse(cacheAssets)[0]) === null || _JSON$parse$ === void 0 ? void 0 : _JSON$parse$.version);
|
|
95
100
|
resVersion = res[0].version;
|
|
96
101
|
|
|
97
|
-
if (!(
|
|
98
|
-
_context.next =
|
|
102
|
+
if (!hasCachedAssets(resVersion)) {
|
|
103
|
+
_context.next = 7;
|
|
99
104
|
break;
|
|
100
105
|
}
|
|
101
106
|
|
|
102
107
|
return _context.abrupt("return", JSON.parse(cacheAssets));
|
|
103
108
|
|
|
104
|
-
case
|
|
105
|
-
_context.next =
|
|
106
|
-
return
|
|
109
|
+
case 7:
|
|
110
|
+
_context.next = 9;
|
|
111
|
+
return fetchAssetsUri(resVersion);
|
|
107
112
|
|
|
108
|
-
case
|
|
113
|
+
case 9:
|
|
109
114
|
assetsUri = _context.sent;
|
|
110
115
|
return _context.abrupt("return", assetsUri);
|
|
111
116
|
|
|
112
|
-
case
|
|
117
|
+
case 11:
|
|
113
118
|
case "end":
|
|
114
119
|
return _context.stop();
|
|
115
120
|
}
|
|
@@ -117,9 +122,10 @@ var getAssets = /*#__PURE__*/function () {
|
|
|
117
122
|
}, _callee);
|
|
118
123
|
}));
|
|
119
124
|
|
|
120
|
-
return function
|
|
125
|
+
return function getAssetsWithCache() {
|
|
121
126
|
return _ref.apply(this, arguments);
|
|
122
127
|
};
|
|
123
128
|
}();
|
|
124
129
|
|
|
125
|
-
|
|
130
|
+
var _default = getAssetsWithCache;
|
|
131
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.SingletonFetchAssetsAndAppend = void 0;
|
|
7
|
+
|
|
8
|
+
var _appendAssets = _interopRequireDefault(require("./append-assets"));
|
|
9
|
+
|
|
10
|
+
var _getAssetsWithCache = _interopRequireDefault(require("./get-assets-with-cache"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
14
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
15
|
+
|
|
16
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
17
|
+
|
|
18
|
+
var getAssetsAndAppend = /*#__PURE__*/function () {
|
|
19
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
20
|
+
var assets, execute;
|
|
21
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
22
|
+
while (1) {
|
|
23
|
+
switch (_context.prev = _context.next) {
|
|
24
|
+
case 0:
|
|
25
|
+
_context.next = 2;
|
|
26
|
+
return (0, _getAssetsWithCache["default"])();
|
|
27
|
+
|
|
28
|
+
case 2:
|
|
29
|
+
assets = _context.sent;
|
|
30
|
+
execute = new _appendAssets["default"]();
|
|
31
|
+
execute.setAssets(assets);
|
|
32
|
+
return _context.abrupt("return", execute.appendAssetsList());
|
|
33
|
+
|
|
34
|
+
case 6:
|
|
35
|
+
case "end":
|
|
36
|
+
return _context.stop();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}, _callee);
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
return function getAssetsAndAppend() {
|
|
43
|
+
return _ref.apply(this, arguments);
|
|
44
|
+
};
|
|
45
|
+
}();
|
|
46
|
+
|
|
47
|
+
var SingletonFetchAssetsAndAppend = function SingletonFetchAssetsAndAppend() {
|
|
48
|
+
var instance;
|
|
49
|
+
return /*#__PURE__*/function () {
|
|
50
|
+
var _Singlenton = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
51
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
52
|
+
while (1) {
|
|
53
|
+
switch (_context2.prev = _context2.next) {
|
|
54
|
+
case 0:
|
|
55
|
+
if (!instance) {
|
|
56
|
+
instance = getAssetsAndAppend();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return _context2.abrupt("return", instance);
|
|
60
|
+
|
|
61
|
+
case 2:
|
|
62
|
+
case "end":
|
|
63
|
+
return _context2.stop();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}, _callee2);
|
|
67
|
+
}));
|
|
68
|
+
|
|
69
|
+
function Singlenton() {
|
|
70
|
+
return _Singlenton.apply(this, arguments);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return Singlenton;
|
|
74
|
+
}();
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
exports.SingletonFetchAssetsAndAppend = SingletonFetchAssetsAndAppend;
|
|
78
|
+
var _default = SingletonFetchAssetsAndAppend;
|
|
79
|
+
exports["default"] = _default;
|
|
@@ -38,8 +38,12 @@ function setToken(token) {
|
|
|
38
38
|
|
|
39
39
|
var getJwtToken = function getJwtToken() {
|
|
40
40
|
return _axios["default"].get("".concat(requestDomain(), "/api/v1/").concat(tenantId, "/").concat(userId, "/const/skynetToken")).then(function (res) {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
if (res.data.Data) {
|
|
42
|
+
setToken(JSON.parse(res.data.Data.obj).token);
|
|
43
|
+
return JSON.parse(res.data.Data.obj).token;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return "";
|
|
43
47
|
});
|
|
44
48
|
};
|
|
45
49
|
|