namirasoft-account-react 1.5.11 → 1.5.13

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.
Files changed (53) hide show
  1. package/dist/NSARouter.d.ts +16 -0
  2. package/dist/NSARouter.js +42 -0
  3. package/dist/NSARouter.js.map +1 -0
  4. package/dist/NSFRouterProps.d.ts +6 -0
  5. package/dist/NSFRouterProps.js +2 -0
  6. package/dist/NSFRouterProps.js.map +1 -0
  7. package/dist/NSFRoutes.d.ts +7 -0
  8. package/dist/NSFRoutes.js +29 -0
  9. package/dist/NSFRoutes.js.map +1 -0
  10. package/dist/layouts/NSALayout.js +2 -2
  11. package/dist/layouts/{NSARoutes_Field.d.ts → NSALayout_Field.d.ts} +2 -2
  12. package/dist/layouts/{NSARoutes_Field.js → NSALayout_Field.js} +27 -24
  13. package/dist/layouts/NSALayout_Field.js.map +1 -0
  14. package/dist/layouts/NSARouter.d.ts +16 -0
  15. package/dist/layouts/NSARouter.js +38 -0
  16. package/dist/layouts/NSARouter.js.map +1 -0
  17. package/dist/layouts/NSARouter_Field.d.ts +8 -0
  18. package/dist/layouts/NSARouter_Field.js +92 -0
  19. package/dist/layouts/NSARouter_Field.js.map +1 -0
  20. package/dist/layouts/NSASectionList.js +1 -1
  21. package/dist/layouts/NSASectionList.js.map +1 -1
  22. package/dist/main.d.ts +21 -14
  23. package/dist/main.js +21 -14
  24. package/dist/main.js.map +1 -1
  25. package/dist/pages/NSFCategoryEditPage.d.ts +19 -0
  26. package/dist/pages/NSFCategoryEditPage.js +47 -0
  27. package/dist/pages/NSFCategoryEditPage.js.map +1 -0
  28. package/dist/pages/NSFCategoryListPage.d.ts +8 -0
  29. package/dist/pages/NSFCategoryListPage.js +12 -0
  30. package/dist/pages/NSFCategoryListPage.js.map +1 -0
  31. package/dist/pages/NSFCategoryViewPage.d.ts +8 -0
  32. package/dist/pages/NSFCategoryViewPage.js +12 -0
  33. package/dist/pages/NSFCategoryViewPage.js.map +1 -0
  34. package/dist/pages/NSFEntities.d.ts +7 -0
  35. package/dist/pages/NSFEntities.js +60 -0
  36. package/dist/pages/NSFEntities.js.map +1 -0
  37. package/package.json +1 -1
  38. package/src/NSARouter.tsx +69 -0
  39. package/src/NSFRouterProps.ts +8 -0
  40. package/src/NSFRoutes.ts +31 -0
  41. package/src/layouts/NSALayout.tsx +2 -2
  42. package/src/layouts/{NSARoutes_Field.ts → NSALayout_Field.ts} +25 -23
  43. package/src/layouts/NSASectionList.tsx +1 -1
  44. package/src/main.ts +21 -14
  45. package/src/pages/NSFCategoryEditPage.tsx +92 -0
  46. package/src/pages/NSFCategoryListPage.tsx +30 -0
  47. package/src/pages/NSFCategoryViewPage.tsx +29 -0
  48. package/src/pages/NSFEntities.ts +59 -0
  49. package/dist/layouts/NSARoutes.d.ts +0 -11
  50. package/dist/layouts/NSARoutes.js +0 -13
  51. package/dist/layouts/NSARoutes.js.map +0 -1
  52. package/dist/layouts/NSARoutes_Field.js.map +0 -1
  53. package/src/layouts/NSARoutes.tsx +0 -29
