awing-library 2.1.2-dev.56 → 2.1.2-dev.58

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.
@@ -1,8 +1,7 @@
1
- import { EnumTypeConvert } from 'Features/types';
2
1
  import { NotificationFilter } from './types';
3
- interface NotificationFilterInput {
4
- [key: string]: string | number | undefined;
5
- }
6
2
  export declare const checkValid: (currentNotificationFilterInput: NotificationFilter) => boolean;
7
- export declare const getDifferentFieldsValue: (oldObjectFilter: NotificationFilter, newObjectFilter: NotificationFilterInput, objectTyeCodes: EnumTypeConvert[], objectConfigTypes: EnumTypeConvert[]) => NotificationFilterInput;
3
+ interface GenericObject {
4
+ [key: string]: string | number | boolean | null | undefined | object;
5
+ }
6
+ export declare const compareObjects: <T extends GenericObject>(original: T, changed: T) => Partial<T>;
8
7
  export {};
@@ -5,12 +5,10 @@ import { LogicExpressionsStructure } from './types';
5
5
  export declare const ObjectFilterContext: import("react").Context<{
6
6
  services?: ObjectFilterServices;
7
7
  objectTyeCodes?: EnumTypeConvert[];
8
- objectConfigTypes?: EnumTypeConvert[];
9
8
  logicExpressionsStructure?: LogicExpressionsStructure;
10
9
  }>;
11
10
  export declare const useGetContext: () => {
12
11
  services?: ObjectFilterServices;
13
12
  objectTyeCodes?: EnumTypeConvert[];
14
- objectConfigTypes?: EnumTypeConvert[];
15
13
  logicExpressionsStructure?: LogicExpressionsStructure;
16
14
  };
@@ -3,7 +3,6 @@ import { EnumTypeConvert } from 'Features/types';
3
3
  import { LogicExpressionsStructure } from './types';
4
4
  declare const NotificationFilter: (props: ObjectFilterServices & {
5
5
  objectTyeCodes: EnumTypeConvert[];
6
- objectConfigTypes: EnumTypeConvert[];
7
6
  logicExpressionsStructure: LogicExpressionsStructure;
8
7
  }) => import("react/jsx-runtime").JSX.Element;
9
8
  export * from './types';
@@ -4,5 +4,5 @@ interface ObjectFilterInput {
4
4
  [key: string]: string | number | undefined;
5
5
  }
6
6
  export declare const checkValid: (currentObjectFilterInput: ObjectFilter) => boolean;
7
- export declare const getDifferentFieldsValue: (oldObjectFilter: ObjectFilter, newObjectFilter: ObjectFilterInput, objectTyeCodes: EnumTypeConvert[], objectConfigTypes: EnumTypeConvert[]) => ObjectFilterInput;
7
+ export declare const getDifferentFieldsValue: (oldObjectFilter: ObjectFilter, newObjectFilter: ObjectFilterInput, objectTyeCodes: EnumTypeConvert[]) => ObjectFilterInput;
8
8
  export {};
