@sankhyalabs/core 1.0.42 → 1.0.45

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 (145) hide show
  1. package/.eslintignore +1 -1
  2. package/.eslintrc.cjs +34 -34
  3. package/README.md +54 -54
  4. package/dist/dataunit/DataUnit.d.ts +87 -82
  5. package/dist/dataunit/DataUnit.js +290 -278
  6. package/dist/dataunit/DataUnit.js.map +1 -1
  7. package/dist/dataunit/metadata/DataType.d.ts +9 -9
  8. package/dist/dataunit/metadata/DataType.js +36 -36
  9. package/dist/dataunit/metadata/UnitMetadata.d.ts +71 -71
  10. package/dist/dataunit/metadata/UnitMetadata.js +31 -31
  11. package/dist/dataunit/state/HistReducer.d.ts +10 -10
  12. package/dist/dataunit/state/HistReducer.js +27 -27
  13. package/dist/dataunit/state/StateManager.d.ts +57 -57
  14. package/dist/dataunit/state/StateManager.js +96 -96
  15. package/dist/dataunit/state/action/DataUnitAction.d.ts +29 -28
  16. package/dist/dataunit/state/action/DataUnitAction.js +34 -33
  17. package/dist/dataunit/state/action/DataUnitAction.js.map +1 -1
  18. package/dist/dataunit/state/slice/AddedRecordsSlice.d.ts +11 -11
  19. package/dist/dataunit/state/slice/AddedRecordsSlice.js +25 -25
  20. package/dist/dataunit/state/slice/ChangesSlice.d.ts +12 -12
  21. package/dist/dataunit/state/slice/ChangesSlice.js +76 -72
  22. package/dist/dataunit/state/slice/ChangesSlice.js.map +1 -1
  23. package/dist/dataunit/state/slice/CurrentRecordsSlice.d.ts +11 -11
  24. package/dist/dataunit/state/slice/CurrentRecordsSlice.js +45 -45
  25. package/dist/dataunit/state/slice/RecordsSlice.d.ts +10 -10
  26. package/dist/dataunit/state/slice/RecordsSlice.js +43 -43
  27. package/dist/dataunit/state/slice/RemovedRecordsSlice.d.ts +9 -9
  28. package/dist/dataunit/state/slice/RemovedRecordsSlice.js +24 -24
  29. package/dist/dataunit/state/slice/SelectionSlice.d.ts +11 -11
  30. package/dist/dataunit/state/slice/SelectionSlice.js +111 -111
  31. package/dist/dataunit/state/slice/UnitMetadataSlice.d.ts +11 -11
  32. package/dist/dataunit/state/slice/UnitMetadataSlice.js +20 -20
  33. package/dist/dataunit/state/slice/WaitingChangesSlice.d.ts +9 -0
  34. package/dist/dataunit/state/slice/WaitingChangesSlice.js +32 -0
  35. package/dist/dataunit/state/slice/WaitingChangesSlice.js.map +1 -0
  36. package/dist/http/AuthorizedServiceCaller.d.ts +11 -11
  37. package/dist/http/AuthorizedServiceCaller.js +53 -53
  38. package/dist/http/HttpProvider.d.ts +25 -25
  39. package/dist/http/HttpProvider.js +73 -73
  40. package/dist/http/RequestMetadata.d.ts +30 -30
  41. package/dist/http/RequestMetadata.js +24 -24
  42. package/dist/http/SkwHttpProvider.d.ts +9 -9
  43. package/dist/http/SkwHttpProvider.js +66 -66
  44. package/dist/index.d.ts +16 -16
  45. package/dist/index.js +17 -17
  46. package/dist/index.js.map +1 -1
  47. package/dist/ui/FloatingManager.d.ts +25 -24
  48. package/dist/ui/FloatingManager.js +124 -122
  49. package/dist/ui/FloatingManager.js.map +1 -1
  50. package/dist/utils/ApplicationContext.d.ts +5 -5
  51. package/dist/utils/ApplicationContext.js +16 -16
  52. package/dist/utils/CriteriaModel.d.ts +109 -109
  53. package/dist/utils/CriteriaModel.js +173 -173
  54. package/dist/utils/CriteriaParameter.d.ts +69 -69
  55. package/dist/utils/CriteriaParameter.js +82 -82
  56. package/dist/utils/DateUtils.d.ts +5 -5
  57. package/dist/utils/DateUtils.js +42 -42
  58. package/dist/utils/MaskFormatter.d.ts +126 -126
  59. package/dist/utils/MaskFormatter.js +275 -275
  60. package/dist/utils/NumberUtils.d.ts +53 -53
  61. package/dist/utils/NumberUtils.js +141 -141
  62. package/dist/utils/StringUtils.d.ts +18 -18
  63. package/dist/utils/StringUtils.js +53 -53
  64. package/dist/utils/TimeFormatter.d.ts +33 -33
  65. package/dist/utils/TimeFormatter.js +97 -97
  66. package/jest.config.ts +16 -16
  67. package/mock/http/XMLHttpRequest-mock.js +25 -25
  68. package/package.json +38 -37
  69. package/scripts/runlink.bat +1 -0
  70. package/src/dataunit/DataUnit.ts +374 -356
  71. package/src/dataunit/metadata/DataType.ts +37 -37
  72. package/src/dataunit/metadata/UnitMetadata.ts +82 -82
  73. package/src/dataunit/state/HistReducer.ts +33 -33
  74. package/src/dataunit/state/StateManager.ts +141 -141
  75. package/src/dataunit/state/action/DataUnitAction.ts +52 -50
  76. package/src/dataunit/state/slice/AddedRecordsSlice.ts +32 -32
  77. package/src/dataunit/state/slice/ChangesSlice.ts +95 -90
  78. package/src/dataunit/state/slice/CurrentRecordsSlice.ts +53 -53
  79. package/src/dataunit/state/slice/RecordsSlice.ts +56 -56
  80. package/src/dataunit/state/slice/RemovedRecordsSlice.ts +29 -29
  81. package/src/dataunit/state/slice/SelectionSlice.ts +130 -130
  82. package/src/dataunit/state/slice/UnitMetadataSlice.ts +29 -29
  83. package/src/dataunit/state/slice/WaitingChangesSlice.ts +44 -0
  84. package/src/http/AuthorizedServiceCaller.ts +58 -58
  85. package/src/http/HttpProvider.ts +93 -93
  86. package/src/http/RequestMetadata.ts +41 -41
  87. package/src/http/SkwHttpProvider.ts +77 -77
  88. package/src/index.ts +45 -44
  89. package/src/ui/FloatingManager.ts +167 -165
  90. package/src/utils/ApplicationContext.ts +18 -18
  91. package/src/utils/CriteriaModel.ts +207 -207
  92. package/src/utils/CriteriaParameter.ts +107 -107
  93. package/src/utils/DateUtils.ts +52 -52
  94. package/src/utils/MaskFormatter.ts +322 -322
  95. package/src/utils/NumberUtils.ts +174 -174
  96. package/src/utils/StringUtils.ts +60 -60
  97. package/src/utils/TimeFormatter.ts +97 -97
  98. package/test/http/HttpProvider.spec.ts +34 -34
  99. package/test/http/SkwHttpProvider.ts.spec.ts +33 -33
  100. package/test/util/CriteriaModel.spec.ts +231 -231
  101. package/test/util/CriteriaParameter.spec.ts +51 -51
  102. package/test/util/MaskFormatter.spec.ts +138 -138
  103. package/test/util/NumberUtils.spec.ts +156 -156
  104. package/test/util/StringUtils.spec.ts +43 -43
  105. package/test/util/TimeFormatter.spec.ts +25 -25
  106. package/tsconfig.json +15 -15
  107. package/dist/application/Application.d.ts +0 -8
  108. package/dist/application/Application.js +0 -19
  109. package/dist/application/Application.js.map +0 -1
  110. package/dist/http/data-fetcher/HttpFetcher.d.ts +0 -14
  111. package/dist/http/data-fetcher/HttpFetcher.js +0 -164
  112. package/dist/http/data-fetcher/HttpFetcher.js.map +0 -1
  113. package/dist/http/data-fetcher/default/DefaultGraphQL.d.ts +0 -3
  114. package/dist/http/data-fetcher/default/DefaultGraphQL.js +0 -18
  115. package/dist/http/data-fetcher/default/DefaultGraphQL.js.map +0 -1
  116. package/dist/http/data-fetcher/default/application-config-fetcher.d.ts +0 -6
  117. package/dist/http/data-fetcher/default/application-config-fetcher.js +0 -21
  118. package/dist/http/data-fetcher/default/application-config-fetcher.js.map +0 -1
  119. package/dist/http/data-fetcher/default/data-unit-graphql.d.ts +0 -3
  120. package/dist/http/data-fetcher/default/data-unit-graphql.js +0 -18
  121. package/dist/http/data-fetcher/default/data-unit-graphql.js.map +0 -1
  122. package/dist/http/data-fetcher/default/dataunit-executor.d.ts +0 -10
  123. package/dist/http/data-fetcher/default/dataunit-executor.js +0 -56
  124. package/dist/http/data-fetcher/default/dataunit-executor.js.map +0 -1
  125. package/dist/http/data-fetcher/default/dataunit-fetcher.d.ts +0 -9
  126. package/dist/http/data-fetcher/default/dataunit-fetcher.js +0 -69
  127. package/dist/http/data-fetcher/default/dataunit-fetcher.js.map +0 -1
  128. package/dist/http/data-fetcher/default/form-config-fetcher.d.ts +0 -2
  129. package/dist/http/data-fetcher/default/form-config-fetcher.js +0 -3
  130. package/dist/http/data-fetcher/default/form-config-fetcher.js.map +0 -1
  131. package/dist/http/data-fetcher/default/grid-config-fetcher.d.ts +0 -2
  132. package/dist/http/data-fetcher/default/grid-config-fetcher.js +0 -3
  133. package/dist/http/data-fetcher/default/grid-config-fetcher.js.map +0 -1
  134. package/dist/http/data-fetcher/default/index.d.ts +0 -0
  135. package/dist/http/data-fetcher/default/index.js +0 -2
  136. package/dist/http/data-fetcher/default/index.js.map +0 -1
  137. package/dist/http/data-fetcher/default/sankhya-graphql.d.ts +0 -3
  138. package/dist/http/data-fetcher/default/sankhya-graphql.js +0 -8
  139. package/dist/http/data-fetcher/default/sankhya-graphql.js.map +0 -1
  140. package/dist/http/data-fetcher/graphql/DefaultGraphQl.d.ts +0 -3
  141. package/dist/http/data-fetcher/graphql/DefaultGraphQl.js +0 -18
  142. package/dist/http/data-fetcher/graphql/DefaultGraphQl.js.map +0 -1
  143. package/dist/http/data-fetcher/state/LoadStateManager.d.ts +0 -23
  144. package/dist/http/data-fetcher/state/LoadStateManager.js +0 -78
  145. package/dist/http/data-fetcher/state/LoadStateManager.js.map +0 -1