@@ -0,0 +1,19 @@
1
+ import { CategoryScopeRow, SlotRow } from "namirasoft-field";
2
+ import { NSBoxString, NSBoxTextArea } from "namirasoft-site-react";
3
+ import { Component } from "react";
4
+ import { NSARouterMakerProps } from "../NSARouterMakerProps";
5
+ import { NSFRouterProps } from "../NSFRouterProps";
6
+ export interface NSFCategoryEditPageProps extends NSARouterMakerProps, NSFRouterProps {
7
+ slot: SlotRow;
8
+ category_scope: CategoryScopeRow;
9
+ isEdit: boolean;
10
+ }
11
+ interface NSFCategoryEditPageState {
12
+ }
13
+ export declare class NSFCategoryEditPage extends Component<NSFCategoryEditPageProps, NSFCategoryEditPageState> {
14
+ NSBoxString_Name: import("react").RefObject<NSBoxString>;
15
+ NSBoxTexArea_Description: import("react").RefObject<NSBoxTextArea>;
16
+ constructor(props: NSFCategoryEditPageProps);
17
+ render(): import("react/jsx-runtime").JSX.Element;
18
+ }
19
+ export {};
@@ -0,0 +1,47 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { NSBox, NSBoxString, NSBoxTextArea, NSColumn, NSRow } from "namirasoft-site-react";
3
+ import { Component, createRef } from "react";
4
+ import { NSALayout } from "../layouts/NSALayout";
5
+ import { NSFEntities } from "./NSFEntities";
6
+ export class NSFCategoryEditPage extends Component {
7
+ constructor(props) {
8
+ super(props);
9
+ this.NSBoxString_Name = createRef();
10
+ this.NSBoxTexArea_Description = createRef();
11
+ this.state = {};
12
+ }
13
+ render() {
14
+ return (_jsx(NSALayout, Object.assign({}, this.props, { action: {
15
+ 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."
16
+ }, pages: {
17
+ entity: NSFEntities.category(this.props, this.props.slot, this.props.category_scope),
18
+ edit: Object.assign(Object.assign({}, this.props), { ui: {
19
+ tab_page_edit: {
20
+ editor: {
21
+ getInputRow: () => {
22
+ var _a, _b, _c, _d;
23
+ let category_scope_id = this.props.category_scope.id;
24
+ let name = (_b = (_a = this.NSBoxString_Name.current) === null || _a === void 0 ? void 0 : _a.getValue()) !== null && _b !== void 0 ? _b : "";
25
+ let description = (_d = (_c = this.NSBoxTexArea_Description.current) === null || _c === void 0 ? void 0 : _c.getValue()) !== null && _d !== void 0 ? _d : "";
26
+ return {
27
+ workspace_id: "",
28
+ category_scope_id,
29
+ name,
30
+ description,
31
+ category_category: [],
32
+ category_field: [],
33
+ category_tag: [],
34
+ };
35
+ },
36
+ setRow: (row) => {
37
+ var _a, _b, _c;
38
+ (_a = this.NSBoxString_Name.current) === null || _a === void 0 ? void 0 : _a.setValue(row.name);
39
+ (_b = this.NSBoxTexArea_Description.current) === null || _b === void 0 ? void 0 : _b.setValue((_c = row.description) !== null && _c !== void 0 ? _c : "");
40
+ }
41
+ }
42
+ }
43
+ } })
44
+ }, children: _jsxs(NSColumn, { children: [_jsx(NSRow, { children: _jsx(NSBoxString, { ref: this.NSBoxString_Name, title: "Name", required: true, style: { width: NSBox.width.double }, info: { link: "https://namirasoft.com/field/console-guide/category/#field-name" } }) }), _jsx(NSBoxTextArea, { ref: this.NSBoxTexArea_Description, title: "Description", required: false, style: { width: NSBox.width.double }, info: { link: "https://namirasoft.com/field/console-guide/category/#field-description" } })] }) })));
45
+ }
46
+ }
47
+ //# sourceMappingURL=NSFCategoryEditPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NSFCategoryEditPage.js","sourceRoot":"","sources":["../../src/pages/NSFCategoryEditPage.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAW5C,MAAM,OAAO,mBAAoB,SAAQ,SAA6D;IAKrG,YAAY,KAA+B;QAE1C,KAAK,CAAC,KAAK,CAAC,CAAC;QALd,qBAAgB,GAAG,SAAS,EAAe,CAAC;QAC5C,6BAAwB,GAAG,SAAS,EAAiB,CAAC;QAKrD,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IACjB,CAAC;IAEQ,MAAM;QAEd,OAAO,CACN,KAAC,SAAS,oBACL,IAAI,CAAC,KAAK,IACd,MAAM,EAAE;gBACP,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,wEAAwE,CAAC,CAAC,CAAC,wEAAwE;aACpL,EACD,KAAK,EAAE;gBACN,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;gBACpF,IAAI,kCACA,IAAI,CAAC,KAAK,KACb,EAAE,EAAE;wBACH,aA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,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,EACpC,IAAI,EAAE,EAAE,IAAI,EAAE,wEAAwE,EAAE,GACvF,IACQ,IACA,CACZ,CAAC;IACH,CAAC;CACD"}
@@ -0,0 +1,8 @@
1
+ import { CategoryScopeRow, SlotRow } from "namirasoft-field";
2
+ import { NSARouterMakerProps } from "../NSARouterMakerProps";
3
+ import { NSFRouterProps } from "../NSFRouterProps";
4
+ export interface NSFCategoryListPageProps extends NSARouterMakerProps, NSFRouterProps {
5
+ slot: SlotRow;
6
+ category_scope: CategoryScopeRow;
7
+ }
8
+ export declare function NSFCategoryListPage(props: NSFCategoryListPageProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { NSALayout } from "../layouts/NSALayout";
3
+ import { NSFEntities } from "./NSFEntities";
4
+ export function NSFCategoryListPage(props) {
5
+ return (_jsx(NSALayout, Object.assign({}, props, { action: {
6
+ description: "This section displays all categories you have created with their basic information."
7
+ }, pages: {
8
+ entity: NSFEntities.category(props, props.slot, props.category_scope),
9
+ list: {}
10
+ }, children: _jsx(_Fragment, {}) })));
11
+ }
12
+ //# sourceMappingURL=NSFCategoryListPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NSFCategoryListPage.js","sourceRoot":"","sources":["../../src/pages/NSFCategoryListPage.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAQ5C,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IAElE,OAAO,CACN,KAAC,SAAS,oBACL,KAAK,IACT,MAAM,EAAE;YACP,WAAW,EAAE,qFAAqF;SAClG,EACD,KAAK,EAAE;YACN,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,cAAc,CAAC;YACrE,IAAI,EAAE,EAAE;SACR,YAED,mBACG,IACQ,CACZ,CAAC;AACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { CategoryScopeRow, SlotRow } from "namirasoft-field";
2
+ import { NSARouterMakerProps } from "../NSARouterMakerProps";
3
+ import { NSFRouterProps } from "../NSFRouterProps";
4
+ export interface NSFCategoryViewPageProps extends NSARouterMakerProps, NSFRouterProps {
5
+ slot: SlotRow;
6
+ category_scope: CategoryScopeRow;
7
+ }
8
+ export declare function NSFCategoryViewPage(props: NSFCategoryViewPageProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { NSALayout } from "../layouts/NSALayout";
3
+ import { NSFEntities } from "./NSFEntities";
4
+ export function NSFCategoryViewPage(props) {
5
+ return (_jsx(NSALayout, Object.assign({}, props, { action: {
6
+ description: "This section displays detailed information about a selected category."
7
+ }, pages: {
8
+ entity: NSFEntities.category(props, props.slot, props.category_scope),
9
+ view: {}
10
+ }, children: _jsx(_Fragment, { children: " " }) })));
11
+ }
12
+ //# sourceMappingURL=NSFCategoryViewPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NSFCategoryViewPage.js","sourceRoot":"","sources":["../../src/pages/NSFCategoryViewPage.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAQ5C,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IAElE,OAAO,CACN,KAAC,SAAS,oBACL,KAAK,IACT,MAAM,EAAE;YACP,WAAW,EAAE,uEAAuE;SACpF,EACD,KAAK,EAAE;YACN,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,cAAc,CAAC;YACrE,IAAI,EAAE,EAAE;SACR,YAED,kCAAM,IACK,CACZ,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { CategoryInputRow, CategoryRow, CategoryScopeRow, SlotRow } from "namirasoft-field";
2
+ import { IEntityInfo } from "../IEntityInfo";
3
+ import { NSARouterMakerProps } from "../NSARouterMakerProps";
4
+ import { NSFRouterProps } from "../NSFRouterProps";
5
+ export declare class NSFEntities {
6
+ static category(props: NSARouterMakerProps & NSFRouterProps, slot: SlotRow, category_scope: CategoryScopeRow): IEntityInfo<CategoryRow, CategoryInputRow>;
7
+ }
@@ -0,0 +1,60 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { ProductUUID } from "namirasoft-api-product";
11
+ import { EnvService, FilterItem, FilterItemOperator, IStorageLocal } from "namirasoft-core";
12
+ import { NamirasoftFieldMetaDatabase, NamirasoftFieldServer } from "namirasoft-field";
13
+ import { NamirasoftMap } from "namirasoft-site-map";
14
+ import { BaseColumnFormatter, DateTimeFormatter, IDFormatter, StringFormatter, StringFormatterSizeType } from "namirasoft-site-react";
15
+ import { NSFRoutes } from "../NSFRoutes";
16
+ export class NSFEntities {
17
+ static category(props, slot, category_scope) {
18
+ let namirasoft = new NamirasoftMap(props.account.token_manager, console.error);
19
+ return {
20
+ product_id: ProductUUID.NAMIRASOFT_FIELD,
21
+ name: "category",
22
+ tables: [{ table: namirasoft.field.tables.category, required: true }],
23
+ client: {
24
+ getColumns() {
25
+ return [
26
+ BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.id, new IDFormatter(namirasoft, null)),
27
+ BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.user_id, new IDFormatter(namirasoft, new IStorageLocal())),
28
+ BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.workspace_id, new IDFormatter(namirasoft, new IStorageLocal())),
29
+ BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.category_scope_id, new IDFormatter(namirasoft, new IStorageLocal())),
30
+ BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.name, new StringFormatter(StringFormatterSizeType.Sentence)),
31
+ BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.description, new StringFormatter(StringFormatterSizeType.Description)),
32
+ BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.created_at, new DateTimeFormatter()),
33
+ BaseColumnFormatter.getColumn(namirasoft.field.tables.category.columns.updated_at, new DateTimeFormatter()),
34
+ ];
35
+ },
36
+ getListURL: () => NSFRoutes.CategoryList(slot.id, slot.name),
37
+ getNewURL: () => NSFRoutes.CategoryNew(slot.id, slot.name),
38
+ getCopyURL: (id) => NSFRoutes.CategoryCopy(slot.id, slot.name, id),
39
+ getEditURL: (id) => NSFRoutes.CategoryEdit(slot.id, slot.name, id),
40
+ getViewURL: (id) => NSFRoutes.CategoryView(slot.id, slot.name, id),
41
+ },
42
+ server: {
43
+ value_list: props.servers.field.value.List,
44
+ get: props.servers.field.category.Get,
45
+ list: (filters, page, size, sorts, all_workspaces) => __awaiter(this, void 0, void 0, function* () {
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 !== null && filters !== void 0 ? filters : [])];
51
+ return yield 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
+ }
60
+ //# sourceMappingURL=NSFEntities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NSFEntities.js","sourceRoot":"","sources":["../../src/pages/NSFEntities.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAmD,2BAA2B,EAAE,qBAAqB,EAAW,MAAM,kBAAkB,CAAC;AAChJ,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAItI,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,OAAO,WAAW;IAEvB,MAAM,CAAC,QAAQ,CAAC,KAA2C,EAAE,IAAa,EAAE,cAAgC;QAE3G,IAAI,UAAU,GAAG,IAAI,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QAE/E,OAAO;YACN,UAAU,EAAE,WAAW,CAAC,gBAAgB;YACxC,IAAI,EAAE,UAAU;YAChB,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YACrE,MAAM,EAAE;gBACP,UAAU;oBAET,OAAO;wBACN,mBAAmB,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC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AAQ,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,iBAAiB,EAAE,KAAK,EAAE,kBAAkB,CAAC,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC;oBAC1K,OAAO,GAAG,CAAC,qBAAqB,EAAE,GAAG,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC,CAAC,CAAC;oBACtD,OAAO,MAAM,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;gBAC9E,CAAC,CAAA;gBACD,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM;gBAC3C,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM;gBAC3C,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM;aAC3C;SACD,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.5.11",
11
+ "version": "1.5.13",
12
12
  "author": "Amir Abolhasani",
