awing-library 2.1.2-dev.51 → 2.1.2-dev.53

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.
@@ -0,0 +1,10 @@
1
+ import { DropDownTreeSelectValueProps } from '../type';
2
+ type TreeViewSearchProps = {
3
+ data: DropDownTreeSelectValueProps[];
4
+ setListId: (value: string[]) => void;
5
+ inputText?: string;
6
+ groupsList?: string[];
7
+ listId?: string[];
8
+ };
9
+ export declare const TreeViewSearch: ({ inputText, groupsList, data, setListId, listId }: TreeViewSearchProps) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1 @@
1
+ export declare const onlyUnique: <T>(array: T[]) => T[];
@@ -0,0 +1,10 @@
1
+ import './index.css';
2
+ import { DropDownTreeSelectValueProps } from './type';
3
+ type DropDownTreeSelectProps = {
4
+ data: DropDownTreeSelectValueProps[];
5
+ listId: string[];
6
+ setListId: (value: string[]) => void;
7
+ disabled?: boolean;
8
+ };
9
+ declare const DropDownTreeSelect: ({ data, listId, setListId, disabled }: DropDownTreeSelectProps) => import("react/jsx-runtime").JSX.Element;
10
+ export default DropDownTreeSelect;
@@ -0,0 +1,5 @@
1
+ export type DropDownTreeSelectValueProps = {
2
+ id: string;
3
+ label: string;
4
+ children?: DropDownTreeSelectValueProps[];
5
+ };
@@ -0,0 +1,16 @@
1
+ import { DropDownTreeSelectValueProps } from './type';
2
+ /**
3
+ * Chuyển đổi dữ liệu phẳng thành cấu trúc cây phân cấp theo kiểu DropDownTreeSelectValueProps
4
+ * @param data Dữ liệu phẳng cần chuyển đổi
5
+ * @param parentIdField Tên trường dùng để xác định ID của node cha, mặc định là "parentObjectId"
6
+ * @param rootValue Giá trị gốc để xác định các node cấp cao nhất, mặc định là 0
7
+ * @returns Mảng các đối tượng DropDownTreeSelectValueProps đã được chuyển đổi
8
+ */
9
+ export declare const convertDataToDropDownTreeSelect: (data: any[], parentIdField?: string, rootValue?: any) => DropDownTreeSelectValueProps[];
10
+ /**
11
+ * Phiên bản đơn giản hơn của hàm chuyển đổi, tạo cây trực tiếp dựa trên cấu trúc level
12
+ * @param data Dữ liệu phẳng cần chuyển đổi
13
+ * @param parentIdField Tên trường dùng để xác định ID của node cha, mặc định là "parentObjectId"
14
+ * @param rootValue Giá trị gốc để xác định các node cấp cao nhất, mặc định là 0
15
+ */
16
+ export declare const convertDataToDropDownTreeSelectSimple: (data: any[], parentIdField?: string, rootValue?: any) => DropDownTreeSelectValueProps[];
@@ -1,12 +1,13 @@
1
1
  import { type DirectoryAddOrEditServices } from 'AWING/DirectoryForm';
2
2
  import { type DirectoryPermissionServices } from 'AWING/DirectoryPermission';
3
- import type { PagingQueryInput } from 'Features/types';
3
+ import type { CustomPagingRequestInput } from 'Features/types';
4
4
  import type { Directory } from './types';
