@fctc/interface-logic 1.5.2 → 1.5.4
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/configs.js +107 -96
- package/dist/configs.mjs +108 -96
- package/dist/environment.js +137 -122
- package/dist/environment.mjs +140 -122
- package/dist/hooks.js +1556 -1393
- package/dist/hooks.mjs +1559 -1393
- package/dist/provider.d.mts +4 -3
- package/dist/provider.d.ts +4 -3
- package/dist/provider.js +562 -509
- package/dist/provider.mjs +565 -509
- package/dist/services.js +1529 -1364
- package/dist/services.mjs +1524 -1356
- package/dist/store.js +19 -5
- package/dist/store.mjs +22 -5
- package/dist/utils.js +116 -94
- package/dist/utils.mjs +119 -94
- package/package.json +1 -1
package/dist/store.js
CHANGED
|
@@ -2,7 +2,21 @@
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
6
20
|
var __export = (target, all) => {
|
|
7
21
|
for (var name in all)
|
|
8
22
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -296,7 +310,7 @@ var headerSlice = (0, import_toolkit5.createSlice)({
|
|
|
296
310
|
},
|
|
297
311
|
reducers: {
|
|
298
312
|
setHeader: (state, action) => {
|
|
299
|
-
state.value = {
|
|
313
|
+
state.value = __spreadValues(__spreadValues({}, state.value), action.payload);
|
|
300
314
|
},
|
|
301
315
|
setAllowedCompanyIds: (state, action) => {
|
|
302
316
|
state.value.allowedCompanyIds = action.payload;
|
|
@@ -535,6 +549,10 @@ var selectSearch = (state) => state.search;
|
|
|
535
549
|
var selectSearchMap = (state) => state.search.searchMap;
|
|
536
550
|
var search_slice_default = searchSlice.reducer;
|
|
537
551
|
|
|
552
|
+
// src/store/index.ts
|
|
553
|
+
var useAppDispatch = import_react_redux.useDispatch;
|
|
554
|
+
var useAppSelector = import_react_redux.useSelector;
|
|
555
|
+
|
|
538
556
|
// src/store/store.ts
|
|
539
557
|
var import_toolkit11 = require("@reduxjs/toolkit");
|
|
540
558
|
|
|
@@ -726,10 +744,6 @@ var envStore = (0, import_toolkit11.configureStore)({
|
|
|
726
744
|
serializableCheck: false
|
|
727
745
|
})
|
|
728
746
|
});
|
|
729
|
-
|
|
730
|
-
// src/store/index.ts
|
|
731
|
-
var useAppDispatch = import_react_redux.useDispatch;
|
|
732
|
-
var useAppSelector = import_react_redux.useSelector;
|
|
733
747
|
// Annotate the CommonJS export names for ESM import in node:
|
|
734
748
|
0 && (module.exports = {
|
|
735
749
|
breadcrumbsSlice,
|
package/dist/store.mjs
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
|
|
1
18
|
// src/store/index.ts
|
|
2
19
|
import { useDispatch, useSelector } from "react-redux";
|
|
3
20
|
|
|
@@ -192,7 +209,7 @@ var headerSlice = createSlice5({
|
|
|
192
209
|
},
|
|
193
210
|
reducers: {
|
|
194
211
|
setHeader: (state, action) => {
|
|
195
|
-
state.value = {
|
|
212
|
+
state.value = __spreadValues(__spreadValues({}, state.value), action.payload);
|
|
196
213
|
},
|
|
197
214
|
setAllowedCompanyIds: (state, action) => {
|
|
198
215
|
state.value.allowedCompanyIds = action.payload;
|
|
@@ -431,6 +448,10 @@ var selectSearch = (state) => state.search;
|
|
|
431
448
|
var selectSearchMap = (state) => state.search.searchMap;
|
|
432
449
|
var search_slice_default = searchSlice.reducer;
|
|
433
450
|
|
|
451
|
+
// src/store/index.ts
|
|
452
|
+
var useAppDispatch = useDispatch;
|
|
453
|
+
var useAppSelector = useSelector;
|
|
454
|
+
|
|
434
455
|
// src/store/store.ts
|
|
435
456
|
import { configureStore } from "@reduxjs/toolkit";
|
|
436
457
|
|
|
@@ -622,10 +643,6 @@ var envStore = configureStore({
|
|
|
622
643
|
serializableCheck: false
|
|
623
644
|
})
|
|
624
645
|
});
|
|
625
|
-
|
|
626
|
-
// src/store/index.ts
|
|
627
|
-
var useAppDispatch = useDispatch;
|
|
628
|
-
var useAppSelector = useSelector;
|
|
629
646
|
export {
|
|
630
647
|
breadcrumbsSlice,
|
|
631
648
|
clearSearchMap,
|
package/dist/utils.js
CHANGED
|
@@ -3,8 +3,23 @@ var __create = Object.create;
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __pow = Math.pow;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
8
23
|
var __export = (target, all) => {
|
|
9
24
|
for (var name in all)
|
|
10
25
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -26,6 +41,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
41
|
mod
|
|
27
42
|
));
|
|
28
43
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
44
|
+
var __async = (__this, __arguments, generator) => {
|
|
45
|
+
return new Promise((resolve, reject) => {
|
|
46
|
+
var fulfilled = (value) => {
|
|
47
|
+
try {
|
|
48
|
+
step(generator.next(value));
|
|
49
|
+
} catch (e) {
|
|
50
|
+
reject(e);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var rejected = (value) => {
|
|
54
|
+
try {
|
|
55
|
+
step(generator.throw(value));
|
|
56
|
+
} catch (e) {
|
|
57
|
+
reject(e);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
61
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
62
|
+
});
|
|
63
|
+
};
|
|
29
64
|
|
|
30
65
|
// src/utils.ts
|
|
31
66
|
var utils_exports = {};
|
|
@@ -65,7 +100,6 @@ module.exports = __toCommonJS(utils_exports);
|
|
|
65
100
|
|
|
66
101
|
// src/utils/error-handler.ts
|
|
67
102
|
var WesapError = class extends Error {
|
|
68
|
-
code;
|
|
69
103
|
constructor(message, code) {
|
|
70
104
|
super(message);
|
|
71
105
|
this.code = code;
|
|
@@ -1452,22 +1486,6 @@ var PyRelativeDelta = class _PyRelativeDelta {
|
|
|
1452
1486
|
this.microsecond = params.microsecond;
|
|
1453
1487
|
this.weekday = params.weekday;
|
|
1454
1488
|
}
|
|
1455
|
-
years;
|
|
1456
|
-
months;
|
|
1457
|
-
days;
|
|
1458
|
-
hours;
|
|
1459
|
-
minutes;
|
|
1460
|
-
seconds;
|
|
1461
|
-
microseconds;
|
|
1462
|
-
leapDays;
|
|
1463
|
-
year;
|
|
1464
|
-
month;
|
|
1465
|
-
day;
|
|
1466
|
-
hour;
|
|
1467
|
-
minute;
|
|
1468
|
-
second;
|
|
1469
|
-
microsecond;
|
|
1470
|
-
weekday;
|
|
1471
1489
|
negate() {
|
|
1472
1490
|
return new _PyRelativeDelta(this, -1);
|
|
1473
1491
|
}
|
|
@@ -1582,7 +1600,7 @@ function execOnIterable(iterable, func) {
|
|
|
1582
1600
|
if (typeof iterable === "object" && !Array.isArray(iterable) && !(iterable instanceof Set)) {
|
|
1583
1601
|
iterable = Object.keys(iterable);
|
|
1584
1602
|
}
|
|
1585
|
-
if (typeof iterable
|
|
1603
|
+
if (typeof (iterable == null ? void 0 : iterable[Symbol.iterator]) !== "function") {
|
|
1586
1604
|
throw new EvaluationError("value not iterable");
|
|
1587
1605
|
}
|
|
1588
1606
|
return func(iterable);
|
|
@@ -1905,7 +1923,7 @@ function applyBinaryOp(ast, context) {
|
|
|
1905
1923
|
}
|
|
1906
1924
|
return Math.floor(left / right);
|
|
1907
1925
|
case "**":
|
|
1908
|
-
return left
|
|
1926
|
+
return __pow(left, right);
|
|
1909
1927
|
case "==":
|
|
1910
1928
|
return isEqual(left, right);
|
|
1911
1929
|
case "<>":
|
|
@@ -2027,7 +2045,7 @@ function evaluate(ast, context = {}) {
|
|
|
2027
2045
|
const dicts = /* @__PURE__ */ new Set();
|
|
2028
2046
|
let pyContext;
|
|
2029
2047
|
const evalContext = Object.create(context);
|
|
2030
|
-
if (!evalContext
|
|
2048
|
+
if (!(evalContext == null ? void 0 : evalContext.context)) {
|
|
2031
2049
|
Object.defineProperty(evalContext, "context", {
|
|
2032
2050
|
get() {
|
|
2033
2051
|
if (!pyContext) {
|
|
@@ -2038,17 +2056,18 @@ function evaluate(ast, context = {}) {
|
|
|
2038
2056
|
});
|
|
2039
2057
|
}
|
|
2040
2058
|
function _innerEvaluate(ast2) {
|
|
2041
|
-
|
|
2059
|
+
var _a, _b, _c;
|
|
2060
|
+
switch (ast2 == null ? void 0 : ast2.type) {
|
|
2042
2061
|
case 0:
|
|
2043
2062
|
// Number
|
|
2044
2063
|
case 1:
|
|
2045
2064
|
return ast2.value;
|
|
2046
2065
|
case 5:
|
|
2047
2066
|
if (ast2.value in evalContext) {
|
|
2048
|
-
if (typeof evalContext[ast2.value] === "object" && evalContext[ast2.value]
|
|
2049
|
-
return evalContext[ast2.value]
|
|
2067
|
+
if (typeof evalContext[ast2.value] === "object" && ((_a = evalContext[ast2.value]) == null ? void 0 : _a.id)) {
|
|
2068
|
+
return (_b = evalContext[ast2.value]) == null ? void 0 : _b.id;
|
|
2050
2069
|
}
|
|
2051
|
-
return evalContext[ast2.value]
|
|
2070
|
+
return (_c = evalContext[ast2.value]) != null ? _c : false;
|
|
2052
2071
|
} else if (ast2.value in BUILTINS) {
|
|
2053
2072
|
return BUILTINS[ast2.value];
|
|
2054
2073
|
} else {
|
|
@@ -2085,7 +2104,7 @@ function evaluate(ast, context = {}) {
|
|
|
2085
2104
|
const args = ast2.args.map(_evaluate);
|
|
2086
2105
|
const kwargs = {};
|
|
2087
2106
|
for (const kwarg in ast2.kwargs) {
|
|
2088
|
-
kwargs[kwarg] = _evaluate(ast2
|
|
2107
|
+
kwargs[kwarg] = _evaluate(ast2 == null ? void 0 : ast2.kwargs[kwarg]);
|
|
2089
2108
|
}
|
|
2090
2109
|
if (fnValue === PyDate || fnValue === PyDateTime || fnValue === PyTime || fnValue === PyRelativeDelta || fnValue === PyTimeDelta) {
|
|
2091
2110
|
return fnValue.create(...args, kwargs);
|
|
@@ -2178,7 +2197,7 @@ function evalPartialContext(_context, evaluationContext = {}) {
|
|
|
2178
2197
|
const value = ast.value[key];
|
|
2179
2198
|
try {
|
|
2180
2199
|
context[key] = evaluate(value, evaluationContext);
|
|
2181
|
-
} catch {
|
|
2200
|
+
} catch (e) {
|
|
2182
2201
|
}
|
|
2183
2202
|
}
|
|
2184
2203
|
return context;
|
|
@@ -2206,9 +2225,25 @@ function escapeRegExp(str) {
|
|
|
2206
2225
|
var InvalidDomainError = class extends Error {
|
|
2207
2226
|
};
|
|
2208
2227
|
var Domain = class _Domain {
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2228
|
+
constructor(descr = []) {
|
|
2229
|
+
this.ast = { type: -1, value: null };
|
|
2230
|
+
if (descr instanceof _Domain) {
|
|
2231
|
+
return new _Domain(descr.toString());
|
|
2232
|
+
} else {
|
|
2233
|
+
let rawAST;
|
|
2234
|
+
try {
|
|
2235
|
+
rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
|
|
2236
|
+
} catch (error) {
|
|
2237
|
+
throw new InvalidDomainError(
|
|
2238
|
+
`Invalid domain representation: ${descr}`,
|
|
2239
|
+
{
|
|
2240
|
+
cause: error
|
|
2241
|
+
}
|
|
2242
|
+
);
|
|
2243
|
+
}
|
|
2244
|
+
this.ast = normalizeDomainAST(rawAST);
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2212
2247
|
static combine(domains, operator) {
|
|
2213
2248
|
if (domains.length === 0) {
|
|
2214
2249
|
return new _Domain([]);
|
|
@@ -2287,24 +2322,6 @@ var Domain = class _Domain {
|
|
|
2287
2322
|
processLeaf(d.ast.value, 0, "&", newDomain);
|
|
2288
2323
|
return newDomain;
|
|
2289
2324
|
}
|
|
2290
|
-
constructor(descr = []) {
|
|
2291
|
-
if (descr instanceof _Domain) {
|
|
2292
|
-
return new _Domain(descr.toString());
|
|
2293
|
-
} else {
|
|
2294
|
-
let rawAST;
|
|
2295
|
-
try {
|
|
2296
|
-
rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
|
|
2297
|
-
} catch (error) {
|
|
2298
|
-
throw new InvalidDomainError(
|
|
2299
|
-
`Invalid domain representation: ${descr}`,
|
|
2300
|
-
{
|
|
2301
|
-
cause: error
|
|
2302
|
-
}
|
|
2303
|
-
);
|
|
2304
|
-
}
|
|
2305
|
-
this.ast = normalizeDomainAST(rawAST);
|
|
2306
|
-
}
|
|
2307
|
-
}
|
|
2308
2325
|
contains(record) {
|
|
2309
2326
|
const expr = evaluate(this.ast, record);
|
|
2310
2327
|
return matchDomain(record, expr);
|
|
@@ -2323,7 +2340,7 @@ var Domain = class _Domain {
|
|
|
2323
2340
|
return evaluatedAsList;
|
|
2324
2341
|
}
|
|
2325
2342
|
return this.toString();
|
|
2326
|
-
} catch {
|
|
2343
|
+
} catch (e) {
|
|
2327
2344
|
return this.toString();
|
|
2328
2345
|
}
|
|
2329
2346
|
}
|
|
@@ -2547,7 +2564,7 @@ var checkDomain = (context, domain) => {
|
|
|
2547
2564
|
};
|
|
2548
2565
|
var matchDomains = (context, domains) => {
|
|
2549
2566
|
if (Array.isArray(domains)) {
|
|
2550
|
-
if (domains
|
|
2567
|
+
if ((domains == null ? void 0 : domains.length) > 0) {
|
|
2551
2568
|
return domains && domains.some((domain) => checkDomain(context, domain));
|
|
2552
2569
|
}
|
|
2553
2570
|
} else return checkDomain(context, domains);
|
|
@@ -2564,15 +2581,17 @@ var evalJSONContext = (_context, context = {}) => {
|
|
|
2564
2581
|
}
|
|
2565
2582
|
};
|
|
2566
2583
|
var evalJSONDomain = (domain, context) => {
|
|
2584
|
+
var _a;
|
|
2567
2585
|
try {
|
|
2568
2586
|
if (context) {
|
|
2569
|
-
Object.keys(context)
|
|
2587
|
+
(_a = Object.keys(context)) == null ? void 0 : _a.forEach((key) => {
|
|
2588
|
+
var _a2, _b;
|
|
2570
2589
|
if (Array.isArray(context[key])) {
|
|
2571
|
-
const isTypeObject = context[key]
|
|
2572
|
-
(item) => typeof item === "object" && item !== null && item
|
|
2590
|
+
const isTypeObject = (_a2 = context[key]) == null ? void 0 : _a2.every(
|
|
2591
|
+
(item) => typeof item === "object" && item !== null && (item == null ? void 0 : item.id) !== void 0
|
|
2573
2592
|
);
|
|
2574
2593
|
if (isTypeObject) {
|
|
2575
|
-
context[key] = context[key]
|
|
2594
|
+
context[key] = (_b = context[key]) == null ? void 0 : _b.map((item) => item == null ? void 0 : item.id);
|
|
2576
2595
|
}
|
|
2577
2596
|
}
|
|
2578
2597
|
});
|
|
@@ -2592,7 +2611,7 @@ var formatSortingString = (input) => {
|
|
|
2592
2611
|
if (!input) return null;
|
|
2593
2612
|
return input.split(",").map((field) => {
|
|
2594
2613
|
const [key, order] = field.trim().split(/\s+/);
|
|
2595
|
-
const sortOrder = order
|
|
2614
|
+
const sortOrder = (order == null ? void 0 : order.toUpperCase()) === "DESC" ? "DESC" : "ASC";
|
|
2596
2615
|
return `${key} ${sortOrder}`;
|
|
2597
2616
|
}).join(", ");
|
|
2598
2617
|
};
|
|
@@ -2636,11 +2655,11 @@ var getFieldsOnChange = (fields) => {
|
|
|
2636
2655
|
function traverse(items) {
|
|
2637
2656
|
for (const item of items) {
|
|
2638
2657
|
if (item) {
|
|
2639
|
-
if (item
|
|
2658
|
+
if ((item == null ? void 0 : item.type_co) === "field" && matchDomains(fields, item == null ? void 0 : item.on_change)) {
|
|
2640
2659
|
result.push(item.name);
|
|
2641
2660
|
}
|
|
2642
|
-
if (item
|
|
2643
|
-
traverse(item
|
|
2661
|
+
if ((item == null ? void 0 : item.fields) && Array.isArray(item == null ? void 0 : item.fields)) {
|
|
2662
|
+
traverse(item == null ? void 0 : item.fields);
|
|
2644
2663
|
}
|
|
2645
2664
|
}
|
|
2646
2665
|
}
|
|
@@ -2656,39 +2675,42 @@ var filterFieldDirty = ({
|
|
|
2656
2675
|
model,
|
|
2657
2676
|
defaultData
|
|
2658
2677
|
}) => {
|
|
2659
|
-
|
|
2678
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
2679
|
+
const data = id ? __spreadValues({}, dirtyFields) : __spreadValues({}, formValues);
|
|
2660
2680
|
for (const key in data) {
|
|
2661
|
-
if (viewData
|
|
2681
|
+
if (((_c = (_b = (_a = viewData == null ? void 0 : viewData.models) == null ? void 0 : _a[model]) == null ? void 0 : _b[key]) == null ? void 0 : _c.type) === "one2many" /* ONE2MANY */) {
|
|
2662
2682
|
const lineData = [];
|
|
2663
|
-
(formValues[key]
|
|
2664
|
-
|
|
2665
|
-
|
|
2683
|
+
((_d = formValues[key]) != null ? _d : []).forEach((itemData, index) => {
|
|
2684
|
+
var _a2, _b2, _c2, _d2;
|
|
2685
|
+
if (typeof (itemData == null ? void 0 : itemData.id) === "string" && (itemData == null ? void 0 : itemData.id.includes("virtual"))) {
|
|
2686
|
+
itemData == null ? true : delete itemData.id;
|
|
2666
2687
|
}
|
|
2667
|
-
if (!itemData
|
|
2688
|
+
if (!(itemData == null ? void 0 : itemData.id)) {
|
|
2668
2689
|
lineData.push([
|
|
2669
2690
|
0 /* CREATE */,
|
|
2670
2691
|
`virtual_${index}`,
|
|
2671
2692
|
filterFieldDirty({
|
|
2672
|
-
id: itemData
|
|
2693
|
+
id: itemData == null ? void 0 : itemData.id,
|
|
2673
2694
|
viewData,
|
|
2674
2695
|
formValues: itemData,
|
|
2675
2696
|
dirtyFields: {},
|
|
2676
|
-
model: viewData
|
|
2697
|
+
model: (_c2 = (_b2 = (_a2 = viewData == null ? void 0 : viewData.models) == null ? void 0 : _a2[model]) == null ? void 0 : _b2[key]) == null ? void 0 : _c2.relation,
|
|
2677
2698
|
defaultData
|
|
2678
2699
|
})
|
|
2679
2700
|
]);
|
|
2680
|
-
} else if (dirtyFields[key]
|
|
2701
|
+
} else if ((_d2 = dirtyFields[key]) == null ? void 0 : _d2.length) {
|
|
2681
2702
|
dirtyFields[key].forEach((itemDirty, indexDirty) => {
|
|
2703
|
+
var _a3, _b3, _c3;
|
|
2682
2704
|
if (Object.values(itemDirty).includes(true) && indexDirty === index) {
|
|
2683
2705
|
lineData.push([
|
|
2684
2706
|
1 /* UPDATE */,
|
|
2685
|
-
itemData
|
|
2707
|
+
itemData == null ? void 0 : itemData.id,
|
|
2686
2708
|
filterFieldDirty({
|
|
2687
|
-
id: itemData
|
|
2709
|
+
id: itemData == null ? void 0 : itemData.id,
|
|
2688
2710
|
viewData,
|
|
2689
2711
|
formValues: itemData,
|
|
2690
2712
|
dirtyFields: itemDirty,
|
|
2691
|
-
model: viewData
|
|
2713
|
+
model: (_c3 = (_b3 = (_a3 = viewData == null ? void 0 : viewData.models) == null ? void 0 : _a3[model]) == null ? void 0 : _b3[key]) == null ? void 0 : _c3.relation,
|
|
2692
2714
|
defaultData: {}
|
|
2693
2715
|
})
|
|
2694
2716
|
]);
|
|
@@ -2696,37 +2718,39 @@ var filterFieldDirty = ({
|
|
|
2696
2718
|
});
|
|
2697
2719
|
}
|
|
2698
2720
|
});
|
|
2699
|
-
(defaultData[key]
|
|
2700
|
-
|
|
2701
|
-
|
|
2721
|
+
((_e = defaultData[key]) != null ? _e : []).forEach((item) => {
|
|
2722
|
+
var _a2;
|
|
2723
|
+
if (!((_a2 = formValues[key]) != null ? _a2 : []).find(
|
|
2724
|
+
(itemData) => (itemData == null ? void 0 : itemData.id) === (item == null ? void 0 : item.id)
|
|
2702
2725
|
)) {
|
|
2703
|
-
lineData.push([2 /* DELETE */, item
|
|
2726
|
+
lineData.push([2 /* DELETE */, item == null ? void 0 : item.id, item]);
|
|
2704
2727
|
}
|
|
2705
2728
|
});
|
|
2706
2729
|
data[key] = lineData;
|
|
2707
|
-
} else if (viewData
|
|
2730
|
+
} else if (((_h = (_g = (_f = viewData == null ? void 0 : viewData.models) == null ? void 0 : _f[model]) == null ? void 0 : _g[key]) == null ? void 0 : _h.type) === "many2many" /* MANY2MANY */) {
|
|
2708
2731
|
const lineData = [];
|
|
2709
2732
|
(formValues[key] || []).forEach((itemData) => {
|
|
2710
|
-
if (itemData
|
|
2711
|
-
lineData.push([4 /* NO_CHANGE */, itemData
|
|
2733
|
+
if (itemData == null ? void 0 : itemData.id) {
|
|
2734
|
+
lineData.push([4 /* NO_CHANGE */, itemData == null ? void 0 : itemData.id]);
|
|
2712
2735
|
}
|
|
2713
2736
|
});
|
|
2714
|
-
(defaultData[key]
|
|
2715
|
-
|
|
2716
|
-
|
|
2737
|
+
((_i = defaultData[key]) != null ? _i : []).forEach((item) => {
|
|
2738
|
+
var _a2;
|
|
2739
|
+
if (!((_a2 = formValues[key]) != null ? _a2 : []).find(
|
|
2740
|
+
(itemData) => (itemData == null ? void 0 : itemData.id) === (item == null ? void 0 : item.id)
|
|
2717
2741
|
)) {
|
|
2718
|
-
lineData.push([3 /* UNLINK */, item
|
|
2742
|
+
lineData.push([3 /* UNLINK */, item == null ? void 0 : item.id]);
|
|
2719
2743
|
}
|
|
2720
2744
|
});
|
|
2721
2745
|
data[key] = lineData;
|
|
2722
2746
|
} else {
|
|
2723
|
-
if (id && (typeof dirtyFields
|
|
2747
|
+
if (id && (typeof (dirtyFields == null ? void 0 : dirtyFields[key]) === "object" && !((_j = dirtyFields == null ? void 0 : dirtyFields[key]) == null ? void 0 : _j.id) || typeof dirtyFields[key] !== "object" && !dirtyFields[key])) {
|
|
2724
2748
|
delete data[key];
|
|
2725
2749
|
} else {
|
|
2726
2750
|
if (!data[key]) {
|
|
2727
2751
|
delete data[key];
|
|
2728
2752
|
} else {
|
|
2729
|
-
data[key] = formValues
|
|
2753
|
+
data[key] = ((_k = formValues == null ? void 0 : formValues[key]) == null ? void 0 : _k.display_name) ? (_l = formValues == null ? void 0 : formValues[key]) == null ? void 0 : _l.id : formValues == null ? void 0 : formValues[key];
|
|
2730
2754
|
}
|
|
2731
2755
|
}
|
|
2732
2756
|
}
|
|
@@ -2735,15 +2759,12 @@ var filterFieldDirty = ({
|
|
|
2735
2759
|
};
|
|
2736
2760
|
var mergeObjects = (object1, object2) => {
|
|
2737
2761
|
if (!object1 || !object2) return void 0;
|
|
2738
|
-
const mergedObject = {
|
|
2762
|
+
const mergedObject = __spreadValues({}, object2);
|
|
2739
2763
|
Object.keys(object1).forEach((key) => {
|
|
2740
2764
|
if (Array.isArray(object1[key]) && Array.isArray(object2[key])) {
|
|
2741
2765
|
mergedObject[key] = object2[key].map((item, index) => {
|
|
2742
2766
|
if (object1[key][index]) {
|
|
2743
|
-
return {
|
|
2744
|
-
...item,
|
|
2745
|
-
...object1[key][index]
|
|
2746
|
-
};
|
|
2767
|
+
return __spreadValues(__spreadValues({}, item), object1[key][index]);
|
|
2747
2768
|
}
|
|
2748
2769
|
return item;
|
|
2749
2770
|
});
|
|
@@ -2785,14 +2806,15 @@ var removeUndefinedFields = (obj) => {
|
|
|
2785
2806
|
return newObj;
|
|
2786
2807
|
};
|
|
2787
2808
|
var useTabModel = (viewData, onchangeData) => {
|
|
2788
|
-
|
|
2809
|
+
var _a, _b, _c;
|
|
2810
|
+
const tabsData = ((_c = (_b = (_a = viewData == null ? void 0 : viewData.views) == null ? void 0 : _a.form) == null ? void 0 : _b.tabs) == null ? void 0 : _c.filter((val) => {
|
|
2789
2811
|
if (!val) return null;
|
|
2790
2812
|
const hide = checkDomain(onchangeData, val.invisible);
|
|
2791
2813
|
if (!hide) {
|
|
2792
2814
|
return val;
|
|
2793
2815
|
}
|
|
2794
2816
|
return false;
|
|
2795
|
-
}) || [];
|
|
2817
|
+
})) || [];
|
|
2796
2818
|
return tabsData;
|
|
2797
2819
|
};
|
|
2798
2820
|
var isBase64File = (str) => {
|
|
@@ -2833,7 +2855,7 @@ var formatFileSize = (size) => {
|
|
|
2833
2855
|
return `${(size / Math.pow(1024, i)).toFixed(2)} ${sizes[i]}`;
|
|
2834
2856
|
};
|
|
2835
2857
|
var getSubdomain = (url = window.location.href) => {
|
|
2836
|
-
const parts = url
|
|
2858
|
+
const parts = url == null ? void 0 : url.split(".");
|
|
2837
2859
|
if (parts.length > 2) {
|
|
2838
2860
|
return parts[0].replace("https://", "").replace("http://", "");
|
|
2839
2861
|
}
|
|
@@ -2856,9 +2878,9 @@ var getOffSet = (arr, start, end) => {
|
|
|
2856
2878
|
}
|
|
2857
2879
|
return arr.slice(0, start).length;
|
|
2858
2880
|
};
|
|
2859
|
-
var copyTextToClipboard =
|
|
2881
|
+
var copyTextToClipboard = (text) => __async(null, null, function* () {
|
|
2860
2882
|
if ("clipboard" in navigator) {
|
|
2861
|
-
return
|
|
2883
|
+
return yield navigator.clipboard.writeText(text);
|
|
2862
2884
|
} else {
|
|
2863
2885
|
const textArea = document.createElement("textarea");
|
|
2864
2886
|
textArea.value = text;
|
|
@@ -2872,7 +2894,7 @@ var copyTextToClipboard = async (text) => {
|
|
|
2872
2894
|
document.body.removeChild(textArea);
|
|
2873
2895
|
}
|
|
2874
2896
|
}
|
|
2875
|
-
};
|
|
2897
|
+
});
|
|
2876
2898
|
var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
|
|
2877
2899
|
if (!originalRequest.data) return originalRequest.data;
|
|
2878
2900
|
if (typeof originalRequest.data === "string") {
|
|
@@ -2908,7 +2930,7 @@ var useField = (props) => {
|
|
|
2908
2930
|
index,
|
|
2909
2931
|
name
|
|
2910
2932
|
} = props;
|
|
2911
|
-
const nameField = rootField ? `${rootField
|
|
2933
|
+
const nameField = rootField ? `${rootField == null ? void 0 : rootField.name}.${index}.${name}` : null;
|
|
2912
2934
|
(0, import_react.useEffect)(() => {
|
|
2913
2935
|
if (onchangeData && Object.keys(onchangeData).length > 0) {
|
|
2914
2936
|
setRequired(
|