13
13
  "license": "MIT",
14
14
  "main": "./dist/main.js",
@@ -0,0 +1,69 @@
1
+ import { CacheService, EnvService } from 'namirasoft-core';
2
+ import { CategoryScopeRow, EntityResolveResponseRow, NamirasoftFieldServer, SlotEntityType, SlotRow } from 'namirasoft-field';
3
+ import { NSRoutes } from 'namirasoft-site-react';
4
+ import { Component, ReactNode } from 'react';
5
+ import { Route } from 'react-router-dom';
6
+ import { FieldCacheService } from './FieldCacheService';
7
+ import { NSARouterMakerProps } from './NSARouterMakerProps';
8
+ import { NSFRoutes } from './NSFRoutes';
9
+ import { NSFCategoryEditPage } from './pages/NSFCategoryEditPage';
10
+ import { NSFCategoryListPage } from './pages/NSFCategoryListPage';
11
+ import { NSFCategoryViewPage } from './pages/NSFCategoryViewPage';
12
+
13
+ export interface NSARoutesProps extends NSARouterMakerProps
14
+ {
15
+ children: ReactNode;
16
+ }
17
+
18
+ interface NSARoutesState
19
+ {
20
+ rows: EntityResolveResponseRow | null;
21
+ }
22
+
23
+ export class NSARouter extends Component<NSARoutesProps, NSARoutesState>
24
+ {
25
+ private cache_field: CacheService<EntityResolveResponseRow>;
26
+
27
+ constructor(props: NSARoutesProps)
28
+ {
29
+ super(props);
30
+
31
+ this.cache_field = FieldCacheService.get(this.props.account.token_manager, this.props.product_id, this.props.notifier.onError);
32
+
33
+ this.state = {
34
+ rows: null,
35
+ };
36
+ }
37
+ override componentDidMount(): void
38
+ {
39
+ this.cache_field.get().then(rows =>
40
+ {
41
+ this.setState(prev => ({ ...prev, rows }));
42
+ });
43
+ }
44
+ override render()
45
+ {
46
+ const { rows } = this.state;
47
+ const scope_slots = rows?.slots.filter(s => s.entity_type === SlotEntityType.CategoryScope) ?? [];
48
+ let pairs = scope_slots.map(slot => ({ slot, category_scope: rows?.category_scopes.find(c => c.id === slot.entity_id) })).filter(i => i.category_scope) as { slot: SlotRow, category_scope: CategoryScopeRow }[];
49
+
50
+ let REACT_APP_BASE_URL_FIELD = new EnvService("REACT_APP_BASE_URL_FIELD", true).getString();
51
+ let field = new NamirasoftFieldServer(REACT_APP_BASE_URL_FIELD, this.props.account.token_manager, this.props.notifier.onError);
52
+ let servers = { field };
53
+
54
+ return (
55
+ <NSRoutes>
56
+ {this.props.children}
57
+ {
58
+ pairs.flatMap(({ slot, category_scope }) => [
59
+ <Route key={`${slot.id}-category-list`} path={NSFRoutes.CategoryList(slot.id, slot.name)} element={<NSFCategoryListPage {...this.props} servers={servers} slot={slot} category_scope={category_scope} />} />,
60
+ <Route key={`${slot.id}-category-new`} path={NSFRoutes.CategoryNew(slot.id, slot.name)} element={<NSFCategoryEditPage {...this.props} servers={servers} isEdit={false} slot={slot} category_scope={category_scope} />} />,
61
+ <Route key={`${slot.id}-category-copy`} path={NSFRoutes.CategoryCopy(slot.id, slot.name, ":id")} element={<NSFCategoryEditPage {...this.props} servers={servers} isEdit={false} slot={slot} category_scope={category_scope} />} />,
62
+ <Route key={`${slot.id}-category-edit`} path={NSFRoutes.CategoryEdit(slot.id, slot.name, ":id")} element={<NSFCategoryEditPage {...this.props} servers={servers} isEdit={true} slot={slot} category_scope={category_scope} />} />,
63
+ <Route key={`${slot.id}-category-view`} path={NSFRoutes.CategoryView(slot.id, slot.name, ":id")} element={<NSFCategoryViewPage {...this.props} servers={servers} slot={slot} category_scope={category_scope} />} />,
64
+ ])
65
+ }
66
+ </NSRoutes>
67
+ );
68
+ }
69
+ }
@@ -0,0 +1,8 @@
1
+ import { NamirasoftFieldServer } from "namirasoft-field";
2
+
3
+ export interface NSFRouterProps
4
+ {
5
+ servers: {
6
+ field: NamirasoftFieldServer;
7
+ }
8
+ }
@@ -0,0 +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
+ };
31
+ }
@@ -21,7 +21,7 @@ import { NSACacheService } from '../NSACacheService';
21
21
  import { NSARouterMakerProps } from '../NSARouterMakerProps';
