@izara_frontend/shared-complex-filter 1.0.2 → 1.0.4

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,4 +1,4 @@
1
- import { useState, useEffect, useMemo } from "react";
1
+ import React, { useState, useEffect, useMemo } from "react";
2
2
  import { useImmer } from "use-immer";
3
3
  import {
4
4
  IzaraDivStyle,
@@ -8,21 +8,14 @@ import {
8
8
  } from "@izaraFrontends/styles";
9
9
 
10
10
  import { useDispatch } from "react-redux";
11
- //test---------------------------------
12
- // import { successTraversalConfig } from "./function/createActionLibCreateLinkStepAndComplexFilter";
13
- // import { ConditionsAndMultipleIdentifersComponent } from "./conditionsAndMultipleIdentifersComponent";
14
11
 
15
12
  function createObjTypeConcat(objType) {
16
- console.log("objType:dfcvcbcxb ", objType);
17
-
18
13
  return `${objType.serviceTag}_${objType.objectType}`;
19
14
  }
20
15
  function createRelTypeConcat(relType) {
21
- console.log("objType:sdsadwsd ", relType);
22
16
  return `${relType?.serviceTag}_${relType?.relationshipTag}`;
23
17
  }
24
18
  function objTypeFromObjTypeConcat(objTypeConcat) {
25
- console.log("objTypeConcat:aeaeaeww ", objTypeConcat);
26
19
  let result = objTypeConcat.split("_");
27
20
 
28
21
  if (result.length !== 2) {
@@ -36,31 +29,24 @@ function objTypeFromObjTypeConcat(objTypeConcat) {
36
29
  }
37
30
 
38
31
  export const ModalLinkStepsComponent = ({
39
- titleModal, //string
40
- statusModalFunc, //func
41
- objConfigUseCase, //store
32
+ titleModal,
33
+ statusModalFunc,
34
+ objConfigUseCase,
42
35
  objTypeMain,
43
36
  nameReducer,
44
37
  parentOutputId,
45
- successFunc, //func
38
+ successFunc,
46
39
  collectObjectLinksWithRequestProperties,
47
40
  collectObjectSchemaWithHierarchy,
48
41
 
49
- //useCase props
50
42
  nameObjectLinkStepEdit,
51
43
  userTag,
52
- keyElement, //**** */
44
+ keyElement,
53
45
  ComponentUseCase,
54
46
  LastStepsComponentUseCase,
55
47
  valueUserTags,
56
48
  successFuncUseCase,
57
49
  }) => {
58
- // InitialSchemaLib.initSchemaFn(
59
- // getObjSchemaS3WithHierarchyShared,
60
- // getObjectLinksShared
61
- // );
62
-
63
- console.log("valueUserTags:ModalLinkStepsComponent ", valueUserTags);
64
50
  let arrObjRequiredData = [{}];
65
51
 
66
52
  arrObjRequiredData = [];
@@ -82,37 +68,28 @@ export const ModalLinkStepsComponent = ({
82
68
  }
83
69
  }
84
70
 
85
- console.log("arrObjRequiredData: xxxxaaawwweee", arrObjRequiredData);
86
71
  if (!objTypeMain) {
87
72
  objTypeMain = objConfigUseCase.objType;
88
73
  }
89
74
 
90
75
  console.time("renderTimeInModalRequiredData");
91
76
 
92
- //--------------------------------------------------------------
93
-
94
77
  const [allObjTypesLinkConfigs, collectRequireLinksFn, collectLinksOpt] =
95
- collectObjectLinksWithRequestProperties(); // allObjTypesLinkConfigs
78
+ collectObjectLinksWithRequestProperties();
96
79
 
97
80
  const [resultFieldName, getObjSchemaHieFn, collectLinksOpt2] =
98
81
  collectObjectSchemaWithHierarchy();
99
82
 
100
- //--------------------------------------------------------------
101
-
102
83
  const [linkSteps, setLinkSteps] = useImmer(arrObjRequiredData);
103
84
 
104
85
  const [nameLinkSteps, setNameLinkSteps] = useState(nameObjectLinkStepEdit);
105
86
  const [linkStepsOutput, setLinkStepsOutput] = useImmer({
106
- status: null, //link or lastStep
87
+ status: null,
107
88
  active: 0,
108
89
  });
109
90
 
110
91
  const dispatch = useDispatch();
111
92
 
112
- console.log("linkSteps:linkStepsLog ", linkSteps);
113
- console.log("collectLinks: ", allObjTypesLinkConfigs, collectLinksOpt);
114
- console.log("allObjTypesLinkConfigs: ", allObjTypesLinkConfigs);
115
-
116
93
  useEffect(() => {
117
94
  collectRequireLinksFn(objTypeMain, {
118
95
  returnLinkTypeId: false,
@@ -133,12 +110,6 @@ export const ModalLinkStepsComponent = ({
133
110
  returnPathLinkTypeId: true,
134
111
  });
135
112
  getObjSchemaHieFn(linkStep.pathLinkType.objType);
136
-
137
- // if (keyLinkStep === arrObjRequiredData.length - 1) {
138
- // setLinkStepsOutput((linkStepsOutput) => {
139
- // linkStepsOutput.status = true;
140
- // });
141
- // }
142
113
  } else {
143
114
  getObjSchemaHieFn(
144
115
  keyLinkStep === 0
@@ -146,14 +117,12 @@ export const ModalLinkStepsComponent = ({
146
117
  : arrObjRequiredData[keyLinkStep - 1].pathLinkType.objType,
147
118
  );
148
119
  }
149
- console.log("linkStep: sddfdfdfgcvb", linkStep);
150
120
  }
151
121
  }
152
122
  }, []);
153
- //-----------------------Shared function-----------------------------------
154
123
 
155
124
  function checkObjTypeLinkStep(activeIndex) {
156
- let objTypeConcat; // objTypeConcat
125
+ let objTypeConcat;
157
126
  objTypeConcat = createObjTypeConcat(objTypeMain);
158
127
  if (activeIndex !== 0) {
159
128
  objTypeConcat = createObjTypeConcat(
@@ -163,8 +132,6 @@ export const ModalLinkStepsComponent = ({
163
132
  return objTypeConcat;
164
133
  }
165
134
 
166
- //-----------------------End Shared function-----------------------------------
167
-
168
135
  function hadelSelectType(e) {
169
136
  let type = e.target.value;
170
137
 
@@ -201,7 +168,6 @@ export const ModalLinkStepsComponent = ({
201
168
  let relType = e.target.value;
202
169
  let index = e.target.selectedIndex - 1;
203
170
 
204
- console.log("index:handelSelectRelTypeAndDirection ", index, typeof index);
205
171
  let objTypeConcat = checkObjTypeLinkStep(linkStepsOutput.active);
206
172
 
207
173
  collectRequireLinksFn(
@@ -220,10 +186,6 @@ export const ModalLinkStepsComponent = ({
220
186
  direction: allObjTypesLinkConfigs[objTypeConcat][index].base.direction,
221
187
  };
222
188
 
223
- // linkSteps[
224
- // linkStepsOutput.active
225
- // ].allObjTypesLinkConfigIndex = index;
226
-
227
189
  if (allObjTypesLinkConfigs[objTypeConcat][index]?.requestProperties) {
228
190
  let requestProperties = {};
229
191
  for (const key in allObjTypesLinkConfigs[objTypeConcat][index]
@@ -257,21 +219,17 @@ export const ModalLinkStepsComponent = ({
257
219
  }
258
220
 
259
221
  function handleNextStep() {
260
- // funcUseCase.testA();
261
222
  let validateResult = true;
262
- // validateAggregateCompare() &&
263
- // validateComparison() &&
264
- // validateRequestProperties();
265
223
 
266
224
  if (validateResult) {
267
225
  setLinkStepsOutput((linkStepsOutput) => {
268
226
  linkStepsOutput.active++;
269
- }); //
227
+ });
270
228
 
271
229
  if (linkSteps.length === linkStepsOutput.active + 1) {
272
230
  setLinkSteps((linkSteps) => {
273
231
  linkSteps[linkStepsOutput.active + 1] = {};
274
- }); //
232
+ });
275
233
  }
276
234
  }
277
235
  }
@@ -287,12 +245,8 @@ export const ModalLinkStepsComponent = ({
287
245
  }
288
246
 
289
247
  function submitLinkSteps() {
290
- console.log("nameObjectLinkStepEdit:xczxczxsd ", nameObjectLinkStepEdit);
291
- console.log("nameLinkSteps:xczxczxsd ", nameLinkSteps);
292
-
293
248
  if (nameObjectLinkStepEdit !== undefined) {
294
249
  if (nameLinkSteps) {
295
- console.log("xczxczxsd");
296
250
  if (successFunc) {
297
251
  dispatch(
298
252
  successFunc({
@@ -304,7 +258,6 @@ export const ModalLinkStepsComponent = ({
304
258
  }),
305
259
  );
306
260
  } else {
307
- //sortFields in requiredData
308
261
  successFuncUseCase(
309
262
  parentOutputId,
310
263
  linkSteps,
@@ -319,25 +272,13 @@ export const ModalLinkStepsComponent = ({
319
272
  }
320
273
  } else {
321
274
  if (successFuncUseCase) {
322
- console.log("dofigusoigdjigfdg");
323
275
  const resultStaus = successFuncUseCase(parentOutputId, linkSteps);
324
276
 
325
277
  statusModalFunc(resultStaus);
326
278
  }
327
-
328
- // dispatch(
329
- // successTraversalConfig({
330
- // parentOutputId: parentOutputId,
331
- // traversalLinkStepsObj: linkSteps,
332
- // }),
333
- // );
334
- // statusModalFunc(false);
335
279
  }
336
-
337
- // }
338
280
  }
339
281
 
340
- console.log("nameObjectLinkStepEdit: ", nameObjectLinkStepEdit);
341
282
  console.timeEnd("renderTimeInModalRequiredData");
342
283
  return (
343
284
  <IzaraDivStyle
@@ -349,7 +290,6 @@ export const ModalLinkStepsComponent = ({
349
290
  <IzaraDivStyle
350
291
  styletags={createStyleDefualtTags("modal", "", "gridTemplate")}
351
292
  >
352
- {/* --------------------------header-------------------- */}
353
293
  <IzaraDivStyle
354
294
  styletags={createStyleDefualtTags("modal", "", "headerTemplate")}
355
295
  >
@@ -370,7 +310,6 @@ export const ModalLinkStepsComponent = ({
370
310
  <button onClick={(e) => submitLinkSteps()}>save</button>
371
311
  <button onClick={(e) => statusModalFunc(false)}>cancel</button>
372
312
  </IzaraDivStyle>
373
- {/* --------------------------data-------------------- */}
374
313
  <div>
375
314
  <IzaraDivStyle
376
315
  styletags={createStyleDefualtTags("pagination", "", "template")}
@@ -415,9 +354,7 @@ export const ModalLinkStepsComponent = ({
415
354
  )}
416
355
  </>
417
356
  </IzaraDivStyle>
418
- <IzaraDivStyle
419
- // styletags={createStyleDefualtTags("background", "scroll", "div")}
420
- >
357
+ <IzaraDivStyle>
421
358
  <p>type:</p>
422
359
 
423
360
  <select
@@ -428,26 +365,11 @@ export const ModalLinkStepsComponent = ({
428
365
  ? "link"
429
366
  : "lastStep"
430
367
  }
431
- value={
432
- linkSteps.length === 0
433
- ? ""
434
- : linkSteps[linkStepsOutput.active].pathLinkType?.objType
435
- }
436
368
  onChange={(e) => {
437
369
  hadelSelectType(e);
438
370
  }}
439
371
  >
440
- <option
441
- // value=""
442
- // selected={
443
- // Object.keys(linkSteps[linkStepsOutput.active]).length === 0
444
- // }
445
- // disabled={
446
- // Object.keys(linkSteps[linkStepsOutput.active]).length !== 0
447
- // }
448
- >
449
- -- choose type --
450
- </option>
372
+ <option>-- choose type --</option>
451
373
  <option value="link">link</option>
452
374
  <option value="lastStep">lastStep</option>
453
375
  </select>
@@ -463,9 +385,9 @@ export const ModalLinkStepsComponent = ({
463
385
  linkStepsOutput.active === 0
464
386
  ? createObjTypeConcat(objTypeMain)
465
387
  : createObjTypeConcat(
466
- linkSteps[linkStepsOutput.active - 1].pathLinkType
467
- .objType,
468
- )
388
+ linkSteps[linkStepsOutput.active - 1].pathLinkType
389
+ .objType,
390
+ )
469
391
  ] ? (
470
392
  <IzaraDivStyle
471
393
  styletags={createStyleDefualtTags(
@@ -476,13 +398,7 @@ export const ModalLinkStepsComponent = ({
476
398
  ></IzaraDivStyle>
477
399
  ) : (
478
400
  <>
479
- <IzaraDivStyle
480
- // styletags={createStyleDefualtTags(
481
- // "background",
482
- // "scroll ",
483
- // "div"
484
- // )}
485
- >
401
+ <IzaraDivStyle>
486
402
  <p> relationship type:</p>
487
403
  <select
488
404
  value={JSON.stringify(
@@ -506,9 +422,9 @@ export const ModalLinkStepsComponent = ({
506
422
  linkStepsOutput.active === 0
507
423
  ? createObjTypeConcat(objTypeMain)
508
424
  : createObjTypeConcat(
509
- linkSteps[linkStepsOutput.active - 1]
510
- .pathLinkType.objType,
511
- )
425
+ linkSteps[linkStepsOutput.active - 1]
426
+ .pathLinkType.objType,
427
+ )
512
428
  ].map((dataLink, index) => (
513
429
  <option
514
430
  key={index}
@@ -523,50 +439,49 @@ export const ModalLinkStepsComponent = ({
523
439
  linkSteps[linkStepsOutput.active]?.pathLinkType
524
440
  ?.relType,
525
441
  ).length !== 0 && (
526
- <>
527
- <p> object type:</p>
528
- <span>
529
- {createObjTypeConcat(
530
- linkSteps[linkStepsOutput.active]
531
- ?.pathLinkType.objType,
532
- )}
533
- </span>
534
- <p>direction</p>
535
- <span>
536
- {
537
- linkSteps[linkStepsOutput.active]
538
- ?.pathLinkType.direction
539
- }
540
- </span>
541
- <br></br>
542
- <hr></hr>
543
- {ComponentUseCase && (
544
- <ComponentUseCase
545
- allObjTypesLinkConfigs={
546
- allObjTypesLinkConfigs
547
- }
548
- resultFieldName={resultFieldName}
549
- linkSteps={linkSteps}
550
- setLinkSteps={setLinkSteps}
551
- linkStepsOutput={linkStepsOutput}
552
- objTypeMain={objTypeMain}
553
- valueUserTags={valueUserTags}
554
- objConfigUseCase={objConfigUseCase}
555
- parentOutputId={parentOutputId}
556
- collectObjectLinksWithRequestProperties={
557
- collectObjectLinksWithRequestProperties
442
+ <>
443
+ <p> object type:</p>
444
+ <span>
445
+ {createObjTypeConcat(
446
+ linkSteps[linkStepsOutput.active]
447
+ ?.pathLinkType.objType,
448
+ )}
449
+ </span>
450
+ <p>direction</p>
451
+ <span>
452
+ {
453
+ linkSteps[linkStepsOutput.active]
454
+ ?.pathLinkType.direction
558
455
  }
559
- collectObjectSchemaWithHierarchy={
560
- collectObjectSchemaWithHierarchy
561
- }
562
- LastStepsComponentUseCase={
563
- LastStepsComponentUseCase
564
- }
565
- // funcUseCase={funcUseCase}
566
- />
567
- )}
568
- </>
569
- )}
456
+ </span>
457
+ <br></br>
458
+ <hr></hr>
459
+ {ComponentUseCase && (
460
+ <ComponentUseCase
461
+ allObjTypesLinkConfigs={
462
+ allObjTypesLinkConfigs
463
+ }
464
+ resultFieldName={resultFieldName}
465
+ linkSteps={linkSteps}
466
+ setLinkSteps={setLinkSteps}
467
+ linkStepsOutput={linkStepsOutput}
468
+ objTypeMain={objTypeMain}
469
+ valueUserTags={valueUserTags}
470
+ objConfigUseCase={objConfigUseCase}
471
+ parentOutputId={parentOutputId}
472
+ collectObjectLinksWithRequestProperties={
473
+ collectObjectLinksWithRequestProperties
474
+ }
475
+ collectObjectSchemaWithHierarchy={
476
+ collectObjectSchemaWithHierarchy
477
+ }
478
+ LastStepsComponentUseCase={
479
+ LastStepsComponentUseCase
480
+ }
481
+ />
482
+ )}
483
+ </>
484
+ )}
570
485
  </IzaraDivStyle>
571
486
  </>
572
487
  )}
@@ -598,7 +513,6 @@ export const ModalLinkStepsComponent = ({
598
513
  )}
599
514
  </div>
600
515
 
601
- {/* --------------------------footer-------------------- */}
602
516
  <IzaraDivStyle
603
517
  styletags={createStyleDefualtTags("gridColumn", "", "11")}
604
518
  >
@@ -612,7 +526,7 @@ export const ModalLinkStepsComponent = ({
612
526
  onClick={handleNextStep}
613
527
  disabled={
614
528
  linkSteps[linkStepsOutput.active]?.pathLinkType?.direction ===
615
- "" ||
529
+ "" ||
616
530
  !linkSteps[linkStepsOutput.active]?.pathLinkType?.objType
617
531
  }
618
532
  >
@@ -624,5 +538,3 @@ export const ModalLinkStepsComponent = ({
624
538
  </IzaraDivStyle>
625
539
  );
626
540
  };
627
-
628
- //----------------------------- use Lib -----------------------------------------------
@@ -10,16 +10,12 @@ import {
10
10
  var hash = require("object-hash");
11
11
 
12
12
  function createObjTypeConcat(objType) {
13
- console.log("objType:dfcvcbcxb ", objType);
14
-
15
13
  return `${objType.serviceTag}_${objType.objectType}`;
16
14
  }
17
15
  function createRelTypeConcat(relType) {
18
- console.log("objType:sdsadwsd ", relType);
19
16
  return `${relType?.serviceTag}_${relType?.relationshipTag}`;
20
17
  }
21
18
  function objTypeFromObjTypeConcat(objTypeConcat) {
22
- console.log("objTypeConcat:aeaeaeww ", objTypeConcat);
23
19
  let result = objTypeConcat.split("_");
24
20
 
25
21
  if (result.length !== 2) {
@@ -109,5 +105,3 @@ export const FieldNameComponent = ({
109
105
  </>
110
106
  );
111
107
  };
112
-
113
- //----------------------------- use Lib -----------------------------------------------
@@ -1,14 +1,7 @@
1
- // import React, { memo, Fragment, useContext, useEffect, useState } from "react";
2
- // import { createAction } from "@reduxjs/toolkit";
3
- // import {
4
- // IzaraDivStyle,
5
- // createStyleDefualtTags,
6
- // IzaraButtonStyle,
7
- // } from "@izaraFrontends/styles";
1
+ import React from "react";
8
2
  import { useImmer } from "use-immer";
9
3
  import { useDispatch, useSelector } from "react-redux";
10
4
 
11
- //----------------------------Lib-Test------------------------------
12
5
  import { valueUserTagCreateConfig } from "../function/createActionLibCreateLinkStepAndComplexFilter";
13
6
 
14
7
  export const UserTagsSelectAndCreateComponent = ({
package/webpack.config.js CHANGED
@@ -5,12 +5,23 @@ const webpack = require("webpack");
5
5
  // export default {
6
6
  module.exports = {
7
7
  mode: "development",
8
+ devtool: "source-map",
9
+ experiments: {
10
+ outputModule: true,
11
+ },
8
12
  entry: "./src/index.js",
9
13
 
10
14
  output: {
11
15
  path: resolve("dist"),
12
16
  filename: "complexFilter.js",
13
- libraryTarget: "commonjs2",
17
+ library: {
18
+ type: "module",
19
+ },
20
+ module: true,
21
+ environment: {
22
+ module: true,
23
+ dynamicImport: true,
24
+ },
14
25
  },
15
26
 
16
27
  plugins: [
@@ -58,96 +69,28 @@ module.exports = {
58
69
  ],
59
70
  },
60
71
  resolve: {
61
- // fallback: {
62
- // buffer: require.resolve("buffer/"),
63
- // process: require.resolve("process/browser"),
64
- // },
65
- // fallback: {
66
- // process: false,
67
- // buffer: false,
68
- // crypto: false,
69
- // stream: false,
70
- // },
72
+ fallback: {
73
+ crypto: false,
74
+ },
71
75
 
72
76
  alias: {
73
77
  react: resolve("./node_modules/react"),
74
78
  "react-dom": resolve("./node_modules/react-dom"),
75
79
  },
76
80
  extensions: [".js", ".jsx"],
77
-
78
- // fallback: {
79
- // fs: false,
80
- // },
81
- // importsFields: ['@izaraFrontends/styles', '@izaraFrontends/authentication$'],
82
- // descriptionFiles: []
83
81
  },
84
82
 
85
83
  externals: {
86
- react: {
87
- commonjs: "react",
88
- commonjs2: "react",
89
- amd: "React",
90
- root: "React",
91
- },
92
- "react-dom": {
93
- commonjs: "react-dom",
94
- commonjs2: "react-dom",
95
- amd: "ReactDOM",
96
- root: "ReactDOM",
97
- },
98
- "react-redux": {
99
- commonjs: "react-redux",
100
- commonjs2: "react-redux",
101
- amd: "react-redux",
102
- root: "react-redux",
103
- },
104
- "@reduxjs/toolkit": {
105
- commonjs: "@reduxjs/toolkit",
106
- commonjs2: "@reduxjs/toolkit",
107
- amd: "@reduxjs/toolkit",
108
- root: "@reduxjs/toolkit",
109
- },
110
- "use-immer": {
111
- commonjs: "use-immer",
112
- commonjs2: "use-immer",
113
- amd: "use-immer",
114
- root: "use-immer",
115
- },
116
- nanoid: {
117
- commonjs: "nanoid",
118
- commonjs2: "nanoid",
119
- amd: "nanoid",
120
- root: "nanoid",
121
- },
122
- "object-hash": {
123
- commonjs: "object-hash",
124
- commonjs2: "object-hash",
125
- amd: "object-hash",
126
- root: "object-hash",
127
- },
128
- "@izaraFrontends/styles": {
129
- commonjs: "@izaraFrontends/styles",
130
- commonjs2: "@izaraFrontends/styles",
131
- amd: "@izaraFrontends/styles",
132
- root: "@izaraFrontends/styles",
133
- },
134
- "@izaraFrontends/store": {
135
- commonjs: "@izaraFrontends/store",
136
- commonjs2: "@izaraFrontends/store",
137
- amd: "@izaraFrontends/store",
138
- root: "@izaraFrontends/store",
139
- },
140
- "@izara_project/izara-shared-search-and-sort": {
141
- commonjs: "@izara_project/izara-shared-search-and-sort",
142
- commonjs2: "@izara_project/izara-shared-search-and-sort",
143
- amd: "@izara_project/izara-shared-search-and-sort",
144
- root: "@izara_project/izara-shared-search-and-sort",
145
- },
146
- "@izara_project/izara-shared-service-schemas": {
147
- commonjs: "@izara_project/izara-shared-service-schemas",
148
- commonjs2: "@izara_project/izara-shared-service-schemas",
149
- amd: "@izara_project/izara-shared-service-schemas",
150
- root: "@izara_project/izara-shared-service-schemas",
151
- },
84
+ react: "react",
85
+ "react-dom": "react-dom",
86
+ "react-redux": "react-redux",
87
+ "@reduxjs/toolkit": "@reduxjs/toolkit",
88
+ "use-immer": "use-immer",
89
+ nanoid: "nanoid",
90
+ "object-hash": "object-hash",
91
+ "@izaraFrontends/styles": "@izaraFrontends/styles",
92
+ "@izaraFrontends/store": "@izaraFrontends/store",
93
+ "@izara_project/izara-shared-search-and-sort": "@izara_project/izara-shared-search-and-sort",
94
+ "@izara_project/izara-shared-service-schemas": "@izara_project/izara-shared-service-schemas",
152
95
  },
153
96
  };