@@ -20,8 +20,7 @@ export type Sharing = {
20
20
  objectFilterId: number;
21
21
  schema?: Schema;
22
22
  schemaId?: number;
23
- sharingWorkspaces: Array<SharingWorkspace>;
24
- totalTargetWorkspace: number;
23
+ sharingWorkspaces?: Array<SharingWorkspace>;
25
24
  workspaceId: number;
26
25
  folderSourceDirectoryId?: number;
27
26
  key?: string;
package/dist/esm/index.js CHANGED
@@ -182215,7 +182215,7 @@ const ObjectFilterContainer = () => {
182215
182215
  const checkValid$2 = currentObjectFilterInput => {
182216
182216
  return Object.values(currentObjectFilterInput).every(value => value !== undefined && "".concat(value).trim() !== '');
182217
182217
  };
182218
- const getDifferentFieldsValue = (oldObjectFilter, newObjectFilter, objectTyeCodes, objectConfigTypes) => {
182218
+ const getDifferentFieldsValue = (oldObjectFilter, newObjectFilter, objectTyeCodes) => {
182219
182219
  const differentField = {};
182220
182220
  Object.entries(newObjectFilter).forEach(_ref => {
182221
182221
  let [key, value] = _ref;
@@ -182224,9 +182224,6 @@ const getDifferentFieldsValue = (oldObjectFilter, newObjectFilter, objectTyeCode
182224
182224
  if (key === 'objectTypeCode') {
182225
182225
  const ob = objectTyeCodes.find(i => i.value === value);
182226
182226
  differentField[key] = ob === null || ob === void 0 ? void 0 : ob.value;
182227
- } else if (key === 'configType') {
182228
- const ob = objectConfigTypes.find(i => i.value === value);
182229
- differentField[key] = ob === null || ob === void 0 ? void 0 : ob.value;
182230
182227
  } else differentField[key] = value;
182231
182228
  }
182232
182229
  });
@@ -182234,7 +182231,7 @@ const getDifferentFieldsValue = (oldObjectFilter, newObjectFilter, objectTyeCode
182234
182231
  };
182235
182232
 
182236
182233
  const CreateOrEdit$6 = () => {
182237
- var _a, _b;
182234
+ var _a;
182238
182235
  const {
182239
182236
  id
182240
182237
  } = useParams();
@@ -182245,7 +182242,6 @@ const CreateOrEdit$6 = () => {
182245
182242
  const {
182246
182243
  services,
182247
182244
  objectTyeCodes = [],
182248
- objectConfigTypes = [],
182249
182245
  logicExpressionsStructure
182250
182246
  } = useGetContext$5();
182251
182247
  // State để kiểm tra việc disabled cho nút thử nghiệm
@@ -182321,7 +182317,7 @@ const CreateOrEdit$6 = () => {
182321
182317
  if (objectFilterId) {
182322
182318
  return await (services === null || services === void 0 ? void 0 : services.updateObjectFilter({
182323
182319
  id: objectFilterId,
182324
- input: getDifferentFieldsValue(convertToObjectFilterInput(originalObjectFilter !== null && originalObjectFilter !== void 0 ? originalObjectFilter : {}), convertToObjectFilterInput(objectFilter), objectTyeCodes, objectConfigTypes),
182320
+ input: getDifferentFieldsValue(convertToObjectFilterInput(originalObjectFilter !== null && originalObjectFilter !== void 0 ? originalObjectFilter : {}), convertToObjectFilterInput(objectFilter), objectTyeCodes),
182325
182321
  versionId: objectFilter.versionId
182326
182322
  }).then(() => {
182327
182323
  snackbar('success');
@@ -182371,16 +182367,15 @@ const CreateOrEdit$6 = () => {
182371
182367
  }
182372
182368
  }, [testingDataInput.objectFilter]);
182373
182369
  useEffect(() => {
182374
- if (!objectFilterId && (objectTyeCodes === null || objectTyeCodes === void 0 ? void 0 : objectTyeCodes.length) > 0 && (objectConfigTypes === null || objectConfigTypes === void 0 ? void 0 : objectConfigTypes.length) > 0) {
182370
+ if (!objectFilterId && (objectTyeCodes === null || objectTyeCodes === void 0 ? void 0 : objectTyeCodes.length) > 0) {
182375
182371
  setObjectFilter(prev => {
182376
- var _a, _b, _c, _d;
182372
+ var _a, _b;
182377
182373
  return Object.assign(Object.assign({}, prev), {
182378
- objectTypeCode: (_b = String((_a = objectTyeCodes[0]) === null || _a === void 0 ? void 0 : _a.value)) !== null && _b !== void 0 ? _b : '',
182379
- configType: (_d = String((_c = objectConfigTypes[0]) === null || _c === void 0 ? void 0 : _c.value)) !== null && _d !== void 0 ? _d : ''
182374
+ objectTypeCode: (_b = String((_a = objectTyeCodes[0]) === null || _a === void 0 ? void 0 : _a.value)) !== null && _b !== void 0 ? _b : ''
182380
182375
  });
182381
182376
  });
182382
182377
  }
182383
- }, [objectTyeCodes, objectConfigTypes]);
182378
+ }, [objectTyeCodes]);
182384
182379
  const objectStructuresByObjectTypeCode = useMemo(() => {
182385
182380
  if (objectFilter.objectTypeCode && (logicExpressionsStructure === null || logicExpressionsStructure === void 0 ? void 0 : logicExpressionsStructure.objectStructures)) {
182386
182381
  return logicExpressionsStructure === null || logicExpressionsStructure === void 0 ? void 0 : logicExpressionsStructure.objectStructures[objectFilter.objectTypeCode];
@@ -182425,18 +182420,6 @@ const CreateOrEdit$6 = () => {
182425
182420
  inputProps: {
182426
182421
  readOnly: !!objectFilterId
182427
182422
  }
182428
- }, {
182429
- fieldName: 'configType',
182430
- type: FIELD_TYPE.SELECT,
182431
- label: t('Filter.ConfigType'),
182432
- required: true,
182433
- options: (_a = objectConfigTypes !== null && objectConfigTypes !== void 0 ? objectConfigTypes : []) === null || _a === void 0 ? void 0 : _a.map(item => ({
182434
- value: item.value.toString(),
182435
- text: item.key
182436
- })),
182437
- inputProps: {
182438
- readOnly: !!objectFilterId && !fieldEditPermission.configType
182439
- }
182440
182423
  }, {
182441
182424
  fieldName: 'name',
182442
182425
  type: FIELD_TYPE.TEXT,
@@ -182451,7 +182434,7 @@ const CreateOrEdit$6 = () => {
182451
182434
  type: FIELD_TYPE.LOGIC_EXPRESSION,
182452
182435
  required: true,
182453
182436
  label: t('Filter.LogicExpression'),
182454
- functionStructures: (_b = logicExpressionsStructure === null || logicExpressionsStructure === void 0 ? void 0 : logicExpressionsStructure.functionStructures) !== null && _b !== void 0 ? _b : [],
182437
+ functionStructures: (_a = logicExpressionsStructure === null || logicExpressionsStructure === void 0 ? void 0 : logicExpressionsStructure.functionStructures) !== null && _a !== void 0 ? _a : [],
182455
182438
  objectStructures: objectStructuresByObjectTypeCode !== null && objectStructuresByObjectTypeCode !== void 0 ? objectStructuresByObjectTypeCode : [],
182456
182439
  defaultValue: objectFilter.logicalExpression,
182457
182440
  disabled: !!objectFilterId && !fieldEditPermission.logicalExpression
@@ -182481,10 +182464,9 @@ const CreateOrEdit$6 = () => {
182481
182464
  const NotificationFilter = props => {
182482
182465
  const {
182483
182466
  objectTyeCodes,
182484
- logicExpressionsStructure,
182485
- objectConfigTypes
182467
+ logicExpressionsStructure
182486
182468
  } = props,
182487
- services = __rest$1(props, ["objectTyeCodes", "logicExpressionsStructure", "objectConfigTypes"]);
182469
+ services = __rest$1(props, ["objectTyeCodes", "logicExpressionsStructure"]);
182488
182470
  const paths = [{
182489
182471
  param: Constants$3.CREATE_PATH,
182490
182472
  element: jsxRuntimeExports.jsx(CreateOrEdit$6, {})
@@ -182497,7 +182479,6 @@ const NotificationFilter = props => {
182497
182479
  value: {
182498
182480
  services: services,
182499
182481
  objectTyeCodes,
182500
- objectConfigTypes,
182501
182482
  logicExpressionsStructure
182502
182483
  },
182503
182484
  children: [jsxRuntimeExports.jsx(ObjectFilterContainer, {}), jsxRuntimeExports.jsx(Routes, {
@@ -182627,6 +182608,17 @@ const NotificationFilterContainer = () => {
182627
182608
  const checkValid$1 = currentNotificationFilterInput => {
182628
182609
  return Object.values(currentNotificationFilterInput).every(value => value !== undefined && "".concat(value).trim() !== '');
182629
182610
  };
182611
+ const compareObjects = (original, changed) => {
182612
+ const differences = {};
182613
+ // Lặp qua các key của object original
182614
+ Object.keys(original).forEach(key => {
182615
+ // So sánh giá trị của key trong cả hai object
182616
+ if (original[key] !== changed[key]) {
182617
+ differences[key] = changed[key];
182618
+ }
182619
+ });
182620
+ return differences;
182621
+ };
182630
182622
 
182631
182623
  const CreateOrEdit$5 = () => {
182632
182624
  var _a;
@@ -182717,17 +182709,6 @@ const CreateOrEdit$5 = () => {
182717
182709
  name: filter.name
182718
182710
  };
182719
182711
  };
182720
- const compareObjects = (original, changed) => {
182721
- const differences = {};
182722
- // Lặp qua các key của object original
182723
- Object.keys(original).forEach(key => {
182724
- // So sánh giá trị của key trong cả hai object
182725
- if (original[key] !== changed[key]) {
182726
- differences[key] = changed[key];
182727
- }
182728
- });
182729
- return differences;
182730
- };
182731
182712
  const handleSubmit = async () => {
182732
182713
  var _a;
182733
182714
  if (notificationFilterId) {
@@ -187194,7 +187175,7 @@ const convertWorkflow = (isCreate, workflow) => {
187194
187175
  } = workflow,
187195
187176
  rest = __rest$1(workflow, ["workflowMatrices", "workflowStates"]);
187196
187177
  let temp = Object.assign({}, rest);
187197
- temp = lodashExports.omit(temp, ['id']);
187178
+ temp = lodashExports.omit(temp, ['id', 'versionId']);
187198
187179
  temp.workflowStates = reconvertWorkflowStates(isCreate, workflowStates !== null && workflowStates !== void 0 ? workflowStates : []);
187199
187180
  return temp;
187200
187181
  };
@@ -189680,6 +189661,10 @@ function SharingContainer() {
189680
189661
  }, {
189681
189662
  field: 'totalTargetWorkspace',
189682
189663
  headerName: t('WorkspaceSharing.Label.Workspace'),
189664
+ valueGetter: row => {
189665
+ var _a;
189666
+ return ((_a = row === null || row === void 0 ? void 0 : row.sharingWorkspaces) === null || _a === void 0 ? void 0 : _a.length) || '';
189667
+ },
189683
189668
  TableCellProps: {
189684
189669
  sx: {
189685
189670
  wordBreak: 'break-word'
package/dist/index.d.ts CHANGED
@@ -2460,7 +2460,6 @@ type ObjectFilterServices = {
2460
2460
 
2461
2461
  declare const NotificationFilter$1: (props: ObjectFilterServices & {
2462
2462
  objectTyeCodes: EnumTypeConvert[];
2463
- objectConfigTypes: EnumTypeConvert[];
2464
2463
  logicExpressionsStructure: LogicExpressionsStructure$1;
2465
2464
  }) => react_jsx_runtime.JSX.Element;
2466
2465
 
@@ -2766,8 +2765,7 @@ type Sharing$1 = {
2766
2765
  objectFilterId: number;
2767
2766
  schema?: Schema;
2768
2767
  schemaId?: number;
2769
- sharingWorkspaces: Array<SharingWorkspace>;
2770
- totalTargetWorkspace: number;
2768
+ sharingWorkspaces?: Array<SharingWorkspace>;
2771
2769
  workspaceId: number;
2772
2770
  folderSourceDirectoryId?: number;
2773
2771
  key?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awing-library",
3
- "version": "2.1.2-dev.56",
3
+ "version": "2.1.2-dev.58",
4
4
  "main": "dist/esm/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/index.d.ts",