5
5
  export type DirectoryServices = DirectoryAddOrEditServices & DirectoryPermissionServices & {
6
6
  /** Get Directories
7
7
  * @params PagingQueryInput<Directory> - Không truyền param sẽ lấy tất cả
8
8
  */
9
- getDirectories: (params?: PagingQueryInput<Directory> & {
9
+ getDirectories: (params?: {
10
+ input?: CustomPagingRequestInput;
10
11
  parentDirectoryId?: number;
11
12
  workspaceId?: number;
12
13
  depthFromRoot?: number;
@@ -1,4 +1,4 @@
1
- import { CustomPagingRequestInput, PagingQueryInput } from 'Features/types';
1
+ import { CustomPagingRequestInput } from 'Features/types';
2
2
  import { Schema, SchemaObjectDefinition } from '../Schema';
3
3
  import { Workspace } from '../types';
4
4
  import { Atom } from 'jotai';
@@ -170,7 +170,8 @@ export interface SharingProps {
170
170
  id: number;
171
171
  }) => Promise<void>;
172
172
  getObjectFilters: () => Promise<ObjectFilter[]>;
173
- getDirectories: (params?: PagingQueryInput<Directory> & {
173
+ getDirectories: (params?: {
174
+ input?: CustomPagingRequestInput;
174
175
  parentDirectoryId?: number;
175
176
  workspaceId?: number;
176
177
  depthFromRoot?: number;
package/dist/esm/index.js CHANGED
@@ -182630,7 +182630,7 @@ const CreateOrEdit$5 = () => {
182630
182630
  // State nhận giá trị khi get API
182631
182631
  const [notificationFilter, setNotificationFilter] = useState(defaultObjectFilter);
182632
182632
  const [loadingNotificationFilter, setLoadingNotificationFilter] = useState(false);
182633
- const [fieldEditPermission, setFieldEditPermission] = useState({
182633
+ const [_fieldEditPermission, setFieldEditPermission] = useState({
182634
182634
  configType: false,
182635
182635
  name: false,
182636
182636
  logicalExpression: false
@@ -187648,10 +187648,12 @@ function Container$3() {
187648
187648
  depthFromRoot
187649
187649
  };
187650
187650
  await (services === null || services === void 0 ? void 0 : services.getDirectories(Object.assign({
187651
- where: {
187652
- isFile: {
187653
- eq: false
187654
- }
187651
+ input: {
187652
+ where: Object.assign({}, convertArrayFiltersToCondition([{
187653
+ key: 'isFile',
187654
+ type: FilterOperationType.EQ,
187655
+ value: false
187656
+ }]))
187655
187657
  },
187656
187658
  workspaceId: currentWorkspace === null || currentWorkspace === void 0 ? void 0 : currentWorkspace.id,
187657
187659
  parentDirectoryId: directoryId
@@ -187668,28 +187670,29 @@ function Container$3() {
187668
187670
  let searchKey = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
187669
187671
  let objectTypeCode = arguments.length > 5 ? arguments[5] : undefined;
187670
187672
  setLoadingChildDirectories(true);
187671
- const queryObjectTypeCode = objectTypeCode ? {
187672
- objectTypeCode: {
187673
- eq: objectTypeCode
187674
- }
187675
- } : {};
187676
187673
  const queryDepthFromRoot = depthFromRoot === -1 ? {} : {
187677
187674
  depthFromRoot
187678
187675
  };
187679
- await (services === null || services === void 0 ? void 0 : services.getDirectories(Object.assign(Object.assign({
187680
- parentDirectoryId: newFocusDirectoryId,
187681
- where: Object.assign({
187682
- name: {
187683
- contains: searchKey
187684
- },
187685
- id: {
187686
- neq: newFocusDirectoryId
187687
- }
187688
- }, queryObjectTypeCode)
187689
- }, queryDepthFromRoot), {
187690
- skip: newPageIndex * newPageSize,
187691
- take: newPageSize
187692
- })).then(data => {
187676
+ await (services === null || services === void 0 ? void 0 : services.getDirectories(Object.assign({
187677
+ input: {
187678
+ where: Object.assign({}, convertArrayFiltersToCondition([{
187679
+ key: 'name',
187680
+ type: FilterOperationType.CONTAINS,
187681
+ value: searchKey
187682
+ }, {
187683
+ key: 'id',
187684
+ type: FilterOperationType.NE,
187685
+ value: newFocusDirectoryId
187686
+ }, {
187687
+ key: 'objectTypeCode',
187688
+ type: FilterOperationType.EQ,
187689
+ value: objectTypeCode
187690
+ }])),
187691
+ skip: newPageIndex * newPageSize,
187692
+ take: newPageSize
187693
+ },
187694
+ parentDirectoryId: newFocusDirectoryId
187695
+ }, queryDepthFromRoot)).then(data => {
187693
187696
  setLoadingChildDirectories(false);
187694
187697
  setChildDirectories(data.items);
187695
187698
  setChildDirectoriesTotal(data.total);
@@ -189331,10 +189334,12 @@ function Create() {
189331
189334
  setObjectFilters(objectFilters || []);
189332
189335
  });
189333
189336
  getDirectories({
189334
- where: {
189335
- isFile: {
189336
- eq: false
189337
- }
189337
+ input: {
189338
+ where: Object.assign({}, convertArrayFiltersToCondition([{
189339
+ key: 'isFile',
189340
+ type: FilterOperationType.EQ,
189341
+ value: false
189342
+ }]))
189338
189343
  },
189339
189344
  // workspaceId: 1 do ADMIN nó tách ra khỏi storage
189340
189345
  workspaceId: 1
package/dist/index.d.ts CHANGED
@@ -2856,7 +2856,8 @@ interface SharingProps {
2856
2856
  id: number;
2857
2857
  }) => Promise<void>;
2858
2858
  getObjectFilters: () => Promise<ObjectFilter[]>;
2859
- getDirectories: (params?: PagingQueryInput<Directory$3> & {
2859
+ getDirectories: (params?: {
2860
+ input?: CustomPagingRequestInput;
2860
2861
  parentDirectoryId?: number;
2861
2862
  workspaceId?: number;
2862
2863
  depthFromRoot?: number;
@@ -3115,7 +3116,8 @@ type DirectoryServices = DirectoryAddOrEditServices$1 & DirectoryPermissionServi
3115
3116
  /** Get Directories
3116
3117
  * @params PagingQueryInput<Directory> - Không truyền param sẽ lấy tất cả
3117
3118
  */
3118
- getDirectories: (params?: PagingQueryInput<Directory> & {
3119
+ getDirectories: (params?: {
3120
+ input?: CustomPagingRequestInput;
3119
3121
  parentDirectoryId?: number;
3120
3122
  workspaceId?: number;
3121
3123
  depthFromRoot?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awing-library",
3
- "version": "2.1.2-dev.51",
3
+ "version": "2.1.2-dev.53",
4
4
  "main": "dist/esm/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/index.d.ts",