@sankhyalabs/ezui 1.1.4 → 1.1.8

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 (186) hide show
  1. package/README.md +72 -72
  2. package/dist/{ezui/DataUnit-285bec19.js → cjs/DataUnit-28b290cb.js} +382 -369
  3. package/dist/{ezui/index-919090de.js → cjs/RequestMetadata-2cd01e8a.js} +4 -383
  4. package/dist/cjs/ez-action-chip.cjs.entry.js +52 -0
  5. package/dist/cjs/ez-button_14.cjs.entry.js +3341 -0
  6. package/dist/cjs/ez-label-chip.cjs.entry.js +131 -0
  7. package/dist/cjs/ez-modal.cjs.entry.js +115 -0
  8. package/dist/cjs/ez-number-input.cjs.entry.js +248 -0
  9. package/dist/cjs/ez-time-input.cjs.entry.js +180 -0
  10. package/dist/cjs/ezui.cjs.js +19 -0
  11. package/dist/cjs/form-metadata.cjs.entry.js +74 -0
  12. package/dist/cjs/index-9403fe8f.js +1322 -0
  13. package/dist/cjs/index.cjs.js +2 -0
  14. package/dist/cjs/loader.cjs.js +21 -0
  15. package/dist/collection/collection-manifest.json +31 -0
  16. package/dist/collection/components/ez-action-chip/ez-action-chip.css +82 -0
  17. package/dist/collection/components/ez-action-chip/ez-action-chip.js +109 -0
  18. package/dist/collection/components/ez-button/ez-button.css +94 -0
  19. package/dist/collection/components/ez-button/ez-button.js +125 -0
  20. package/dist/collection/components/ez-calendar/ez-calendar.css +210 -0
  21. package/dist/collection/components/ez-calendar/ez-calendar.js +215 -0
  22. package/dist/collection/components/ez-check/ez-check.css +266 -0
  23. package/dist/collection/components/ez-check/ez-check.js +168 -0
  24. package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.css +68 -0
  25. package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.js +108 -0
  26. package/dist/collection/components/ez-combo-box/ez-combo-box-interfaces.js +2 -0
  27. package/dist/collection/components/ez-combo-box/ez-combo-box.css +167 -0
  28. package/dist/collection/components/ez-combo-box/ez-combo-box.js +363 -0
  29. package/dist/collection/components/ez-date-input/ez-date-input.css +39 -0
  30. package/dist/collection/components/ez-date-input/ez-date-input.js +172 -0
  31. package/dist/collection/components/ez-form/ez-form.css +19 -0
  32. package/dist/collection/components/ez-form/ez-form.js +368 -0
  33. package/dist/collection/components/ez-form/store/Form.actions.js +132 -0
  34. package/dist/collection/components/ez-form/store/Form.reducer.js +194 -0
  35. package/dist/collection/components/ez-form/store/Form.selectors.js +44 -0
  36. package/dist/collection/components/ez-form/subcomponents/DataUnit.js +207 -0
  37. package/dist/collection/components/ez-form/subcomponents/FormMetadata.js +16 -0
  38. package/dist/collection/components/ez-form/subcomponents/css/place-holder.css +24 -0
  39. package/dist/collection/components/ez-form/subcomponents/form-metadata.js +173 -0
  40. package/dist/collection/components/ez-form/subcomponents/place-holder.js +14 -0
  41. package/dist/collection/components/ez-form/subcomponents/structure/Field.js +71 -0
  42. package/dist/collection/components/ez-form/subcomponents/structure/FieldSet.js +27 -0
  43. package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +40 -0
  44. package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +27 -0
  45. package/dist/collection/components/ez-icon/ez-icon.css +37 -0
  46. package/dist/collection/components/ez-icon/ez-icon.js +56 -0
  47. package/dist/collection/components/ez-label-chip/ez-label-chip.css +117 -0
  48. package/dist/collection/components/ez-label-chip/ez-label-chip.js +276 -0
  49. package/dist/collection/components/ez-modal/ez-modal.css +87 -0
  50. package/dist/collection/components/ez-modal/ez-modal.js +224 -0
  51. package/dist/collection/components/ez-number-input/ez-number-input.css +144 -0
  52. package/dist/collection/components/ez-number-input/ez-number-input.js +465 -0
  53. package/dist/collection/components/ez-popover/ez-popover.css +39 -0
  54. package/dist/collection/components/ez-popover/ez-popover.js +323 -0
  55. package/dist/collection/components/ez-search/ez-search.css +296 -0
  56. package/dist/{ezui/ez-search.entry.js → collection/components/ez-search/ez-search.js} +527 -334
  57. package/dist/collection/components/ez-tabselector/ez-tabselector.css +126 -0
  58. package/dist/{ezui/ez-tabselector.entry.js → collection/components/ez-tabselector/ez-tabselector.js} +283 -209
  59. package/dist/collection/components/ez-text-area/ez-text-area.css +140 -0
  60. package/dist/collection/components/ez-text-area/ez-text-area.js +267 -0
  61. package/dist/collection/components/ez-text-input/ez-text-input.css +170 -0
  62. package/dist/collection/components/ez-text-input/ez-text-input.js +395 -0
  63. package/dist/collection/components/ez-time-input/ez-time-input.css +155 -0
  64. package/dist/collection/components/ez-time-input/ez-time-input.js +326 -0
  65. package/dist/collection/index.js +1 -0
  66. package/dist/collection/servidor.js +101 -0
  67. package/dist/collection/utils/FloatingManager.js +16 -0
  68. package/dist/collection/utils/utils.js +6 -0
  69. package/dist/custom-elements/index.js +5071 -0
  70. package/dist/esm/DataUnit-69e518fa.js +378 -0
  71. package/dist/esm/RequestMetadata-c265c9d5.js +527 -0
  72. package/dist/{ezui → esm}/ez-action-chip.entry.js +42 -42
  73. package/dist/esm/ez-button_14.entry.js +3324 -0
  74. package/dist/{ezui → esm}/ez-label-chip.entry.js +121 -121
  75. package/dist/{ezui → esm}/ez-modal.entry.js +105 -96
  76. package/dist/{ezui → esm}/ez-number-input.entry.js +238 -238
  77. package/dist/{ezui → esm}/ez-time-input.entry.js +170 -170
  78. package/dist/esm/ezui.js +17 -0
  79. package/dist/{ezui → esm}/form-metadata.entry.js +66 -66
  80. package/dist/esm/index-95bb3fd9.js +1293 -0
  81. package/dist/esm/index.js +1 -0
  82. package/dist/esm/loader.js +17 -0
  83. package/dist/esm/polyfills/core-js.js +11 -0
  84. package/dist/esm/polyfills/css-shim.js +1 -0
  85. package/dist/esm/polyfills/dom.js +79 -0
  86. package/dist/esm/polyfills/es5-html-element.js +1 -0
  87. package/dist/esm/polyfills/index.js +34 -0
  88. package/dist/esm/polyfills/system.js +6 -0
  89. package/dist/ezui/ezui.esm.js +1 -122
  90. package/dist/ezui/index.esm.js +0 -1
  91. package/dist/ezui/p-10ef58b3.js +1 -0
  92. package/dist/ezui/p-185c57f4.js +1 -0
  93. package/dist/ezui/p-22b82efb.entry.js +1 -0
  94. package/dist/ezui/p-77fdb4fd.entry.js +1 -0
  95. package/dist/ezui/p-9dfccb16.js +1 -0
  96. package/dist/ezui/p-b0974f4f.entry.js +1 -0
  97. package/dist/ezui/p-db11c600.entry.js +1 -0
  98. package/dist/ezui/p-dd4331b7.entry.js +1 -0
  99. package/dist/ezui/p-f6fd31ab.entry.js +1 -0
  100. package/dist/ezui/p-fa260f22.entry.js +1 -0
  101. package/dist/index.cjs.js +1 -0
  102. package/dist/index.js +1 -0
  103. package/dist/types/components/ez-action-chip/ez-action-chip.d.ts +16 -16
  104. package/dist/types/components/ez-button/ez-button.d.ts +20 -20
  105. package/dist/types/components/ez-calendar/ez-calendar.d.ts +42 -42
  106. package/dist/types/components/ez-check/ez-check.d.ts +32 -32
  107. package/dist/types/components/ez-collapsable-box/ez-collapsable-box.d.ts +18 -18
  108. package/dist/types/components/ez-combo-box/ez-combo-box-interfaces.d.ts +4 -4
  109. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +68 -68
  110. package/dist/types/components/ez-date-input/ez-date-input.d.ts +31 -31
  111. package/dist/types/components/ez-form/ez-form.d.ts +31 -27
  112. package/dist/types/components/ez-form/store/Form.actions.d.ts +111 -104
  113. package/dist/types/components/ez-form/store/Form.reducer.d.ts +20 -11
  114. package/dist/types/components/ez-form/store/Form.selectors.d.ts +14 -13
  115. package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +55 -48
  116. package/dist/types/components/ez-form/subcomponents/FormMetadata.d.ts +41 -41
  117. package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +15 -15
  118. package/dist/types/components/ez-form/subcomponents/place-holder.d.ts +3 -3
  119. package/dist/types/components/ez-form/subcomponents/structure/Field.d.ts +10 -10
  120. package/dist/types/components/ez-form/subcomponents/structure/FieldSet.d.ts +12 -12
  121. package/dist/types/components/ez-form/subcomponents/structure/FormSheet.d.ts +13 -13
  122. package/dist/types/components/ez-form/subcomponents/structure/NavigationBar.d.ts +17 -7
  123. package/dist/types/components/ez-icon/ez-icon.d.ts +5 -5
  124. package/dist/types/components/ez-label-chip/ez-label-chip.d.ts +40 -40
  125. package/dist/types/components/ez-modal/ez-modal.d.ts +32 -26
  126. package/dist/types/components/ez-number-input/ez-number-input.d.ts +73 -73
  127. package/dist/types/components/ez-popover/ez-popover.d.ts +52 -52
  128. package/dist/types/components/ez-search/ez-search.d.ts +95 -95
  129. package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +31 -31
  130. package/dist/types/components/ez-text-area/ez-text-area.d.ts +49 -49
  131. package/dist/types/components/ez-text-input/ez-text-input.d.ts +64 -64
  132. package/dist/types/components/ez-time-input/ez-time-input.d.ts +53 -53
  133. package/dist/types/components.d.ts +8 -0
  134. package/dist/types/index.d.ts +1 -1
  135. package/dist/types/utils/utils.d.ts +2 -2
  136. package/loader/cdn.js +3 -0
  137. package/loader/index.cjs.js +3 -0
  138. package/loader/index.d.ts +13 -0
  139. package/loader/index.es2017.js +3 -0
  140. package/loader/index.js +4 -0
  141. package/loader/package.json +10 -0
  142. package/package.json +114 -114
  143. package/react/components.d.ts +22 -0
  144. package/react/components.js +25 -0
  145. package/react/components.js.map +1 -0
  146. package/react/react-component-lib/createComponent.d.ts +10 -0
  147. package/react/react-component-lib/createComponent.js +59 -0
  148. package/react/react-component-lib/createComponent.js.map +1 -0
  149. package/react/react-component-lib/createOverlayComponent.d.ts +20 -0
  150. package/react/react-component-lib/createOverlayComponent.js +89 -0
  151. package/react/react-component-lib/createOverlayComponent.js.map +1 -0
  152. package/react/react-component-lib/index.d.ts +2 -0
  153. package/react/react-component-lib/index.js +3 -0
  154. package/react/react-component-lib/index.js.map +1 -0
  155. package/react/react-component-lib/interfaces.d.ts +29 -0
  156. package/react/react-component-lib/interfaces.js +1 -0
  157. package/react/react-component-lib/interfaces.js.map +1 -0
  158. package/react/react-component-lib/utils/attachProps.d.ts +12 -0
  159. package/react/react-component-lib/utils/attachProps.js +96 -0
  160. package/react/react-component-lib/utils/attachProps.js.map +1 -0
  161. package/react/react-component-lib/utils/case.d.ts +2 -0
  162. package/react/react-component-lib/utils/case.js +7 -0
  163. package/react/react-component-lib/utils/case.js.map +1 -0
  164. package/react/react-component-lib/utils/dev.d.ts +2 -0
  165. package/react/react-component-lib/utils/dev.js +13 -0
  166. package/react/react-component-lib/utils/dev.js.map +1 -0
  167. package/react/react-component-lib/utils/index.d.ts +7 -0
  168. package/react/react-component-lib/utils/index.js +21 -0
  169. package/react/react-component-lib/utils/index.js.map +1 -0
  170. package/dist/ezui/app-globals-0f993ce5.js +0 -3
  171. package/dist/ezui/css-shim-003e9264.js +0 -4
  172. package/dist/ezui/dom-1b195079.js +0 -73
  173. package/dist/ezui/ez-button.entry.js +0 -47
  174. package/dist/ezui/ez-calendar.entry.js +0 -102
  175. package/dist/ezui/ez-check.entry.js +0 -62
  176. package/dist/ezui/ez-collapsable-box.entry.js +0 -32
  177. package/dist/ezui/ez-combo-box.entry.js +0 -181
  178. package/dist/ezui/ez-date-input.entry.js +0 -77
  179. package/dist/ezui/ez-form.entry.js +0 -1907
  180. package/dist/ezui/ez-icon.entry.js +0 -17
  181. package/dist/ezui/ez-popover.entry.js +0 -112
  182. package/dist/ezui/ez-text-area.entry.js +0 -105
  183. package/dist/ezui/ez-text-input.entry.js +0 -202
  184. package/dist/ezui/index-39044be2.js +0 -2832
  185. package/dist/ezui/place-holder.entry.js +0 -15
  186. package/dist/ezui/shadow-css-c1ad5fdc.js +0 -383
