namirasoft-account-react 1.5.19 → 1.5.21

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/Router.js CHANGED
@@ -2,15 +2,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ProductUUID } from 'namirasoft-api-product';
3
3
  import { IStorageSession } from 'namirasoft-core';
4
4
  import { NSNotFoundPage } from 'namirasoft-site-react';
5
- import { useState } from 'react';
5
+ import { useReducer } from 'react';
6
6
  import { Route, Routes, useNavigate } from 'react-router-dom';
7
- import { App } from './App';
8
7
  import { NSARouterMaker } from './NSARouterMaker';
8
+ import { App } from './App';
9
9
  export default function Router() {
10
- let [state, setState] = useState(Math.random());
10
+ let [, page_force_update] = useReducer((x) => x + 1, 0);
11
11
  let navigate = useNavigate();
12
- return _jsx(NSARouterMaker, { product_id: ProductUUID.NAMIRASOFT_INFRA, notifier_storage: new IStorageSession(), page_force_update: () => { setState(state + Math.random()); }, navigate: navigate, renderOnLogin: (props) => {
13
- return (_jsxs(Routes, { children: [_jsx(Route, { path: "/:id/view", element: _jsx(App, Object.assign({}, props)) }), _jsx(Route, { path: "*", element: _jsx(App, Object.assign({}, props)) })] }));
12
+ return _jsx(NSARouterMaker, { product_id: ProductUUID.NAMIRASOFT_INFRA, notifier_storage: new IStorageSession(), page_force_update: page_force_update, navigate: navigate, renderOnLogin: (props) => {
13
+ return (_jsxs(Routes, { children: [_jsx(Route, { path: "/", element: _jsx(App, Object.assign({}, props)) }), _jsx(Route, { path: "*", element: _jsx(App, Object.assign({}, props)) })] }));
14
14
  }, renderOnLogout: (_, __) => {
15
15
  return (_jsx(Routes, { children: _jsx(Route, { path: "*", element: _jsx(NSNotFoundPage, {}) }) }));
16
16
  }, getNSALayout: (props) => {
@@ -1 +1 @@
1
- {"version":3,"file":"Router.js","sourceRoot":"","sources":["../src/Router.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,MAAM,CAAC,OAAO,UAAU,MAAM;IAE1B,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAS,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAExD,IAAI,QAAQ,GAAG,WAAW,EAAE,CAAC;IAE7B,OAAO,KAAC,cAAc,IAClB,UAAU,EAAE,WAAW,CAAC,gBAAgB,EACxC,gBAAgB,EAAE,IAAI,eAAe,EAAE,EACvC,iBAAiB,EAAE,GAAG,EAAE,GAAG,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,EAC7D,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,CAAC,KAA2B,EAAE,EAAE;YAE3C,OAAO,CACH,MAAC,MAAM,eACH,KAAC,KAAK,IAAC,IAAI,EAAC,WAAW,EAAC,OAAO,EAAE,KAAC,GAAG,oBAAK,KAAK,EAAQ,GAAI,EAC3D,KAAC,KAAK,IAAC,IAAI,EAAC,GAAG,EAAC,OAAO,EAAE,KAAC,GAAG,oBAAK,KAAK,EAAQ,GAAI,IAC9C,CACZ,CAAC;QACN,CAAC,EACD,cAAc,EAAE,CAAC,CAAuB,EAAE,EAAW,EAAE,EAAE;YAErD,OAAO,CACH,KAAC,MAAM,cACH,KAAC,KAAK,IAAC,IAAI,EAAC,GAAG,EAAC,OAAO,EAAE,KAAC,cAAc,KAAkB,GAAI,GACzD,CACZ,CAAC;QACN,CAAC,EACD,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE;YAEpB,OAAO,KAAK,CAAC,QAAQ,CAAC;QAC1B,CAAC,EACD,WAAW,EAAE;YACT,YAAY,EAAE;gBACV,KAAK,EAAE,IAAI;gBACX,KAAK,EAAE,IAAI;aACd;SACJ,GACH,CAAC;AACP,CAAC"}
1
+ {"version":3,"file":"Router.js","sourceRoot":"","sources":["../src/Router.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,MAAM,CAAC,OAAO,UAAU,MAAM;IAE1B,IAAI,CAAC,EAAE,iBAAiB,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAExD,IAAI,QAAQ,GAAG,WAAW,EAAE,CAAC;IAE7B,OAAO,KAAC,cAAc,IAClB,UAAU,EAAE,WAAW,CAAC,gBAAgB,EACxC,gBAAgB,EAAE,IAAI,eAAe,EAAE,EACvC,iBAAiB,EAAE,iBAAiB,EACpC,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,CAAC,KAA2B,EAAE,EAAE;YAE3C,OAAO,CACH,MAAC,MAAM,eACH,KAAC,KAAK,IAAC,IAAI,EAAC,GAAG,EAAC,OAAO,EAAE,KAAC,GAAG,oBAAK,KAAK,EAAI,GAAI,EAC/C,KAAC,KAAK,IAAC,IAAI,EAAC,GAAG,EAAC,OAAO,EAAE,KAAC,GAAG,oBAAK,KAAK,EAAI,GAAI,IAC1C,CACZ,CAAC;QACN,CAAC,EACD,cAAc,EAAE,CAAC,CAAuB,EAAE,EAAW,EAAE,EAAE;YAErD,OAAO,CACH,KAAC,MAAM,cACH,KAAC,KAAK,IAAC,IAAI,EAAC,GAAG,EAAC,OAAO,EAAE,KAAC,cAAc,KAAkB,GAAI,GACzD,CACZ,CAAC;QACN,CAAC,EACD,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE;YAEpB,OAAO,KAAK,CAAC,QAAQ,CAAC;QAC1B,CAAC,EACD,WAAW,EAAE;YACT,YAAY,EAAE;gBACV,KAAK,EAAE,IAAI;gBACX,KAAK,EAAE,IAAI;aACd;SACJ,GACH,CAAC;AACP,CAAC"}
@@ -3,11 +3,13 @@
3
3
  z-index: -1;
4
4
  width: 100dvw;
5
5
  height: 100dvh;
6
+ display: none;
6
7
  background-color: #00000080;
7
8
  }
8
9
 
9
10
  .nsa_master_menu_aside.open {
10
11
  z-index: 999;
12
+ display: flex;
11
13
  }
12
14
 
13
15
  .nsa_master_menu_wrapper {
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "framework": "npm",
9
9
  "application": "package",
10
10
  "private": false,
11
- "version": "1.5.19",
11
+ "version": "1.5.21",
12
12
  "author": "Amir Abolhasani",
13
13
  "license": "MIT",
14
14
  "main": "./dist/main.js",
@@ -50,7 +50,7 @@
50
50
  "react-dev-utils": "^12.0.1",
51
51
  "react-dom": "^18.3.1",
52
52
  "react-helmet": "^6.1.0",
53
- "react-router-dom": "7.6.3",
53
+ "react-router-dom": "7.9.1",
54
54
  "react-scripts": "5.0.1",
55
55
  "webpack": "^5.108.4"
56
56
  },
@@ -1,85 +1,85 @@
1
- import { TokenManager } from "namirasoft-account";
2
- import { CacheService, CookieService, EnvService, IStorageLocal, NamingConvention } from "namirasoft-core";
3
- import { EntityResolveResponseRow, NamirasoftFieldHeader, NamirasoftFieldServer } from "namirasoft-field";
4
- import { NSLoading } from "namirasoft-site-react";
5
- import { Component, ReactNode } from "react";
6
- import { NSARouterMakerResult } from "./NSARouterMakerResult";
7
-
8
- export interface FieldCacheServiceProps extends NSARouterMakerResult
9
- {
10
- entity_name?: string | null;
11
- render: (rows: EntityResolveResponseRow) => ReactNode;
12
- }
13
-
14
- interface FieldCacheServiceState
15
- {
16
- rows: EntityResolveResponseRow | null;
17
- }
18
-
19
- export class FieldCacheService extends Component<FieldCacheServiceProps, FieldCacheServiceState>
20
- {
21
- static get(token_manager: TokenManager, product_id: string, onError: (error: Error | string) => void): CacheService<EntityResolveResponseRow>
22
- {
23
- // todo this must be owner_id, otherwise switching between owners does not work correctly
24
- let user_id: string = token_manager?.getUserData(x => x.id, "") ?? "";
25
- let key_field = `ns-field-user:${user_id}-product:${product_id ?? "*"}`;
26
- return new CacheService<EntityResolveResponseRow>(key_field, new IStorageLocal(), 24 * 60, async () =>
27
- {
28
- let service = new CookieService(document.cookie, NamirasoftFieldHeader.cookie.VERSION());
29
- return user_id + "" + service.getString();
30
- }, async () =>
31
- {
32
- let REACT_APP_BASE_URL_FIELD = new EnvService("REACT_APP_BASE_URL_FIELD", true).getString();
33
- let server = new NamirasoftFieldServer(REACT_APP_BASE_URL_FIELD, token_manager, onError);
34
- let ans: EntityResolveResponseRow = {
35
- slots: [],
36
- category_scopes: [],
37
- categories: [],
38
- fields: [],
39
- };
40
-
41
- try
42
- {
43
- ans = await server.entity.Resolve(product_id);
44
- } catch (error: any)
45
- {
46
- }
47
-
48
- return ans;
49
- });
50
- }
51
-
52
- constructor(props: FieldCacheServiceProps)
53
- {
54
- super(props);
55
- this.state = {
56
- rows: null,
57
- };
58
-
59
- }
60
- override componentDidMount(): void
61
- {
62
- let cache = FieldCacheService.get(this.props.account.token_manager, this.props.product_id, this.props.notifier.onError);
63
- cache.get().then(rows =>
64
- {
65
- this.setState(prev => ({ ...prev, rows }));
66
- });
67
- }
68
- override render(): ReactNode
69
- {
70
- let { rows } = this.state;
71
- if (!rows)
72
- return <NSLoading title="Loading Namirasoft Field" />;
73
-
74
- if (this.props.entity_name)
75
- {
76
- const entity_name = NamingConvention.auto.convert((this.props.entity_name ?? "").trim(), NamingConvention.lower_case);
77
- rows = {
78
- ...rows,
79
- slots: rows.slots.filter(slot => NamingConvention.auto.convert((slot.entity ?? "").trim(), NamingConvention.lower_case) === entity_name),
80
- }
81
- }
82
-
83
- return this.props.render(rows);
84
- }
1
+ import { TokenManager } from "namirasoft-account";
2
+ import { CacheService, CookieService, EnvService, IStorageLocal, NamingConvention } from "namirasoft-core";
3
+ import { EntityResolveResponseRow, NamirasoftFieldHeader, NamirasoftFieldServer } from "namirasoft-field";
4
+ import { NSLoading } from "namirasoft-site-react";
5
+ import { Component, ReactNode } from "react";
6
+ import { NSARouterMakerResult } from "./NSARouterMakerResult";
7
+
8
+ export interface FieldCacheServiceProps extends NSARouterMakerResult
9
+ {
10
+ entity_name?: string | null;
11
+ render: (rows: EntityResolveResponseRow) => ReactNode;
12
+ }
13
+
14
+ interface FieldCacheServiceState
15
+ {
16
+ rows: EntityResolveResponseRow | null;
17
+ }
18
+
19
+ export class FieldCacheService extends Component<FieldCacheServiceProps, FieldCacheServiceState>
20
+ {
21
+ static get(token_manager: TokenManager, product_id: string, onError: (error: Error | string) => void): CacheService<EntityResolveResponseRow>
22
+ {
23
+ // todo this must be owner_id, otherwise switching between owners does not work correctly
24
+ let user_id: string = token_manager?.getUserData(x => x.id, "") ?? "";
25
+ let key_field = `ns-field-user:${user_id}-product:${product_id ?? "*"}`;
26
+ return new CacheService<EntityResolveResponseRow>(key_field, new IStorageLocal(), 24 * 60, async () =>
27
+ {
28
+ let service = new CookieService(document.cookie, NamirasoftFieldHeader.cookie.VERSION());
29
+ return user_id + "" + service.getString();
30
+ }, async () =>
31
+ {
32
+ let REACT_APP_BASE_URL_FIELD = new EnvService("REACT_APP_BASE_URL_FIELD", true).getString();
33
+ let server = new NamirasoftFieldServer(REACT_APP_BASE_URL_FIELD, token_manager, onError);
34
+ let ans: EntityResolveResponseRow = {
35
+ slots: [],
36
+ category_scopes: [],
37
+ categories: [],
38
+ fields: [],
39
+ };
40
+
41
+ try
42
+ {
43
+ ans = await server.entity.Resolve(product_id);
44
+ } catch (error: any)
45
+ {
46
+ }
47
+
48
+ return ans;
49
+ });
50
+ }
51
+
52
+ constructor(props: FieldCacheServiceProps)
53
+ {
54
+ super(props);
55
+ this.state = {
56
+ rows: null,
57
+ };
58
+
59
+ }
60
+ override componentDidMount(): void
61
+ {
62
+ let cache = FieldCacheService.get(this.props.account.token_manager, this.props.product_id, this.props.notifier.onError);
63
+ cache.get().then(rows =>
64
+ {
65
+ this.setState(prev => ({ ...prev, rows }));
66
+ });
67
+ }
68
+ override render(): ReactNode
69
+ {
70
+ let { rows } = this.state;
71
+ if (!rows)
72
+ return <NSLoading title="Loading Namirasoft Field" />;
73
+
74
+ if (this.props.entity_name)
75
+ {
76
+ const entity_name = NamingConvention.auto.convert((this.props.entity_name ?? "").trim(), NamingConvention.lower_case);
77
+ rows = {
78
+ ...rows,
79
+ slots: rows.slots.filter(slot => NamingConvention.auto.convert((slot.entity ?? "").trim(), NamingConvention.lower_case) === entity_name),
80
+ }
81
+ }
82
+
83
+ return this.props.render(rows);
84
+ }
85
85
  }
@@ -1,8 +1,8 @@
1
- import { NamirasoftFieldServer } from "namirasoft-field";
2
-
3
- export interface NSFRouterProps
4
- {
5
- servers: {
6
- field: NamirasoftFieldServer;
7
- }
1
+ import { NamirasoftFieldServer } from "namirasoft-field";
2
+
3
+ export interface NSFRouterProps
4
+ {
5
+ servers: {
6
+ field: NamirasoftFieldServer;
7
+ }
8
8
  }
package/src/NSFRoutes.ts CHANGED
@@ -1,31 +1,31 @@
1
- import { NamingConvention } from 'namirasoft-core';
2
-
3
- export class NSFRoutes
4
- {
5
- // Category
6
- static CategoryList(slot_id: string, slot_name: string)
7
- {
8
- const name = NamingConvention.auto.convert(slot_name, NamingConvention.lower_case_underscore);
9
- return `/slot/${slot_id}/${name}/category/list`;
10
- };
11
- static CategoryNew(slot_id: string, slot_name: string)
12
- {
13
- const name = NamingConvention.auto.convert(slot_name, NamingConvention.lower_case_underscore);
14
- return `/slot/${slot_id}/${name}/category/new`;
15
- };
16
- static CategoryCopy(slot_id: string, slot_name: string, id: string)
17
- {
18
- const name = NamingConvention.auto.convert(slot_name, NamingConvention.lower_case_underscore);
19
- return `/slot/${slot_id}/${name}/category/${id}/copy`;
20
- };
21
- static CategoryEdit(slot_id: string, slot_name: string, id: string)
22
- {
23
- const name = NamingConvention.auto.convert(slot_name, NamingConvention.lower_case_underscore);
24
- return `/slot/${slot_id}/${name}/category/${id}/edit`;
25
- };
26
- static CategoryView(slot_id: string, slot_name: string, id: string)
27
- {
28
- const name = NamingConvention.auto.convert(slot_name, NamingConvention.lower_case_underscore);
29
- return `/slot/${slot_id}/${name}/category/${id}/view`;
30
- };
1
+ import { NamingConvention } from 'namirasoft-core';
2
+
3
+ export class NSFRoutes
4
+ {
5
+ // Category
6
+ static CategoryList(slot_id: string, slot_name: string)
7
+ {
8
+ const name = NamingConvention.auto.convert(slot_name, NamingConvention.lower_case_underscore);
9
+ return `/slot/${slot_id}/${name}/category/list`;
10
+ };
11
+ static CategoryNew(slot_id: string, slot_name: string)
12
+ {
13
+ const name = NamingConvention.auto.convert(slot_name, NamingConvention.lower_case_underscore);
14
+ return `/slot/${slot_id}/${name}/category/new`;
15
+ };
16
+ static CategoryCopy(slot_id: string, slot_name: string, id: string)
17
+ {
18
+ const name = NamingConvention.auto.convert(slot_name, NamingConvention.lower_case_underscore);
19
+ return `/slot/${slot_id}/${name}/category/${id}/copy`;
20
+ };
21
+ static CategoryEdit(slot_id: string, slot_name: string, id: string)
22
+ {
23
+ const name = NamingConvention.auto.convert(slot_name, NamingConvention.lower_case_underscore);
24
+ return `/slot/${slot_id}/${name}/category/${id}/edit`;
25
+ };
26
+ static CategoryView(slot_id: string, slot_name: string, id: string)
27
+ {
28
+ const name = NamingConvention.auto.convert(slot_name, NamingConvention.lower_case_underscore);
29
+ return `/slot/${slot_id}/${name}/category/${id}/view`;
30
+ };
31
31
  }
package/src/Router.tsx CHANGED
@@ -1,29 +1,29 @@
1
1
  import { ProductUUID } from 'namirasoft-api-product';
2
2
  import { IStorageSession } from 'namirasoft-core';
3
3
  import { NSNotFoundPage } from 'namirasoft-site-react';
4
- import { useState } from 'react';
4
+ import { useReducer } from 'react';
5
5
  import { Route, Routes, useNavigate } from 'react-router-dom';
6
- import { App } from './App';
7
6
  import { NSARouterMaker } from './NSARouterMaker';
8
7
  import { NSARouterMakerResult } from './NSARouterMakerResult';
8
+ import { App } from './App';
9
9
 
10
10
  export default function Router()
11
11
  {
12
- let [state, setState] = useState<number>(Math.random());
12
+ let [, page_force_update] = useReducer((x) => x + 1, 0);
13
13
 
14
14
  let navigate = useNavigate();
15
15
 
16
16
  return <NSARouterMaker
17
17
  product_id={ProductUUID.NAMIRASOFT_INFRA}
18
18
  notifier_storage={new IStorageSession()}
19
- page_force_update={() => { setState(state + Math.random()); }}
19
+ page_force_update={page_force_update}
20
20
  navigate={navigate}
21
21
  renderOnLogin={(props: NSARouterMakerResult) =>
22
22
  {
23
23
  return (
24
24
  <Routes>
25
- <Route path="/:id/view" element={<App {...props}></App>} />
26
- <Route path="*" element={<App {...props}></App>} />
25
+ <Route path="/" element={<App {...props} />} />
26
+ <Route path="*" element={<App {...props} />} />
27
27
  </Routes>
28
28
  );
29
29
  }}
@@ -3,11 +3,13 @@
3
3
  z-index: -1;
4
4
  width: 100dvw;
5
5
  height: 100dvh;
6
+ display: none;
6
7
  background-color: #00000080;
7
8
  }
8
9
 
9
10
  .nsa_master_menu_aside.open {
10
11
  z-index: 999;
12
+ display: flex;
11
13
  }
12
14
 
13
15
  .nsa_master_menu_wrapper {
@@ -1,126 +1,126 @@
1
- import { FilterLinkFullRow } from 'namirasoft-api-link';
2
- import { NamingConvention } from 'namirasoft-core';
3
- import { EntityResolveResponseRow, SlotEntityType, SlotRow } from 'namirasoft-field';
4
- import { NSFRoutes } from '../NSFRoutes';
5
-
6
- export class NSALayout_Field
7
- {
8
- static postprocess(
9
- filters: FilterLinkFullRow[],
10
- rows: EntityResolveResponseRow | null,
11
- ): FilterLinkFullRow[]
12
- {
13
- if (!rows || rows.slots.length === 0)
14
- return filters;
15
-
16
- const result: FilterLinkFullRow[] = [...filters];
17
- const id_counter = { value: -1_000_000 };
18
- const matched = new Set<string>();
19
-
20
- NSALayout_Field.walk(filters, null, rows, result, id_counter, matched);
21
-
22
- const fallback_filter_id = filters[0]?.filter_id ?? 0;
23
- const fallback_filter_ref = filters[0]?.filter ?? null;
24
- for (const slot of rows.slots)
25
- {
26
- if (matched.has(slot.id))
27
- continue;
28
-
29
- const parent = NSALayout_Field.make(id_counter, null, fallback_filter_id, fallback_filter_ref, slot.name, slot.description ?? "", "");
30
- result.push(parent);
31
-
32
- result.push(NSALayout_Field.make(id_counter, parent.id, fallback_filter_id, fallback_filter_ref, "Create", "", NSFRoutes.CategoryNew(slot.id, slot.name)));
33
- result.push(NSALayout_Field.make(id_counter, parent.id, fallback_filter_id, fallback_filter_ref, "List", "", NSFRoutes.CategoryList(slot.id, slot.name)));
34
- }
35
-
36
- return result;
37
- }
38
-
39
- private static findEntityRow(filter_name: string | null | undefined, rows: EntityResolveResponseRow): SlotRow | null
40
- {
41
- const n = NamingConvention.auto.convert((filter_name ?? "").trim(), NamingConvention.lower_case);
42
- if (n.length === 0)
43
- return null;
44
- for (const slot of rows.slots)
45
- {
46
- if (slot.entity_type != SlotEntityType.CategoryScope)
47
- continue;
48
- if (NamingConvention.auto.convert((slot.entity ?? "").trim(), NamingConvention.lower_case) === n)
49
- return slot;
50
- }
51
- return null;
52
- }
53
-
54
- private static make(
55
- id_counter: { value: number },
56
- parent_id: number | null,
57
- filter_id: number,
58
- filter_ref: any,
59
- label: string,
60
- description: string,
61
- url: string,
62
- ): FilterLinkFullRow
63
- {
64
- const now = new Date();
65
- const id = id_counter.value--;
66
- return {
67
- id,
68
- parent_id,
69
- filter_id,
70
- link_id: null,
71
- name: label,
72
- logo: "https://static.namirasoft.com/image/namirasoft/field/logo/base.png",
73
- order: 0,
74
- created_at: now,
75
- updated_at: now,
76
- filter: filter_ref,
77
- link: {
78
- id: 0,
79
- category_id: 0,
80
- domain_id: 0,
81
- name: label,
82
- url: url,
83
- logo: "https://static.namirasoft.com/image/namirasoft/field/logo/base.png",
84
- public: true,
85
- private: true,
86
- importance: 0,
87
- description,
88
- created_at: now,
89
- updated_at: now,
90
- category: null as any,
91
- domain: null as any,
92
- }
93
- };
94
- }
95
-
96
- private static walk(
97
- filters: FilterLinkFullRow[],
98
- parent_id: number | null,
99
- rows: EntityResolveResponseRow,
100
- result: FilterLinkFullRow[],
101
- id_counter: { value: number },
102
- matched: Set<string>,
103
- ): void
104
- {
105
- const children = filters.filter(f => f.parent_id === parent_id);
106
- for (const filter of children)
107
- {
108
- const filter_name = filter.name ?? filter.link?.name ?? "";
109
- const slot = NSALayout_Field.findEntityRow(filter_name, rows);
110
- if (slot)
111
- {
112
- matched.add(slot.id);
113
- const parent = NSALayout_Field.make(id_counter, filter.parent_id, filter.filter_id, filter.filter, slot.name, slot.description ?? "", "");
114
- parent.order = (filter.order ?? 0) - 1;
115
- const idx = result.indexOf(filter);
116
- if (idx >= 0)
117
- result.splice(idx, 0, parent);
118
- else
119
- result.push(parent);
120
- result.push(NSALayout_Field.make(id_counter, parent.id, filter.filter_id, filter.filter, "Create", "", NSFRoutes.CategoryNew(slot.id, slot.name)));
121
- result.push(NSALayout_Field.make(id_counter, parent.id, filter.filter_id, filter.filter, "List", "", NSFRoutes.CategoryList(slot.id, slot.name)));
122
- }
123
- NSALayout_Field.walk(filters, filter.id, rows, result, id_counter, matched);
124
- }
125
- }
1
+ import { FilterLinkFullRow } from 'namirasoft-api-link';
2
+ import { NamingConvention } from 'namirasoft-core';
3
+ import { EntityResolveResponseRow, SlotEntityType, SlotRow } from 'namirasoft-field';
4
+ import { NSFRoutes } from '../NSFRoutes';
5
+
6
+ export class NSALayout_Field
7
+ {
8
+ static postprocess(
9
+ filters: FilterLinkFullRow[],
10
+ rows: EntityResolveResponseRow | null,
11
+ ): FilterLinkFullRow[]
12
+ {
13
+ if (!rows || rows.slots.length === 0)
14
+ return filters;
15
+
16
+ const result: FilterLinkFullRow[] = [...filters];
17
+ const id_counter = { value: -1_000_000 };
18
+ const matched = new Set<string>();
19
+
20
+ NSALayout_Field.walk(filters, null, rows, result, id_counter, matched);
21
+
22
+ const fallback_filter_id = filters[0]?.filter_id ?? 0;
23
+ const fallback_filter_ref = filters[0]?.filter ?? null;
24
+ for (const slot of rows.slots)
25
+ {
26
+ if (matched.has(slot.id))
27
+ continue;
28
+
29
+ const parent = NSALayout_Field.make(id_counter, null, fallback_filter_id, fallback_filter_ref, slot.name, slot.description ?? "", "");
30
+ result.push(parent);
31
+
32
+ result.push(NSALayout_Field.make(id_counter, parent.id, fallback_filter_id, fallback_filter_ref, "Create", "", NSFRoutes.CategoryNew(slot.id, slot.name)));
33
+ result.push(NSALayout_Field.make(id_counter, parent.id, fallback_filter_id, fallback_filter_ref, "List", "", NSFRoutes.CategoryList(slot.id, slot.name)));
34
+ }
35
+
36
+ return result;
37
+ }
38
+
39
+ private static findEntityRow(filter_name: string | null | undefined, rows: EntityResolveResponseRow): SlotRow | null
40
+ {
41
+ const n = NamingConvention.auto.convert((filter_name ?? "").trim(), NamingConvention.lower_case);
42
+ if (n.length === 0)
43
+ return null;
44
+ for (const slot of rows.slots)
45
+ {
46
+ if (slot.entity_type != SlotEntityType.CategoryScope)
47
+ continue;
48
+ if (NamingConvention.auto.convert((slot.entity ?? "").trim(), NamingConvention.lower_case) === n)
49
+ return slot;
50
+ }
51
+ return null;
52
+ }
53
+
54
+ private static make(
55
+ id_counter: { value: number },
56
+ parent_id: number | null,
57
+ filter_id: number,
58
+ filter_ref: any,
59
+ label: string,
60
+ description: string,
61
+ url: string,
62
+ ): FilterLinkFullRow
63
+ {
64
+ const now = new Date();
65
+ const id = id_counter.value--;
66
+ return {
67
+ id,
68
+ parent_id,
69
+ filter_id,
70
+ link_id: null,
71
+ name: label,
72
+ logo: "https://static.namirasoft.com/image/namirasoft/field/logo/base.png",
73
+ order: 0,
74
+ created_at: now,
75
+ updated_at: now,
76
+ filter: filter_ref,
77
+ link: {
78
+ id: 0,
79
+ category_id: 0,
80
+ domain_id: 0,
81
+ name: label,
82
+ url: url,
83
+ logo: "https://static.namirasoft.com/image/namirasoft/field/logo/base.png",
84
+ public: true,
85
+ private: true,
86
+ importance: 0,
87
+ description,
88
+ created_at: now,
89
+ updated_at: now,
90
+ category: null as any,
91
+ domain: null as any,
92
+ }
93
+ };
94
+ }
95
+
96
+ private static walk(
97
+ filters: FilterLinkFullRow[],
98
+ parent_id: number | null,
99
+ rows: EntityResolveResponseRow,
100
+ result: FilterLinkFullRow[],
101
+ id_counter: { value: number },
102
+ matched: Set<string>,
103
+ ): void
104
+ {
105
+ const children = filters.filter(f => f.parent_id === parent_id);
106
+ for (const filter of children)
107
+ {
108
+ const filter_name = filter.name ?? filter.link?.name ?? "";
109
+ const slot = NSALayout_Field.findEntityRow(filter_name, rows);
110
+ if (slot)
111
+ {
112
+ matched.add(slot.id);
113
+ const parent = NSALayout_Field.make(id_counter, filter.parent_id, filter.filter_id, filter.filter, slot.name, slot.description ?? "", "");
114
+ parent.order = (filter.order ?? 0) - 1;
115
+ const idx = result.indexOf(filter);
116
+ if (idx >= 0)
117
+ result.splice(idx, 0, parent);
118
+ else
119
+ result.push(parent);
120
+ result.push(NSALayout_Field.make(id_counter, parent.id, filter.filter_id, filter.filter, "Create", "", NSFRoutes.CategoryNew(slot.id, slot.name)));
121
+ result.push(NSALayout_Field.make(id_counter, parent.id, filter.filter_id, filter.filter, "List", "", NSFRoutes.CategoryList(slot.id, slot.name)));
122
+ }
123
+ NSALayout_Field.walk(filters, filter.id, rows, result, id_counter, matched);
124
+ }
125
+ }
126
126
  }
@@ -1,88 +1,88 @@
1
- import { CategoryInputRow, CategoryRow, CategoryScopeRow, SlotRow } from "namirasoft-field";
2
- import { NSBox, NSBoxString, NSBoxTextArea, NSColumn, NSRow } from "namirasoft-site-react";
3
- import { Component, createRef } from "react";
4
- import { NSALayoutCustomProps } from "../layouts/NSALayout";
5
- import { NSFRouterProps } from "../NSFRouterProps";
6
- import { NSFEntities } from "./NSFEntities";
7
-
8
- export interface NSFCategoryEditPageProps extends NSALayoutCustomProps<CategoryRow>, NSFRouterProps
9
- {
10
- slot: SlotRow;
11
- category_scope: CategoryScopeRow;
12
- isEdit: boolean;
13
- }
14
-
15
- interface NSFCategoryEditPageState { }
16
-
17
- export class NSFCategoryEditPage extends Component<NSFCategoryEditPageProps, NSFCategoryEditPageState>
18
- {
19
- NSBoxString_Name = createRef<NSBoxString>();
20
- NSBoxTexArea_Description = createRef<NSBoxTextArea>();
21
-
22
- constructor(props: NSFCategoryEditPageProps)
23
- {
24
- super(props);
25
- this.state = {};
26
- }
27
-
28
- override render()
29
- {
30
- return this.props.layout.getNSALayout<CategoryRow, CategoryInputRow>({
31
- ...this.props,
32
- action: {
33
- description: this.props.isEdit ? "This section allows you to update the details of an existing category." : "This section allows you to add a new category by entering its details."
34
- },
35
- pages: {
36
- entity: NSFEntities.category(this.props, this.props.slot, this.props.category_scope),
37
- edit: {
38
- ...this.props,
39
- ui: {
40
- tab_page_edit: {
41
- editor: {
42
- getInputRow: () =>
43
- {
44
- let category_scope_id = this.props.category_scope.id;
45
- let name = this.NSBoxString_Name.current?.getValue() ?? "";
46
- let description = this.NSBoxTexArea_Description.current?.getValue() ?? "";
47
-
48
- return {
49
- workspace_id: "",
50
- category_scope_id,
51
- name,
52
- description,
53
- category_category: [],
54
- category_field: [],
55
- category_tag: [],
56
- };
57
- },
58
- setRow: (row) =>
59
- {
60
- this.NSBoxString_Name.current?.setValue(row.name);
61
- this.NSBoxTexArea_Description.current?.setValue(row.description ?? "");
62
- }
63
- }
64
- }
65
- }
66
- }
67
- },
68
- children: <NSColumn>
69
- <NSRow>
70
- <NSBoxString
71
- ref={this.NSBoxString_Name}
72
- title="Name"
73
- required
74
- style={{ width: NSBox.width.double }}
75
- info={{ link: "https://namirasoft.com/field/console-guide/category/#field-name" }}
76
- />
77
- </NSRow>
78
- <NSBoxTextArea
79
- ref={this.NSBoxTexArea_Description}
80
- title="Description"
81
- required={false}
82
- style={{ width: NSBox.width.double }}
83
- info={{ link: "https://namirasoft.com/field/console-guide/category/#field-description" }}
84
- />
85
- </NSColumn>
86
- }, "nsf-page-category-view");
87
- }
1
+ import { CategoryInputRow, CategoryRow, CategoryScopeRow, SlotRow } from "namirasoft-field";
2
+ import { NSBox, NSBoxString, NSBoxTextArea, NSColumn, NSRow } from "namirasoft-site-react";
3
+ import { Component, createRef } from "react";
4
+ import { NSALayoutCustomProps } from "../layouts/NSALayout";
5
+ import { NSFRouterProps } from "../NSFRouterProps";
6
+ import { NSFEntities } from "./NSFEntities";
7
+
8
+ export interface NSFCategoryEditPageProps extends NSALayoutCustomProps<CategoryRow>, NSFRouterProps
9
+ {
10
+ slot: SlotRow;
11
+ category_scope: CategoryScopeRow;
12
+ isEdit: boolean;
13
+ }
14
+
15
+ interface NSFCategoryEditPageState { }
16
+
17
+ export class NSFCategoryEditPage extends Component<NSFCategoryEditPageProps, NSFCategoryEditPageState>
18
+ {
19
+ NSBoxString_Name = createRef<NSBoxString>();
20
+ NSBoxTexArea_Description = createRef<NSBoxTextArea>();
21
+
22
+ constructor(props: NSFCategoryEditPageProps)
23
+ {
24
+ super(props);
25
+ this.state = {};
26
+ }
27
+
28
+ override render()
29
+ {
30
+ return this.props.layout.getNSALayout<CategoryRow, CategoryInputRow>({
31
+ ...this.props,
32
+ action: {
33
+ description: this.props.isEdit ? "This section allows you to update the details of an existing category." : "This section allows you to add a new category by entering its details."
34
+ },
35
+ pages: {
36
+ entity: NSFEntities.category(this.props, this.props.slot, this.props.category_scope),
37
+ edit: {
38
+ ...this.props,
39
+ ui: {
40
+ tab_page_edit: {
41
+ editor: {
42
+ getInputRow: () =>
43
+ {
44
+ let category_scope_id = this.props.category_scope.id;
45
+ let name = this.NSBoxString_Name.current?.getValue() ?? "";
46
+ let description = this.NSBoxTexArea_Description.current?.getValue() ?? "";
47
+
48
+ return {
49
+ workspace_id: "",
50
+ category_scope_id,
51
+ name,
52
+ description,
53
+ category_category: [],
54
+ category_field: [],
55
+ category_tag: [],
56
+ };
57
+ },
58
+ setRow: (row) =>
59
+ {
60
+ this.NSBoxString_Name.current?.setValue(row.name);
61
+ this.NSBoxTexArea_Description.current?.setValue(row.description ?? "");
62
+ }
63
+ }
64
+ }
65
+ }
66
+ }
67
+ },
68
+ children: <NSColumn>
69
+ <NSRow>
70
+ <NSBoxString
71
+ ref={this.NSBoxString_Name}
72
+ title="Name"
73
+ required
74
+ style={{ width: NSBox.width.double }}
75
+ info={{ link: "https://namirasoft.com/field/console-guide/category/#field-name" }}
76
+ />
77
+ </NSRow>
78
+ <NSBoxTextArea
79
+ ref={this.NSBoxTexArea_Description}
80
+ title="Description"
81
+ required={false}
82
+ style={{ width: NSBox.width.double }}
83
+ info={{ link: "https://namirasoft.com/field/console-guide/category/#field-description" }}
84
+ />
85
+ </NSColumn>
86
+ }, "nsf-page-category-view");
87
+ }
88
88
  }
@@ -1,24 +1,24 @@
1
- import { CategoryRow, CategoryScopeRow, SlotRow } from "namirasoft-field";
2
- import { NSALayoutCustomProps } from "../layouts/NSALayout";
3
- import { NSFRouterProps } from "../NSFRouterProps";
4
- import { NSFEntities } from "./NSFEntities";
5
-
6
- export interface NSFCategoryListPageProps extends NSALayoutCustomProps<CategoryRow>, NSFRouterProps
7
- {
8
- slot: SlotRow;
9
- category_scope: CategoryScopeRow;
10
- }
11
-
12
- export function NSFCategoryListPage(props: NSFCategoryListPageProps)
13
- {
14
- return props.layout.getNSALayout({
15
- ...props,
16
- action: {
17
- description: "This section displays all categories you have created with their basic information."
18
- },
19
- pages: {
20
- entity: NSFEntities.category(props, props.slot, props.category_scope),
21
- list: {}
22
- }
23
- }, "nsf-page-category-list");
1
+ import { CategoryRow, CategoryScopeRow, SlotRow } from "namirasoft-field";
2
+ import { NSALayoutCustomProps } from "../layouts/NSALayout";
3
+ import { NSFRouterProps } from "../NSFRouterProps";
4
+ import { NSFEntities } from "./NSFEntities";
5
+
6
+ export interface NSFCategoryListPageProps extends NSALayoutCustomProps<CategoryRow>, NSFRouterProps
7
+ {
8
+ slot: SlotRow;
9
+ category_scope: CategoryScopeRow;
10
+ }
11
+
12
+ export function NSFCategoryListPage(props: NSFCategoryListPageProps)
13
+ {
14
+ return props.layout.getNSALayout({
15
+ ...props,
16
+ action: {
17
+ description: "This section displays all categories you have created with their basic information."
18
+ },
19
+ pages: {
20
+ entity: NSFEntities.category(props, props.slot, props.category_scope),
21
+ list: {}
22
+ }
23
+ }, "nsf-page-category-list");
24
24
  }
@@ -1,24 +1,24 @@
1
- import { CategoryRow, CategoryScopeRow, SlotRow } from "namirasoft-field";
2
- import { NSALayoutCustomProps } from "../layouts/NSALayout";
3
- import { NSFRouterProps } from "../NSFRouterProps";
4
- import { NSFEntities } from "./NSFEntities";
5
-
6
- export interface NSFCategoryViewPageProps extends NSALayoutCustomProps<CategoryRow>, NSFRouterProps
7
- {
8
- slot: SlotRow;
9
- category_scope: CategoryScopeRow;
10
- }
11
-
12
- export function NSFCategoryViewPage(props: NSFCategoryViewPageProps)
13
- {
14
- return props.layout.getNSALayout({
15
- ...props,
16
- action: {
17
- description: "This section displays detailed information about a selected category."
18
- },
19
- pages: {
20
- entity: NSFEntities.category(props, props.slot, props.category_scope),
21
- view: {}
22
- }
23
- }, "nsf-page-category-view");
1
+ import { CategoryRow, CategoryScopeRow, SlotRow } from "namirasoft-field";
2
+ import { NSALayoutCustomProps } from "../layouts/NSALayout";
3
+ import { NSFRouterProps } from "../NSFRouterProps";
4
+ import { NSFEntities } from "./NSFEntities";
5
+
6
+ export interface NSFCategoryViewPageProps extends NSALayoutCustomProps<CategoryRow>, NSFRouterProps
7
+ {
8
+ slot: SlotRow;
9
+ category_scope: CategoryScopeRow;
10
+ }
11
+
12
+ export function NSFCategoryViewPage(props: NSFCategoryViewPageProps)
13
+ {
14
+ return props.layout.getNSALayout({
15
+ ...props,
16
+ action: {
17
+ description: "This section displays detailed information about a selected category."
18
+ },
19
+ pages: {
20
+ entity: NSFEntities.category(props, props.slot, props.category_scope),
21
+ view: {}
22
+ }
23
+ }, "nsf-page-category-view");
24
24
  }
@@ -1,59 +1,59 @@
1
- import { ProductUUID } from "namirasoft-api-product";
2
- import { EnvService, FilterItem, FilterItemOperator, IStorageLocal } from "namirasoft-core";
3
- import { CategoryInputRow, CategoryRow, CategoryScopeRow, NamirasoftFieldMetaDatabase, NamirasoftFieldServer, SlotRow } from "namirasoft-field";
4
- import { NamirasoftMap } from "namirasoft-site-map";
5
- import { BaseColumnFormatter, DateTimeFormatter, IDFormatter, StringFormatter, StringFormatterSizeType } from "namirasoft-site-react";
6
- import { IEntityInfo } from "../IEntityInfo";
7
- import { NSARouterMakerResult } from "../NSARouterMakerResult";
8
- import { NSFRouterProps } from "../NSFRouterProps";
9
- import { NSFRoutes } from "../NSFRoutes";
10
-
11
- export class NSFEntities
12
- {
13
- static category(props: NSARouterMakerResult & NSFRouterProps, slot: SlotRow, category_scope: CategoryScopeRow): IEntityInfo<CategoryRow, CategoryInputRow>
14
- {
15
- let namirasoft = new NamirasoftMap(props.account.token_manager, console.error);
16
-
17
- return {
18
- product_id: ProductUUID.NAMIRASOFT_FIELD,
19
- name: "category",
20
- tables: [{ table: namirasoft.field.tables.category, required: true }],
21
- client: {
22
- getColumns()
23
- {
24
- return [
25
- BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.id, new IDFormatter(namirasoft, null)),
26
- BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.user_id, new IDFormatter(namirasoft, new IStorageLocal())),
27
- BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.workspace_id, new IDFormatter(namirasoft, new IStorageLocal())),
28
- BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.category_scope_id, new IDFormatter(namirasoft, new IStorageLocal())),
29
- BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.name, new StringFormatter(StringFormatterSizeType.Sentence)),
30
- BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.description, new StringFormatter(StringFormatterSizeType.Description)),
31
- BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.created_at, new DateTimeFormatter()),
32
- BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.updated_at, new DateTimeFormatter()),
33
- ];
34
- },
35
- getListURL: () => NSFRoutes.CategoryList(slot.id, slot.name),
36
- getNewURL: () => NSFRoutes.CategoryNew(slot.id, slot.name),
37
- getCopyURL: (id: string) => NSFRoutes.CategoryCopy(slot.id, slot.name, id),
38
- getEditURL: (id: string) => NSFRoutes.CategoryEdit(slot.id, slot.name, id),
39
- getViewURL: (id: string) => NSFRoutes.CategoryView(slot.id, slot.name, id),
40
- },
41
- server: {
42
- value_list: props.servers.field.value.List,
43
- get: props.servers.field.category.Get,
44
- list: async (filters, page, size, sorts, all_workspaces) =>
45
- {
46
- let REACT_APP_BASE_URL_FIELD = new EnvService("REACT_APP_BASE_URL_FIELD", true).getString();
47
- let field = new NamirasoftFieldServer(REACT_APP_BASE_URL_FIELD, props.account.token_manager, props.notifier.onError);
48
- let meta = new NamirasoftFieldMetaDatabase(props.account.token_manager);
49
- let filter_category_scope = new FilterItem(meta.tables.category, meta.tables.category.columns.category_scope_id, false, FilterItemOperator.all.equals, category_scope.id);
50
- filters = [filter_category_scope, ...(filters ?? [])];
51
- return await field.category.List(filters, page, size, sorts, all_workspaces);
52
- },
53
- create: props.servers.field.category.Create,
54
- update: props.servers.field.category.Update,
55
- delete: props.servers.field.category.Delete
56
- }
57
- };
58
- }
1
+ import { ProductUUID } from "namirasoft-api-product";
2
+ import { EnvService, FilterItem, FilterItemOperator, IStorageLocal } from "namirasoft-core";
3
+ import { CategoryInputRow, CategoryRow, CategoryScopeRow, NamirasoftFieldMetaDatabase, NamirasoftFieldServer, SlotRow } from "namirasoft-field";
4
+ import { NamirasoftMap } from "namirasoft-site-map";
5
+ import { BaseColumnFormatter, DateTimeFormatter, IDFormatter, StringFormatter, StringFormatterSizeType } from "namirasoft-site-react";
6
+ import { IEntityInfo } from "../IEntityInfo";
7
+ import { NSARouterMakerResult } from "../NSARouterMakerResult";
8
+ import { NSFRouterProps } from "../NSFRouterProps";
9
+ import { NSFRoutes } from "../NSFRoutes";
10
+
11
+ export class NSFEntities
12
+ {
13
+ static category(props: NSARouterMakerResult & NSFRouterProps, slot: SlotRow, category_scope: CategoryScopeRow): IEntityInfo<CategoryRow, CategoryInputRow>
14
+ {
15
+ let namirasoft = new NamirasoftMap(props.account.token_manager, console.error);
16
+
17
+ return {
18
+ product_id: ProductUUID.NAMIRASOFT_FIELD,
19
+ name: "category",
20
+ tables: [{ table: namirasoft.field.tables.category, required: true }],
21
+ client: {
22
+ getColumns()
23
+ {
24
+ return [
25
+ BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.id, new IDFormatter(namirasoft, null)),
26
+ BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.user_id, new IDFormatter(namirasoft, new IStorageLocal())),
27
+ BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.workspace_id, new IDFormatter(namirasoft, new IStorageLocal())),
28
+ BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.category_scope_id, new IDFormatter(namirasoft, new IStorageLocal())),
29
+ BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.name, new StringFormatter(StringFormatterSizeType.Sentence)),
30
+ BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.description, new StringFormatter(StringFormatterSizeType.Description)),
31
+ BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.created_at, new DateTimeFormatter()),
32
+ BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.updated_at, new DateTimeFormatter()),
33
+ ];
34
+ },
35
+ getListURL: () => NSFRoutes.CategoryList(slot.id, slot.name),
36
+ getNewURL: () => NSFRoutes.CategoryNew(slot.id, slot.name),
37
+ getCopyURL: (id: string) => NSFRoutes.CategoryCopy(slot.id, slot.name, id),
38
+ getEditURL: (id: string) => NSFRoutes.CategoryEdit(slot.id, slot.name, id),
39
+ getViewURL: (id: string) => NSFRoutes.CategoryView(slot.id, slot.name, id),
40
+ },
41
+ server: {
42
+ value_list: props.servers.field.value.List,
43
+ get: props.servers.field.category.Get,
44
+ list: async (filters, page, size, sorts, all_workspaces) =>
45
+ {
46
+ let REACT_APP_BASE_URL_FIELD = new EnvService("REACT_APP_BASE_URL_FIELD", true).getString();
47
+ let field = new NamirasoftFieldServer(REACT_APP_BASE_URL_FIELD, props.account.token_manager, props.notifier.onError);
48
+ let meta = new NamirasoftFieldMetaDatabase(props.account.token_manager);
49
+ let filter_category_scope = new FilterItem(meta.tables.category, meta.tables.category.columns.category_scope_id, false, FilterItemOperator.all.equals, category_scope.id);
50
+ filters = [filter_category_scope, ...(filters ?? [])];
51
+ return await field.category.List(filters, page, size, sorts, all_workspaces);
52
+ },
53
+ create: props.servers.field.category.Create,
54
+ update: props.servers.field.category.Update,
55
+ delete: props.servers.field.category.Delete
56
+ }
57
+ };
58
+ }
59
59
  }