@@ -1,166 +1,168 @@
1
- interface FloatingOptions {
2
- autoClose: boolean;
3
- top?: string;
4
- left?: string;
5
- right?: string;
6
- bottom?: string;
7
- innerClickTest?: Function;
8
- }
9
-
10
- class FloatingEntry {
11
-
12
- private weakRefParent?: WeakRef<HTMLElement>;
13
- private weakRefContent?: WeakRef<HTMLElement>;
14
- private strongRefParent?: HTMLElement;
15
- private strongRefContent?: HTMLElement;
16
- public options: FloatingOptions;
17
-
18
- constructor(parent: HTMLElement, content: HTMLElement, opts: FloatingOptions) {
19
- try{
20
- this.weakRefParent = new WeakRef(parent);
21
- this.weakRefContent = new WeakRef(content);
22
- } catch(error){
23
- this.strongRefParent = parent;
24
- this.strongRefContent = content;
25
- }
26
- this.options = opts;
27
- }
28
-
29
- public get parent():HTMLElement|undefined{
30
- if(this.weakRefParent){
31
- return this.weakRefParent.deref();
32
- }
33
- return this.strongRefParent
34
- }
35
-
36
- public get content():HTMLElement|undefined{
37
- if(this.weakRefContent){
38
- return this.weakRefContent.deref();
39
- }
40
- return this.strongRefContent;
41
- }
42
- }
43
-
44
- export default class FloatingManager {
45
-
46
- private static initialized: boolean;
47
- private static entries: Array<FloatingEntry>;
48
-
49
- private static init() {
50
- FloatingManager.entries = [];
51
- document.addEventListener('mousedown', FloatingManager.handleDocumentEvent);
52
- document.addEventListener('keydown', FloatingManager.handleKeyboardEvent);
53
- FloatingManager.initialized = true;
54
- }
55
-
56
- private static innerClick(container: HTMLElement, node: HTMLElement) {
57
- if (container.contains(node)) {
58
- return true;
59
- }
60
-
61
- if (container.shadowRoot && container.shadowRoot.contains(node)) {
62
- return true;
63
- }
64
-
65
- return false;
66
- }
67
-
68
- private static doClose(id: number, entry: FloatingEntry, target?: HTMLElement) {
69
- if (!target || entry.options.autoClose) {
70
- const parent: HTMLElement | undefined = entry.parent;
71
- const content: HTMLElement | undefined = entry.content;
72
-
73
- if (parent && content) {
74
- const innerClickFunction: Function = entry.options.innerClickTest ? entry.options.innerClickTest : FloatingManager.innerClick;
75
-
76
- if (!target || !innerClickFunction(content, target)) {
77
- content.remove();
78
- delete FloatingManager.entries[id];
79
- }
80
- } else {
81
- delete FloatingManager.entries[id];
82
- }
83
- }
84
- }
85
-
86
- private static handleDocumentEvent(event: Event) {
87
-
88
- FloatingManager.entries.forEach((entry, index) => {
89
- FloatingManager.doClose(index, entry, event.composedPath()[0] as HTMLElement);
90
- });
91
- }
92
-
93
- private static handleKeyboardEvent(event: KeyboardEvent) {
94
- if (event.key === 'Escape') {
95
- for (let index: number = FloatingManager.entries.length; index >= 0; index--) {
96
- const entry: FloatingEntry = FloatingManager.entries[index];
97
- if (entry) {
98
- FloatingManager.close(index);
99
- break;
100
- }
101
- }
102
- }
103
- }
104
-
105
- private static applyStyle(element: HTMLElement, propertyName: string, value?: string) {
106
- if (value) {
107
- element.style.setProperty(propertyName, value);
108
- }
109
- }
110
-
111
- private static getFloatIndex(content: HTMLElement, parent: HTMLElement): number {
112
-
113
- for (let index: number = 0; index < FloatingManager.entries.length; index++) {
114
- const entry: FloatingEntry = FloatingManager.entries[index];
115
- if (entry && content === entry.content && parent === entry.parent) {
116
- return index;
117
- }
118
- }
119
- return -1;
120
- }
121
-
122
- public static isFloating(id: number){
123
- return FloatingManager.entries[id] !== undefined;
124
- }
125
-
126
- public static float(content: HTMLElement, parent: HTMLElement, options: FloatingOptions = { autoClose: true }): number {
127
-
128
- if (!FloatingManager.initialized) {
129
- FloatingManager.init();
130
- }
131
-
132
- const alreadyFloatingIndex = FloatingManager.getFloatIndex(content, parent);
133
-
134
- if (alreadyFloatingIndex > -1) {
135
- return alreadyFloatingIndex;
136
- }
137
-
138
- content.style.position = 'absolute';
139
- FloatingManager.applyStyle(content, "top", options.top);
140
- FloatingManager.applyStyle(content, "left", options.left);
141
- FloatingManager.applyStyle(content, "right", options.right);
142
- FloatingManager.applyStyle(content, "bottom", options.bottom);
143
-
144
- parent.appendChild(content);
145
- FloatingManager.entries.push(new FloatingEntry(parent, content, options));
146
-
147
- return FloatingManager.entries.length - 1;
148
- }
149
-
150
- public static updateFloatPosition(content: HTMLElement, parent: HTMLElement, options: FloatingOptions = { autoClose: true }) {
151
- const alreadyFloatingIndex = FloatingManager.getFloatIndex(content, parent);
152
- if (alreadyFloatingIndex > -1) {
153
- FloatingManager.applyStyle(content, "top", options.top);
154
- FloatingManager.applyStyle(content, "left", options.left);
155
- FloatingManager.applyStyle(content, "right", options.right);
156
- FloatingManager.applyStyle(content, "bottom", options.bottom);
157
- }
158
-
159
- }
160
-
161
- public static close(id: number) {
162
- if (FloatingManager.entries[id]) {
163
- FloatingManager.doClose(id, FloatingManager.entries[id], undefined);
164
- }
165
- }
1
+ interface FloatingOptions {
2
+ autoClose: boolean;
3
+ top?: string;
4
+ left?: string;
5
+ right?: string;
6
+ bottom?: string;
7
+ innerClickTest?: Function;
8
+ backClickListener?: Function;
9
+ }
10
+
11
+ class FloatingEntry {
12
+
13
+ private weakRefParent?: WeakRef<HTMLElement>;
14
+ private weakRefContent?: WeakRef<HTMLElement>;
15
+ private strongRefParent?: HTMLElement;
16
+ private strongRefContent?: HTMLElement;
17
+ public options: FloatingOptions;
18
+
19
+ constructor(parent: HTMLElement, content: HTMLElement, opts: FloatingOptions) {
20
+ try{
21
+ this.weakRefParent = new WeakRef(parent);
22
+ this.weakRefContent = new WeakRef(content);
23
+ } catch(error){
24
+ this.strongRefParent = parent;
25
+ this.strongRefContent = content;
26
+ }
27
+ this.options = opts;
28
+ }
29
+
30
+ public get parent():HTMLElement|undefined{
31
+ if(this.weakRefParent){
32
+ return this.weakRefParent.deref();
33
+ }
34
+ return this.strongRefParent
35
+ }
36
+
37
+ public get content():HTMLElement|undefined{
38
+ if(this.weakRefContent){
39
+ return this.weakRefContent.deref();
40
+ }
41
+ return this.strongRefContent;
42
+ }
43
+ }
44
+
45
+ export default class FloatingManager {
46
+
47
+ private static initialized: boolean;
48
+ private static entries: Array<FloatingEntry>;
49
+
50
+ private static init() {
51
+ FloatingManager.entries = [];
52
+ document.addEventListener('mousedown', FloatingManager.handleDocumentEvent);
53
+ document.addEventListener('keydown', FloatingManager.handleKeyboardEvent);
54
+ FloatingManager.initialized = true;
55
+ }
56
+
57
+ private static innerClick(container: HTMLElement, node: HTMLElement) {
58
+ if (container.contains(node)) {
59
+ return true;
60
+ }
61
+
62
+ if (container.shadowRoot && container.shadowRoot.contains(node)) {
63
+ return true;
64
+ }
65
+
66
+ return false;
67
+ }
68
+
69
+ private static doClose(id: number, entry: FloatingEntry, target?: HTMLElement, event?:Event) {
70
+ if (!target || entry.options.autoClose) {
71
+ const parent: HTMLElement | undefined = entry.parent;
72
+ const content: HTMLElement | undefined = entry.content;
73
+
74
+ if (parent && content) {
75
+ const innerClickFunction: Function = entry.options.innerClickTest ? entry.options.innerClickTest : FloatingManager.innerClick;
76
+ const backClickFunction: Function = entry.options.backClickListener ? entry.options.backClickListener : () => {};
77
+ if (!target || !innerClickFunction(content, target, event)) {
78
+ content.remove();
79
+ delete FloatingManager.entries[id];
80
+ backClickFunction();
81
+ }
82
+ } else {
83
+ delete FloatingManager.entries[id];
84
+ }
85
+ }
86
+ }
87
+
88
+ private static handleDocumentEvent(event: Event) {
89
+
90
+ FloatingManager.entries.forEach((entry, index) => {
91
+ FloatingManager.doClose(index, entry, event.composedPath()[0] as HTMLElement, event);
92
+ });
93
+ }
94
+
95
+ private static handleKeyboardEvent(event: KeyboardEvent) {
96
+ if (event.key === 'Escape') {
97
+ for (let index: number = FloatingManager.entries.length; index >= 0; index--) {
98
+ const entry: FloatingEntry = FloatingManager.entries[index];
99
+ if (entry) {
100
+ FloatingManager.close(index);
101
+ break;
102
+ }
103
+ }
104
+ }
105
+ }
106
+
107
+ private static applyStyle(element: HTMLElement, propertyName: string, value?: string) {
108
+ if (value) {
109
+ element.style.setProperty(propertyName, value);
110
+ }
111
+ }
112
+
113
+ private static getFloatIndex(content: HTMLElement, parent: HTMLElement): number {
114
+
115
+ for (let index: number = 0; index < FloatingManager.entries.length; index++) {
116
+ const entry: FloatingEntry = FloatingManager.entries[index];
117
+ if (entry && content === entry.content && parent === entry.parent) {
118
+ return index;
119
+ }
120
+ }
121
+ return -1;
122
+ }
123
+
124
+ public static isFloating(id: number){
125
+ return FloatingManager.entries[id] !== undefined;
126
+ }
127
+
128
+ public static float(content: HTMLElement, parent: HTMLElement, options: FloatingOptions = { autoClose: true }): number {
129
+
130
+ if (!FloatingManager.initialized) {
131
+ FloatingManager.init();
132
+ }
133
+
134
+ const alreadyFloatingIndex = FloatingManager.getFloatIndex(content, parent);
135
+
136
+ if (alreadyFloatingIndex > -1) {
137
+ return alreadyFloatingIndex;
138
+ }
139
+
140
+ content.style.position = 'absolute';
141
+ FloatingManager.applyStyle(content, "top", options.top);
142
+ FloatingManager.applyStyle(content, "left", options.left);
143
+ FloatingManager.applyStyle(content, "right", options.right);
144
+ FloatingManager.applyStyle(content, "bottom", options.bottom);
145
+
146
+ parent.appendChild(content);
147
+ FloatingManager.entries.push(new FloatingEntry(parent, content, options));
148
+
149
+ return FloatingManager.entries.length - 1;
150
+ }
151
+
152
+ public static updateFloatPosition(content: HTMLElement, parent: HTMLElement, options: FloatingOptions = { autoClose: true }) {
153
+ const alreadyFloatingIndex = FloatingManager.getFloatIndex(content, parent);
154
+ if (alreadyFloatingIndex > -1) {
155
+ FloatingManager.applyStyle(content, "top", options.top);
156
+ FloatingManager.applyStyle(content, "left", options.left);
157
+ FloatingManager.applyStyle(content, "right", options.right);
158
+ FloatingManager.applyStyle(content, "bottom", options.bottom);
159
+ }
160
+
161
+ }
162
+
163
+ public static close(id: number) {
164
+ if (FloatingManager.entries[id]) {
165
+ FloatingManager.doClose(id, FloatingManager.entries[id], undefined);
166
+ }
167
+ }
166
168
  }
@@ -1,19 +1,19 @@
1
- export default class ApplicationContext{
2
-
3
- public static getContextValue(key: string):any{
4
- return ApplicationContext.getCtx()[key];
5
- }
6
-
7
- public static setContextValue(key: string, value: any):any{
8
- ApplicationContext.getCtx()[key] = value;
9
- }
10
-
11
- private static getCtx():any{
12
- let ctx = (window as any).___snkcore___ctx___;
13
- if(!ctx){
14
- ctx = {};
15
- (window as any).___snkcore___ctx___ = ctx;
16
- }
17
- return ctx;
18
- }
1
+ export default class ApplicationContext{
2
+
3
+ public static getContextValue(key: string):any{
4
+ return ApplicationContext.getCtx()[key];
5
+ }
6
+
7
+ public static setContextValue(key: string, value: any):any{
8
+ ApplicationContext.getCtx()[key] = value;
9
+ }
10
+
11
+ private static getCtx():any{
12
+ let ctx = (window as any).___snkcore___ctx___;
13
+ if(!ctx){
14
+ ctx = {};
15
+ (window as any).___snkcore___ctx___ = ctx;
16
+ }
17
+ return ctx;
18
+ }
19
19
  }