@fctc/interface-logic 1.2.10 → 1.3.1
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.d.mts +15 -0
- package/dist/configs.d.ts +15 -0
- package/dist/{config.js → configs.js} +4 -4
- package/dist/constants.d.mts +131 -0
- package/dist/constants.d.ts +131 -0
- package/dist/environment.d.mts +55 -0
- package/dist/environment.d.ts +55 -0
- package/dist/hooks.d.mts +340 -0
- package/dist/hooks.d.ts +340 -0
- package/dist/index-C_nK1Mii.d.mts +19 -0
- package/dist/index-C_nK1Mii.d.ts +19 -0
- package/dist/models.d.mts +34 -0
- package/dist/models.d.ts +34 -0
- package/dist/{model.js → models.js} +124 -128
- package/dist/{model.mjs → models.mjs} +120 -123
- package/dist/provider.d.mts +15 -0
- package/dist/provider.d.ts +15 -0
- package/dist/services.d.mts +255 -0
- package/dist/services.d.ts +255 -0
- package/dist/store.d.mts +643 -0
- package/dist/store.d.ts +643 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.d.ts +2 -0
- package/dist/utils.d.mts +93 -0
- package/dist/utils.d.ts +93 -0
- package/dist/utils.js +0 -41
- package/dist/utils.mjs +0 -39
- package/dist/view-type-mROO2TFx.d.mts +100 -0
- package/dist/view-type-mROO2TFx.d.ts +100 -0
- package/package.json +10 -11
- package/dist/index.d.mts +0 -1709
- package/dist/index.d.ts +0 -1709
- package/dist/index.js +0 -7249
- package/dist/index.mjs +0 -7001
- /package/dist/{config.mjs → configs.mjs} +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface BaseModelInit {
|
|
2
|
+
name: string;
|
|
3
|
+
view: Record<string, any>;
|
|
4
|
+
actContext?: Record<string, any>;
|
|
5
|
+
fields?: any;
|
|
6
|
+
}
|
|
7
|
+
declare class BaseModel {
|
|
8
|
+
name: string;
|
|
9
|
+
view: Record<string, any>;
|
|
10
|
+
actContext?: Record<string, any>;
|
|
11
|
+
fields?: any;
|
|
12
|
+
constructor(init: BaseModelInit);
|
|
13
|
+
private getSpecificationByFields;
|
|
14
|
+
getTreeProps(): Record<string, any>;
|
|
15
|
+
getTreeFields(): Record<string, any>[];
|
|
16
|
+
getSpecification(): Record<string, any>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { BaseModel as B, type BaseModelInit as a };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { B as BaseModel, a as BaseModelInit } from './index-C_nK1Mii.mjs';
|
|
2
|
+
|
|
3
|
+
interface CompanyData {
|
|
4
|
+
id?: number;
|
|
5
|
+
name?: string;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
interface CompanyResponse {
|
|
9
|
+
data: CompanyData;
|
|
10
|
+
status: number;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
declare class CompanyModel extends BaseModel {
|
|
14
|
+
constructor(init: BaseModelInit);
|
|
15
|
+
getCurrentCompany(): Promise<CompanyResponse>;
|
|
16
|
+
getUserCompany(id: number): Promise<CompanyResponse>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface UserData {
|
|
20
|
+
id?: number;
|
|
21
|
+
name?: string;
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}
|
|
24
|
+
interface UserResponse {
|
|
25
|
+
data: UserData;
|
|
26
|
+
status: number;
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}
|
|
29
|
+
declare class UserModel extends BaseModel {
|
|
30
|
+
constructor(init: BaseModelInit);
|
|
31
|
+
getProfile(): Promise<UserResponse>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { CompanyModel, UserModel };
|
package/dist/models.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { B as BaseModel, a as BaseModelInit } from './index-C_nK1Mii.js';
|
|
2
|
+
|
|
3
|
+
interface CompanyData {
|
|
4
|
+
id?: number;
|
|
5
|
+
name?: string;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
interface CompanyResponse {
|
|
9
|
+
data: CompanyData;
|
|
10
|
+
status: number;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
declare class CompanyModel extends BaseModel {
|
|
14
|
+
constructor(init: BaseModelInit);
|
|
15
|
+
getCurrentCompany(): Promise<CompanyResponse>;
|
|
16
|
+
getUserCompany(id: number): Promise<CompanyResponse>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface UserData {
|
|
20
|
+
id?: number;
|
|
21
|
+
name?: string;
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}
|
|
24
|
+
interface UserResponse {
|
|
25
|
+
data: UserData;
|
|
26
|
+
status: number;
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}
|
|
29
|
+
declare class UserModel extends BaseModel {
|
|
30
|
+
constructor(init: BaseModelInit);
|
|
31
|
+
getProfile(): Promise<UserResponse>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { CompanyModel, UserModel };
|
|
@@ -27,14 +27,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
|
-
// src/
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
UserModel: () => user_model_default
|
|
30
|
+
// src/models.ts
|
|
31
|
+
var models_exports = {};
|
|
32
|
+
__export(models_exports, {
|
|
33
|
+
CompanyModel: () => CompanyModel,
|
|
34
|
+
UserModel: () => UserModel
|
|
36
35
|
});
|
|
37
|
-
module.exports = __toCommonJS(
|
|
36
|
+
module.exports = __toCommonJS(models_exports);
|
|
38
37
|
|
|
39
38
|
// src/constants/api/uri-constant.ts
|
|
40
39
|
var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
|
|
@@ -66,6 +65,12 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
|
|
|
66
65
|
return UriConstants2;
|
|
67
66
|
})(UriConstants || {});
|
|
68
67
|
|
|
68
|
+
// src/configs/axios-client.ts
|
|
69
|
+
var import_axios = __toESM(require("axios"));
|
|
70
|
+
|
|
71
|
+
// src/utils/format.ts
|
|
72
|
+
var import_moment = __toESM(require("moment"));
|
|
73
|
+
|
|
69
74
|
// src/constants/widget/widget-avatar-constant.ts
|
|
70
75
|
var WIDGETAVATAR = /* @__PURE__ */ ((WIDGETAVATAR2) => {
|
|
71
76
|
WIDGETAVATAR2["many2one_avatar_user"] = "many2one_avatar_user";
|
|
@@ -73,124 +78,6 @@ var WIDGETAVATAR = /* @__PURE__ */ ((WIDGETAVATAR2) => {
|
|
|
73
78
|
return WIDGETAVATAR2;
|
|
74
79
|
})(WIDGETAVATAR || {});
|
|
75
80
|
|
|
76
|
-
// src/models/base-model/index.ts
|
|
77
|
-
var BaseModel = class {
|
|
78
|
-
name;
|
|
79
|
-
view;
|
|
80
|
-
actContext;
|
|
81
|
-
fields;
|
|
82
|
-
constructor(init) {
|
|
83
|
-
this.name = init.name;
|
|
84
|
-
this.view = init.view;
|
|
85
|
-
this.actContext = init.actContext;
|
|
86
|
-
this.fields = init.fields;
|
|
87
|
-
}
|
|
88
|
-
getSpecificationByFields({
|
|
89
|
-
fields = [],
|
|
90
|
-
specification = {},
|
|
91
|
-
modelsData,
|
|
92
|
-
model,
|
|
93
|
-
modelRoot
|
|
94
|
-
}) {
|
|
95
|
-
if (Array.isArray(fields)) {
|
|
96
|
-
let spec = { ...specification };
|
|
97
|
-
fields.forEach((field) => {
|
|
98
|
-
if (!field?.type_co || field?.name && field?.type_co === "field" /* FIELD */) {
|
|
99
|
-
if (modelsData?.[model]?.[field?.name]) {
|
|
100
|
-
if (modelsData?.[model]?.[field?.name]?.type === "one2many" /* ONE2MANY */ || modelsData?.[model]?.[field?.name]?.type === "many2many" /* MANY2MANY */) {
|
|
101
|
-
const relation = modelsData?.[model]?.[field?.name]?.relation;
|
|
102
|
-
const modelRelation = modelsData?.[relation];
|
|
103
|
-
if (modelRelation) {
|
|
104
|
-
spec[field?.name] = {
|
|
105
|
-
fields: {}
|
|
106
|
-
};
|
|
107
|
-
if (modelRoot && modelRoot === relation) {
|
|
108
|
-
spec[field?.name].fields = { id: {} };
|
|
109
|
-
} else {
|
|
110
|
-
spec[field?.name].fields = this.getSpecificationByFields({
|
|
111
|
-
fields: Object.values(modelRelation),
|
|
112
|
-
specification: {},
|
|
113
|
-
modelsData,
|
|
114
|
-
model: relation,
|
|
115
|
-
modelRoot: model
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
} else {
|
|
119
|
-
spec[field?.name] = {
|
|
120
|
-
fields: {
|
|
121
|
-
id: {},
|
|
122
|
-
display_name: {}
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
} else if (modelsData?.[model]?.[field?.name]?.type === "many2one" /* MANY2ONE */) {
|
|
127
|
-
spec[field?.name] = {
|
|
128
|
-
fields: {
|
|
129
|
-
id: {},
|
|
130
|
-
display_name: {},
|
|
131
|
-
...WIDGETAVATAR[field?.widget] ? { image_256: {} } : {},
|
|
132
|
-
...field?.name === "currency_id" && fields?.find((item) => item?.widget === "monetary") ? { symbol: {} } : {},
|
|
133
|
-
...field?.widget === "many2many_binary" ? { mimetype: {} } : {}
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
} else {
|
|
137
|
-
spec[field?.name] = {};
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
} else if (field?.type_co === "group" /* GROUP */ || field?.type_co === "div" /* DIV */ || field?.type_co === "span" /* SPAN */) {
|
|
141
|
-
const specGroup = this.getSpecificationByFields({
|
|
142
|
-
fields: field?.fields,
|
|
143
|
-
specification: spec,
|
|
144
|
-
modelsData,
|
|
145
|
-
model
|
|
146
|
-
});
|
|
147
|
-
spec = { ...spec, ...specGroup };
|
|
148
|
-
} else if (field?.type_co === "tree" /* TREE */ || field?.type_co === "list" /* LIST */) {
|
|
149
|
-
const relation = modelsData?.[model]?.[field?.name]?.relation;
|
|
150
|
-
const specTreee = this.getSpecificationByFields({
|
|
151
|
-
fields: field?.fields,
|
|
152
|
-
specification: {},
|
|
153
|
-
modelsData,
|
|
154
|
-
model: relation,
|
|
155
|
-
modelRoot: model
|
|
156
|
-
});
|
|
157
|
-
spec = { ...spec, [field?.name]: { fields: specTreee } };
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
return spec;
|
|
161
|
-
} else {
|
|
162
|
-
console.warn("fields is not array");
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
getTreeProps() {
|
|
166
|
-
const props = this.view?.views?.list || {};
|
|
167
|
-
return props;
|
|
168
|
-
}
|
|
169
|
-
getTreeFields() {
|
|
170
|
-
const fields = this.view?.views?.list?.fields || [];
|
|
171
|
-
return fields;
|
|
172
|
-
}
|
|
173
|
-
getSpecification() {
|
|
174
|
-
const specInit = {};
|
|
175
|
-
const modelData = this.view?.models || {};
|
|
176
|
-
const specification = this.getSpecificationByFields({
|
|
177
|
-
fields: this.fields,
|
|
178
|
-
specification: specInit,
|
|
179
|
-
modelsData: modelData,
|
|
180
|
-
model: this.name,
|
|
181
|
-
modelRoot: ""
|
|
182
|
-
});
|
|
183
|
-
return specification;
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
var base_model_default = BaseModel;
|
|
187
|
-
|
|
188
|
-
// src/configs/axios-client.ts
|
|
189
|
-
var import_axios = __toESM(require("axios"));
|
|
190
|
-
|
|
191
|
-
// src/utils/format.ts
|
|
192
|
-
var import_moment = __toESM(require("moment"));
|
|
193
|
-
|
|
194
81
|
// src/utils/domain/py_tokenizer.ts
|
|
195
82
|
var TokenizerError = class extends Error {
|
|
196
83
|
};
|
|
@@ -3324,6 +3211,118 @@ var UserService = {
|
|
|
3324
3211
|
};
|
|
3325
3212
|
var user_service_default = UserService;
|
|
3326
3213
|
|
|
3214
|
+
// src/models/base-model/index.ts
|
|
3215
|
+
var BaseModel = class {
|
|
3216
|
+
name;
|
|
3217
|
+
view;
|
|
3218
|
+
actContext;
|
|
3219
|
+
fields;
|
|
3220
|
+
constructor(init) {
|
|
3221
|
+
this.name = init.name;
|
|
3222
|
+
this.view = init.view;
|
|
3223
|
+
this.actContext = init.actContext;
|
|
3224
|
+
this.fields = init.fields;
|
|
3225
|
+
}
|
|
3226
|
+
getSpecificationByFields({
|
|
3227
|
+
fields = [],
|
|
3228
|
+
specification = {},
|
|
3229
|
+
modelsData,
|
|
3230
|
+
model,
|
|
3231
|
+
modelRoot
|
|
3232
|
+
}) {
|
|
3233
|
+
if (Array.isArray(fields)) {
|
|
3234
|
+
let spec = { ...specification };
|
|
3235
|
+
fields.forEach((field) => {
|
|
3236
|
+
if (!field?.type_co || field?.name && field?.type_co === "field" /* FIELD */) {
|
|
3237
|
+
if (modelsData?.[model]?.[field?.name]) {
|
|
3238
|
+
if (modelsData?.[model]?.[field?.name]?.type === "one2many" /* ONE2MANY */ || modelsData?.[model]?.[field?.name]?.type === "many2many" /* MANY2MANY */) {
|
|
3239
|
+
const relation = modelsData?.[model]?.[field?.name]?.relation;
|
|
3240
|
+
const modelRelation = modelsData?.[relation];
|
|
3241
|
+
if (modelRelation) {
|
|
3242
|
+
spec[field?.name] = {
|
|
3243
|
+
fields: {}
|
|
3244
|
+
};
|
|
3245
|
+
if (modelRoot && modelRoot === relation) {
|
|
3246
|
+
spec[field?.name].fields = { id: {} };
|
|
3247
|
+
} else {
|
|
3248
|
+
spec[field?.name].fields = this.getSpecificationByFields({
|
|
3249
|
+
fields: Object.values(modelRelation),
|
|
3250
|
+
specification: {},
|
|
3251
|
+
modelsData,
|
|
3252
|
+
model: relation,
|
|
3253
|
+
modelRoot: model
|
|
3254
|
+
});
|
|
3255
|
+
}
|
|
3256
|
+
} else {
|
|
3257
|
+
spec[field?.name] = {
|
|
3258
|
+
fields: {
|
|
3259
|
+
id: {},
|
|
3260
|
+
display_name: {}
|
|
3261
|
+
}
|
|
3262
|
+
};
|
|
3263
|
+
}
|
|
3264
|
+
} else if (modelsData?.[model]?.[field?.name]?.type === "many2one" /* MANY2ONE */) {
|
|
3265
|
+
spec[field?.name] = {
|
|
3266
|
+
fields: {
|
|
3267
|
+
id: {},
|
|
3268
|
+
display_name: {},
|
|
3269
|
+
...WIDGETAVATAR[field?.widget] ? { image_256: {} } : {},
|
|
3270
|
+
...field?.name === "currency_id" && fields?.find((item) => item?.widget === "monetary") ? { symbol: {} } : {},
|
|
3271
|
+
...field?.widget === "many2many_binary" ? { mimetype: {} } : {}
|
|
3272
|
+
}
|
|
3273
|
+
};
|
|
3274
|
+
} else {
|
|
3275
|
+
spec[field?.name] = {};
|
|
3276
|
+
}
|
|
3277
|
+
}
|
|
3278
|
+
} else if (field?.type_co === "group" /* GROUP */ || field?.type_co === "div" /* DIV */ || field?.type_co === "span" /* SPAN */) {
|
|
3279
|
+
const specGroup = this.getSpecificationByFields({
|
|
3280
|
+
fields: field?.fields,
|
|
3281
|
+
specification: spec,
|
|
3282
|
+
modelsData,
|
|
3283
|
+
model
|
|
3284
|
+
});
|
|
3285
|
+
spec = { ...spec, ...specGroup };
|
|
3286
|
+
} else if (field?.type_co === "tree" /* TREE */ || field?.type_co === "list" /* LIST */) {
|
|
3287
|
+
const relation = modelsData?.[model]?.[field?.name]?.relation;
|
|
3288
|
+
const specTreee = this.getSpecificationByFields({
|
|
3289
|
+
fields: field?.fields,
|
|
3290
|
+
specification: {},
|
|
3291
|
+
modelsData,
|
|
3292
|
+
model: relation,
|
|
3293
|
+
modelRoot: model
|
|
3294
|
+
});
|
|
3295
|
+
spec = { ...spec, [field?.name]: { fields: specTreee } };
|
|
3296
|
+
}
|
|
3297
|
+
});
|
|
3298
|
+
return spec;
|
|
3299
|
+
} else {
|
|
3300
|
+
console.warn("fields is not array");
|
|
3301
|
+
}
|
|
3302
|
+
}
|
|
3303
|
+
getTreeProps() {
|
|
3304
|
+
const props = this.view?.views?.list || {};
|
|
3305
|
+
return props;
|
|
3306
|
+
}
|
|
3307
|
+
getTreeFields() {
|
|
3308
|
+
const fields = this.view?.views?.list?.fields || [];
|
|
3309
|
+
return fields;
|
|
3310
|
+
}
|
|
3311
|
+
getSpecification() {
|
|
3312
|
+
const specInit = {};
|
|
3313
|
+
const modelData = this.view?.models || {};
|
|
3314
|
+
const specification = this.getSpecificationByFields({
|
|
3315
|
+
fields: this.fields,
|
|
3316
|
+
specification: specInit,
|
|
3317
|
+
modelsData: modelData,
|
|
3318
|
+
model: this.name,
|
|
3319
|
+
modelRoot: ""
|
|
3320
|
+
});
|
|
3321
|
+
return specification;
|
|
3322
|
+
}
|
|
3323
|
+
};
|
|
3324
|
+
var base_model_default = BaseModel;
|
|
3325
|
+
|
|
3327
3326
|
// src/models/company-model/index.ts
|
|
3328
3327
|
var CompanyModel = class extends base_model_default {
|
|
3329
3328
|
constructor(init) {
|
|
@@ -3336,7 +3335,6 @@ var CompanyModel = class extends base_model_default {
|
|
|
3336
3335
|
return await company_service_default.getInfoCompany(id);
|
|
3337
3336
|
}
|
|
3338
3337
|
};
|
|
3339
|
-
var company_model_default = CompanyModel;
|
|
3340
3338
|
|
|
3341
3339
|
// src/models/user-model/index.ts
|
|
3342
3340
|
var UserModel = class extends base_model_default {
|
|
@@ -3347,10 +3345,8 @@ var UserModel = class extends base_model_default {
|
|
|
3347
3345
|
return await user_service_default.getProfile();
|
|
3348
3346
|
}
|
|
3349
3347
|
};
|
|
3350
|
-
var user_model_default = UserModel;
|
|
3351
3348
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3352
3349
|
0 && (module.exports = {
|
|
3353
|
-
BaseModel,
|
|
3354
3350
|
CompanyModel,
|
|
3355
3351
|
UserModel
|
|
3356
3352
|
});
|
|
@@ -28,6 +28,12 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
|
|
|
28
28
|
return UriConstants2;
|
|
29
29
|
})(UriConstants || {});
|
|
30
30
|
|
|
31
|
+
// src/configs/axios-client.ts
|
|
32
|
+
import axios from "axios";
|
|
33
|
+
|
|
34
|
+
// src/utils/format.ts
|
|
35
|
+
import moment from "moment";
|
|
36
|
+
|
|
31
37
|
// src/constants/widget/widget-avatar-constant.ts
|
|
32
38
|
var WIDGETAVATAR = /* @__PURE__ */ ((WIDGETAVATAR2) => {
|
|
33
39
|
WIDGETAVATAR2["many2one_avatar_user"] = "many2one_avatar_user";
|
|
@@ -35,124 +41,6 @@ var WIDGETAVATAR = /* @__PURE__ */ ((WIDGETAVATAR2) => {
|
|
|
35
41
|
return WIDGETAVATAR2;
|
|
36
42
|
})(WIDGETAVATAR || {});
|
|
37
43
|
|
|
38
|
-
// src/models/base-model/index.ts
|
|
39
|
-
var BaseModel = class {
|
|
40
|
-
name;
|
|
41
|
-
view;
|
|
42
|
-
actContext;
|
|
43
|
-
fields;
|
|
44
|
-
constructor(init) {
|
|
45
|
-
this.name = init.name;
|
|
46
|
-
this.view = init.view;
|
|
47
|
-
this.actContext = init.actContext;
|
|
48
|
-
this.fields = init.fields;
|
|
49
|
-
}
|
|
50
|
-
getSpecificationByFields({
|
|
51
|
-
fields = [],
|
|
52
|
-
specification = {},
|
|
53
|
-
modelsData,
|
|
54
|
-
model,
|
|
55
|
-
modelRoot
|
|
56
|
-
}) {
|
|
57
|
-
if (Array.isArray(fields)) {
|
|
58
|
-
let spec = { ...specification };
|
|
59
|
-
fields.forEach((field) => {
|
|
60
|
-
if (!field?.type_co || field?.name && field?.type_co === "field" /* FIELD */) {
|
|
61
|
-
if (modelsData?.[model]?.[field?.name]) {
|
|
62
|
-
if (modelsData?.[model]?.[field?.name]?.type === "one2many" /* ONE2MANY */ || modelsData?.[model]?.[field?.name]?.type === "many2many" /* MANY2MANY */) {
|
|
63
|
-
const relation = modelsData?.[model]?.[field?.name]?.relation;
|
|
64
|
-
const modelRelation = modelsData?.[relation];
|
|
65
|
-
if (modelRelation) {
|
|
66
|
-
spec[field?.name] = {
|
|
67
|
-
fields: {}
|
|
68
|
-
};
|
|
69
|
-
if (modelRoot && modelRoot === relation) {
|
|
70
|
-
spec[field?.name].fields = { id: {} };
|
|
71
|
-
} else {
|
|
72
|
-
spec[field?.name].fields = this.getSpecificationByFields({
|
|
73
|
-
fields: Object.values(modelRelation),
|
|
74
|
-
specification: {},
|
|
75
|
-
modelsData,
|
|
76
|
-
model: relation,
|
|
77
|
-
modelRoot: model
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
} else {
|
|
81
|
-
spec[field?.name] = {
|
|
82
|
-
fields: {
|
|
83
|
-
id: {},
|
|
84
|
-
display_name: {}
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
} else if (modelsData?.[model]?.[field?.name]?.type === "many2one" /* MANY2ONE */) {
|
|
89
|
-
spec[field?.name] = {
|
|
90
|
-
fields: {
|
|
91
|
-
id: {},
|
|
92
|
-
display_name: {},
|
|
93
|
-
...WIDGETAVATAR[field?.widget] ? { image_256: {} } : {},
|
|
94
|
-
...field?.name === "currency_id" && fields?.find((item) => item?.widget === "monetary") ? { symbol: {} } : {},
|
|
95
|
-
...field?.widget === "many2many_binary" ? { mimetype: {} } : {}
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
} else {
|
|
99
|
-
spec[field?.name] = {};
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
} else if (field?.type_co === "group" /* GROUP */ || field?.type_co === "div" /* DIV */ || field?.type_co === "span" /* SPAN */) {
|
|
103
|
-
const specGroup = this.getSpecificationByFields({
|
|
104
|
-
fields: field?.fields,
|
|
105
|
-
specification: spec,
|
|
106
|
-
modelsData,
|
|
107
|
-
model
|
|
108
|
-
});
|
|
109
|
-
spec = { ...spec, ...specGroup };
|
|
110
|
-
} else if (field?.type_co === "tree" /* TREE */ || field?.type_co === "list" /* LIST */) {
|
|
111
|
-
const relation = modelsData?.[model]?.[field?.name]?.relation;
|
|
112
|
-
const specTreee = this.getSpecificationByFields({
|
|
113
|
-
fields: field?.fields,
|
|
114
|
-
specification: {},
|
|
115
|
-
modelsData,
|
|
116
|
-
model: relation,
|
|
117
|
-
modelRoot: model
|
|
118
|
-
});
|
|
119
|
-
spec = { ...spec, [field?.name]: { fields: specTreee } };
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
return spec;
|
|
123
|
-
} else {
|
|
124
|
-
console.warn("fields is not array");
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
getTreeProps() {
|
|
128
|
-
const props = this.view?.views?.list || {};
|
|
129
|
-
return props;
|
|
130
|
-
}
|
|
131
|
-
getTreeFields() {
|
|
132
|
-
const fields = this.view?.views?.list?.fields || [];
|
|
133
|
-
return fields;
|
|
134
|
-
}
|
|
135
|
-
getSpecification() {
|
|
136
|
-
const specInit = {};
|
|
137
|
-
const modelData = this.view?.models || {};
|
|
138
|
-
const specification = this.getSpecificationByFields({
|
|
139
|
-
fields: this.fields,
|
|
140
|
-
specification: specInit,
|
|
141
|
-
modelsData: modelData,
|
|
142
|
-
model: this.name,
|
|
143
|
-
modelRoot: ""
|
|
144
|
-
});
|
|
145
|
-
return specification;
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
var base_model_default = BaseModel;
|
|
149
|
-
|
|
150
|
-
// src/configs/axios-client.ts
|
|
151
|
-
import axios from "axios";
|
|
152
|
-
|
|
153
|
-
// src/utils/format.ts
|
|
154
|
-
import moment from "moment";
|
|
155
|
-
|
|
156
44
|
// src/utils/domain/py_tokenizer.ts
|
|
157
45
|
var TokenizerError = class extends Error {
|
|
158
46
|
};
|
|
@@ -3286,6 +3174,118 @@ var UserService = {
|
|
|
3286
3174
|
};
|
|
3287
3175
|
var user_service_default = UserService;
|
|
3288
3176
|
|
|
3177
|
+
// src/models/base-model/index.ts
|
|
3178
|
+
var BaseModel = class {
|
|
3179
|
+
name;
|
|
3180
|
+
view;
|
|
3181
|
+
actContext;
|
|
3182
|
+
fields;
|
|
3183
|
+
constructor(init) {
|
|
3184
|
+
this.name = init.name;
|
|
3185
|
+
this.view = init.view;
|
|
3186
|
+
this.actContext = init.actContext;
|
|
3187
|
+
this.fields = init.fields;
|
|
3188
|
+
}
|
|
3189
|
+
getSpecificationByFields({
|
|
3190
|
+
fields = [],
|
|
3191
|
+
specification = {},
|
|
3192
|
+
modelsData,
|
|
3193
|
+
model,
|
|
3194
|
+
modelRoot
|
|
3195
|
+
}) {
|
|
3196
|
+
if (Array.isArray(fields)) {
|
|
3197
|
+
let spec = { ...specification };
|
|
3198
|
+
fields.forEach((field) => {
|
|
3199
|
+
if (!field?.type_co || field?.name && field?.type_co === "field" /* FIELD */) {
|
|
3200
|
+
if (modelsData?.[model]?.[field?.name]) {
|
|
3201
|
+
if (modelsData?.[model]?.[field?.name]?.type === "one2many" /* ONE2MANY */ || modelsData?.[model]?.[field?.name]?.type === "many2many" /* MANY2MANY */) {
|
|
3202
|
+
const relation = modelsData?.[model]?.[field?.name]?.relation;
|
|
3203
|
+
const modelRelation = modelsData?.[relation];
|
|
3204
|
+
if (modelRelation) {
|
|
3205
|
+
spec[field?.name] = {
|
|
3206
|
+
fields: {}
|
|
3207
|
+
};
|
|
3208
|
+
if (modelRoot && modelRoot === relation) {
|
|
3209
|
+
spec[field?.name].fields = { id: {} };
|
|
3210
|
+
} else {
|
|
3211
|
+
spec[field?.name].fields = this.getSpecificationByFields({
|
|
3212
|
+
fields: Object.values(modelRelation),
|
|
3213
|
+
specification: {},
|
|
3214
|
+
modelsData,
|
|
3215
|
+
model: relation,
|
|
3216
|
+
modelRoot: model
|
|
3217
|
+
});
|
|
3218
|
+
}
|
|
3219
|
+
} else {
|
|
3220
|
+
spec[field?.name] = {
|
|
3221
|
+
fields: {
|
|
3222
|
+
id: {},
|
|
3223
|
+
display_name: {}
|
|
3224
|
+
}
|
|
3225
|
+
};
|
|
3226
|
+
}
|
|
3227
|
+
} else if (modelsData?.[model]?.[field?.name]?.type === "many2one" /* MANY2ONE */) {
|
|
3228
|
+
spec[field?.name] = {
|
|
3229
|
+
fields: {
|
|
3230
|
+
id: {},
|
|
3231
|
+
display_name: {},
|
|
3232
|
+
...WIDGETAVATAR[field?.widget] ? { image_256: {} } : {},
|
|
3233
|
+
...field?.name === "currency_id" && fields?.find((item) => item?.widget === "monetary") ? { symbol: {} } : {},
|
|
3234
|
+
...field?.widget === "many2many_binary" ? { mimetype: {} } : {}
|
|
3235
|
+
}
|
|
3236
|
+
};
|
|
3237
|
+
} else {
|
|
3238
|
+
spec[field?.name] = {};
|
|
3239
|
+
}
|
|
3240
|
+
}
|
|
3241
|
+
} else if (field?.type_co === "group" /* GROUP */ || field?.type_co === "div" /* DIV */ || field?.type_co === "span" /* SPAN */) {
|
|
3242
|
+
const specGroup = this.getSpecificationByFields({
|
|
3243
|
+
fields: field?.fields,
|
|
3244
|
+
specification: spec,
|
|
3245
|
+
modelsData,
|
|
3246
|
+
model
|
|
3247
|
+
});
|
|
3248
|
+
spec = { ...spec, ...specGroup };
|
|
3249
|
+
} else if (field?.type_co === "tree" /* TREE */ || field?.type_co === "list" /* LIST */) {
|
|
3250
|
+
const relation = modelsData?.[model]?.[field?.name]?.relation;
|
|
3251
|
+
const specTreee = this.getSpecificationByFields({
|
|
3252
|
+
fields: field?.fields,
|
|
3253
|
+
specification: {},
|
|
3254
|
+
modelsData,
|
|
3255
|
+
model: relation,
|
|
3256
|
+
modelRoot: model
|
|
3257
|
+
});
|
|
3258
|
+
spec = { ...spec, [field?.name]: { fields: specTreee } };
|
|
3259
|
+
}
|
|
3260
|
+
});
|
|
3261
|
+
return spec;
|
|
3262
|
+
} else {
|
|
3263
|
+
console.warn("fields is not array");
|
|
3264
|
+
}
|
|
3265
|
+
}
|
|
3266
|
+
getTreeProps() {
|
|
3267
|
+
const props = this.view?.views?.list || {};
|
|
3268
|
+
return props;
|
|
3269
|
+
}
|
|
3270
|
+
getTreeFields() {
|
|
3271
|
+
const fields = this.view?.views?.list?.fields || [];
|
|
3272
|
+
return fields;
|
|
3273
|
+
}
|
|
3274
|
+
getSpecification() {
|
|
3275
|
+
const specInit = {};
|
|
3276
|
+
const modelData = this.view?.models || {};
|
|
3277
|
+
const specification = this.getSpecificationByFields({
|
|
3278
|
+
fields: this.fields,
|
|
3279
|
+
specification: specInit,
|
|
3280
|
+
modelsData: modelData,
|
|
3281
|
+
model: this.name,
|
|
3282
|
+
modelRoot: ""
|
|
3283
|
+
});
|
|
3284
|
+
return specification;
|
|
3285
|
+
}
|
|
3286
|
+
};
|
|
3287
|
+
var base_model_default = BaseModel;
|
|
3288
|
+
|
|
3289
3289
|
// src/models/company-model/index.ts
|
|
3290
3290
|
var CompanyModel = class extends base_model_default {
|
|
3291
3291
|
constructor(init) {
|
|
@@ -3298,7 +3298,6 @@ var CompanyModel = class extends base_model_default {
|
|
|
3298
3298
|
return await company_service_default.getInfoCompany(id);
|
|
3299
3299
|
}
|
|
3300
3300
|
};
|
|
3301
|
-
var company_model_default = CompanyModel;
|
|
3302
3301
|
|
|
3303
3302
|
// src/models/user-model/index.ts
|
|
3304
3303
|
var UserModel = class extends base_model_default {
|
|
@@ -3309,9 +3308,7 @@ var UserModel = class extends base_model_default {
|
|
|
3309
3308
|
return await user_service_default.getProfile();
|
|
3310
3309
|
}
|
|
3311
3310
|
};
|
|
3312
|
-
var user_model_default = UserModel;
|
|
3313
3311
|
export {
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
user_model_default as UserModel
|
|
3312
|
+
CompanyModel,
|
|
3313
|
+
UserModel
|
|
3317
3314
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
declare const MainProvider: ({ children }: {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}) => JSX.Element;
|
|
6
|
+
|
|
7
|
+
declare const ReactQueryProvider: ({ children }: {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}) => JSX.Element;
|
|
10
|
+
|
|
11
|
+
declare const VersionGate: ({ children }: {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}) => JSX.Element | null;
|
|
14
|
+
|
|
15
|
+
export { MainProvider, ReactQueryProvider, VersionGate };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
declare const MainProvider: ({ children }: {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}) => JSX.Element;
|
|
6
|
+
|
|
7
|
+
declare const ReactQueryProvider: ({ children }: {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}) => JSX.Element;
|
|
10
|
+
|
|
11
|
+
declare const VersionGate: ({ children }: {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}) => JSX.Element | null;
|
|
14
|
+
|
|
15
|
+
export { MainProvider, ReactQueryProvider, VersionGate };
|