@fctc/edu-logic-lib 1.2.0 → 1.2.2
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/chunk-3VUHHO7T.mjs +1 -0
- package/dist/chunk-4HCNCH3K.mjs +1 -0
- package/dist/chunk-4WC7TEQB.mjs +2 -0
- package/dist/chunk-6QAALOXO.mjs +6 -0
- package/dist/chunk-AT7T7PUJ.mjs +1 -0
- package/dist/chunk-CDLT5L7M.mjs +1 -0
- package/dist/chunk-GHOANIO5.mjs +1 -0
- package/dist/chunk-QKRSQCY2.mjs +1 -0
- package/dist/chunk-TWFPZEDT.mjs +1 -0
- package/dist/chunk-UBGANIIB.mjs +1 -0
- package/dist/chunk-WAXGOBY2.mjs +0 -1
- package/dist/chunk-ZC4WZW6I.mjs +1 -0
- package/dist/config.mjs +1 -2
- package/dist/constants.mjs +1 -2
- package/dist/environment.mjs +1 -4
- package/dist/hooks.mjs +1 -9
- package/dist/index.d.mts +0 -1
- package/dist/index.mjs +1 -12
- package/dist/models.mjs +1 -9
- package/dist/provider.d.mts +3 -4
- package/dist/provider.mjs +1 -8
- package/dist/services.mjs +1 -7
- package/dist/store.mjs +1 -1
- package/dist/types.mjs +1 -1
- package/dist/utils.mjs +1 -1
- package/package.json +79 -90
- package/dist/base-model-type-DvO53Lwi.d.ts +0 -7
- package/dist/chunk-227GQM56.mjs +0 -295
- package/dist/chunk-3B6NWGPJ.js +0 -303
- package/dist/chunk-3GSWPBI3.js +0 -122
- package/dist/chunk-56VJGYA5.js +0 -66
- package/dist/chunk-5CWLH3IT.js +0 -635
- package/dist/chunk-A3OMRS6W.mjs +0 -62
- package/dist/chunk-GGNOJ77I.js +0 -2
- package/dist/chunk-HDWNBT3C.mjs +0 -120
- package/dist/chunk-IGSNXETE.mjs +0 -85
- package/dist/chunk-IXDDYGKE.js +0 -61
- package/dist/chunk-KYUV2PH4.mjs +0 -585
- package/dist/chunk-MLJQPO4Q.mjs +0 -57
- package/dist/chunk-MXBJCI62.mjs +0 -2344
- package/dist/chunk-ODQQQ7WA.js +0 -94
- package/dist/chunk-QLUONJPQ.mjs +0 -519
- package/dist/chunk-QMO7DJNI.mjs +0 -1059
- package/dist/chunk-QYYFZUNV.mjs +0 -90
- package/dist/chunk-RZBHZYXG.js +0 -582
- package/dist/chunk-TT2ZKGNO.mjs +0 -29
- package/dist/chunk-UHYQ7IVO.js +0 -32
- package/dist/chunk-UY632SGY.js +0 -2362
- package/dist/chunk-UYN3VSHW.js +0 -95
- package/dist/chunk-ZAYNNN2Q.js +0 -1068
- package/dist/config.d.ts +0 -15
- package/dist/config.js +0 -11
- package/dist/constants.d.ts +0 -120
- package/dist/constants.js +0 -55
- package/dist/context-type-D5XefoL-.d.ts +0 -8
- package/dist/environment.d.ts +0 -54
- package/dist/environment.js +0 -25
- package/dist/hooks.d.ts +0 -218
- package/dist/hooks.js +0 -194
- package/dist/index-C_nK1Mii.d.ts +0 -19
- package/dist/index.d.ts +0 -23
- package/dist/index.js +0 -629
- package/dist/models.d.ts +0 -35
- package/dist/models.js +0 -26
- package/dist/provider.d.ts +0 -16
- package/dist/provider.js +0 -25
- package/dist/services.d.ts +0 -160
- package/dist/services.js +0 -44
- package/dist/store.d.ts +0 -505
- package/dist/store.js +0 -254
- package/dist/types.d.ts +0 -12
- package/dist/types.js +0 -4
- package/dist/use-get-selection-DFh6sc49.d.ts +0 -26
- package/dist/utils.d.ts +0 -52
- package/dist/utils.js +0 -66
- package/dist/view-type-BTzRpkT7.d.ts +0 -106
package/dist/chunk-3GSWPBI3.js
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkUYN3VSHW_js = require('./chunk-UYN3VSHW.js');
|
|
4
|
-
|
|
5
|
-
// src/models/base-model/index.ts
|
|
6
|
-
var BaseModel = class {
|
|
7
|
-
name;
|
|
8
|
-
view;
|
|
9
|
-
actContext;
|
|
10
|
-
fields;
|
|
11
|
-
constructor(init) {
|
|
12
|
-
this.name = init.name;
|
|
13
|
-
this.view = init.view;
|
|
14
|
-
this.actContext = init.actContext;
|
|
15
|
-
this.fields = init.fields;
|
|
16
|
-
}
|
|
17
|
-
getSpecificationByFields({
|
|
18
|
-
fields = [],
|
|
19
|
-
specification = {},
|
|
20
|
-
modelsData,
|
|
21
|
-
model,
|
|
22
|
-
modelRoot
|
|
23
|
-
}) {
|
|
24
|
-
if (Array.isArray(fields)) {
|
|
25
|
-
let spec = { ...specification };
|
|
26
|
-
fields.forEach((field) => {
|
|
27
|
-
if (!field?.type_co || field?.name && field?.type_co === "field" /* FIELD */) {
|
|
28
|
-
if (modelsData?.[model]?.[field?.name]) {
|
|
29
|
-
if (modelsData?.[model]?.[field?.name]?.type === "one2many" /* ONE2MANY */ || modelsData?.[model]?.[field?.name]?.type === "many2many" /* MANY2MANY */) {
|
|
30
|
-
const relation = modelsData?.[model]?.[field?.name]?.relation;
|
|
31
|
-
const modelRelation = modelsData?.[relation];
|
|
32
|
-
if (modelRelation) {
|
|
33
|
-
spec[field?.name] = {
|
|
34
|
-
fields: {}
|
|
35
|
-
};
|
|
36
|
-
if (modelRoot && modelRoot === relation) {
|
|
37
|
-
spec[field?.name].fields = { id: {} };
|
|
38
|
-
} else {
|
|
39
|
-
spec[field?.name].fields = this.getSpecificationByFields({
|
|
40
|
-
fields: Object.values(modelRelation),
|
|
41
|
-
specification: {},
|
|
42
|
-
modelsData,
|
|
43
|
-
model: relation,
|
|
44
|
-
modelRoot: model
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
} else {
|
|
48
|
-
spec[field?.name] = {
|
|
49
|
-
fields: {
|
|
50
|
-
id: {},
|
|
51
|
-
display_name: {}
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
} else if (modelsData?.[model]?.[field?.name]?.type === "many2one" /* MANY2ONE */) {
|
|
56
|
-
spec[field?.name] = {
|
|
57
|
-
fields: {
|
|
58
|
-
id: {},
|
|
59
|
-
display_name: {},
|
|
60
|
-
...chunkUYN3VSHW_js.WIDGETAVATAR[field?.widget] ? { image_256: {} } : {},
|
|
61
|
-
...field?.name === "currency_id" && fields?.find((item) => item?.widget === "monetary") ? { symbol: {} } : {},
|
|
62
|
-
...field?.widget === "many2many_binary" ? { mimetype: {} } : {}
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
} else {
|
|
66
|
-
spec[field?.name] = {};
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
} else if (field?.type_co === "group" /* GROUP */ || field?.type_co === "div" /* DIV */ || field?.type_co === "span" /* SPAN */) {
|
|
70
|
-
const specGroup = this.getSpecificationByFields({
|
|
71
|
-
fields: field?.fields,
|
|
72
|
-
specification: spec,
|
|
73
|
-
modelsData,
|
|
74
|
-
model
|
|
75
|
-
});
|
|
76
|
-
spec = { ...spec, ...specGroup };
|
|
77
|
-
} else if (field?.type_co === "tree" /* TREE */ || field?.type_co === "list" /* LIST */) {
|
|
78
|
-
const relation = modelsData?.[model]?.[field?.name]?.relation;
|
|
79
|
-
const specTreee = this.getSpecificationByFields({
|
|
80
|
-
fields: field?.fields,
|
|
81
|
-
specification: {},
|
|
82
|
-
modelsData,
|
|
83
|
-
model: relation,
|
|
84
|
-
modelRoot: model
|
|
85
|
-
});
|
|
86
|
-
spec = {
|
|
87
|
-
...spec,
|
|
88
|
-
[field?.name]: {
|
|
89
|
-
fields: { ...spec?.[field?.name]?.fields, ...specTreee }
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
return spec;
|
|
95
|
-
} else {
|
|
96
|
-
console.warn("fields is not array");
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
getTreeProps() {
|
|
100
|
-
const props = this.view?.views?.list || {};
|
|
101
|
-
return props;
|
|
102
|
-
}
|
|
103
|
-
getTreeFields() {
|
|
104
|
-
const fields = this.view?.views?.list?.fields || [];
|
|
105
|
-
return fields;
|
|
106
|
-
}
|
|
107
|
-
getSpecification() {
|
|
108
|
-
const specInit = {};
|
|
109
|
-
const modelData = this.view?.models || {};
|
|
110
|
-
const specification = this.getSpecificationByFields({
|
|
111
|
-
fields: this.fields,
|
|
112
|
-
specification: specInit,
|
|
113
|
-
modelsData: modelData,
|
|
114
|
-
model: this.name,
|
|
115
|
-
modelRoot: ""
|
|
116
|
-
});
|
|
117
|
-
return specification;
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
var base_model_default = BaseModel;
|
|
121
|
-
|
|
122
|
-
exports.base_model_default = base_model_default;
|
package/dist/chunk-56VJGYA5.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkZAYNNN2Q_js = require('./chunk-ZAYNNN2Q.js');
|
|
4
|
-
var chunkRZBHZYXG_js = require('./chunk-RZBHZYXG.js');
|
|
5
|
-
var react = require('react');
|
|
6
|
-
var reactQuery = require('@tanstack/react-query');
|
|
7
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
-
var reactRedux = require('react-redux');
|
|
9
|
-
|
|
10
|
-
var ReactQueryProvider = ({ children }) => {
|
|
11
|
-
const [queryClient] = react.useState(
|
|
12
|
-
() => new reactQuery.QueryClient({
|
|
13
|
-
defaultOptions: {
|
|
14
|
-
queries: {
|
|
15
|
-
refetchOnWindowFocus: false,
|
|
16
|
-
refetchOnMount: false,
|
|
17
|
-
refetchOnReconnect: false,
|
|
18
|
-
retry: false
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
})
|
|
22
|
-
);
|
|
23
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children });
|
|
24
|
-
};
|
|
25
|
-
var ReduxProvider = ({ children }) => {
|
|
26
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactRedux.Provider, { store: chunkRZBHZYXG_js.envStore, children });
|
|
27
|
-
};
|
|
28
|
-
var MainProvider = ({ children }) => {
|
|
29
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ReduxProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(ReactQueryProvider, { children }) });
|
|
30
|
-
};
|
|
31
|
-
var VersionGate = ({ children }) => {
|
|
32
|
-
const queryClient = reactQuery.useQueryClient();
|
|
33
|
-
const [ready, setReady] = react.useState(false);
|
|
34
|
-
react.useEffect(() => {
|
|
35
|
-
const clearVersion = () => {
|
|
36
|
-
queryClient.clear();
|
|
37
|
-
localStorage.removeItem("__api_version__");
|
|
38
|
-
};
|
|
39
|
-
const validateVersion = async () => {
|
|
40
|
-
const serverVersion = await chunkZAYNNN2Q_js.view_service_default.getVersion();
|
|
41
|
-
const cached = localStorage.getItem("__api_version__");
|
|
42
|
-
if (cached !== serverVersion?.api_version) {
|
|
43
|
-
clearVersion();
|
|
44
|
-
localStorage.setItem("__api_version__", serverVersion?.api_version);
|
|
45
|
-
} else {
|
|
46
|
-
console.log("Api version:", serverVersion?.api_version);
|
|
47
|
-
}
|
|
48
|
-
setReady(true);
|
|
49
|
-
};
|
|
50
|
-
validateVersion();
|
|
51
|
-
if (typeof window !== "undefined") {
|
|
52
|
-
const onKey = (e) => {
|
|
53
|
-
const key = e.key.toLowerCase();
|
|
54
|
-
const isHardRefresh = (key === "f5" || key === "r") && e.ctrlKey && (key !== "r" || e.shiftKey) || key === "r" && e.metaKey && e.shiftKey || key === "r" && e.metaKey && e.altKey;
|
|
55
|
-
if (isHardRefresh) clearVersion();
|
|
56
|
-
};
|
|
57
|
-
window.addEventListener("keydown", onKey);
|
|
58
|
-
return () => window.removeEventListener("keydown", onKey);
|
|
59
|
-
}
|
|
60
|
-
}, [queryClient]);
|
|
61
|
-
return ready ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children }) : null;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
exports.MainProvider = MainProvider;
|
|
65
|
-
exports.ReactQueryProvider = ReactQueryProvider;
|
|
66
|
-
exports.VersionGate = VersionGate;
|