22
22
  import { UseParams } from '../UseParams';
23
23
  import { Actions } from './Actions';
24
- import { NSARoutes_Field } from './NSARoutes_Field';
24
+ import { NSALayout_Field } from './NSALayout_Field';
25
25
  import { NSASectionEdit, NSASectionEditCustomProps } from './NSASectionEdit';
26
26
  import { NSASectionList, NSASectionListCustomProps } from './NSASectionList';
27
27
  import { NSASectionView, NSASectionViewCutomProps } from './NSASectionView';
@@ -670,7 +670,7 @@ export class NSALayout<RowType extends { id: string }, RowTypeInput = RowType> e
670
670
  {
671
671
  this.setState((prev) => ({ showMasterMenu: !prev.showMasterMenu }))
672
672
  },
673
- filters_postprocessor: (filters) => NSARoutes_Field.postprocess(filters, this.state.ctf_rows),
673
+ filters_postprocessor: (filters) => NSALayout_Field.postprocess(filters, this.state.ctf_rows),
674
674
  }}
675
675
  action={{
676
676
  title: action_title,
@@ -1,41 +1,42 @@
1
1
  import { FilterLinkFullRow } from 'namirasoft-api-link';
2
2
  import { NamingConvention } from 'namirasoft-core';
3
- import { CategoryScopeRow, EntityResolveResponseRow, SlotEntityType } from 'namirasoft-field';
3
+ import { EntityResolveResponseRow, SlotEntityType, SlotRow } from 'namirasoft-field';
4
+ import { NSFRoutes } from '../NSFRoutes';
4
5
 
5
- export class NSARoutes_Field
6
+ export class NSALayout_Field
6
7
  {
7
8
  static postprocess(
8
9
  filters: FilterLinkFullRow[],
9
10
  rows: EntityResolveResponseRow | null,
10
11
  ): FilterLinkFullRow[]
11
12
  {
12
- if (!rows || rows.category_scopes.length === 0)
13
+ if (!rows || rows.slots.length === 0)
13
14
  return filters;
14
15
 
15
16
  const result: FilterLinkFullRow[] = [...filters];
16
17
  const id_counter = { value: -1_000_000 };
17
18
  const matched = new Set<string>();
18
19
 
19
- NSARoutes_Field.walk(filters, null, rows, result, id_counter, matched);
20
+ NSALayout_Field.walk(filters, null, rows, result, id_counter, matched);
20
21
 
21
22
  const fallback_filter_id = filters[0]?.filter_id ?? 0;
22
23
  const fallback_filter_ref = filters[0]?.filter ?? null;
23
- for (const scope of rows.category_scopes)
24
+ for (const slot of rows.slots)
24
25
  {
25
- if (matched.has(scope.id))
26
+ if (matched.has(slot.id))
26
27
  continue;
27
28
 
28
- const parent = NSARoutes_Field.make(id_counter, null, fallback_filter_id, fallback_filter_ref, scope.name, scope.description ?? "", "");
29
+ const parent = NSALayout_Field.make(id_counter, null, fallback_filter_id, fallback_filter_ref, slot.name, slot.description ?? "", "");
29
30
  result.push(parent);
30
31
 
31
- result.push(NSARoutes_Field.make(id_counter, parent.id, fallback_filter_id, fallback_filter_ref, "Create", "", `./cateogry/${scope.name}/new`));
32
- result.push(NSARoutes_Field.make(id_counter, parent.id, fallback_filter_id, fallback_filter_ref, "List", "", `./cateogry/${scope.name}/list`));
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)));
33
34
  }
34
35
 
35
36
  return result;
36
37
  }
