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