vap1 0.5.4 → 0.5.7
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/components/Box/Box.d.ts +4 -0
- package/components/Box/Box.js +17 -7
- package/components/Box/SelectBar.d.ts +1 -4
- package/components/Box/SelectBar.js +3 -6
- package/components/Lists/Grid/index.js +0 -1
- package/components/SearchTool/SearchBar/ActionButtons.js +3 -16
- package/components/SearchTool/SearchBar/ByKeyword.js +1 -1
- package/components/Tables/Components/ActionBar.js +0 -36
- package/components/Tables/Components/useTableContext.js +0 -1
- package/components/Tables/Util.d.ts +2 -2
- package/components/Tables/VTable.js +4 -2
- package/components/Trees/ActionTree.js +5 -1
- package/components/Trees/BaseTree.js +1 -1
- package/components/Trees/STree.js +1 -1
- package/components/UForm/FormWrapper.js +5 -0
- package/components/UForm/UFormModal.js +2 -2
- package/components/UForm/_FieldType.js +2 -1
- package/components/UForm/index.d.ts +1 -1
- package/package.json +1 -1
- package/utils/Global.d.ts +5 -0
- package/utils/Global.js +1 -1
- package/components/Tables/VTableBack.d.ts +0 -0
- package/components/Tables/VTableBack.js +0 -269
- package/deps/app-data/Const.d.ts +0 -71
- package/deps/app-data/Const.js +0 -54
- package/deps/app-data/SourceTable.d.ts +0 -0
- package/deps/app-data/SourceTable.js +0 -137
- package/deps/app-data/TimeConst.d.ts +0 -0
- package/deps/app-data/TimeConst.js +0 -58
- package/deps/app-data/useSource.d.ts +0 -22
- package/deps/app-data/useSource.js +0 -253
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
45
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
46
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
47
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
48
|
-
function step(op) {
|
|
49
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
50
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
51
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
52
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
53
|
-
switch (op[0]) {
|
|
54
|
-
case 0: case 1: t = op; break;
|
|
55
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
56
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
57
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
58
|
-
default:
|
|
59
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
60
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
61
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
62
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
63
|
-
if (t[2]) _.ops.pop();
|
|
64
|
-
_.trys.pop(); continue;
|
|
65
|
-
}
|
|
66
|
-
op = body.call(thisArg, _);
|
|
67
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
68
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
72
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
73
|
-
if (!m) return o;
|
|
74
|
-
var i = m.call(o), r, ar = [], e;
|
|
75
|
-
try {
|
|
76
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
77
|
-
}
|
|
78
|
-
catch (error) { e = { error: error }; }
|
|
79
|
-
finally {
|
|
80
|
-
try {
|
|
81
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
82
|
-
}
|
|
83
|
-
finally { if (e) throw e.error; }
|
|
84
|
-
}
|
|
85
|
-
return ar;
|
|
86
|
-
};
|
|
87
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
88
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
89
|
-
};
|
|
90
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
91
|
-
exports.useSource = exports.sourceTypeRender = void 0;
|
|
92
|
-
var react_1 = __importStar(require("react"));
|
|
93
|
-
var lodash_1 = __importDefault(require("lodash"));
|
|
94
|
-
var utils_1 = require("../../utils");
|
|
95
|
-
var Icon_1 = require("../../components/_adapt/Icon");
|
|
96
|
-
var hooks_1 = require("../../hooks");
|
|
97
|
-
var Const_1 = require("./Const");
|
|
98
|
-
var SOURCE_API = Const_1.API_PREFIX + '/source';
|
|
99
|
-
var sourceTypeRender = function (type) {
|
|
100
|
-
switch (type) {
|
|
101
|
-
case Const_1.SOURCE_TYPE.ELASTIC:
|
|
102
|
-
return react_1.default.createElement("img", { src: "".concat(Const_1.IMAGE_PREFIX, "/source-type/elastic-search.svg"), height: 20, width: 58, style: { verticalAlign: 'middle' } });
|
|
103
|
-
case Const_1.SOURCE_TYPE.MYSQL:
|
|
104
|
-
return react_1.default.createElement("img", { src: "".concat(Const_1.IMAGE_PREFIX, "/source-type/mysql.svg"), height: 20, width: 30, style: { verticalAlign: 'middle' } });
|
|
105
|
-
case Const_1.SOURCE_TYPE.DORIS:
|
|
106
|
-
return react_1.default.createElement("img", { src: "".concat(Const_1.IMAGE_PREFIX, "/source-type/doris.svg"), height: 20, width: 59, style: { verticalAlign: 'middle' } });
|
|
107
|
-
default:
|
|
108
|
-
return react_1.default.createElement("img", { src: "".concat(Const_1.IMAGE_PREFIX, "/source-type/elastic-search.svg"), height: 20, width: 58, style: { verticalAlign: 'middle' } });
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
exports.sourceTypeRender = sourceTypeRender;
|
|
112
|
-
utils_1.Ajax.SESSION(SOURCE_API);
|
|
113
|
-
var DEFAULT = {
|
|
114
|
-
sourceLoading: true,
|
|
115
|
-
all: [],
|
|
116
|
-
es: [],
|
|
117
|
-
mysql: [],
|
|
118
|
-
doris: [],
|
|
119
|
-
sourceOptions: [],
|
|
120
|
-
esOptions: [],
|
|
121
|
-
mysqlOptions: [],
|
|
122
|
-
dorisOptions: [],
|
|
123
|
-
nameMap: new Map(),
|
|
124
|
-
sourceMap: new Map(),
|
|
125
|
-
};
|
|
126
|
-
var useSource = function () {
|
|
127
|
-
var _a = __read((0, hooks_1.useGlobal)('DATA_SOURCE', DEFAULT, { share: true, }), 3), _b = _a[0], sourceLoading = _b.sourceLoading, all = _b.all, es = _b.es, mysql = _b.mysql, doris = _b.doris, sourceOptions = _b.sourceOptions, esOptions = _b.esOptions, mysqlOptions = _b.mysqlOptions, dorisOptions = _b.dorisOptions, sourceMap = _b.sourceMap, nameMap = _b.nameMap, setState = _a[1], loaded = _a[2];
|
|
128
|
-
var reflush = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
129
|
-
var resp, es, mysql, doris, all, sourceMap, nameMap, sourceOptions, esOptions, mysqlOptions, dorisOptions;
|
|
130
|
-
return __generator(this, function (_a) {
|
|
131
|
-
switch (_a.label) {
|
|
132
|
-
case 0:
|
|
133
|
-
if (loaded)
|
|
134
|
-
return [2 /*return*/];
|
|
135
|
-
return [4 /*yield*/, utils_1.Ajax.GET(SOURCE_API)];
|
|
136
|
-
case 1:
|
|
137
|
-
resp = _a.sent();
|
|
138
|
-
es = [];
|
|
139
|
-
mysql = [];
|
|
140
|
-
doris = [];
|
|
141
|
-
all = [];
|
|
142
|
-
sourceMap = new Map();
|
|
143
|
-
nameMap = new Map();
|
|
144
|
-
if (resp.code == '0') {
|
|
145
|
-
resp.data.map(function (item) {
|
|
146
|
-
all.push(item);
|
|
147
|
-
sourceMap.set(item.id, item);
|
|
148
|
-
nameMap.set(item.name, item.id);
|
|
149
|
-
if (item.type == Const_1.SOURCE_TYPE.ELASTIC) {
|
|
150
|
-
es.push(item);
|
|
151
|
-
}
|
|
152
|
-
else if (item.type == Const_1.SOURCE_TYPE.MYSQL) {
|
|
153
|
-
mysql.push(item);
|
|
154
|
-
}
|
|
155
|
-
else if (item.type == Const_1.SOURCE_TYPE.DORIS) {
|
|
156
|
-
doris.push(item);
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
sourceOptions = [], esOptions = [], mysqlOptions = [], dorisOptions = [];
|
|
161
|
-
all.map(function (item) {
|
|
162
|
-
var option = {
|
|
163
|
-
value: item.id,
|
|
164
|
-
label: react_1.default.createElement("span", { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
|
|
165
|
-
react_1.default.createElement("span", { style: { alignItems: 'center', display: 'flex' } },
|
|
166
|
-
(0, exports.sourceTypeRender)(item.type),
|
|
167
|
-
" ",
|
|
168
|
-
react_1.default.createElement("b", { style: { marginLeft: 4 } }, item.title)),
|
|
169
|
-
react_1.default.createElement("i", null, item.name))
|
|
170
|
-
};
|
|
171
|
-
sourceOptions.push(option);
|
|
172
|
-
if (item.type == Const_1.SOURCE_TYPE.ELASTIC) {
|
|
173
|
-
esOptions.push(option);
|
|
174
|
-
}
|
|
175
|
-
else if (item.type == Const_1.SOURCE_TYPE.MYSQL) {
|
|
176
|
-
mysqlOptions.push(option);
|
|
177
|
-
}
|
|
178
|
-
else if (item.type == Const_1.SOURCE_TYPE.DORIS) {
|
|
179
|
-
dorisOptions.push(option);
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
setState({ sourceLoading: false, nameMap: nameMap, all: all, es: es, mysql: mysql, doris: doris, sourceOptions: sourceOptions, sourceMap: sourceMap, esOptions: esOptions, mysqlOptions: mysqlOptions, dorisOptions: dorisOptions });
|
|
183
|
-
return [2 /*return*/];
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
}); };
|
|
187
|
-
(0, hooks_1.useEffectFunction)(reflush);
|
|
188
|
-
var getSourceFiled = (0, react_1.useCallback)(function (sourceId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
189
|
-
var API, resp;
|
|
190
|
-
return __generator(this, function (_a) {
|
|
191
|
-
switch (_a.label) {
|
|
192
|
-
case 0:
|
|
193
|
-
API = "/api-data/source/field/".concat(sourceId);
|
|
194
|
-
utils_1.Ajax.SESSION(API);
|
|
195
|
-
return [4 /*yield*/, utils_1.Ajax.GET(API)];
|
|
196
|
-
case 1:
|
|
197
|
-
resp = _a.sent();
|
|
198
|
-
if (lodash_1.default.isArray(resp.data))
|
|
199
|
-
return [2 /*return*/, resp.data.filter(function (item) { return item.name != ''; })];
|
|
200
|
-
return [2 /*return*/, []];
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
}); }, []);
|
|
204
|
-
var sourceIdRender = (0, react_1.useCallback)(function (idStr, showIdx) {
|
|
205
|
-
if (showIdx === void 0) { showIdx = false; }
|
|
206
|
-
try {
|
|
207
|
-
var id = parseInt(idStr);
|
|
208
|
-
if (!sourceMap.has(id)) {
|
|
209
|
-
return '';
|
|
210
|
-
}
|
|
211
|
-
var source = sourceMap.get(id);
|
|
212
|
-
if (showIdx && source.title) {
|
|
213
|
-
return react_1.default.createElement("span", { style: { display: 'flex', alignItems: 'center', columnGap: 3 } },
|
|
214
|
-
source.icon && react_1.default.createElement(Icon_1.Icon, { type: source.icon }),
|
|
215
|
-
react_1.default.createElement("span", null,
|
|
216
|
-
source.title,
|
|
217
|
-
" ",
|
|
218
|
-
react_1.default.createElement("i", null,
|
|
219
|
-
"(",
|
|
220
|
-
source.name,
|
|
221
|
-
")")));
|
|
222
|
-
}
|
|
223
|
-
var txt = source.title || source.name;
|
|
224
|
-
return react_1.default.createElement("span", { style: { display: 'flex', alignItems: 'center', columnGap: 3 } },
|
|
225
|
-
source.icon && react_1.default.createElement(Icon_1.Icon, { type: source.icon }),
|
|
226
|
-
react_1.default.createElement("span", null, txt));
|
|
227
|
-
}
|
|
228
|
-
catch (_a) {
|
|
229
|
-
return utils_1.Const.NONE;
|
|
230
|
-
}
|
|
231
|
-
}, [sourceMap]);
|
|
232
|
-
var sourceNameRender = (0, react_1.useCallback)(function (sourceName) {
|
|
233
|
-
var source = (0, Const_1.getSourceByName)(sourceName, all);
|
|
234
|
-
return sourceIdRender(source.id);
|
|
235
|
-
}, [sourceMap]);
|
|
236
|
-
return {
|
|
237
|
-
sourceLoading: sourceLoading,
|
|
238
|
-
all: all,
|
|
239
|
-
sourceOptions: sourceOptions,
|
|
240
|
-
sourceMap: sourceMap,
|
|
241
|
-
nameMap: nameMap,
|
|
242
|
-
sourceIdRender: sourceIdRender,
|
|
243
|
-
sourceNameRender: sourceNameRender,
|
|
244
|
-
getSourceFiled: getSourceFiled,
|
|
245
|
-
es: es,
|
|
246
|
-
mysql: mysql,
|
|
247
|
-
doris: doris,
|
|
248
|
-
esOptions: esOptions,
|
|
249
|
-
mysqlOptions: mysqlOptions,
|
|
250
|
-
dorisOptions: dorisOptions,
|
|
251
|
-
};
|
|
252
|
-
};
|
|
253
|
-
exports.useSource = useSource;
|