37
38
 
38
- private static findScope(filter_name: string | null | undefined, rows: EntityResolveResponseRow): CategoryScopeRow | null
39
+ private static findEntityRow(filter_name: string | null | undefined, rows: EntityResolveResponseRow): SlotRow | null
39
40
  {
40
41
  const n = NamingConvention.auto.convert((filter_name ?? "").trim(), NamingConvention.lower_case);
41
42
  if (n.length === 0)
@@ -45,11 +46,7 @@ export class NSARoutes_Field
45
46
  if (slot.entity_type != SlotEntityType.CategoryScope)
46
47
  continue;
47
48
  if (NamingConvention.auto.convert((slot.entity ?? "").trim(), NamingConvention.lower_case) === n)
48
- {
49
- const scope = rows.category_scopes.find(c => c.id == slot.entity_id);
50
- if (scope)
51
- return scope;
52
- }
49
+ return slot;
53
50
  }
54
51
  return null;
55
52
  }
@@ -109,16 +106,21 @@ export class NSARoutes_Field
109
106
  for (const filter of children)
110
107
  {
111
108
  const filter_name = filter.name ?? filter.link?.name ?? "";
112
- const scope = NSARoutes_Field.findScope(filter_name, rows);
113
- if (scope)
109
+ const slot = NSALayout_Field.findEntityRow(filter_name, rows);
110
+ if (slot)
114
111
  {
115
- matched.add(scope.id);
116
- const parent = NSARoutes_Field.make(id_counter, filter.id, filter.filter_id, filter.filter, scope.name, scope.description ?? "", "");
117
- result.push(parent);
118
- result.push(NSARoutes_Field.make(id_counter, parent.id, filter.filter_id, filter.filter, "Create", "", `./cateogry/${scope.name}/new`));
119
- result.push(NSARoutes_Field.make(id_counter, parent.id, filter.filter_id, filter.filter, "List", "", `./cateogry/${scope.name}/list`));
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)));
120
122
  }
