namirasoft-account-react 1.4.162 → 1.4.164
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/App.js +11 -15
- package/dist/App.js.map +1 -1
- package/dist/IEntityInfo.d.ts +1 -1
- package/dist/layouts/NSASectionList.js +65 -9
- package/dist/layouts/NSASectionList.js.map +1 -1
- package/package.json +5 -5
- package/src/App.tsx +11 -15
- package/src/IEntityInfo.ts +1 -1
- package/src/layouts/NSASectionList.tsx +68 -8
package/dist/App.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { NamirasoftAccountMetaDatabase } from "namirasoft-account";
|
|
3
2
|
import { NSALayout, NSALoginPage, NSASectionTabs } from "./main";
|
|
4
|
-
import { BaseColumnFormatter, DateTimeFormatter, IDFormatter,
|
|
3
|
+
import { BaseColumnFormatter, DateTimeFormatter, IDFormatter, StringFormatter, StringFormatterSizeType } from "namirasoft-site-react";
|
|
5
4
|
import { ProductUUID } from "namirasoft-site";
|
|
6
|
-
import { NamirasoftFieldServer } from "namirasoft-field";
|
|
5
|
+
import { NamirasoftFieldMetaDatabase, NamirasoftFieldServer } from "namirasoft-field";
|
|
7
6
|
export function App(props) {
|
|
8
7
|
let server = new NamirasoftFieldServer("https://field.namirasoft.dev/api/v1", props.account.token_manager, props.notifier.onError);
|
|
9
8
|
if (!props.account)
|
|
@@ -12,7 +11,7 @@ export function App(props) {
|
|
|
12
11
|
entity: {
|
|
13
12
|
product_id: ProductUUID.NAMIRASOFT_FIELD,
|
|
14
13
|
name: "category",
|
|
15
|
-
tables: [{ table:
|
|
14
|
+
tables: [{ table: NamirasoftFieldMetaDatabase.main.tables.category, required: false }],
|
|
16
15
|
client: {
|
|
17
16
|
getListURL: () => "",
|
|
18
17
|
getNewURL: null,
|
|
@@ -21,16 +20,13 @@ export function App(props) {
|
|
|
21
20
|
getViewURL: null,
|
|
22
21
|
getColumns: () => {
|
|
23
22
|
return [
|
|
24
|
-
BaseColumnFormatter.getColumn(
|
|
25
|
-
BaseColumnFormatter.getColumn(
|
|
26
|
-
BaseColumnFormatter.getColumn(
|
|
27
|
-
BaseColumnFormatter.getColumn(
|
|
28
|
-
BaseColumnFormatter.getColumn(
|
|
29
|
-
BaseColumnFormatter.getColumn(
|
|
30
|
-
BaseColumnFormatter.getColumn(
|
|
31
|
-
BaseColumnFormatter.getColumn(NamirasoftAccountMetaDatabase.main.tables.session.columns.city, new StringFormatter(StringFormatterSizeType.TwoWords)),
|
|
32
|
-
BaseColumnFormatter.getColumn(NamirasoftAccountMetaDatabase.main.tables.session.columns.created_at, new DateTimeFormatter()),
|
|
33
|
-
BaseColumnFormatter.getColumn(NamirasoftAccountMetaDatabase.main.tables.session.columns.updated_at, new DateTimeFormatter()),
|
|
23
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.id, new IDFormatter()),
|
|
24
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.user_id, new IDFormatter()),
|
|
25
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.name, new StringFormatter(StringFormatterSizeType.TwoWords)),
|
|
26
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.group, new StringFormatter(StringFormatterSizeType.TwoWords)),
|
|
27
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.entity, new StringFormatter(StringFormatterSizeType.TwoWords)),
|
|
28
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.created_at, new DateTimeFormatter()),
|
|
29
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.updated_at, new DateTimeFormatter()),
|
|
34
30
|
];
|
|
35
31
|
}
|
|
36
32
|
},
|
|
@@ -50,7 +46,7 @@ export function App(props) {
|
|
|
50
46
|
}
|
|
51
47
|
}
|
|
52
48
|
},
|
|
53
|
-
|
|
49
|
+
list: {
|
|
54
50
|
isEdit: true,
|
|
55
51
|
ui: {
|
|
56
52
|
getEntity: () => { return {}; },
|
package/dist/App.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.js","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"App.js","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACtI,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAMtF,MAAM,UAAU,GAAG,CAAC,KAAe;IAElC,IAAI,MAAM,GAAG,IAAI,qBAAqB,CAAC,qCAAqC,EAAE,KAAK,CAAC,OAAO,CAAC,aAAa,EAAE,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACnI,IAAI,CAAC,KAAK,CAAC,OAAO;QACjB,OAAO,KAAC,YAAY,IACnB,UAAU,EAAE,EAAE,KAAK,EAAE,2EAA2E,EAAE,EAClG,IAAI,EAAC,qEAAqE,EAC1E,KAAK,EAAC,mBAAmB,GACxB,CAAA;IAEH,OAAO,CACN,4BACC,MAAC,SAAS,oBAAK,KAAK,IACnB,KAAK,EAAE,iCAAiC,EACxC,IAAI,EAAE,EAAE,EACR,UAAU,EAAE,EAAE,EACd,MAAM,EAAE,EAAE,EACV,aAAa,EAAE,EAAE,EACjB,KAAK,EACJ;gBACC,MAAM,EAAE;oBACP,UAAU,EAAE,WAAW,CAAC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IAAI,iBAAiB,EAAE,CAAC;gCAC3H,mBAAmB,CAAC,SAAS,CAAC,2BAA2B,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,iBAAiB,EAAE,CAAC;6BAC3H,CAAC;wBACH,CAAC;qBACD;oBACD,MAAM,EAAE;wBACP,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI;wBAC7B,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG;wBACxB,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI;wBAC1B,MAAM,EAAE,IAAI;wBACZ,MAAM,EAAE,IAAI;wBACZ,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM;qBAC9B;iBACD;gBACD,EAAE,EAAE;oBACH,MAAM,EAAE;wBACP,KAAK,EAAE;4BACN,WAAW,EAAE,KAAK;yBAClB;qBACD;iBACD;gBACD,IAAI,EAAE;oBACL,MAAM,EAAE,IAAI;oBACZ,EAAE,EAAE;wBACH,SAAS,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,CAAA,CAAC,CAAC;wBAC9B,SAAS,EAAE,GAAG,EAAE,GAAG,CAAC;qBACpB;iBACD;aAWD,aAGF,qCAAS,EACT,KAAC,cAAc,KAAG,KACN,GACX,CACH,CAAC;AACH,CAAC;AAAA,CAAC"}
|
package/dist/IEntityInfo.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface IEntityInfo<EntityType extends {
|
|
|
10
10
|
required: boolean;
|
|
11
11
|
}[];
|
|
12
12
|
server: {
|
|
13
|
-
value_list: (table: string, column: string, search: string | null) => Promise<string[]>;
|
|
13
|
+
value_list: (table: string, column: string, search: string | null, field_id: string | null, limit: number | null) => Promise<string[]>;
|
|
14
14
|
get: null | ((id: string) => Promise<EntityType>);
|
|
15
15
|
list: null | ((filters: FilterItem[] | null, page: (number | null), size: (number | null), sorts: SortItem[], user_id: (string | null)) => Promise<{
|
|
16
16
|
rows: EntityType[];
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { Component, createRef } from "react";
|
|
12
|
-
import { FilterItem, FilterItemColumnType, NamingConvention, ObjectService } from "namirasoft-core";
|
|
12
|
+
import { FilterItem, FilterItemColumnType, NamingConvention, ObjectService, SearchOperation } from "namirasoft-core";
|
|
13
13
|
import { NSLine, NSSpace, NSSpaceSizeType, NSTable, NSFilterBox } from "namirasoft-site-react";
|
|
14
14
|
import { NSASectionTabs } from "./NSASectionTabs";
|
|
15
15
|
export class NSASectionList extends Component {
|
|
@@ -49,7 +49,7 @@ export class NSASectionList extends Component {
|
|
|
49
49
|
}
|
|
50
50
|
return (_jsxs(_Fragment, { children: [_jsx(NSFilterBox, { ref: this.NSFilterBox_Top, filterItems: filterItems, getTables: () => {
|
|
51
51
|
return this.props.entity.tables.map(table => {
|
|
52
|
-
let columns = table.table.getColumns().map(c => { return Object.assign(Object.assign({}, c), { type: new ObjectService(c.type).getEnum(FilterItemColumnType, FilterItemColumnType.
|
|
52
|
+
let columns = table.table.getColumns().map(c => { return Object.assign(Object.assign({ id: c.name }, c), { type: new ObjectService(c.type).getEnum(FilterItemColumnType, FilterItemColumnType.Unknown) }); });
|
|
53
53
|
return { name: table.table.name, text: table.table.text, columns, required: table.required };
|
|
54
54
|
});
|
|
55
55
|
}, getMoreTables: () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -57,27 +57,83 @@ export class NSASectionList extends Component {
|
|
|
57
57
|
if (this.props.ctf.enabled)
|
|
58
58
|
try {
|
|
59
59
|
if (this.props.ctf.fields)
|
|
60
|
-
if (this.props.ctf.fields.length > 0)
|
|
60
|
+
if (this.props.ctf.fields.length > 0) {
|
|
61
|
+
let name = this.props.entity.name + "_field";
|
|
61
62
|
ans.push({
|
|
62
|
-
name
|
|
63
|
+
name,
|
|
63
64
|
text: "Fields",
|
|
64
|
-
columns:
|
|
65
|
+
columns: [{
|
|
66
|
+
id: "field_id",
|
|
67
|
+
name: "field_id",
|
|
68
|
+
text: "ID",
|
|
69
|
+
type: FilterItemColumnType.Unknown,
|
|
70
|
+
getValues: (search) => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
return (_b = (_a = this.props.ctf.fields) === null || _a === void 0 ? void 0 : _a.filter(c => SearchOperation.match(c.id, search)).map(c => { return { value: c.id, title: c.id }; })) !== null && _b !== void 0 ? _b : [];
|
|
73
|
+
})
|
|
74
|
+
}, {
|
|
75
|
+
id: "field_name",
|
|
76
|
+
name: "field_id",
|
|
77
|
+
text: "Name",
|
|
78
|
+
type: FilterItemColumnType.Unknown,
|
|
79
|
+
getValues: (search) => __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
var _a, _b;
|
|
81
|
+
return (_b = (_a = this.props.ctf.fields) === null || _a === void 0 ? void 0 : _a.filter(c => SearchOperation.match(c.name, search)).map(c => { return { value: c.id, title: c.name }; })) !== null && _b !== void 0 ? _b : [];
|
|
82
|
+
})
|
|
83
|
+
}, {
|
|
84
|
+
id: "field_value",
|
|
85
|
+
name: "value",
|
|
86
|
+
text: "Value",
|
|
87
|
+
type: FilterItemColumnType.Unknown
|
|
88
|
+
},
|
|
89
|
+
...this.props.ctf.fields.map(f => {
|
|
90
|
+
return {
|
|
91
|
+
id: f.id,
|
|
92
|
+
name: f.id,
|
|
93
|
+
text: f.name,
|
|
94
|
+
type: new ObjectService(f.type.type.type).getEnum(FilterItemColumnType, FilterItemColumnType.Number),
|
|
95
|
+
getValues: (search) => __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
let values = yield this.props.entity.server.value_list(name, "value", search, f.id, null);
|
|
97
|
+
return values.map(v => { return { value: v, title: v }; });
|
|
98
|
+
})
|
|
99
|
+
};
|
|
100
|
+
}),],
|
|
65
101
|
required: false
|
|
66
102
|
});
|
|
103
|
+
}
|
|
67
104
|
if (this.props.ctf.categories)
|
|
68
105
|
if (this.props.ctf.categories.length > 0)
|
|
69
106
|
ans.push({
|
|
70
|
-
name: "
|
|
107
|
+
name: this.props.entity.name + "_category",
|
|
71
108
|
text: "Categories",
|
|
72
|
-
columns:
|
|
109
|
+
columns: [{
|
|
110
|
+
id: "category_id",
|
|
111
|
+
name: "category_id",
|
|
112
|
+
text: "ID",
|
|
113
|
+
type: FilterItemColumnType.Unknown,
|
|
114
|
+
getValues: (search) => __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
var _a, _b;
|
|
116
|
+
return (_b = (_a = this.props.ctf.categories) === null || _a === void 0 ? void 0 : _a.filter(c => SearchOperation.match(c.id, search)).map(c => { return { value: c.id, title: c.id }; })) !== null && _b !== void 0 ? _b : [];
|
|
117
|
+
})
|
|
118
|
+
}, {
|
|
119
|
+
id: "category_name",
|
|
120
|
+
name: "category_id",
|
|
121
|
+
text: "Name",
|
|
122
|
+
type: FilterItemColumnType.Unknown,
|
|
123
|
+
getValues: (search) => __awaiter(this, void 0, void 0, function* () {
|
|
124
|
+
var _a, _b;
|
|
125
|
+
return (_b = (_a = this.props.ctf.categories) === null || _a === void 0 ? void 0 : _a.filter(c => SearchOperation.match(c.name, search)).map(c => { return { value: c.id, title: c.name }; })) !== null && _b !== void 0 ? _b : [];
|
|
126
|
+
})
|
|
127
|
+
}],
|
|
73
128
|
required: false
|
|
74
129
|
});
|
|
75
130
|
}
|
|
76
131
|
catch (error) {
|
|
77
132
|
}
|
|
78
133
|
return ans;
|
|
79
|
-
}),
|
|
80
|
-
|
|
134
|
+
}), getValues: (table, column, value) => __awaiter(this, void 0, void 0, function* () {
|
|
135
|
+
let values = yield this.props.entity.server.value_list(table.name, column.name, value, null, null);
|
|
136
|
+
return values.map(v => { return { value: v, title: v }; });
|
|
81
137
|
}), onChanged: () => {
|
|
82
138
|
var _a, _b;
|
|
83
139
|
(_a = this.NSTable_Main.current) === null || _a === void 0 ? void 0 : _a.setSelectedIDs([], []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSASectionList.js","sourceRoot":"","sources":["../../src/layouts/NSASectionList.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAa,SAAS,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"NSASectionList.js","sourceRoot":"","sources":["../../src/layouts/NSASectionList.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAa,SAAS,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACrH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,EAAkF,MAAM,uBAAuB,CAAC;AAI/K,OAAO,EAAE,cAAc,EAA4B,MAAM,kBAAkB,CAAC;AA4B5E,MAAM,OAAO,cACZ,SAAQ,SACP;IAID,YAAY,KAA4D;QAEvE,KAAK,CAAC,KAAK,CAAC,CAAC;QAJP,oBAAe,GAAG,SAAS,EAAe,CAAC;QAC3C,iBAAY,GAAG,SAAS,EAAuB,CAAC;QAItD,IAAI,CAAC,KAAK,GAAG,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;IAChC,CAAC;IACD,cAAc;;QAEb,OAAO,MAAA,MAAA,IAAI,CAAC,YAAY,CAAC,OAAO,0CAAE,cAAc,EAAE,mCAAI,EAAE,CAAC;IAC1D,CAAC;IACD,eAAe;;QAEd,OAAO,MAAA,MAAA,IAAI,CAAC,YAAY,CAAC,OAAO,0CAAE,eAAe,EAAE,mCAAI,EAAE,CAAC;IAC3D,CAAC;IACQ,MAAM;;QAEd,MAA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EAAE;wBAE1B,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY;4BAC1B,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;;4BAE1B,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;oBACpB,CAAC,GACA,EAED,EAAE;oBACF,8BACC,KAAC,OAAO,IAAC,IAAI,EAAE,eAAe,CAAC,IAAI,GAAY,EAC/C,KAAC,MAAM,KAAU,EACjB,KAAC,OAAO,IAAC,IAAI,EAAE,eAAe,CAAC,IAAI,GAAY,EAC/C,KAAC,cAAc,kBAAC,EAAE,EAAE,EAAE,IAAM,IAAI,CAAC,KAAK,IAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,IAAI,IAClE,IAEF,CACH,CAAC;IACH,CAAC;CACD"}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"framework": "npm",
|
|
9
9
|
"application": "package",
|
|
10
10
|
"private": false,
|
|
11
|
-
"version": "1.4.
|
|
11
|
+
"version": "1.4.164",
|
|
12
12
|
"author": "Amir Abolhasani",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"main": "./dist/main.js",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"namirasoft-account": "^1.4.48",
|
|
31
31
|
"namirasoft-account-client": "^1.4.0",
|
|
32
32
|
"namirasoft-api-product": "^1.4.12",
|
|
33
|
-
"namirasoft-core": "^1.4.
|
|
34
|
-
"namirasoft-field": "^1.4.
|
|
33
|
+
"namirasoft-core": "^1.4.41",
|
|
34
|
+
"namirasoft-field": "^1.4.11",
|
|
35
35
|
"namirasoft-history": "^1.4.12",
|
|
36
36
|
"namirasoft-message": "^1.4.12",
|
|
37
37
|
"namirasoft-site": "^1.4.8",
|
|
38
38
|
"namirasoft-site-map": "^1.4.9",
|
|
39
|
-
"namirasoft-site-react": "^1.4.
|
|
40
|
-
"namirasoft-workspace": "^1.4.
|
|
39
|
+
"namirasoft-site-react": "^1.4.220",
|
|
40
|
+
"namirasoft-workspace": "^1.4.11",
|
|
41
41
|
"os-browserify": "^0.3.0",
|
|
42
42
|
"path-browserify": "^1.0.1",
|
|
43
43
|
"process": "^0.11.10",
|
package/src/App.tsx
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { NamirasoftAccountMetaDatabase } from "namirasoft-account";
|
|
2
1
|
import { INSARouterProps } from "./INSARouterProps";
|
|
3
2
|
import { NSALayout, NSALoginPage, NSASectionTabs } from "./main";
|
|
4
|
-
import { BaseColumnFormatter, DateTimeFormatter, IDFormatter,
|
|
3
|
+
import { BaseColumnFormatter, DateTimeFormatter, IDFormatter, StringFormatter, StringFormatterSizeType } from "namirasoft-site-react";
|
|
5
4
|
import { ProductUUID } from "namirasoft-site";
|
|
6
|
-
import { NamirasoftFieldServer } from "namirasoft-field";
|
|
5
|
+
import { NamirasoftFieldMetaDatabase, NamirasoftFieldServer } from "namirasoft-field";
|
|
7
6
|
|
|
8
7
|
export interface AppProps extends INSARouterProps
|
|
9
8
|
{
|
|
@@ -32,7 +31,7 @@ export function App(props: AppProps)
|
|
|
32
31
|
entity: {
|
|
33
32
|
product_id: ProductUUID.NAMIRASOFT_FIELD,
|
|
34
33
|
name: "category",
|
|
35
|
-
tables: [{ table:
|
|
34
|
+
tables: [{ table: NamirasoftFieldMetaDatabase.main.tables.category, required: false }],
|
|
36
35
|
client: {
|
|
37
36
|
getListURL: () => "",
|
|
38
37
|
getNewURL: null,
|
|
@@ -42,16 +41,13 @@ export function App(props: AppProps)
|
|
|
42
41
|
getColumns: () =>
|
|
43
42
|
{
|
|
44
43
|
return [
|
|
45
|
-
BaseColumnFormatter.getColumn(
|
|
46
|
-
BaseColumnFormatter.getColumn(
|
|
47
|
-
BaseColumnFormatter.getColumn(
|
|
48
|
-
BaseColumnFormatter.getColumn(
|
|
49
|
-
BaseColumnFormatter.getColumn(
|
|
50
|
-
BaseColumnFormatter.getColumn(
|
|
51
|
-
BaseColumnFormatter.getColumn(
|
|
52
|
-
BaseColumnFormatter.getColumn(NamirasoftAccountMetaDatabase.main.tables.session.columns.city, new StringFormatter(StringFormatterSizeType.TwoWords)),
|
|
53
|
-
BaseColumnFormatter.getColumn(NamirasoftAccountMetaDatabase.main.tables.session.columns.created_at, new DateTimeFormatter()),
|
|
54
|
-
BaseColumnFormatter.getColumn(NamirasoftAccountMetaDatabase.main.tables.session.columns.updated_at, new DateTimeFormatter()),
|
|
44
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.id, new IDFormatter()),
|
|
45
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.user_id, new IDFormatter()),
|
|
46
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.name, new StringFormatter(StringFormatterSizeType.TwoWords)),
|
|
47
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.group, new StringFormatter(StringFormatterSizeType.TwoWords)),
|
|
48
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.entity, new StringFormatter(StringFormatterSizeType.TwoWords)),
|
|
49
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.created_at, new DateTimeFormatter()),
|
|
50
|
+
BaseColumnFormatter.getColumn(NamirasoftFieldMetaDatabase.main.tables.category.columns.updated_at, new DateTimeFormatter()),
|
|
55
51
|
];
|
|
56
52
|
}
|
|
57
53
|
},
|
|
@@ -71,7 +67,7 @@ export function App(props: AppProps)
|
|
|
71
67
|
}
|
|
72
68
|
}
|
|
73
69
|
},
|
|
74
|
-
|
|
70
|
+
list: {
|
|
75
71
|
isEdit: true,
|
|
76
72
|
ui: {
|
|
77
73
|
getEntity: () => { return {} },
|
package/src/IEntityInfo.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface IEntityInfo<EntityType extends { id: string }, EntityTypeInput
|
|
|
7
7
|
name: string;
|
|
8
8
|
tables: { table: BaseMetaTable, required: boolean }[];
|
|
9
9
|
server: {
|
|
10
|
-
value_list: (table: string, column: string, search: string | null) => Promise<string[]>;
|
|
10
|
+
value_list: (table: string, column: string, search: string | null, field_id: string | null, limit: number | null) => Promise<string[]>;
|
|
11
11
|
get: null | ((id: string) => Promise<EntityType>);
|
|
12
12
|
list: null | ((filters: FilterItem[] | null, page: (number | null), size: (number | null), sorts: SortItem[], user_id: (string | null)) => Promise<{
|
|
13
13
|
rows: EntityType[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, ReactNode, createRef } from "react";
|
|
2
|
-
import { FilterItem, FilterItemColumnType, NamingConvention, ObjectService } from "namirasoft-core";
|
|
2
|
+
import { FilterItem, FilterItemColumnType, NamingConvention, ObjectService, SearchOperation } from "namirasoft-core";
|
|
3
3
|
import { NSLine, NSSpace, NSSpaceSizeType, NSTable, NSFilterBox, NSFilterBoxProps_Table, NSFilterBoxProps_Column, TableColumnInfo, TableRowInfo } from "namirasoft-site-react";
|
|
4
4
|
import { CategoryRow, FieldRow } from "namirasoft-field";
|
|
5
5
|
import { IEntityInfo } from "../IEntityInfo";
|
|
@@ -85,7 +85,7 @@ export class NSASectionList<EntityType extends { id: string }, EntityTypeInput =
|
|
|
85
85
|
{
|
|
86
86
|
return this.props.entity.tables.map(table =>
|
|
87
87
|
{
|
|
88
|
-
let columns = table.table.getColumns().map(c => { return { ...c, type: new ObjectService(c.type).getEnum(FilterItemColumnType, FilterItemColumnType.
|
|
88
|
+
let columns = table.table.getColumns().map(c => { return { id: c.name, ...c, type: new ObjectService(c.type).getEnum(FilterItemColumnType, FilterItemColumnType.Unknown) }; });
|
|
89
89
|
return { name: table.table.name, text: table.table.text, columns, required: table.required };
|
|
90
90
|
})
|
|
91
91
|
}}
|
|
@@ -97,18 +97,77 @@ export class NSASectionList<EntityType extends { id: string }, EntityTypeInput =
|
|
|
97
97
|
{
|
|
98
98
|
if (this.props.ctf.fields)
|
|
99
99
|
if (this.props.ctf.fields.length > 0)
|
|
100
|
+
{
|
|
101
|
+
let name = this.props.entity.name + "_field";
|
|
100
102
|
ans.push({
|
|
101
|
-
name
|
|
103
|
+
name,
|
|
102
104
|
text: "Fields",
|
|
103
|
-
columns:
|
|
105
|
+
columns: [{
|
|
106
|
+
id: "field_id",
|
|
107
|
+
name: "field_id",
|
|
108
|
+
text: "ID",
|
|
109
|
+
type: FilterItemColumnType.Unknown,
|
|
110
|
+
getValues: async (search) =>
|
|
111
|
+
{
|
|
112
|
+
return this.props.ctf.fields?.filter(c => SearchOperation.match(c.id, search)).map(c => { return { value: c.id, title: c.id } }) ?? [];
|
|
113
|
+
}
|
|
114
|
+
}, {
|
|
115
|
+
id: "field_name",
|
|
116
|
+
name: "field_id",
|
|
117
|
+
text: "Name",
|
|
118
|
+
type: FilterItemColumnType.Unknown,
|
|
119
|
+
getValues: async (search) =>
|
|
120
|
+
{
|
|
121
|
+
return this.props.ctf.fields?.filter(c => SearchOperation.match(c.name, search)).map(c => { return { value: c.id, title: c.name } }) ?? [];
|
|
122
|
+
}
|
|
123
|
+
}, {
|
|
124
|
+
id: "field_value",
|
|
125
|
+
name: "value",
|
|
126
|
+
text: "Value",
|
|
127
|
+
type: FilterItemColumnType.Unknown
|
|
128
|
+
},
|
|
129
|
+
...this.props.ctf.fields.map(f =>
|
|
130
|
+
{
|
|
131
|
+
return {
|
|
132
|
+
id: f.id,
|
|
133
|
+
name: f.id,
|
|
134
|
+
text: f.name,
|
|
135
|
+
type: new ObjectService(f.type.type.type).getEnum(FilterItemColumnType, FilterItemColumnType.Number),
|
|
136
|
+
getValues: async (search: string) =>
|
|
137
|
+
{
|
|
138
|
+
let values = await this.props.entity.server.value_list(name, "value", search, f.id, null);
|
|
139
|
+
return values.map(v => { return { value: v, title: v } });
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}),],
|
|
104
143
|
required: false
|
|
105
144
|
});
|
|
145
|
+
}
|
|
146
|
+
|
|
106
147
|
if (this.props.ctf.categories)
|
|
107
148
|
if (this.props.ctf.categories.length > 0)
|
|
108
149
|
ans.push({
|
|
109
|
-
name: "
|
|
150
|
+
name: this.props.entity.name + "_category",
|
|
110
151
|
text: "Categories",
|
|
111
|
-
columns:
|
|
152
|
+
columns: [{
|
|
153
|
+
id: "category_id",
|
|
154
|
+
name: "category_id",
|
|
155
|
+
text: "ID",
|
|
156
|
+
type: FilterItemColumnType.Unknown,
|
|
157
|
+
getValues: async (search) =>
|
|
158
|
+
{
|
|
159
|
+
return this.props.ctf.categories?.filter(c => SearchOperation.match(c.id, search)).map(c => { return { value: c.id, title: c.id } }) ?? [];
|
|
160
|
+
}
|
|
161
|
+
}, {
|
|
162
|
+
id: "category_name",
|
|
163
|
+
name: "category_id",
|
|
164
|
+
text: "Name",
|
|
165
|
+
type: FilterItemColumnType.Unknown,
|
|
166
|
+
getValues: async (search) =>
|
|
167
|
+
{
|
|
168
|
+
return this.props.ctf.categories?.filter(c => SearchOperation.match(c.name, search)).map(c => { return { value: c.id, title: c.name } }) ?? [];
|
|
169
|
+
}
|
|
170
|
+
}],
|
|
112
171
|
required: false
|
|
113
172
|
});
|
|
114
173
|
|
|
@@ -118,9 +177,10 @@ export class NSASectionList<EntityType extends { id: string }, EntityTypeInput =
|
|
|
118
177
|
// todo add tags
|
|
119
178
|
return ans;
|
|
120
179
|
}}
|
|
121
|
-
|
|
180
|
+
getValues={async (table: NSFilterBoxProps_Table, column: NSFilterBoxProps_Column, value: string) =>
|
|
122
181
|
{
|
|
123
|
-
|
|
182
|
+
let values = await this.props.entity.server.value_list(table.name, column.name, value, null, null);
|
|
183
|
+
return values.map(v => { return { value: v, title: v } });
|
|
124
184
|
}}
|
|
125
185
|
onChanged={() =>
|
|
126
186
|
{
|