@@ -1,1907 +0,0 @@
1
- import { h, r as registerInstance, f as forceUpdate, g as getElement } from './index-39044be2.js';
2
- import { s as selectIsCollapsedFieldSet, c as collapseExpandGroup, a as selectCurrentTab, b as changeTab$1, i as invalidField$1, f as formLoad, D as DataUnit } from './DataUnit-285bec19.js';
3
- import { D as DateUtils } from './index-919090de.js';
4
-
5
- function _defineProperty(obj, key, value) {
6
- if (key in obj) {
7
- Object.defineProperty(obj, key, {
8
- value: value,
9
- enumerable: true,
10
- configurable: true,
11
- writable: true
12
- });
13
- } else {
14
- obj[key] = value;
15
- }
16
-
17
- return obj;
18
- }
19
-
20
- function ownKeys(object, enumerableOnly) {
21
- var keys = Object.keys(object);
22
-
23
- if (Object.getOwnPropertySymbols) {
24
- var symbols = Object.getOwnPropertySymbols(object);
25
-
26
- if (enumerableOnly) {
27
- symbols = symbols.filter(function (sym) {
28
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
29
- });
30
- }
31
-
32
- keys.push.apply(keys, symbols);
33
- }
34
-
35
- return keys;
36
- }
37
-
38
- function _objectSpread2(target) {
39
- for (var i = 1; i < arguments.length; i++) {
40
- var source = arguments[i] != null ? arguments[i] : {};
41
-
42
- if (i % 2) {
43
- ownKeys(Object(source), true).forEach(function (key) {
44
- _defineProperty(target, key, source[key]);
45
- });
46
- } else if (Object.getOwnPropertyDescriptors) {
47
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
48
- } else {
49
- ownKeys(Object(source)).forEach(function (key) {
50
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
51
- });
52
- }
53
- }
54
-
55
- return target;
56
- }
57
-
58
- /**
59
- * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
60
- *
61
- * Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes
62
- * during build.
63
- * @param {number} code
64
- */
65
- function formatProdErrorMessage(code) {
66
- return "Minified Redux error #" + code + "; visit https://redux.js.org/Errors?code=" + code + " for the full message or " + 'use the non-minified dev environment for full errors. ';
67
- }
68
-
69
- // Inlined version of the `symbol-observable` polyfill
70
- var $$observable = (function () {
71
- return typeof Symbol === 'function' && Symbol.observable || '@@observable';
72
- })();
73
-
74
- /**
75
- * These are private action types reserved by Redux.
76
- * For any unknown actions, you must return the current state.
77
- * If the current state is undefined, you must return the initial state.
78
- * Do not reference these action types directly in your code.
79
- */
80
- var randomString = function randomString() {
81
- return Math.random().toString(36).substring(7).split('').join('.');
82
- };
83
-
84
- var ActionTypes = {
85
- INIT: "@@redux/INIT" + randomString(),
86
- REPLACE: "@@redux/REPLACE" + randomString(),
87
- PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
88
- return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
89
- }
90
- };
91
-
92
- /**
93
- * @param {any} obj The object to inspect.
94
- * @returns {boolean} True if the argument appears to be a plain object.
95
- */
96
- function isPlainObject(obj) {
97
- if (typeof obj !== 'object' || obj === null) return false;
98
- var proto = obj;
99
-
100
- while (Object.getPrototypeOf(proto) !== null) {
101
- proto = Object.getPrototypeOf(proto);
102
- }
103
-
104
- return Object.getPrototypeOf(obj) === proto;
105
- }
106
-
107
- // Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of
108
- function miniKindOf(val) {
109
- if (val === void 0) return 'undefined';
110
- if (val === null) return 'null';
111
- var type = typeof val;
112
-
113
- switch (type) {
114
- case 'boolean':
115
- case 'string':
116
- case 'number':
117
- case 'symbol':
118
- case 'function':
119
- {
120
- return type;
121
- }
122
- }
123
-
124
- if (Array.isArray(val)) return 'array';
125
- if (isDate(val)) return 'date';
126
- if (isError(val)) return 'error';
127
- var constructorName = ctorName(val);
128
-
129
- switch (constructorName) {
130
- case 'Symbol':
131
- case 'Promise':
132
- case 'WeakMap':
133
- case 'WeakSet':
134
- case 'Map':
135
- case 'Set':
136
- return constructorName;
137
- } // other
138
-
139
-
140
- return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
141
- }
142
-
143
- function ctorName(val) {
144
- return typeof val.constructor === 'function' ? val.constructor.name : null;
145
- }
146
-
147
- function isError(val) {
148
- return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';
149
- }
150
-
151
- function isDate(val) {
152
- if (val instanceof Date) return true;
153
- return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';
154
- }
155
-
156
- function kindOf(val) {
157
- var typeOfVal = typeof val;
158
-
159
- if ("development" !== 'production') {
160
- typeOfVal = miniKindOf(val);
161
- }
162
-
163
- return typeOfVal;
164
- }
165
-
166
- /**
167
- * Creates a Redux store that holds the state tree.
168
- * The only way to change the data in the store is to call `dispatch()` on it.
169
- *
170
- * There should only be a single store in your app. To specify how different
171
- * parts of the state tree respond to actions, you may combine several reducers
172
- * into a single reducer function by using `combineReducers`.
173
- *
174
- * @param {Function} reducer A function that returns the next state tree, given
175
- * the current state tree and the action to handle.
176
- *
177
- * @param {any} [preloadedState] The initial state. You may optionally specify it
178
- * to hydrate the state from the server in universal apps, or to restore a
179
- * previously serialized user session.
180
- * If you use `combineReducers` to produce the root reducer function, this must be
181
- * an object with the same shape as `combineReducers` keys.
182
- *
183
- * @param {Function} [enhancer] The store enhancer. You may optionally specify it
184
- * to enhance the store with third-party capabilities such as middleware,
185
- * time travel, persistence, etc. The only store enhancer that ships with Redux
186
- * is `applyMiddleware()`.
187
- *
188
- * @returns {Store} A Redux store that lets you read the state, dispatch actions
189
- * and subscribe to changes.
190
- */
191
-
192
- function createStore(reducer, preloadedState, enhancer) {
193
- var _ref2;
194
-
195
- if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
196
- throw new Error("development" === "production" ? formatProdErrorMessage(0) : 'It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.');
197
- }
198
-
199
- if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
200
- enhancer = preloadedState;
201
- preloadedState = undefined;
202
- }
203
-
204
- if (typeof enhancer !== 'undefined') {
205
- if (typeof enhancer !== 'function') {
206
- throw new Error("development" === "production" ? formatProdErrorMessage(1) : "Expected the enhancer to be a function. Instead, received: '" + kindOf(enhancer) + "'");
207
- }
208
-
209
- return enhancer(createStore)(reducer, preloadedState);
210
- }
211
-
212
- if (typeof reducer !== 'function') {
213
- throw new Error("development" === "production" ? formatProdErrorMessage(2) : "Expected the root reducer to be a function. Instead, received: '" + kindOf(reducer) + "'");
214
- }
215
-
216
- var currentReducer = reducer;
217
- var currentState = preloadedState;
218
- var currentListeners = [];
219
- var nextListeners = currentListeners;
220
- var isDispatching = false;
221
- /**
222
- * This makes a shallow copy of currentListeners so we can use
223
- * nextListeners as a temporary list while dispatching.
224
- *
225
- * This prevents any bugs around consumers calling
226
- * subscribe/unsubscribe in the middle of a dispatch.
227
- */
228
-
229
- function ensureCanMutateNextListeners() {
230
- if (nextListeners === currentListeners) {
231
- nextListeners = currentListeners.slice();
232
- }
233
- }
234
- /**
235
- * Reads the state tree managed by the store.
236
- *
237
- * @returns {any} The current state tree of your application.
238
- */
239
-
240
-
241
- function getState() {
242
- if (isDispatching) {
243
- throw new Error("development" === "production" ? formatProdErrorMessage(3) : 'You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');
244
- }
245
-
246
- return currentState;
247
- }
248
- /**
249
- * Adds a change listener. It will be called any time an action is dispatched,
250
- * and some part of the state tree may potentially have changed. You may then
251
- * call `getState()` to read the current state tree inside the callback.
252
- *
253
- * You may call `dispatch()` from a change listener, with the following
254
- * caveats:
255
- *
256
- * 1. The subscriptions are snapshotted just before every `dispatch()` call.
257
- * If you subscribe or unsubscribe while the listeners are being invoked, this
258
- * will not have any effect on the `dispatch()` that is currently in progress.
259
- * However, the next `dispatch()` call, whether nested or not, will use a more
260
- * recent snapshot of the subscription list.
261
- *
262
- * 2. The listener should not expect to see all state changes, as the state
263
- * might have been updated multiple times during a nested `dispatch()` before
264
- * the listener is called. It is, however, guaranteed that all subscribers
265
- * registered before the `dispatch()` started will be called with the latest
266
- * state by the time it exits.
267
- *
268
- * @param {Function} listener A callback to be invoked on every dispatch.
269
- * @returns {Function} A function to remove this change listener.
270
- */
271
-
272
-
273
- function subscribe(listener) {
274
- if (typeof listener !== 'function') {
275
- throw new Error("development" === "production" ? formatProdErrorMessage(4) : "Expected the listener to be a function. Instead, received: '" + kindOf(listener) + "'");
276
- }
277
-
278
- if (isDispatching) {
279
- throw new Error("development" === "production" ? formatProdErrorMessage(5) : 'You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');
280
- }
281
-
282
- var isSubscribed = true;
283
- ensureCanMutateNextListeners();
284
- nextListeners.push(listener);
285
- return function unsubscribe() {
286
- if (!isSubscribed) {
287
- return;
288
- }
289
-
290
- if (isDispatching) {
291
- throw new Error("development" === "production" ? formatProdErrorMessage(6) : 'You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');
292
- }
293
-
294
- isSubscribed = false;
295
- ensureCanMutateNextListeners();
296
- var index = nextListeners.indexOf(listener);
297
- nextListeners.splice(index, 1);
298
- currentListeners = null;
299
- };
300
- }
301
- /**
302
- * Dispatches an action. It is the only way to trigger a state change.
303
- *
304
- * The `reducer` function, used to create the store, will be called with the
305
- * current state tree and the given `action`. Its return value will
306
- * be considered the **next** state of the tree, and the change listeners
307
- * will be notified.
308
- *
309
- * The base implementation only supports plain object actions. If you want to
310
- * dispatch a Promise, an Observable, a thunk, or something else, you need to
311
- * wrap your store creating function into the corresponding middleware. For
312
- * example, see the documentation for the `redux-thunk` package. Even the
313
- * middleware will eventually dispatch plain object actions using this method.
314
- *
315
- * @param {Object} action A plain object representing “what changed”. It is
316
- * a good idea to keep actions serializable so you can record and replay user
317
- * sessions, or use the time travelling `redux-devtools`. An action must have
318
- * a `type` property which may not be `undefined`. It is a good idea to use
319
- * string constants for action types.
320
- *
321
- * @returns {Object} For convenience, the same action object you dispatched.
322
- *
323
- * Note that, if you use a custom middleware, it may wrap `dispatch()` to
324
- * return something else (for example, a Promise you can await).
325
- */
326
-
327
-
328
- function dispatch(action) {
329
- if (!isPlainObject(action)) {
330
- throw new Error("development" === "production" ? formatProdErrorMessage(7) : "Actions must be plain objects. Instead, the actual type was: '" + kindOf(action) + "'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");
331
- }
332
-
333
- if (typeof action.type === 'undefined') {
334
- throw new Error("development" === "production" ? formatProdErrorMessage(8) : 'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');
335
- }
336
-
337
- if (isDispatching) {
338
- throw new Error("development" === "production" ? formatProdErrorMessage(9) : 'Reducers may not dispatch actions.');
339
- }
340
-
341
- try {
342
- isDispatching = true;
343
- currentState = currentReducer(currentState, action);
344
- } finally {
345
- isDispatching = false;
346
- }
347
-
348
- var listeners = currentListeners = nextListeners;
349
-
350
- for (var i = 0; i < listeners.length; i++) {
351
- var listener = listeners[i];
352
- listener();
353
- }
354
-
355
- return action;
356
- }
357
- /**
358
- * Replaces the reducer currently used by the store to calculate the state.
359
- *
360
- * You might need this if your app implements code splitting and you want to
361
- * load some of the reducers dynamically. You might also need this if you
362
- * implement a hot reloading mechanism for Redux.
363
- *
364
- * @param {Function} nextReducer The reducer for the store to use instead.
365
- * @returns {void}
366
- */
367
-
368
-
369
- function replaceReducer(nextReducer) {
370
- if (typeof nextReducer !== 'function') {
371
- throw new Error("development" === "production" ? formatProdErrorMessage(10) : "Expected the nextReducer to be a function. Instead, received: '" + kindOf(nextReducer));
372
- }
373
-
374
- currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.
375
- // Any reducers that existed in both the new and old rootReducer
376
- // will receive the previous state. This effectively populates
377
- // the new state tree with any relevant data from the old one.
378
-
379
- dispatch({
380
- type: ActionTypes.REPLACE
381
- });
382
- }
383
- /**
384
- * Interoperability point for observable/reactive libraries.
385
- * @returns {observable} A minimal observable of state changes.
386
- * For more information, see the observable proposal:
387
- * https://github.com/tc39/proposal-observable
388
- */
389
-
390
-
391
- function observable() {
392
- var _ref;
393
-
394
- var outerSubscribe = subscribe;
395
- return _ref = {
396
- /**
397
- * The minimal observable subscription method.
398
- * @param {Object} observer Any object that can be used as an observer.
399
- * The observer object should have a `next` method.
400
- * @returns {subscription} An object with an `unsubscribe` method that can
401
- * be used to unsubscribe the observable from the store, and prevent further
402
- * emission of values from the observable.
403
- */
404
- subscribe: function subscribe(observer) {
405
- if (typeof observer !== 'object' || observer === null) {
406
- throw new Error("development" === "production" ? formatProdErrorMessage(11) : "Expected the observer to be an object. Instead, received: '" + kindOf(observer) + "'");
407
- }
408
-
409
- function observeState() {
410
- if (observer.next) {
411
- observer.next(getState());
412
- }
413
- }
414
-
415
- observeState();
416
- var unsubscribe = outerSubscribe(observeState);
417
- return {
418
- unsubscribe: unsubscribe
419
- };
420
- }
421
- }, _ref[$$observable] = function () {
422
- return this;
423
- }, _ref;
424
- } // When a store is created, an "INIT" action is dispatched so that every
425
- // reducer returns their initial state. This effectively populates
426
- // the initial state tree.
427
-
428
-
429
- dispatch({
430
- type: ActionTypes.INIT
431
- });
432
- return _ref2 = {
433
- dispatch: dispatch,
434
- subscribe: subscribe,
435
- getState: getState,
436
- replaceReducer: replaceReducer
437
- }, _ref2[$$observable] = observable, _ref2;
438
- }
439
-
440
- /**
441
- * Prints a warning in the console if it exists.
442
- *
443
- * @param {String} message The warning message.
444
- * @returns {void}
445
- */
446
- function warning(message) {
447
- /* eslint-disable no-console */
448
- if (typeof console !== 'undefined' && typeof console.error === 'function') {
449
- console.error(message);
450
- }
451
- /* eslint-enable no-console */
452
-
453
-
454
- try {
455
- // This error was thrown as a convenience so that if you enable
456
- // "break on all exceptions" in your console,
457
- // it would pause the execution at this line.
458
- throw new Error(message);
459
- } catch (e) {} // eslint-disable-line no-empty
460
-
461
- }
462
-
463
- function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
464
- var reducerKeys = Object.keys(reducers);
465
- var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
466
-
467
- if (reducerKeys.length === 0) {
468
- return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
469
- }
470
-
471
- if (!isPlainObject(inputState)) {
472
- return "The " + argumentName + " has unexpected type of \"" + kindOf(inputState) + "\". Expected argument to be an object with the following " + ("keys: \"" + reducerKeys.join('", "') + "\"");
473
- }
474
-
475
- var unexpectedKeys = Object.keys(inputState).filter(function (key) {
476
- return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
477
- });
478
- unexpectedKeys.forEach(function (key) {
479
- unexpectedKeyCache[key] = true;
480
- });
481
- if (action && action.type === ActionTypes.REPLACE) return;
482
-
483
- if (unexpectedKeys.length > 0) {
484
- return "Unexpected " + (unexpectedKeys.length > 1 ? 'keys' : 'key') + " " + ("\"" + unexpectedKeys.join('", "') + "\" found in " + argumentName + ". ") + "Expected to find one of the known reducer keys instead: " + ("\"" + reducerKeys.join('", "') + "\". Unexpected keys will be ignored.");
485
- }
486
- }
487
-
488
- function assertReducerShape(reducers) {
489
- Object.keys(reducers).forEach(function (key) {
490
- var reducer = reducers[key];
491
- var initialState = reducer(undefined, {
492
- type: ActionTypes.INIT
493
- });
494
-
495
- if (typeof initialState === 'undefined') {
496
- throw new Error("development" === "production" ? formatProdErrorMessage(12) : "The slice reducer for key \"" + key + "\" returned undefined during initialization. " + "If the state passed to the reducer is undefined, you must " + "explicitly return the initial state. The initial state may " + "not be undefined. If you don't want to set a value for this reducer, " + "you can use null instead of undefined.");
497
- }
498
-
499
- if (typeof reducer(undefined, {
500
- type: ActionTypes.PROBE_UNKNOWN_ACTION()
501
- }) === 'undefined') {
502
- throw new Error("development" === "production" ? formatProdErrorMessage(13) : "The slice reducer for key \"" + key + "\" returned undefined when probed with a random type. " + ("Don't try to handle '" + ActionTypes.INIT + "' or other actions in \"redux/*\" ") + "namespace. They are considered private. Instead, you must return the " + "current state for any unknown actions, unless it is undefined, " + "in which case you must return the initial state, regardless of the " + "action type. The initial state may not be undefined, but can be null.");
503
- }
504
- });
505
- }
506
- /**
507
- * Turns an object whose values are different reducer functions, into a single
508
- * reducer function. It will call every child reducer, and gather their results
509
- * into a single state object, whose keys correspond to the keys of the passed
510
- * reducer functions.
511
- *
512
- * @param {Object} reducers An object whose values correspond to different
513
- * reducer functions that need to be combined into one. One handy way to obtain
514
- * it is to use ES6 `import * as reducers` syntax. The reducers may never return
515
- * undefined for any action. Instead, they should return their initial state
516
- * if the state passed to them was undefined, and the current state for any
517
- * unrecognized action.
518
- *
519
- * @returns {Function} A reducer function that invokes every reducer inside the
520
- * passed object, and builds a state object with the same shape.
521
- */
522
-
523
-
524
- function combineReducers(reducers) {
525
- var reducerKeys = Object.keys(reducers);
526
- var finalReducers = {};
527
-
528
- for (var i = 0; i < reducerKeys.length; i++) {
529
- var key = reducerKeys[i];
530
-
531
- if ("development" !== 'production') {
532
- if (typeof reducers[key] === 'undefined') {
533
- warning("No reducer provided for key \"" + key + "\"");
534
- }
535
- }
536
-
537
- if (typeof reducers[key] === 'function') {
538
- finalReducers[key] = reducers[key];
539
- }
540
- }
541
-
542
- var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same
543
- // keys multiple times.
544
-
545
- var unexpectedKeyCache;
546
-
547
- if ("development" !== 'production') {
548
- unexpectedKeyCache = {};
549
- }
550
-
551
- var shapeAssertionError;
552
-
553
- try {
554
- assertReducerShape(finalReducers);
555
- } catch (e) {
556
- shapeAssertionError = e;
557
- }
558
-
559
- return function combination(state, action) {
560
- if (state === void 0) {
561
- state = {};
562
- }
563
-
564
- if (shapeAssertionError) {
565
- throw shapeAssertionError;
566
- }
567
-
568
- if ("development" !== 'production') {
569
- var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
570
-
571
- if (warningMessage) {
572
- warning(warningMessage);
573
- }
574
- }
575
-
576
- var hasChanged = false;
577
- var nextState = {};
578
-
579
- for (var _i = 0; _i < finalReducerKeys.length; _i++) {
580
- var _key = finalReducerKeys[_i];
581
- var reducer = finalReducers[_key];
582
- var previousStateForKey = state[_key];
583
- var nextStateForKey = reducer(previousStateForKey, action);
584
-
585
- if (typeof nextStateForKey === 'undefined') {
586
- var actionType = action && action.type;
587
- throw new Error("development" === "production" ? formatProdErrorMessage(14) : "When called with an action of type " + (actionType ? "\"" + String(actionType) + "\"" : '(unknown type)') + ", the slice reducer for key \"" + _key + "\" returned undefined. " + "To ignore an action, you must explicitly return the previous state. " + "If you want this reducer to hold no value, you can return null instead of undefined.");
588
- }
589
-
590
- nextState[_key] = nextStateForKey;
591
- hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
592
- }
593
-
594
- hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
595
- return hasChanged ? nextState : state;
596
- };
597
- }
598
-
599
- function bindActionCreator(actionCreator, dispatch) {
600
- return function () {
601
- return dispatch(actionCreator.apply(this, arguments));
602
- };
603
- }
604
- /**
605
- * Turns an object whose values are action creators, into an object with the
606
- * same keys, but with every function wrapped into a `dispatch` call so they
607
- * may be invoked directly. This is just a convenience method, as you can call
608
- * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
609
- *
610
- * For convenience, you can also pass an action creator as the first argument,
611
- * and get a dispatch wrapped function in return.
612
- *
613
- * @param {Function|Object} actionCreators An object whose values are action
614
- * creator functions. One handy way to obtain it is to use ES6 `import * as`
615
- * syntax. You may also pass a single function.
616
- *
617
- * @param {Function} dispatch The `dispatch` function available on your Redux
618
- * store.
619
- *
620
- * @returns {Function|Object} The object mimicking the original object, but with
621
- * every action creator wrapped into the `dispatch` call. If you passed a
622
- * function as `actionCreators`, the return value will also be a single
623
- * function.
624
- */
625
-
626
-
627
- function bindActionCreators(actionCreators, dispatch) {
628
- if (typeof actionCreators === 'function') {
629
- return bindActionCreator(actionCreators, dispatch);
630
- }
631
-
632
- if (typeof actionCreators !== 'object' || actionCreators === null) {
633
- throw new Error("development" === "production" ? formatProdErrorMessage(16) : "bindActionCreators expected an object or a function, but instead received: '" + kindOf(actionCreators) + "'. " + "Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?");
634
- }
635
-
636
- var boundActionCreators = {};
637
-
638
- for (var key in actionCreators) {
639
- var actionCreator = actionCreators[key];
640
-
641
- if (typeof actionCreator === 'function') {
642
- boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
643
- }
644
- }
645
-
646
- return boundActionCreators;
647
- }
648
-
649
- /**
650
- * Composes single-argument functions from right to left. The rightmost
651
- * function can take multiple arguments as it provides the signature for
652
- * the resulting composite function.
653
- *
654
- * @param {...Function} funcs The functions to compose.
655
- * @returns {Function} A function obtained by composing the argument functions
656
- * from right to left. For example, compose(f, g, h) is identical to doing
657
- * (...args) => f(g(h(...args))).
658
- */
659
- function compose() {
660
- for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
661
- funcs[_key] = arguments[_key];
662
- }
663
-
664
- if (funcs.length === 0) {
665
- return function (arg) {
666
- return arg;
667
- };
668
- }
669
-
670
- if (funcs.length === 1) {
671
- return funcs[0];
672
- }
673
-
674
- return funcs.reduce(function (a, b) {
675
- return function () {
676
- return a(b.apply(void 0, arguments));
677
- };
678
- });
679
- }
680
-
681
- /**
682
- * Creates a store enhancer that applies middleware to the dispatch method
683
- * of the Redux store. This is handy for a variety of tasks, such as expressing
684
- * asynchronous actions in a concise manner, or logging every action payload.
685
- *
686
- * See `redux-thunk` package as an example of the Redux middleware.
687
- *
688
- * Because middleware is potentially asynchronous, this should be the first
689
- * store enhancer in the composition chain.
690
- *
691
- * Note that each middleware will be given the `dispatch` and `getState` functions
692
- * as named arguments.
693
- *
694
- * @param {...Function} middlewares The middleware chain to be applied.
695
- * @returns {Function} A store enhancer applying the middleware.
696
- */
697
-
698
- function applyMiddleware() {
699
- for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
700
- middlewares[_key] = arguments[_key];
701
- }
702
-
703
- return function (createStore) {
704
- return function () {
705
- var store = createStore.apply(void 0, arguments);
706
-
707
- var _dispatch = function dispatch() {
708
- throw new Error("development" === "production" ? formatProdErrorMessage(15) : 'Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');
709
- };
710
-
711
- var middlewareAPI = {
712
- getState: store.getState,
713
- dispatch: function dispatch() {
714
- return _dispatch.apply(void 0, arguments);
715
- }
716
- };
717
- var chain = middlewares.map(function (middleware) {
718
- return middleware(middlewareAPI);
719
- });
720
- _dispatch = compose.apply(void 0, chain)(store.dispatch);
721
- return _objectSpread2(_objectSpread2({}, store), {}, {
722
- dispatch: _dispatch
723
- });
724
- };
725
- };
726
- }
727
-
728
- /*
729
- * This is a dummy function to check if the function name has been altered by minification.
730
- * If the function has been minified and NODE_ENV !== 'production', warn the user.
731
- */
732
-
733
- function isCrushed() {}
734
-
735
- if ("development" !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
736
- warning('You are currently using minified code outside of NODE_ENV === "production". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.');
737
- }
738
-
739
- function createThunkMiddleware(extraArgument) {
740
- return function (_ref) {
741
- var dispatch = _ref.dispatch,
742
- getState = _ref.getState;
743
- return function (next) {
744
- return function (action) {
745
- if (typeof action === 'function') {
746
- return action(dispatch, getState, extraArgument);
747
- }
748
-
749
- return next(action);
750
- };
751
- };
752
- };
753
- }
754
-
755
- var thunk = createThunkMiddleware();
756
- thunk.withExtraArgument = createThunkMiddleware;
757
-
758
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
759
-
760
- function getDefaultExportFromCjs (x) {
761
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
762
- }
763
-
764
- function createCommonjsModule(fn, basedir, module) {
765
- return module = {
766
- path: basedir,
767
- exports: {},
768
- require: function (path, base) {
769
- return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
770
- }
771
- }, fn(module, module.exports), module.exports;
772
- }
773
-
774
- function getDefaultExportFromNamespaceIfPresent (n) {
775
- return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n;
776
- }
777
-
778
- function getDefaultExportFromNamespaceIfNotNamed (n) {
779
- return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;
780
- }
781
-
782
- function getAugmentedNamespace(n) {
783
- if (n.__esModule) return n;
784
- var a = Object.defineProperty({}, '__esModule', {value: true});
785
- Object.keys(n).forEach(function (k) {
786
- var d = Object.getOwnPropertyDescriptor(n, k);
787
- Object.defineProperty(a, k, d.get ? d : {
788
- enumerable: true,
789
- get: function () {
790
- return n[k];
791
- }
792
- });
793
- });
794
- return a;
795
- }
796
-
797
- function commonjsRequire () {
798
- throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
799
- }
800
-
801
- var actions = createCommonjsModule(function (module, exports) {
802
- "use strict";
803
-
804
- Object.defineProperty(exports, "__esModule", {
805
- value: true
806
- });
807
- exports.ActionCreators = exports.ActionTypes = void 0;
808
- var ActionTypes = {
809
- UNDO: '@@redux-undo/UNDO',
810
- REDO: '@@redux-undo/REDO',
811
- JUMP_TO_FUTURE: '@@redux-undo/JUMP_TO_FUTURE',
812
- JUMP_TO_PAST: '@@redux-undo/JUMP_TO_PAST',
813
- JUMP: '@@redux-undo/JUMP',
814
- CLEAR_HISTORY: '@@redux-undo/CLEAR_HISTORY'
815
- };
816
- exports.ActionTypes = ActionTypes;
817
- var ActionCreators = {
818
- undo: function undo() {
819
- return {
820
- type: ActionTypes.UNDO
821
- };
822
- },
823
- redo: function redo() {
824
- return {
825
- type: ActionTypes.REDO
826
- };
827
- },
828
- jumpToFuture: function jumpToFuture(index) {
829
- return {
830
- type: ActionTypes.JUMP_TO_FUTURE,
831
- index: index
832
- };
833
- },
834
- jumpToPast: function jumpToPast(index) {
835
- return {
836
- type: ActionTypes.JUMP_TO_PAST,
837
- index: index
838
- };
839
- },
840
- jump: function jump(index) {
841
- return {
842
- type: ActionTypes.JUMP,
843
- index: index
844
- };
845
- },
846
- clearHistory: function clearHistory() {
847
- return {
848
- type: ActionTypes.CLEAR_HISTORY
849
- };
850
- }
851
- };
852
- exports.ActionCreators = ActionCreators;
853
- });
854
-
855
- const actions$1 = /*@__PURE__*/getDefaultExportFromCjs(actions);
856
-
857
- var helpers = createCommonjsModule(function (module, exports) {
858
- "use strict";
859
-
860
- Object.defineProperty(exports, "__esModule", {
861
- value: true
862
- });
863
- exports.parseActions = parseActions;
864
- exports.isHistory = isHistory;
865
- exports.includeAction = includeAction;
866
- exports.excludeAction = excludeAction;
867
- exports.combineFilters = combineFilters;
868
- exports.groupByActionTypes = groupByActionTypes;
869
- exports.newHistory = newHistory;
870
-
871
- // parseActions helper: takes a string (or array)
872
- // and makes it an array if it isn't yet
873
- function parseActions(rawActions) {
874
- var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
875
-
876
- if (Array.isArray(rawActions)) {
877
- return rawActions;
878
- } else if (typeof rawActions === 'string') {
879
- return [rawActions];
880
- }
881
-
882
- return defaultValue;
883
- } // isHistory helper: check for a valid history object
884
-
885
-
886
- function isHistory(history) {
887
- return typeof history.present !== 'undefined' && typeof history.future !== 'undefined' && typeof history.past !== 'undefined' && Array.isArray(history.future) && Array.isArray(history.past);
888
- } // includeAction helper: whitelist actions to be added to the history
889
-
890
-
891
- function includeAction(rawActions) {
892
- var actions = parseActions(rawActions);
893
- return function (action) {
894
- return actions.indexOf(action.type) >= 0;
895
- };
896
- } // excludeAction helper: blacklist actions from being added to the history
897
-
898
-
899
- function excludeAction(rawActions) {
900
- var actions = parseActions(rawActions);
901
- return function (action) {
902
- return actions.indexOf(action.type) < 0;
903
- };
904
- } // combineFilters helper: combine multiple filters to one
905
-
906
-
907
- function combineFilters() {
908
- for (var _len = arguments.length, filters = new Array(_len), _key = 0; _key < _len; _key++) {
909
- filters[_key] = arguments[_key];
910
- }
911
-
912
- return filters.reduce(function (prev, curr) {
913
- return function (action, currentState, previousHistory) {
914
- return prev(action, currentState, previousHistory) && curr(action, currentState, previousHistory);
915
- };
916
- }, function () {
917
- return true;
918
- });
919
- }
920
-
921
- function groupByActionTypes(rawActions) {
922
- var actions = parseActions(rawActions);
923
- return function (action) {
924
- return actions.indexOf(action.type) >= 0 ? action.type : null;
925
- };
926
- }
927
-
928
- function newHistory(past, present, future) {
929
- var group = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
930
- return {
931
- past: past,
932
- present: present,
933
- future: future,
934
- group: group,
935
- _latestUnfiltered: present,
936
- index: past.length,
937
- limit: past.length + future.length + 1
938
- };
939
- }
940
- });
941
-
942
- const helpers$1 = /*@__PURE__*/getDefaultExportFromCjs(helpers);
943
-
944
- var debug = createCommonjsModule(function (module, exports) {
945
- "use strict";
946
-
947
- Object.defineProperty(exports, "__esModule", {
948
- value: true
949
- });
950
- exports.set = set;
951
- exports.start = start;
952
- exports.end = end;
953
- exports.log = log;
954
-
955
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
956
-
957
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
958
-
959
- function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
960
-
961
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
962
-
963
- var __DEBUG__;
964
-
965
- var displayBuffer;
966
- var colors = {
967
- prevState: '#9E9E9E',
968
- action: '#03A9F4',
969
- nextState: '#4CAF50'
970
- };
971
- /* istanbul ignore next: debug messaging is not tested */
972
-
973
- function initBuffer() {
974
- displayBuffer = {
975
- header: [],
976
- prev: [],
977
- action: [],
978
- next: [],
979
- msgs: []
980
- };
981
- }
982
- /* istanbul ignore next: debug messaging is not tested */
983
-
984
-
985
- function printBuffer() {
986
- var _displayBuffer = displayBuffer,
987
- header = _displayBuffer.header,
988
- prev = _displayBuffer.prev,
989
- next = _displayBuffer.next,
990
- action = _displayBuffer.action,
991
- msgs = _displayBuffer.msgs;
992
-
993
- if (console.group) {
994
- var _console, _console2, _console3, _console4, _console5;
995
-
996
- (_console = console).groupCollapsed.apply(_console, _toConsumableArray(header));
997
-
998
- (_console2 = console).log.apply(_console2, _toConsumableArray(prev));
999
-
1000
- (_console3 = console).log.apply(_console3, _toConsumableArray(action));
1001
-
1002
- (_console4 = console).log.apply(_console4, _toConsumableArray(next));
1003
-
1004
- (_console5 = console).log.apply(_console5, _toConsumableArray(msgs));
1005
-
1006
- console.groupEnd();
1007
- } else {
1008
- var _console6, _console7, _console8, _console9, _console10;
1009
-
1010
- (_console6 = console).log.apply(_console6, _toConsumableArray(header));
1011
-
1012
- (_console7 = console).log.apply(_console7, _toConsumableArray(prev));
1013
-
1014
- (_console8 = console).log.apply(_console8, _toConsumableArray(action));
1015
-
1016
- (_console9 = console).log.apply(_console9, _toConsumableArray(next));
1017
-
1018
- (_console10 = console).log.apply(_console10, _toConsumableArray(msgs));
1019
- }
1020
- }
1021
- /* istanbul ignore next: debug messaging is not tested */
1022
-
1023
-
1024
- function colorFormat(text, color, obj) {
1025
- return ["%c".concat(text), "color: ".concat(color, "; font-weight: bold"), obj];
1026
- }
1027
- /* istanbul ignore next: debug messaging is not tested */
1028
-
1029
-
1030
- function start(action, state) {
1031
- initBuffer();
1032
-
1033
- if (__DEBUG__) {
1034
- if (console.group) {
1035
- displayBuffer.header = ['%credux-undo', 'font-style: italic', 'action', action.type];
1036
- displayBuffer.action = colorFormat('action', colors.action, action);
1037
- displayBuffer.prev = colorFormat('prev history', colors.prevState, state);
1038
- } else {
1039
- displayBuffer.header = ['redux-undo action', action.type];
1040
- displayBuffer.action = ['action', action];
1041
- displayBuffer.prev = ['prev history', state];
1042
- }
1043
- }
1044
- }
1045
- /* istanbul ignore next: debug messaging is not tested */
1046
-
1047
-
1048
- function end(nextState) {
1049
- if (__DEBUG__) {
1050
- if (console.group) {
1051
- displayBuffer.next = colorFormat('next history', colors.nextState, nextState);
1052
- } else {
1053
- displayBuffer.next = ['next history', nextState];
1054
- }
1055
-
1056
- printBuffer();
1057
- }
1058
- }
1059
- /* istanbul ignore next: debug messaging is not tested */
1060
-
1061
-
1062
- function log() {
1063
- if (__DEBUG__) {
1064
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1065
- args[_key] = arguments[_key];
1066
- }
1067
-
1068
- displayBuffer.msgs = displayBuffer.msgs.concat([].concat(args, ['\n']));
1069
- }
1070
- }
1071
- /* istanbul ignore next: debug messaging is not tested */
1072
-
1073
-
1074
- function set(debug) {
1075
- __DEBUG__ = debug;
1076
- }
1077
- });
1078
-
1079
- const debug$1 = /*@__PURE__*/getDefaultExportFromCjs(debug);
1080
-
1081
- var reducer = createCommonjsModule(function (module, exports) {
1082
- "use strict";
1083
-
1084
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1085
-
1086
- Object.defineProperty(exports, "__esModule", {
1087
- value: true
1088
- });
1089
- exports["default"] = undoable;
1090
-
1091
- var debug$1 = _interopRequireWildcard(debug);
1092
-
1093
-
1094
-
1095
-
1096
-
1097
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
1098
-
1099
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
1100
-
1101
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
1102
-
1103
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
1104
-
1105
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1106
-
1107
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
1108
-
1109
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
1110
-
1111
- function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
1112
-
1113
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
1114
-
1115
- function createHistory(state, ignoreInitialState) {
1116
- // ignoreInitialState essentially prevents the user from undoing to the
1117
- // beginning, in the case that the undoable reducer handles initialization
1118
- // in a way that can't be redone simply
1119
- var history = (0, helpers.newHistory)([], state, []);
1120
-
1121
- if (ignoreInitialState) {
1122
- history._latestUnfiltered = null;
1123
- }
1124
-
1125
- return history;
1126
- } // insert: insert `state` into history, which means adding the current state
1127
- // into `past`, setting the new `state` as `present` and erasing
1128
- // the `future`.
1129
-
1130
-
1131
- function insert(history, state, limit, group) {
1132
- var lengthWithoutFuture = history.past.length + 1;
1133
- debug$1.log('inserting', state);
1134
- debug$1.log('new free: ', limit - lengthWithoutFuture);
1135
- var past = history.past,
1136
- _latestUnfiltered = history._latestUnfiltered;
1137
- var isHistoryOverflow = limit && limit <= lengthWithoutFuture;
1138
- var pastSliced = past.slice(isHistoryOverflow ? 1 : 0);
1139
- var newPast = _latestUnfiltered != null ? [].concat(_toConsumableArray(pastSliced), [_latestUnfiltered]) : pastSliced;
1140
- return (0, helpers.newHistory)(newPast, state, [], group);
1141
- } // jumpToFuture: jump to requested index in future history
1142
-
1143
-
1144
- function jumpToFuture(history, index) {
1145
- if (index < 0 || index >= history.future.length) return history;
1146
- var past = history.past,
1147
- future = history.future,
1148
- _latestUnfiltered = history._latestUnfiltered;
1149
- var newPast = [].concat(_toConsumableArray(past), [_latestUnfiltered], _toConsumableArray(future.slice(0, index)));
1150
- var newPresent = future[index];
1151
- var newFuture = future.slice(index + 1);
1152
- return (0, helpers.newHistory)(newPast, newPresent, newFuture);
1153
- } // jumpToPast: jump to requested index in past history
1154
-
1155
-
1156
- function jumpToPast(history, index) {
1157
- if (index < 0 || index >= history.past.length) return history;
1158
- var past = history.past,
1159
- future = history.future,
1160
- _latestUnfiltered = history._latestUnfiltered;
1161
- var newPast = past.slice(0, index);
1162
- var newFuture = [].concat(_toConsumableArray(past.slice(index + 1)), [_latestUnfiltered], _toConsumableArray(future));
1163
- var newPresent = past[index];
1164
- return (0, helpers.newHistory)(newPast, newPresent, newFuture);
1165
- } // jump: jump n steps in the past or forward
1166
-
1167
-
1168
- function jump(history, n) {
1169
- if (n > 0) return jumpToFuture(history, n - 1);
1170
- if (n < 0) return jumpToPast(history, history.past.length + n);
1171
- return history;
1172
- } // helper to dynamically match in the reducer's switch-case
1173
-
1174
-
1175
- function actionTypeAmongClearHistoryType(actionType, clearHistoryType) {
1176
- return clearHistoryType.indexOf(actionType) > -1 ? actionType : !actionType;
1177
- } // redux-undo higher order reducer
1178
-
1179
-
1180
- function undoable(reducer) {
1181
- var rawConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1182
- debug$1.set(rawConfig.debug);
1183
-
1184
- var config = _objectSpread({
1185
- limit: undefined,
1186
- filter: function filter() {
1187
- return true;
1188
- },
1189
- groupBy: function groupBy() {
1190
- return null;
1191
- },
1192
- undoType: actions.ActionTypes.UNDO,
1193
- redoType: actions.ActionTypes.REDO,
1194
- jumpToPastType: actions.ActionTypes.JUMP_TO_PAST,
1195
- jumpToFutureType: actions.ActionTypes.JUMP_TO_FUTURE,
1196
- jumpType: actions.ActionTypes.JUMP,
1197
- neverSkipReducer: false,
1198
- ignoreInitialState: false,
1199
- syncFilter: false
1200
- }, rawConfig, {
1201
- initTypes: (0, helpers.parseActions)(rawConfig.initTypes, ['@@redux-undo/INIT']),
1202
- clearHistoryType: (0, helpers.parseActions)(rawConfig.clearHistoryType, [actions.ActionTypes.CLEAR_HISTORY])
1203
- }); // Allows the user to call the reducer with redux-undo specific actions
1204
-
1205
-
1206
- var skipReducer = config.neverSkipReducer ? function (res, action) {
1207
- for (var _len = arguments.length, slices = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
1208
- slices[_key - 2] = arguments[_key];
1209
- }
1210
-
1211
- return _objectSpread({}, res, {
1212
- present: reducer.apply(void 0, [res.present, action].concat(slices))
1213
- });
1214
- } : function (res) {
1215
- return res;
1216
- };
1217
- var initialState;
1218
- return function () {
1219
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
1220
- var action = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1221
- debug$1.start(action, state);
1222
- var history = state;
1223
-
1224
- for (var _len2 = arguments.length, slices = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
1225
- slices[_key2 - 2] = arguments[_key2];
1226
- }
1227
-
1228
- if (!initialState) {
1229
- debug$1.log('history is uninitialized');
1230
-
1231
- if (state === undefined) {
1232
- var createHistoryAction = {
1233
- type: '@@redux-undo/CREATE_HISTORY'
1234
- };
1235
- var start = reducer.apply(void 0, [state, createHistoryAction].concat(slices));
1236
- history = createHistory(start, config.ignoreInitialState);
1237
- debug$1.log('do not set initialState on probe actions');
1238
- debug$1.end(history);
1239
- return history;
1240
- } else if ((0, helpers.isHistory)(state)) {
1241
- history = initialState = config.ignoreInitialState ? state : (0, helpers.newHistory)(state.past, state.present, state.future);
1242
- debug$1.log('initialHistory initialized: initialState is a history', initialState);
1243
- } else {
1244
- history = initialState = createHistory(state, config.ignoreInitialState);
1245
- debug$1.log('initialHistory initialized: initialState is not a history', initialState);
1246
- }
1247
- }
1248
-
1249
- var res;
1250
-
1251
- switch (action.type) {
1252
- case undefined:
1253
- return history;
1254
-
1255
- case config.undoType:
1256
- res = jump(history, -1);
1257
- debug$1.log('perform undo');
1258
- debug$1.end(res);
1259
- return skipReducer.apply(void 0, [res, action].concat(slices));
1260
-
1261
- case config.redoType:
1262
- res = jump(history, 1);
1263
- debug$1.log('perform redo');
1264
- debug$1.end(res);
1265
- return skipReducer.apply(void 0, [res, action].concat(slices));
1266
-
1267
- case config.jumpToPastType:
1268
- res = jumpToPast(history, action.index);
1269
- debug$1.log("perform jumpToPast to ".concat(action.index));
1270
- debug$1.end(res);
1271
- return skipReducer.apply(void 0, [res, action].concat(slices));
1272
-
1273
- case config.jumpToFutureType:
1274
- res = jumpToFuture(history, action.index);
1275
- debug$1.log("perform jumpToFuture to ".concat(action.index));
1276
- debug$1.end(res);
1277
- return skipReducer.apply(void 0, [res, action].concat(slices));
1278
-
1279
- case config.jumpType:
1280
- res = jump(history, action.index);
1281
- debug$1.log("perform jump to ".concat(action.index));
1282
- debug$1.end(res);
1283
- return skipReducer.apply(void 0, [res, action].concat(slices));
1284
-
1285
- case actionTypeAmongClearHistoryType(action.type, config.clearHistoryType):
1286
- res = createHistory(history.present, config.ignoreInitialState);
1287
- debug$1.log('perform clearHistory');
1288
- debug$1.end(res);
1289
- return skipReducer.apply(void 0, [res, action].concat(slices));
1290
-
1291
- default:
1292
- res = reducer.apply(void 0, [history.present, action].concat(slices));
1293
-
1294
- if (config.initTypes.some(function (actionType) {
1295
- return actionType === action.type;
1296
- })) {
1297
- debug$1.log('reset history due to init action');
1298
- debug$1.end(initialState);
1299
- return initialState;
1300
- }
1301
-
1302
- if (history._latestUnfiltered === res) {
1303
- // Don't handle this action. Do not call debug.end here,
1304
- // because this action should not produce side effects to the console
1305
- return history;
1306
- }
1307
- /* eslint-disable-next-line no-case-declarations */
1308
-
1309
-
1310
- var filtered = typeof config.filter === 'function' && !config.filter(action, res, history);
1311
-
1312
- if (filtered) {
1313
- // if filtering an action, merely update the present
1314
- var filteredState = (0, helpers.newHistory)(history.past, res, history.future, history.group);
1315
-
1316
- if (!config.syncFilter) {
1317
- filteredState._latestUnfiltered = history._latestUnfiltered;
1318
- }
1319
-
1320
- debug$1.log('filter ignored action, not storing it in past');
1321
- debug$1.end(filteredState);
1322
- return filteredState;
1323
- }
1324
- /* eslint-disable-next-line no-case-declarations */
1325
-
1326
-
1327
- var group = config.groupBy(action, res, history);
1328
-
1329
- if (group != null && group === history.group) {
1330
- // if grouping with the previous action, only update the present
1331
- var groupedState = (0, helpers.newHistory)(history.past, res, history.future, history.group);
1332
- debug$1.log('groupBy grouped the action with the previous action');
1333
- debug$1.end(groupedState);
1334
- return groupedState;
1335
- } // If the action wasn't filtered or grouped, insert normally
1336
-
1337
-
1338
- history = insert(history, res, config.limit, group);
1339
- debug$1.log('inserted new state into history');
1340
- debug$1.end(history);
1341
- return history;
1342
- }
1343
- };
1344
- }
1345
- });
1346
-
1347
- const reducer$1 = /*@__PURE__*/getDefaultExportFromCjs(reducer);
1348
-
1349
- var lib = createCommonjsModule(function (module, exports) {
1350
- "use strict";
1351
-
1352
- Object.defineProperty(exports, "__esModule", {
1353
- value: true
1354
- });
1355
- Object.defineProperty(exports, "ActionTypes", {
1356
- enumerable: true,
1357
- get: function get() {
1358
- return actions.ActionTypes;
1359
- }
1360
- });
1361
- Object.defineProperty(exports, "ActionCreators", {
1362
- enumerable: true,
1363
- get: function get() {
1364
- return actions.ActionCreators;
1365
- }
1366
- });
1367
- Object.defineProperty(exports, "parseActions", {
1368
- enumerable: true,
1369
- get: function get() {
1370
- return helpers.parseActions;
1371
- }
1372
- });
1373
- Object.defineProperty(exports, "isHistory", {
1374
- enumerable: true,
1375
- get: function get() {
1376
- return helpers.isHistory;
1377
- }
1378
- });
1379
- Object.defineProperty(exports, "includeAction", {
1380
- enumerable: true,
1381
- get: function get() {
1382
- return helpers.includeAction;
1383
- }
1384
- });
1385
- Object.defineProperty(exports, "excludeAction", {
1386
- enumerable: true,
1387
- get: function get() {
1388
- return helpers.excludeAction;
1389
- }
1390
- });
1391
- Object.defineProperty(exports, "combineFilters", {
1392
- enumerable: true,
1393
- get: function get() {
1394
- return helpers.combineFilters;
1395
- }
1396
- });
1397
- Object.defineProperty(exports, "groupByActionTypes", {
1398
- enumerable: true,
1399
- get: function get() {
1400
- return helpers.groupByActionTypes;
1401
- }
1402
- });
1403
- Object.defineProperty(exports, "newHistory", {
1404
- enumerable: true,
1405
- get: function get() {
1406
- return helpers.newHistory;
1407
- }
1408
- });
1409
- Object.defineProperty(exports, "default", {
1410
- enumerable: true,
1411
- get: function get() {
1412
- return _reducer["default"];
1413
- }
1414
- });
1415
-
1416
-
1417
-
1418
-
1419
-
1420
- var _reducer = _interopRequireDefault(reducer);
1421
-
1422
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
1423
- });
1424
-
1425
- const undoable = /*@__PURE__*/getDefaultExportFromCjs(lib);
1426
-
1427
- const inicialState = {
1428
- currentTabIndex: {},
1429
- currentRecordIndex: {},
1430
- changes: {},
1431
- collapsedGroups: {},
1432
- newRecordIndex: {}
1433
- };
1434
- function formReducer(state = inicialState, action) {
1435
- switch (action.type) {
1436
- case 'FORM/COLLAPSEGROUP':
1437
- return collapseGroup(state, action.payload);
1438
- case 'FORM/CHANGETAB':
1439
- return changeTab(state, action.payload.formId, action.payload.index);
1440
- case 'FORM/NAVIGATE':
1441
- return navigate(state, action.payload);
1442
- case 'FORM/INSERT':
1443
- return insertRecord(state, action.payload);
1444
- case 'FORM/CHANGEFIELD':
1445
- return changeFieldValue(state, action.payload);
1446
- case 'FORM/CLEAREDITION':
1447
- return clearEdition(state, action.payload);
1448
- case 'FORM/INVALIDFIELD':
1449
- return navigateToInvalid(state, action.payload);
1450
- default:
1451
- return state;
1452
- }
1453
- }
1454
- function formNonHistoricReducer(state = { dataLoading: {}, invalidFields: {} }, action) {
1455
- switch (action.type) {
1456
- case 'FORM/DATALOADING':
1457
- return dataLoading(state, action.payload);
1458
- case 'FORM/DATALOADED':
1459
- return dataLoaded(state, action.payload);
1460
- case 'FORM/SAVINGCHANGES':
1461
- return savingChanges(state, action.payload);
1462
- case 'FORM/CHANGESSAVED':
1463
- return changesSaved(state, action.payload);
1464
- case 'FORM/REMOVINGRECORD':
1465
- return removingRecord(state, action.payload);
1466
- case 'FORM/RECORDREMOVED':
1467
- return recordRemoved(state, action.payload);
1468
- case 'FORM/INVALIDFIELD':
1469
- return invalidField(state, action.payload);
1470
- case 'FORM/CLEAREDITION':
1471
- return clearAllInvalidFields(state, action.payload);
1472
- case 'FORM/CHANGEFIELD':
1473
- return clearInvalidField(state, action.payload);
1474
- default:
1475
- return state;
1476
- }
1477
- }
1478
- function collapseGroup(state, { collapseId, collapsed }) {
1479
- const currentCollapsed = Object.assign({}, state.collapsedGroups);
1480
- if (collapsed) {
1481
- currentCollapsed[collapseId] = true;
1482
- }
1483
- else {
1484
- delete currentCollapsed[collapseId];
1485
- }
1486
- return Object.assign(Object.assign({}, state), { collapsedGroups: currentCollapsed });
1487
- }
1488
- function changeTab(state, formId, index) {
1489
- const currentTabIndex = Object.assign({}, state.currentTabIndex);
1490
- currentTabIndex[formId] = index;
1491
- return Object.assign(Object.assign({}, state), { currentTabIndex });
1492
- }
1493
- function navigate(state, { dataUnit, limit, backward }) {
1494
- const currentRecordIndex = Object.assign({}, state.currentRecordIndex);
1495
- const recIndex = currentRecordIndex[dataUnit] || 0;
1496
- return gotoIndex(state, dataUnit, backward ? Math.max(limit, recIndex - 1) : Math.min(limit, recIndex + 1));
1497
- }
1498
- function gotoIndex(state, dataUnit, index) {
1499
- const currentRecordIndex = Object.assign({}, state.currentRecordIndex);
1500
- currentRecordIndex[dataUnit] = index;
1501
- return Object.assign(Object.assign({}, state), { currentRecordIndex });
1502
- }
1503
- function insertRecord(state, { dataUnit, insertionIndex }) {
1504
- const currentRecordIndex = Object.assign({}, state.currentRecordIndex);
1505
- const newRecordIndex = Object.assign({}, state.newRecordIndex);
1506
- currentRecordIndex[dataUnit] = insertionIndex;
1507
- newRecordIndex[dataUnit] = (state.newRecordIndex[dataUnit] || 0) + 1;
1508
- return Object.assign(Object.assign({}, state), { currentRecordIndex,
1509
- newRecordIndex });
1510
- }
1511
- function changeFieldValue(state, { dataUnit, recordId, fieldName, value }) {
1512
- const changes = Object.assign({}, state.changes);
1513
- const dataUnitChanges = Object.assign({}, changes[dataUnit]);
1514
- const recordChanges = Object.assign({}, dataUnitChanges[recordId]);
1515
- recordChanges[fieldName] = value;
1516
- dataUnitChanges[recordId] = recordChanges;
1517
- changes[dataUnit] = dataUnitChanges;
1518
- const invalidFields = Object.assign({}, state.invalidFields);
1519
- const dataUnitInvalidRecords = Object.assign({}, invalidFields[dataUnit]);
1520
- const errorMessages = Object.assign({}, dataUnitInvalidRecords[recordId]);
1521
- delete errorMessages[fieldName];
1522
- dataUnitInvalidRecords[recordId] = errorMessages;
1523
- invalidFields[dataUnit] = dataUnitInvalidRecords;
1524
- return Object.assign(Object.assign({}, state), { changes,
1525
- invalidFields, invalidFieldSelected: undefined });
1526
- }
1527
- function clearEdition(state, { dataUnit, recordsLimit }) {
1528
- const changes = Object.assign({}, state.changes);
1529
- const newRecordIndex = Object.assign({}, state.newRecordIndex);
1530
- const currentRecordIndex = Object.assign({}, state.currentRecordIndex);
1531
- delete changes[dataUnit];
1532
- delete newRecordIndex[dataUnit];
1533
- const recIndex = currentRecordIndex[dataUnit] || 0;
1534
- currentRecordIndex[dataUnit] = Math.min(recordsLimit, recIndex);
1535
- return Object.assign(Object.assign({}, state), { changes,
1536
- newRecordIndex,
1537
- currentRecordIndex });
1538
- }
1539
- function navigateToInvalid(state, payload) {
1540
- let newState = Object.assign({}, state);
1541
- if (newState.invalidFieldSelected === undefined) {
1542
- newState.invalidFieldSelected = true;
1543
- newState = gotoIndex(newState, payload.dataUnit, payload.recordIndex);
1544
- newState = changeTab(newState, payload.tabController, payload.tabIndex);
1545
- }
1546
- return newState;
1547
- }
1548
- function dataLoading(state, { dataUnit }) {
1549
- const dataLoading = Object.assign({}, state.dataLoading);
1550
- dataLoading[dataUnit] = true;
1551
- return Object.assign(Object.assign({}, state), { dataLoading });
1552
- }
1553
- function dataLoaded(state, { dataUnit }) {
1554
- const dataLoading = Object.assign({}, state.dataLoading);
1555
- delete dataLoading[dataUnit];
1556
- return Object.assign(Object.assign({}, state), { dataLoading });
1557
- }
1558
- function savingChanges(state, { dataUnit }) {
1559
- const dataLoading = Object.assign({}, state.dataLoading);
1560
- dataLoading[dataUnit] = true;
1561
- return Object.assign(Object.assign({}, state), { dataLoading });
1562
- }
1563
- function changesSaved(state, { dataUnit }) {
1564
- const dataLoading = Object.assign({}, state.dataLoading);
1565
- delete dataLoading[dataUnit];
1566
- return Object.assign(Object.assign({}, state), { dataLoading });
1567
- }
1568
- function removingRecord(state, { dataUnit }) {
1569
- const dataLoading = Object.assign({}, state.dataLoading);
1570
- dataLoading[dataUnit] = true;
1571
- return Object.assign(Object.assign({}, state), { dataLoading });
1572
- }
1573
- function recordRemoved(state, { dataUnit }) {
1574
- const dataLoading = Object.assign({}, state.dataLoading);
1575
- delete dataLoading[dataUnit];
1576
- return Object.assign(Object.assign({}, state), { dataLoading });
1577
- }
1578
- function invalidField(state, { dataUnit, recordId, fieldName, errorMessage }) {
1579
- const invalidFields = Object.assign({}, state.invalidFields);
1580
- const dataUnitInvalidRecords = Object.assign({}, invalidFields[dataUnit]);
1581
- const errorMessages = Object.assign({}, dataUnitInvalidRecords[recordId]);
1582
- errorMessages[fieldName] = errorMessage;
1583
- dataUnitInvalidRecords[recordId] = errorMessages;
1584
- invalidFields[dataUnit] = dataUnitInvalidRecords;
1585
- return Object.assign(Object.assign({}, state), { invalidFields });
1586
- }
1587
- function clearAllInvalidFields(state, { dataUnit }) {
1588
- const invalidFields = Object.assign({}, state.invalidFields);
1589
- delete invalidFields[dataUnit];
1590
- return Object.assign(Object.assign({}, state), { invalidFields });
1591
- }
1592
- function clearInvalidField(state, { dataUnit, recordId, fieldName }) {
1593
- const invalidFields = Object.assign({}, state.invalidFields);
1594
- const dataUnitInvalidRecords = Object.assign({}, invalidFields[dataUnit]);
1595
- const errorMessages = Object.assign({}, dataUnitInvalidRecords[recordId]);
1596
- delete errorMessages[fieldName];
1597
- dataUnitInvalidRecords[recordId] = errorMessages;
1598
- invalidFields[dataUnit] = dataUnitInvalidRecords;
1599
- return Object.assign(Object.assign({}, state), { invalidFields });
1600
- }
1601
-
1602
- function removeHandler(dataUnit) {
1603
- if (confirm("Tem certeza que deseja Remover?")) {
1604
- dataUnit.remove();
1605
- }
1606
- }
1607
- const NavigationBar = ({ dataUnit: du }) => {
1608
- return h("div", { class: "col col--sd-12 align--right" },
1609
- du.cardinality !== '1' ? [
1610
- h("ez-button", { title: "Registro anterior", mode: "icon", enabled: du.hasPrevious(), onClick: () => du.previous(), image: "/themes/default/images/icons/actions-sprite.svg#previous-circle-inverted", class: "button--secondary margin-right--medium" }),
1611
- h("ez-button", { title: "Pr\u00F3ximo registro", mode: "icon", enabled: du.hasNext(), onClick: () => du.next(), image: "/themes/default/images/icons/actions-sprite.svg#next-circle-inverted", class: "button--secondary margin-right--medium" }),
1612
- h("ez-button", { title: "Incluir registro", mode: "icon", onClick: () => du.insert(), image: "/themes/default/images/icons/actions-sprite.svg#plus-circle-inverted", class: "button--secondary margin-right--medium" }),
1613
- h("ez-button", { title: "Remover registro", mode: "icon", enabled: du.hasCurrentRecord(), onClick: () => removeHandler(du), image: "/themes/default/images/icons/actions-sprite.svg#minus-circle-inverted", class: "button--secondary margin-right--medium" })
1614
- ] : null,
1615
- h("ez-button", { title: "Salvar altera\u00E7\u00F5es", mode: "icon", enabled: du.hasChanges(), onClick: () => du.save(), image: "/themes/default/images/icons/actions-sprite.svg#check-circle-inverted", class: "button--secondary margin-right--medium" }),
1616
- h("ez-button", { title: "Descartar altera\u00E7\u00F5es", mode: "icon", enabled: du.hasChanges(), onClick: () => du.cancel(), image: "/themes/default/images/icons/actions-sprite.svg#close-circle-inverted", class: "button--secondary margin-right--medium" }),
1617
- h("ez-button", { title: "Carregar registros", mode: "icon", onClick: () => du.load(), image: "/themes/default/images/icons/actions-sprite.svg#rotate", class: "button--secondary margin-right--medium" }));
1618
- };
1619
-
1620
- class Form {
1621
- }
1622
- class Field$1 {
1623
- }
1624
- class FieldSet$1 {
1625
- }
1626
- class UIProperty {
1627
- }
1628
- class FieldDependency {
1629
- }
1630
- var DependencyType;
1631
- (function (DependencyType) {
1632
- DependencyType["SEARCHING"] = "SEARCHING";
1633
- DependencyType["REQUIREMENT"] = "REQUIREMENT";
1634
- DependencyType["VISIBILITY"] = "REQUIREMENT";
1635
- })(DependencyType || (DependencyType = {}));
1636
-
1637
- function scrollToView(forceScroll, elem) {
1638
- if (forceScroll) {
1639
- window.requestAnimationFrame(() => elem.scrollIntoView());
1640
- }
1641
- }
1642
- const Field = ({ dataUnit, source, forceScroll }) => {
1643
- const { name, label, userInterface, properties, required, dependencies } = source;
1644
- const value = dataUnit.getValue(name) || null;
1645
- const loadingData = dataUnit.isLoading();
1646
- const formattedLabel = required ? `* ${label} (obrigatório)` : label;
1647
- const errorMessage = dataUnit.getErrorMessage(name);
1648
- const changeFieldHandler = (newValue) => {
1649
- dataUnit.changeValue(name, newValue);
1650
- };
1651
- switch (userInterface) {
1652
- case 'LONGTEXT':
1653
- return h("div", { class: "col col--sd-12 padding--small" },
1654
- h("ez-text-area", { label: formattedLabel, onInput: evt => changeFieldHandler(evt.target['value']), value: value || '', errormessage: errorMessage, ref: elem => scrollToView(forceScroll, elem) }));
1655
- case 'CHECKBOX':
1656
- return h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
1657
- h("ez-check", { onInput: evt => changeFieldHandler(evt.target['value']), ref: elem => scrollToView(forceScroll, elem) }));
1658
- case 'SWITCH':
1659
- return h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
1660
- h("div", { class: "row" },
1661
- h("div", { class: "col col--sd-2" },
1662
- h("ez-check", { mode: "switch", value: value === "S", ref: elem => scrollToView(forceScroll, elem) })),
1663
- h("div", { class: "col col--sd-10" },
1664
- h("label", { class: "text text--primary text--medium" }, label))));
1665
- case 'OPTIONSELECTOR':
1666
- const optsObj = JSON.parse(properties.find(prop => prop.name === 'options').value);
1667
- return h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
1668
- h("ez-combo-box", { value: value, label: formattedLabel, onEzChange: (event) => changeFieldHandler(event.target['value']), errormessage: errorMessage, ref: elem => scrollToView(forceScroll, elem) }, Object.keys(optsObj).map(key => h("option", { value: key }, optsObj[key]))));
1669
- case 'SEARCH':
1670
- const context = {};
1671
- properties.forEach(({ name, value }) => {
1672
- context[name] = value;
1673
- });
1674
- let criteriaList = [];
1675
- dependencies === null || dependencies === void 0 ? void 0 : dependencies.forEach(dependency => {
1676
- var _a;
1677
- if (dependency.type === DependencyType.SEARCHING) {
1678
- if (((_a = dependency.masterFields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1679
- let criteria = {
1680
- expression: dependency.expression,
1681
- paramNames: [...dependency.masterFields],
1682
- paramResolver: name => dataUnit.getValue(name)
1683
- };
1684
- criteriaList.push(criteria);
1685
- }
1686
- }
1687
- });
1688
- if (criteriaList.length > 0) {
1689
- context['CRITERIA'] = criteriaList;
1690
- }
1691
- return h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
1692
- h("ez-search", { label: label, onEzChange: (event) => changeFieldHandler(event.target['value']), showvalue: true, value: value, loadexecutor: (argument, callback) => dataUnit.fieldSearchExecutor(argument, context, callback) }));
1693
- case 'DATE':
1694
- return h("div", { class: "col col--sd-12 col--tb-3 padding--small" },
1695
- h("ez-date-input", { label: formattedLabel, enabled: true, value: !value ? null : DateUtils.clearTime(value), onEzChange: (event) => changeFieldHandler(event.target['value']), errormessage: errorMessage, ref: elem => scrollToView(forceScroll, elem) }));
1696
- //IMAGE, FILE, DATE, DATETIME, ELAPSEDTIME, DECIMALNUMBER, INTEGERNUMBER, PASSWORD, MASKEDTEXT, HTML
1697
- default:
1698
- return h("div", { class: "col col--sd-12 col--tb-3 padding--small" }, loadingData
1699
- ?
1700
- h("place-holder", null)
1701
- :
1702
- h("ez-text-input", { loading: loadingData, label: formattedLabel, onInput: (event) => changeFieldHandler(event.target['value']), value: value, errormessage: errorMessage, ref: elem => scrollToView(forceScroll, elem) }));
1703
- }
1704
- };
1705
-
1706
- const FieldSet = ({ store, formName, source, dataUnit }) => {
1707
- const { label, fields } = source;
1708
- const fieldSetName = formName + label;
1709
- let isCollapsed = selectIsCollapsedFieldSet(store.getState(), formName + label);
1710
- let fieldToScroll;
1711
- source.fields.forEach((field) => {
1712
- if (fieldToScroll === undefined) {
1713
- const fieldError = dataUnit.getErrorMessage(field.name);
1714
- if (fieldError !== undefined && fieldError !== null && fieldError !== "") {
1715
- fieldToScroll = field.name;
1716
- }
1717
- }
1718
- });
1719
- if (fieldToScroll) {
1720
- isCollapsed = false;
1721
- }
1722
- return h("div", { class: "col col--sd-12 padding--small" },
1723
- h("div", { class: "row margin-top--large" },
1724
- h("div", { class: "col col--sd-12 align--middle padding-horizontal--medium" },
1725
- h("ez-collapsable-box", { value: isCollapsed, label: label, onEzChange: () => store.dispatch(collapseExpandGroup(fieldSetName, !isCollapsed)) }),
1726
- isCollapsed ? null :
1727
- h("div", { class: "col col--sd-12" }, fields.map(field => h(Field, { source: field, dataUnit: dataUnit, forceScroll: fieldToScroll === field.name }))))));
1728
- };
1729
-
1730
- function buildFormItem(source, formName, store, dataUnit) {
1731
- if ("fields" in source) {
1732
- return h(FieldSet, { source: source, store: store, formName: formName, dataUnit: dataUnit });
1733
- }
1734
- const errorMsg = dataUnit.getErrorMessage(source.name);
1735
- const forceScroll = errorMsg === undefined || errorMsg === null || errorMsg === "" ? false : true;
1736
- return h(Field, { source: source, dataUnit: dataUnit, forceScroll: forceScroll });
1737
- }
1738
- const FormSheet = ({ store, parentName, source, parentDataUnit, dataUnitBuilder }) => {
1739
- const selectedTab = selectCurrentTab(store.getState(), parentName);
1740
- const tabs = source.length > 1 ? source.map(form => h("ez-tab", { label: form.label, tabKey: form.name })) : null;
1741
- const { subForms, items, name } = source[selectedTab];
1742
- const dataUnit = dataUnitBuilder(source[selectedTab].dataUnit);
1743
- source[selectedTab].dataUnit = dataUnit;
1744
- const hasSubForms = subForms && subForms.length > 0;
1745
- const changeTabHandler = (index) => {
1746
- store.dispatch(changeTab$1(parentName, index));
1747
- };
1748
- //todos os campos e subformulários precisam estar ligados a um DU
1749
- const currentDU = dataUnit || parentDataUnit;
1750
- return h("div", { class: "form-sheet" },
1751
- tabs ? h("ez-tabselector", { selectedindex: selectedTab, selectedtab: name, onChange: (evt) => changeTabHandler(evt.target.selectedindex) }, tabs) : null,
1752
- dataUnit ? h(NavigationBar, { dataUnit: dataUnit }) : null,
1753
- h("div", { class: "tab__container" },
1754
- items ? items.map(item => buildFormItem(item, name, store, currentDU)) : null,
1755
- hasSubForms ? h(FormSheet, { store: store, source: subForms, parentName: name, parentDataUnit: currentDU, dataUnitBuilder: dataUnitBuilder }) : null));
1756
- };
1757
-
1758
- const ezFormCss = "ez-form{display:flex;flex-direction:column;width:100%}.form-sheet{display:flex;width:100%;flex-wrap:wrap;position:relative}.tab__container{display:flex;width:100%;flex-wrap:wrap;position:relative}";
1759
-
1760
- const EzForm = class {
1761
- constructor(hostRef) {
1762
- registerInstance(this, hostRef);
1763
- this._requiredFieldsByDU = {};
1764
- }
1765
- validateRecords(dataUnit, records) {
1766
- const result = { isValid: true, message: '' };
1767
- const reqFields = this._requiredFieldsByDU[dataUnit.name];
1768
- records.forEach(record => {
1769
- reqFields.forEach(field => {
1770
- const recordIndex = record["record__index"];
1771
- const fieldName = field.name;
1772
- const fieldValue = record[fieldName];
1773
- if (fieldValue === null || fieldValue === undefined || fieldValue === '') {
1774
- this._store.dispatch(invalidField$1(field.tabControler, field.tabIndex, dataUnit.name, recordIndex, record.record__id, field.name, "Essa informação é obrigatória"));
1775
- result.isValid = false;
1776
- }
1777
- });
1778
- });
1779
- if (!result.isValid) {
1780
- result.message = "Há pelo menos um campo obrigatório não preenchido.";
1781
- }
1782
- return result;
1783
- }
1784
- componentWillRender() {
1785
- if (this._store === undefined) {
1786
- const rootReducer = combineReducers({
1787
- "hist": undoable(formReducer),
1788
- "nonhist": formNonHistoricReducer
1789
- });
1790
- this._store = createStore(rootReducer, applyMiddleware(thunk));
1791
- this._store.subscribe(() => { forceUpdate(this); });
1792
- }
1793
- }
1794
- loadMDFromExecutor(callBack) {
1795
- if (this._loadMetadataFunction) {
1796
- const result = this._loadMetadataFunction();
1797
- if (result) {
1798
- if (result instanceof Promise) {
1799
- result.then(md => {
1800
- callBack(md);
1801
- });
1802
- }
1803
- else {
1804
- callBack(result);
1805
- }
1806
- }
1807
- }
1808
- }
1809
- loadMDFromElement(callBack) {
1810
- const metadata = [];
1811
- Array.from(this._host.children).forEach(elem => {
1812
- if (elem.tagName === "FORM-METADATA") {
1813
- const formMetadata = elem;
1814
- metadata.push(formMetadata.metadata);
1815
- }
1816
- });
1817
- callBack(metadata.length > 0 ? metadata : null);
1818
- }
1819
- updateMetadata(metadata) {
1820
- if (metadata) {
1821
- const processFields = (duName, form, tabController, tabIndex) => {
1822
- var _a;
1823
- let requiredFields = this._requiredFieldsByDU[duName];
1824
- if (requiredFields === undefined) {
1825
- requiredFields = [];
1826
- this._requiredFieldsByDU[duName] = requiredFields;
1827
- }
1828
- form.items.forEach(item => {
1829
- if ("fields" in item) {
1830
- const fSet = item;
1831
- fSet.fields.forEach(f => {
1832
- f.tabControler = tabController;
1833
- f.tabIndex = tabIndex;
1834
- if (f.required) {
1835
- requiredFields.push(f);
1836
- }
1837
- });
1838
- }
1839
- else {
1840
- const f = item;
1841
- f.tabControler = tabController;
1842
- f.tabIndex = tabIndex;
1843
- if (f.required) {
1844
- requiredFields.push(f);
1845
- }
1846
- }
1847
- });
1848
- (_a = form.subForms) === null || _a === void 0 ? void 0 : _a.forEach((subForm, index) => {
1849
- const subDU = subForm.dataUnit ? subForm.dataUnit.name : duName;
1850
- processFields(subDU, subForm, form.name, index);
1851
- });
1852
- };
1853
- this.metadata = metadata;
1854
- metadata.map((form, index) => {
1855
- processFields(form.dataUnit.name, form, "__MAIN__FORM__", index);
1856
- });
1857
- this._store.dispatch(formLoad());
1858
- }
1859
- }
1860
- parseExecutor(executor) {
1861
- if (executor) {
1862
- return executor instanceof Function ? executor : eval(executor);
1863
- }
1864
- return null;
1865
- }
1866
- componentDidLoad() {
1867
- this._loadMetadataFunction = this.parseExecutor(this.metadataexecutor);
1868
- this._loadDataFunction = this.parseExecutor(this.loadexecutor);
1869
- this._saveFunction = this.parseExecutor(this.saveexecutor);
1870
- this._removeFunction = this.parseExecutor(this.removeexecutor);
1871
- this._fieldSearchFunction = this.parseExecutor(this.fieldsearchexecutor);
1872
- if (this.metadata) {
1873
- this.updateMetadata(this.metadata);
1874
- }
1875
- else {
1876
- this.loadMDFromElement((md) => this.updateMetadata(md));
1877
- if (!this.metadata) {
1878
- this.loadMDFromExecutor((md) => this.updateMetadata(md));
1879
- }
1880
- }
1881
- }
1882
- buildDataUnit(dataUnit) {
1883
- if (dataUnit) {
1884
- const { name, records, cardinality } = dataUnit;
1885
- if (!(dataUnit instanceof DataUnit)) {
1886
- dataUnit = new DataUnit(name, cardinality);
1887
- if (records) {
1888
- dataUnit.records = records;
1889
- }
1890
- dataUnit.store = this._store;
1891
- dataUnit.loadExecutor = this._loadDataFunction;
1892
- dataUnit.saveExecutor = this._saveFunction;
1893
- dataUnit.removeExecutor = this._removeFunction;
1894
- dataUnit.recordsValidator = this;
1895
- dataUnit.fieldSearchExecutor = this._fieldSearchFunction;
1896
- }
1897
- }
1898
- return dataUnit;
1899
- }
1900
- render() {
1901
- return this.metadata ? h(FormSheet, { store: this._store, source: this.metadata, parentName: "__MAIN__FORM__", dataUnitBuilder: (du) => this.buildDataUnit(du) }) : null;
1902
- }
1903
- get _host() { return getElement(this); }
1904
- };
1905
- EzForm.style = ezFormCss;
1906
-
1907
- export { EzForm as ez_form };