121
- NSARoutes_Field.walk(filters, filter.id, rows, result, id_counter, matched);
123
+ NSALayout_Field.walk(filters, filter.id, rows, result, id_counter, matched);
122
124
  }
123
125
  }
124
126
  }
@@ -123,7 +123,7 @@ export class NSASectionList<RowType extends { id: string }, RowTypeInput = RowTy
123
123
  {
124
124
  show_view ?
125
125
  <NSSplitter
126
- storage_key={`nsa_splitter_${this.props.entity.product_id}_${this.props.entity.name}`}
126
+ storage_key={`ns-splitter-product:${this.props.entity.product_id}-entity:${this.props.entity.name}-height`}
127
127
  master_content={mode_current.getChild(this.props.entity)}
128
128
  detail_content={(
129
129
  this.state.selected_row_ids.length === 1 &&
package/src/main.ts CHANGED
@@ -1,8 +1,15 @@
1
1
  export * from "./components/NSAAccessListDialog";
2
+ export * from "./components/NSABoxSecret";
2
3
  export * from "./components/NSAMasterMenu";
3
4
  export * from "./components/NSAMasterMenuItem";
4
5
  export * from "./components/NSAMessageListDialog";
5
6
  export * from "./components/NSAProductListDialog";
7
+ export * from "./components/NSAReorderDialog";
8
+ export * from "./components/NSASortDialog";
9
+ export * from "./components/NSATable";
10
+ export * from "./components/NSAUserDialog";
11
+ export * from "./components/NSAWorkspaceListDialog";
12
+ export * from "./components/NSLabelSecret";
6
13
  export * from "./components/quickfilter/NSAFilterBoxBase";
7
14
  export * from "./components/quickfilter/NSAFilterBoxBoolean";
8
15
  export * from "./components/quickfilter/NSAFilterBoxDate";
@@ -13,35 +20,35 @@ export * from "./components/quickfilter/NSAFilterBoxString";
13
20
  export * from "./components/quickfilter/NSAFilterBoxTime";
14
21
  export * from "./components/quickfilter/NSAQuickFilterBar";
15
22
  export * from "./components/quickfilter/NSAQuickFilterDialog";
16
- export * from "./components/NSAReorderDialog";
17
- export * from "./components/NSASortDialog";
18
- export * from "./components/NSATable";
19
- export * from "./components/NSAUserDialog";
20
- export * from "./components/NSAWorkspaceListDialog";
21
- export * from "./components/NSABoxSecret";
22
- export * from "./components/NSLabelSecret";
23
+ export * from "./CTFRow";
23
24
  export * from "./formatters/SecretFormatter";
25
+ export * from "./IEntityInfo";
24
26
  export * from "./layouts/Actions";
25
27
  export * from "./layouts/CFTUtil";
26
28
  export * from "./layouts/NSALayout";
29
+ export * from "./layouts/NSALayout_Field";
27
30
  export * from "./layouts/NSASectionEdit";
28
31
  export * from "./layouts/NSASectionEditTabPage";
29
32
  export * from "./layouts/NSASectionList";
30
33
  export * from "./layouts/NSASectionView";
31
34
  export * from "./layouts/NSASectionViewTabMore";
32
35
  export * from "./layouts/NSASectionViewTabPage";
36
+ export * from "./NSACacheService";
37
+ export * from "./NSAFilterOperators";
38
+ export * from "./NSARouter";
39
+ export * from "./NSARouterMaker";
40
+ export * from "./NSARouterMakerConfig";
41
+ export * from "./NSARouterMakerProps";
42
+ export * from "./NSFRoutes";
33
43
  export * from "./pages/NSAConsentPage";
34
44
  export * from "./pages/NSAEmailVerificationPage";
35
45
  export * from "./pages/NSAHomePage";
36
46
  export * from "./pages/NSALoginPage";
37
47
  export * from "./pages/NSAPhoneVerificationPage";
38
48
  export * from "./pages/NSAVerificationPage";
49
+ export * from "./pages/NSFCategoryEditPage";
50
+ export * from "./pages/NSFCategoryListPage";
51
+ export * from "./pages/NSFCategoryViewPage";
52
+ export * from "./pages/NSFEntities";
39
53
  export * from "./pages/PaymentRequired";
40
- export * from "./CTFRow";
41
- export * from "./IEntityInfo";
42
- export * from "./NSACacheService";
43
- export * from "./NSAFilterOperators";
44
- export * from "./NSARouterMaker";
45
- export * from "./NSARouterMakerConfig";
46
- export * from "./NSARouterMakerProps";
47
54
  export * from "./UseParams";
@@ -0,0 +1,92 @@
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 { NSALayout } from "../layouts/NSALayout";
5
+ import { NSARouterMakerProps } from "../NSARouterMakerProps";
6
+ import { NSFRouterProps } from "../NSFRouterProps";
7
+ import { NSFEntities } from "./NSFEntities";
8
+
9
+ export interface NSFCategoryEditPageProps extends NSARouterMakerProps, NSFRouterProps
10
+ {
11
+ slot: SlotRow;
12
+ category_scope: CategoryScopeRow;
13
+ isEdit: boolean;
14
+ }
15
+
16
+ interface NSFCategoryEditPageState { }
17
+
18
+ export class NSFCategoryEditPage extends Component<NSFCategoryEditPageProps, NSFCategoryEditPageState>
19
+ {
20
+ NSBoxString_Name = createRef<NSBoxString>();
21
+ NSBoxTexArea_Description = createRef<NSBoxTextArea>();
22
+
23
+ constructor(props: NSFCategoryEditPageProps)
24
+ {
25
+ super(props);
26
+ this.state = {};
27
+ }
28
+
29
+ override render()
30
+ {
31
+ return (
32
+ <NSALayout<CategoryRow, CategoryInputRow>
33
+ {...this.props}
34
+ action={{
35
+ 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."
36
+ }}
37
+ pages={{
38
+ entity: NSFEntities.category(this.props, this.props.slot, this.props.category_scope),
39
+ edit: {
40
+ ...this.props,
41
+ ui: {
42
+ tab_page_edit: {
43
+ editor: {
44
+ getInputRow: () =>
45
+ {
46
+ let category_scope_id = this.props.category_scope.id;
47
+ let name = this.NSBoxString_Name.current?.getValue() ?? "";
48
+ let description = this.NSBoxTexArea_Description.current?.getValue() ?? "";
49
+
50
+ return {
51
+ workspace_id: "",
52
+ category_scope_id,
53
+ name,
54
+ description,
55
+ category_category: [],
56
+ category_field: [],
57
+ category_tag: [],
58
+ };
59
+ },
60
+ setRow: (row) =>
61
+ {
62
+ this.NSBoxString_Name.current?.setValue(row.name);
63
+ this.NSBoxTexArea_Description.current?.setValue(row.description ?? "");
64
+ }
65
+ }
66
+ }
67
+ }
68
+ }
69
+ }}
70
+ >
71
+ <NSColumn>
72
+ <NSRow>
73
+ <NSBoxString
74
+ ref={this.NSBoxString_Name}
75
+ title="Name"
76
+ required
77
+ style={{ width: NSBox.width.double }}
78
+ info={{ link: "https://namirasoft.com/field/console-guide/category/#field-name" }}
79
+ />
80
+ </NSRow>
81
+ <NSBoxTextArea
82
+ ref={this.NSBoxTexArea_Description}
83
+ title="Description"
84
+ required={false}
85
+ style={{ width: NSBox.width.double }}
86
+ info={{ link: "https://namirasoft.com/field/console-guide/category/#field-description" }}
87
+ />
88
+ </NSColumn>
89
+ </NSALayout>
90
+ );
91
+ }
92
+ }