@fctc/interface-logic 5.1.0 → 5.1.3

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/models.js CHANGED
@@ -1,147 +1,11 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ 'use strict';
2
+
3
+ var chunkRPWKWEMA_js = require('./chunk-RPWKWEMA.js');
4
+ require('./chunk-WBGK2SHU.js');
19
5
 
20
- // src/models.ts
21
- var models_exports = {};
22
- __export(models_exports, {
23
- BaseModel: () => BaseModel
24
- });
25
- module.exports = __toCommonJS(models_exports);
26
6
 
27
- // src/constants/widget/widget-avatar-constant.ts
28
- var WIDGETAVATAR = /* @__PURE__ */ ((WIDGETAVATAR2) => {
29
- WIDGETAVATAR2["many2one_avatar_user"] = "many2one_avatar_user";
30
- WIDGETAVATAR2["many2many_avatar_user"] = "many2many_avatar_user";
31
- return WIDGETAVATAR2;
32
- })(WIDGETAVATAR || {});
33
7
 
34
- // src/models/base-model/index.ts
35
- var BaseModel = class {
36
- name;
37
- view;
38
- fields;
39
- constructor(init) {
40
- this.name = init.name;
41
- this.view = init.view;
42
- this.fields = init.fields;
43
- }
44
- getSpecificationByFields({
45
- fields = [],
46
- specification = {},
47
- modelsData,
48
- model,
49
- modelRoot
50
- }) {
51
- if (Array.isArray(fields)) {
52
- let spec = { ...specification };
53
- fields.forEach((field) => {
54
- if (!field?.type_co || field?.name && field?.type_co === "field" /* FIELD */) {
55
- if (modelsData?.[model]?.[field?.name]) {
56
- if (modelsData?.[model]?.[field?.name]?.type === "one2many" /* ONE2MANY */ || modelsData?.[model]?.[field?.name]?.type === "many2many" /* MANY2MANY */) {
57
- const relation = modelsData?.[model]?.[field?.name]?.relation;
58
- const modelRelation = modelsData?.[relation];
59
- if (modelRelation) {
60
- spec[field?.name] = {
61
- fields: {}
62
- };
63
- if (modelRoot && modelRoot === relation) {
64
- spec[field?.name].fields = { id: {} };
65
- } else {
66
- spec[field?.name].fields = this.getSpecificationByFields({
67
- fields: Object.values(modelRelation),
68
- specification: { id: {}, display_name: {} },
69
- modelsData,
70
- model: relation,
71
- modelRoot: model
72
- });
73
- }
74
- } else {
75
- spec[field?.name] = {
76
- fields: {
77
- id: {},
78
- display_name: {},
79
- ...field?.widget === "many2many_binary" ? { mimetype: {} } : {},
80
- ...field?.widget === "many2many_binary" && relation === "ir.attachment" ? { datas: {} } : {}
81
- }
82
- };
83
- }
84
- } else if (modelsData?.[model]?.[field?.name]?.type === "many2one" /* MANY2ONE */) {
85
- spec[field?.name] = {
86
- fields: {
87
- id: {},
88
- display_name: {},
89
- ...WIDGETAVATAR[field?.widget] ? { image_256: {} } : {},
90
- ...field?.name === "currency_id" && fields?.find((item) => item?.widget === "monetary") ? { symbol: {} } : {},
91
- ...field?.widget === "many2many_binary" ? { mimetype: {} } : {}
92
- }
93
- };
94
- } else {
95
- spec[field?.name] = {};
96
- }
97
- }
98
- } else if (field?.type_co === "group" /* GROUP */ || field?.type_co === "div" /* DIV */ || field?.type_co === "span" /* SPAN */) {
99
- const specGroup = this.getSpecificationByFields({
100
- fields: field?.fields,
101
- specification: spec,
102
- modelsData,
103
- model
104
- });
105
- spec = { ...spec, ...specGroup };
106
- } else if (field?.type_co === "tree" /* TREE */ || field?.type_co === "list" /* LIST */) {
107
- const relation = modelsData?.[model]?.[field?.name]?.relation;
108
- const specTreee = this.getSpecificationByFields({
109
- fields: field?.fields,
110
- specification: {},
111
- modelsData,
112
- model: relation,
113
- modelRoot: model
114
- });
115
- spec = { ...spec, [field?.name]: { fields: specTreee } };
116
- }
117
- });
118
- return spec;
119
- } else {
120
- console.warn("fields is not array");
121
- }
122
- }
123
- getTreeProps() {
124
- const props = this.view?.views?.list || {};
125
- return props;
126
- }
127
- getTreeFields() {
128
- const fields = this.view?.views?.list?.fields || [];
129
- return fields;
130
- }
131
- getSpecification() {
132
- const specInit = {};
133
- const modelData = this.view?.models || {};
134
- const specification = this.getSpecificationByFields({
135
- fields: this.fields,
136
- specification: specInit,
137
- modelsData: modelData,
138
- model: this.name,
139
- modelRoot: ""
140
- });
141
- return specification;
142
- }
143
- };
144
- // Annotate the CommonJS export names for ESM import in node:
145
- 0 && (module.exports = {
146
- BaseModel
8
+ Object.defineProperty(exports, "BaseModel", {
9
+ enumerable: true,
10
+ get: function () { return chunkRPWKWEMA_js.BaseModel; }
147
11
  });
package/dist/models.mjs CHANGED
@@ -1,120 +1,2 @@
1
- // src/constants/widget/widget-avatar-constant.ts
2
- var WIDGETAVATAR = /* @__PURE__ */ ((WIDGETAVATAR2) => {
3
- WIDGETAVATAR2["many2one_avatar_user"] = "many2one_avatar_user";
4
- WIDGETAVATAR2["many2many_avatar_user"] = "many2many_avatar_user";
5
- return WIDGETAVATAR2;
6
- })(WIDGETAVATAR || {});
7
-
8
- // src/models/base-model/index.ts
9
- var BaseModel = class {
10
- name;
11
- view;
12
- fields;
13
- constructor(init) {
14
- this.name = init.name;
15
- this.view = init.view;
16
- this.fields = init.fields;
17
- }
18
- getSpecificationByFields({
19
- fields = [],
20
- specification = {},
21
- modelsData,
22
- model,
23
- modelRoot
24
- }) {
25
- if (Array.isArray(fields)) {
26
- let spec = { ...specification };
27
- fields.forEach((field) => {
28
- if (!field?.type_co || field?.name && field?.type_co === "field" /* FIELD */) {
29
- if (modelsData?.[model]?.[field?.name]) {
30
- if (modelsData?.[model]?.[field?.name]?.type === "one2many" /* ONE2MANY */ || modelsData?.[model]?.[field?.name]?.type === "many2many" /* MANY2MANY */) {
31
- const relation = modelsData?.[model]?.[field?.name]?.relation;
32
- const modelRelation = modelsData?.[relation];
33
- if (modelRelation) {
34
- spec[field?.name] = {
35
- fields: {}
36
- };
37
- if (modelRoot && modelRoot === relation) {
38
- spec[field?.name].fields = { id: {} };
39
- } else {
40
- spec[field?.name].fields = this.getSpecificationByFields({
41
- fields: Object.values(modelRelation),
42
- specification: { id: {}, display_name: {} },
43
- modelsData,
44
- model: relation,
45
- modelRoot: model
46
- });
47
- }
48
- } else {
49
- spec[field?.name] = {
50
- fields: {
51
- id: {},
52
- display_name: {},
53
- ...field?.widget === "many2many_binary" ? { mimetype: {} } : {},
54
- ...field?.widget === "many2many_binary" && relation === "ir.attachment" ? { datas: {} } : {}
55
- }
56
- };
57
- }
58
- } else if (modelsData?.[model]?.[field?.name]?.type === "many2one" /* MANY2ONE */) {
59
- spec[field?.name] = {
60
- fields: {
61
- id: {},
62
- display_name: {},
63
- ...WIDGETAVATAR[field?.widget] ? { image_256: {} } : {},
64
- ...field?.name === "currency_id" && fields?.find((item) => item?.widget === "monetary") ? { symbol: {} } : {},
65
- ...field?.widget === "many2many_binary" ? { mimetype: {} } : {}
66
- }
67
- };
68
- } else {
69
- spec[field?.name] = {};
70
- }
71
- }
72
- } else if (field?.type_co === "group" /* GROUP */ || field?.type_co === "div" /* DIV */ || field?.type_co === "span" /* SPAN */) {
73
- const specGroup = this.getSpecificationByFields({
74
- fields: field?.fields,
75
- specification: spec,
76
- modelsData,
77
- model
78
- });
79
- spec = { ...spec, ...specGroup };
80
- } else if (field?.type_co === "tree" /* TREE */ || field?.type_co === "list" /* LIST */) {
81
- const relation = modelsData?.[model]?.[field?.name]?.relation;
82
- const specTreee = this.getSpecificationByFields({
83
- fields: field?.fields,
84
- specification: {},
85
- modelsData,
86
- model: relation,
87
- modelRoot: model
88
- });
89
- spec = { ...spec, [field?.name]: { fields: specTreee } };
90
- }
91
- });
92
- return spec;
93
- } else {
94
- console.warn("fields is not array");
95
- }
96
- }
97
- getTreeProps() {
98
- const props = this.view?.views?.list || {};
99
- return props;
100
- }
101
- getTreeFields() {
102
- const fields = this.view?.views?.list?.fields || [];
103
- return fields;
104
- }
105
- getSpecification() {
106
- const specInit = {};
107
- const modelData = this.view?.models || {};
108
- const specification = this.getSpecificationByFields({
109
- fields: this.fields,
110
- specification: specInit,
111
- modelsData: modelData,
112
- model: this.name,
113
- modelRoot: ""
114
- });
115
- return specification;
116
- }
117
- };
118
- export {
119
- BaseModel
120
- };
1
+ export { BaseModel } from './chunk-QOXPJWSN.mjs';
2
+ import './chunk-VBYRP2P7.mjs';