@sankhyalabs/sankhyablocks 1.1.25 → 1.1.27
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.
- package/dist/cjs/{AssetsUtils-7e3c38f9.js → AssetsUtils-bd004f63.js} +1 -1
- package/dist/cjs/_commonjsHelpers-537d719a.js +20 -0
- package/dist/cjs/ez-action-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-application.cjs.entry.js +1 -1
- package/dist/cjs/ez-button_4.cjs.entry.js +1 -1
- package/dist/cjs/ez-calendar.cjs.entry.js +1 -1
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
- package/dist/cjs/ez-combo-box.cjs.entry.js +1 -1
- package/dist/cjs/ez-date-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-date-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ez-form.cjs.entry.js +325 -3
- package/dist/cjs/ez-grid.cjs.entry.js +109843 -5
- package/dist/cjs/ez-icon.cjs.entry.js +1 -1
- package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal_2.cjs.entry.js +2 -2
- package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-popover.cjs.entry.js +1 -1
- package/dist/cjs/ez-popup.cjs.entry.js +1 -1
- package/dist/cjs/ez-search.cjs.entry.js +1 -1
- package/dist/cjs/ez-tabselector.cjs.entry.js +1 -1
- package/dist/cjs/ez-text-area.cjs.entry.js +1 -1
- package/dist/cjs/ez-text-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-time-input.cjs.entry.js +2 -2
- package/dist/cjs/ez-toast.cjs.entry.js +1 -1
- package/dist/cjs/ez-upload.cjs.entry.js +1 -1
- package/dist/cjs/{index-682c98b2.js → index-6ac5268e.js} +7 -9
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +47 -345
- package/dist/cjs/test-du.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/components/_commonjsHelpers.js +17 -0
- package/dist/components/ez-form2.js +323 -1
- package/dist/components/ez-grid.js +109844 -6
- package/dist/components/snk-application.js +8 -306
- package/dist/esm/{AssetsUtils-6e6624dc.js → AssetsUtils-98074c9c.js} +1 -1
- package/dist/esm/_commonjsHelpers-9943807e.js +17 -0
- package/dist/esm/ez-action-chip.entry.js +1 -1
- package/dist/esm/ez-application.entry.js +1 -1
- package/dist/esm/ez-button_4.entry.js +1 -1
- package/dist/esm/ez-calendar.entry.js +1 -1
- package/dist/esm/ez-collapsible-box.entry.js +1 -1
- package/dist/esm/ez-combo-box.entry.js +1 -1
- package/dist/esm/ez-date-input.entry.js +1 -1
- package/dist/esm/ez-date-time-input.entry.js +1 -1
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/ez-form.entry.js +324 -2
- package/dist/esm/ez-grid.entry.js +109843 -5
- package/dist/esm/ez-icon.entry.js +1 -1
- package/dist/esm/ez-label-chip.entry.js +1 -1
- package/dist/esm/ez-modal_2.entry.js +2 -2
- package/dist/esm/ez-number-input.entry.js +1 -1
- package/dist/esm/ez-popover.entry.js +1 -1
- package/dist/esm/ez-popup.entry.js +1 -1
- package/dist/esm/ez-search.entry.js +1 -1
- package/dist/esm/ez-tabselector.entry.js +1 -1
- package/dist/esm/ez-text-area.entry.js +1 -1
- package/dist/esm/ez-text-input.entry.js +1 -1
- package/dist/esm/ez-time-input.entry.js +2 -2
- package/dist/esm/ez-toast.entry.js +1 -1
- package/dist/esm/ez-upload.entry.js +1 -1
- package/dist/esm/{index-35088a3f.js → index-df166135.js} +7 -9
- package/dist/esm/loader.js +2 -2
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-application.entry.js +9 -307
- package/dist/esm/test-du.entry.js +1 -1
- package/dist/sankhyablocks/{p-9750632b.entry.js → p-08e1cded.entry.js} +1 -1
- package/dist/sankhyablocks/p-0a77ac95.entry.js +57 -0
- package/dist/sankhyablocks/p-112455b1.js +1 -0
- package/dist/sankhyablocks/p-126c4aaa.entry.js +1 -0
- package/dist/sankhyablocks/{p-f6db07fb.entry.js → p-1421b89a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-8b543003.entry.js → p-1beadcaf.entry.js} +1 -1
- package/dist/sankhyablocks/{p-89a1100f.entry.js → p-1c423f5d.entry.js} +1 -1
- package/dist/sankhyablocks/{p-0183d259.entry.js → p-28a0dbf0.entry.js} +1 -1
- package/dist/sankhyablocks/p-4763d5c2.js +1 -0
- package/dist/sankhyablocks/{p-ba64cc41.entry.js → p-4c66200a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-ac8842e5.entry.js → p-5dc772be.entry.js} +1 -1
- package/dist/sankhyablocks/p-5ff3e300.entry.js +1 -0
- package/dist/sankhyablocks/{p-710bfffe.entry.js → p-7122cec4.entry.js} +1 -1
- package/dist/sankhyablocks/{p-5f9af495.entry.js → p-9b33a005.entry.js} +1 -1
- package/dist/sankhyablocks/{p-01f23a70.entry.js → p-9e22ec87.entry.js} +1 -1
- package/dist/sankhyablocks/{p-105724a3.entry.js → p-9f7239df.entry.js} +1 -1
- package/dist/sankhyablocks/p-9f7e6e48.js +1 -0
- package/dist/sankhyablocks/{p-ef04b633.entry.js → p-a47e0537.entry.js} +1 -1
- package/dist/sankhyablocks/{p-c1ede043.entry.js → p-a9aba60a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-3f6aa9a7.entry.js → p-afda7940.entry.js} +1 -1
- package/dist/sankhyablocks/{p-07c32f68.entry.js → p-b3a83eaf.entry.js} +1 -1
- package/dist/sankhyablocks/{p-e5355a29.entry.js → p-b96a8d40.entry.js} +1 -1
- package/dist/sankhyablocks/{p-70ad6c16.entry.js → p-c61c0e40.entry.js} +1 -1
- package/dist/sankhyablocks/{p-35364a97.entry.js → p-ca29d028.entry.js} +1 -1
- package/dist/sankhyablocks/{p-fcd9bd92.entry.js → p-cd17abb1.entry.js} +1 -1
- package/dist/sankhyablocks/p-d3a5366d.entry.js +369 -0
- package/dist/sankhyablocks/{p-a96272f7.entry.js → p-d5703a41.entry.js} +1 -1
- package/dist/sankhyablocks/{p-2ac02d48.entry.js → p-e5f77a59.entry.js} +1 -1
- package/dist/sankhyablocks/{p-d90ebb85.entry.js → p-e9e94d51.entry.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components.d.ts +2 -6
- package/package.json +10 -7
- package/dist/sankhyablocks/p-0f90499d.entry.js +0 -1
- package/dist/sankhyablocks/p-60967cf0.js +0 -1
- package/dist/sankhyablocks/p-6ce33b60.entry.js +0 -57
- package/dist/sankhyablocks/p-735440c1.entry.js +0 -1
- package/dist/sankhyablocks/p-85a9446b.js +0 -2
- package/dist/sankhyablocks/p-e17dfaae.entry.js +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2
|
+
|
|
3
|
+
function createCommonjsModule(fn, basedir, module) {
|
|
4
|
+
return module = {
|
|
5
|
+
path: basedir,
|
|
6
|
+
exports: {},
|
|
7
|
+
require: function (path, base) {
|
|
8
|
+
return commonjsRequire();
|
|
9
|
+
}
|
|
10
|
+
}, fn(module, module.exports), module.exports;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function commonjsRequire () {
|
|
14
|
+
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { commonjsGlobal as a, createCommonjsModule as c };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { h, proxyCustomElement, HTMLElement, forceUpdate, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { UserInterface, ApplicationContext, Action, DataUnitAction, DataUnit } from '@sankhyalabs/core';
|
|
3
|
-
import { createStore } from 'redux';
|
|
4
3
|
import { A as ApplicationUtils } from './ApplicationUtils.js';
|
|
5
4
|
import { d as defineCustomElement$1 } from './ez-tabselector2.js';
|
|
6
5
|
|
|
@@ -234,6 +233,329 @@ const buildFromConfig = (fields, dataUnit) => {
|
|
|
234
233
|
return metadata;
|
|
235
234
|
};
|
|
236
235
|
|
|
236
|
+
/**
|
|
237
|
+
* Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
|
|
238
|
+
*
|
|
239
|
+
* Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes
|
|
240
|
+
* during build.
|
|
241
|
+
* @param {number} code
|
|
242
|
+
*/
|
|
243
|
+
function formatProdErrorMessage(code) {
|
|
244
|
+
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. ';
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Inlined version of the `symbol-observable` polyfill
|
|
248
|
+
var $$observable = (function () {
|
|
249
|
+
return typeof Symbol === 'function' && Symbol.observable || '@@observable';
|
|
250
|
+
})();
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* These are private action types reserved by Redux.
|
|
254
|
+
* For any unknown actions, you must return the current state.
|
|
255
|
+
* If the current state is undefined, you must return the initial state.
|
|
256
|
+
* Do not reference these action types directly in your code.
|
|
257
|
+
*/
|
|
258
|
+
var randomString = function randomString() {
|
|
259
|
+
return Math.random().toString(36).substring(7).split('').join('.');
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
var ActionTypes = {
|
|
263
|
+
INIT: "@@redux/INIT" + randomString(),
|
|
264
|
+
REPLACE: "@@redux/REPLACE" + randomString(),
|
|
265
|
+
PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
|
266
|
+
return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* @param {any} obj The object to inspect.
|
|
272
|
+
* @returns {boolean} True if the argument appears to be a plain object.
|
|
273
|
+
*/
|
|
274
|
+
function isPlainObject(obj) {
|
|
275
|
+
if (typeof obj !== 'object' || obj === null) return false;
|
|
276
|
+
var proto = obj;
|
|
277
|
+
|
|
278
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
279
|
+
proto = Object.getPrototypeOf(proto);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return Object.getPrototypeOf(obj) === proto;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* @deprecated
|
|
287
|
+
*
|
|
288
|
+
* **We recommend using the `configureStore` method
|
|
289
|
+
* of the `@reduxjs/toolkit` package**, which replaces `createStore`.
|
|
290
|
+
*
|
|
291
|
+
* Redux Toolkit is our recommended approach for writing Redux logic today,
|
|
292
|
+
* including store setup, reducers, data fetching, and more.
|
|
293
|
+
*
|
|
294
|
+
* **For more details, please read this Redux docs page:**
|
|
295
|
+
* **https://redux.js.org/introduction/why-rtk-is-redux-today**
|
|
296
|
+
*
|
|
297
|
+
* `configureStore` from Redux Toolkit is an improved version of `createStore` that
|
|
298
|
+
* simplifies setup and helps avoid common bugs.
|
|
299
|
+
*
|
|
300
|
+
* You should not be using the `redux` core package by itself today, except for learning purposes.
|
|
301
|
+
* The `createStore` method from the core `redux` package will not be removed, but we encourage
|
|
302
|
+
* all users to migrate to using Redux Toolkit for all Redux code.
|
|
303
|
+
*
|
|
304
|
+
* If you want to use `createStore` without this visual deprecation warning, use
|
|
305
|
+
* the `legacy_createStore` import instead:
|
|
306
|
+
*
|
|
307
|
+
* `import { legacy_createStore as createStore} from 'redux'`
|
|
308
|
+
*
|
|
309
|
+
*/
|
|
310
|
+
|
|
311
|
+
function createStore(reducer, preloadedState, enhancer) {
|
|
312
|
+
var _ref2;
|
|
313
|
+
|
|
314
|
+
if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
|
|
315
|
+
throw new Error(formatProdErrorMessage(0) );
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
|
|
319
|
+
enhancer = preloadedState;
|
|
320
|
+
preloadedState = undefined;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (typeof enhancer !== 'undefined') {
|
|
324
|
+
if (typeof enhancer !== 'function') {
|
|
325
|
+
throw new Error(formatProdErrorMessage(1) );
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
return enhancer(createStore)(reducer, preloadedState);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (typeof reducer !== 'function') {
|
|
332
|
+
throw new Error(formatProdErrorMessage(2) );
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
var currentReducer = reducer;
|
|
336
|
+
var currentState = preloadedState;
|
|
337
|
+
var currentListeners = [];
|
|
338
|
+
var nextListeners = currentListeners;
|
|
339
|
+
var isDispatching = false;
|
|
340
|
+
/**
|
|
341
|
+
* This makes a shallow copy of currentListeners so we can use
|
|
342
|
+
* nextListeners as a temporary list while dispatching.
|
|
343
|
+
*
|
|
344
|
+
* This prevents any bugs around consumers calling
|
|
345
|
+
* subscribe/unsubscribe in the middle of a dispatch.
|
|
346
|
+
*/
|
|
347
|
+
|
|
348
|
+
function ensureCanMutateNextListeners() {
|
|
349
|
+
if (nextListeners === currentListeners) {
|
|
350
|
+
nextListeners = currentListeners.slice();
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Reads the state tree managed by the store.
|
|
355
|
+
*
|
|
356
|
+
* @returns {any} The current state tree of your application.
|
|
357
|
+
*/
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
function getState() {
|
|
361
|
+
if (isDispatching) {
|
|
362
|
+
throw new Error(formatProdErrorMessage(3) );
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
return currentState;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Adds a change listener. It will be called any time an action is dispatched,
|
|
369
|
+
* and some part of the state tree may potentially have changed. You may then
|
|
370
|
+
* call `getState()` to read the current state tree inside the callback.
|
|
371
|
+
*
|
|
372
|
+
* You may call `dispatch()` from a change listener, with the following
|
|
373
|
+
* caveats:
|
|
374
|
+
*
|
|
375
|
+
* 1. The subscriptions are snapshotted just before every `dispatch()` call.
|
|
376
|
+
* If you subscribe or unsubscribe while the listeners are being invoked, this
|
|
377
|
+
* will not have any effect on the `dispatch()` that is currently in progress.
|
|
378
|
+
* However, the next `dispatch()` call, whether nested or not, will use a more
|
|
379
|
+
* recent snapshot of the subscription list.
|
|
380
|
+
*
|
|
381
|
+
* 2. The listener should not expect to see all state changes, as the state
|
|
382
|
+
* might have been updated multiple times during a nested `dispatch()` before
|
|
383
|
+
* the listener is called. It is, however, guaranteed that all subscribers
|
|
384
|
+
* registered before the `dispatch()` started will be called with the latest
|
|
385
|
+
* state by the time it exits.
|
|
386
|
+
*
|
|
387
|
+
* @param {Function} listener A callback to be invoked on every dispatch.
|
|
388
|
+
* @returns {Function} A function to remove this change listener.
|
|
389
|
+
*/
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
function subscribe(listener) {
|
|
393
|
+
if (typeof listener !== 'function') {
|
|
394
|
+
throw new Error(formatProdErrorMessage(4) );
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
if (isDispatching) {
|
|
398
|
+
throw new Error(formatProdErrorMessage(5) );
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
var isSubscribed = true;
|
|
402
|
+
ensureCanMutateNextListeners();
|
|
403
|
+
nextListeners.push(listener);
|
|
404
|
+
return function unsubscribe() {
|
|
405
|
+
if (!isSubscribed) {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
if (isDispatching) {
|
|
410
|
+
throw new Error(formatProdErrorMessage(6) );
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
isSubscribed = false;
|
|
414
|
+
ensureCanMutateNextListeners();
|
|
415
|
+
var index = nextListeners.indexOf(listener);
|
|
416
|
+
nextListeners.splice(index, 1);
|
|
417
|
+
currentListeners = null;
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Dispatches an action. It is the only way to trigger a state change.
|
|
422
|
+
*
|
|
423
|
+
* The `reducer` function, used to create the store, will be called with the
|
|
424
|
+
* current state tree and the given `action`. Its return value will
|
|
425
|
+
* be considered the **next** state of the tree, and the change listeners
|
|
426
|
+
* will be notified.
|
|
427
|
+
*
|
|
428
|
+
* The base implementation only supports plain object actions. If you want to
|
|
429
|
+
* dispatch a Promise, an Observable, a thunk, or something else, you need to
|
|
430
|
+
* wrap your store creating function into the corresponding middleware. For
|
|
431
|
+
* example, see the documentation for the `redux-thunk` package. Even the
|
|
432
|
+
* middleware will eventually dispatch plain object actions using this method.
|
|
433
|
+
*
|
|
434
|
+
* @param {Object} action A plain object representing “what changed”. It is
|
|
435
|
+
* a good idea to keep actions serializable so you can record and replay user
|
|
436
|
+
* sessions, or use the time travelling `redux-devtools`. An action must have
|
|
437
|
+
* a `type` property which may not be `undefined`. It is a good idea to use
|
|
438
|
+
* string constants for action types.
|
|
439
|
+
*
|
|
440
|
+
* @returns {Object} For convenience, the same action object you dispatched.
|
|
441
|
+
*
|
|
442
|
+
* Note that, if you use a custom middleware, it may wrap `dispatch()` to
|
|
443
|
+
* return something else (for example, a Promise you can await).
|
|
444
|
+
*/
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
function dispatch(action) {
|
|
448
|
+
if (!isPlainObject(action)) {
|
|
449
|
+
throw new Error(formatProdErrorMessage(7) );
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
if (typeof action.type === 'undefined') {
|
|
453
|
+
throw new Error(formatProdErrorMessage(8) );
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
if (isDispatching) {
|
|
457
|
+
throw new Error(formatProdErrorMessage(9) );
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
try {
|
|
461
|
+
isDispatching = true;
|
|
462
|
+
currentState = currentReducer(currentState, action);
|
|
463
|
+
} finally {
|
|
464
|
+
isDispatching = false;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
var listeners = currentListeners = nextListeners;
|
|
468
|
+
|
|
469
|
+
for (var i = 0; i < listeners.length; i++) {
|
|
470
|
+
var listener = listeners[i];
|
|
471
|
+
listener();
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
return action;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Replaces the reducer currently used by the store to calculate the state.
|
|
478
|
+
*
|
|
479
|
+
* You might need this if your app implements code splitting and you want to
|
|
480
|
+
* load some of the reducers dynamically. You might also need this if you
|
|
481
|
+
* implement a hot reloading mechanism for Redux.
|
|
482
|
+
*
|
|
483
|
+
* @param {Function} nextReducer The reducer for the store to use instead.
|
|
484
|
+
* @returns {void}
|
|
485
|
+
*/
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
function replaceReducer(nextReducer) {
|
|
489
|
+
if (typeof nextReducer !== 'function') {
|
|
490
|
+
throw new Error(formatProdErrorMessage(10) );
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.
|
|
494
|
+
// Any reducers that existed in both the new and old rootReducer
|
|
495
|
+
// will receive the previous state. This effectively populates
|
|
496
|
+
// the new state tree with any relevant data from the old one.
|
|
497
|
+
|
|
498
|
+
dispatch({
|
|
499
|
+
type: ActionTypes.REPLACE
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Interoperability point for observable/reactive libraries.
|
|
504
|
+
* @returns {observable} A minimal observable of state changes.
|
|
505
|
+
* For more information, see the observable proposal:
|
|
506
|
+
* https://github.com/tc39/proposal-observable
|
|
507
|
+
*/
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
function observable() {
|
|
511
|
+
var _ref;
|
|
512
|
+
|
|
513
|
+
var outerSubscribe = subscribe;
|
|
514
|
+
return _ref = {
|
|
515
|
+
/**
|
|
516
|
+
* The minimal observable subscription method.
|
|
517
|
+
* @param {Object} observer Any object that can be used as an observer.
|
|
518
|
+
* The observer object should have a `next` method.
|
|
519
|
+
* @returns {subscription} An object with an `unsubscribe` method that can
|
|
520
|
+
* be used to unsubscribe the observable from the store, and prevent further
|
|
521
|
+
* emission of values from the observable.
|
|
522
|
+
*/
|
|
523
|
+
subscribe: function subscribe(observer) {
|
|
524
|
+
if (typeof observer !== 'object' || observer === null) {
|
|
525
|
+
throw new Error(formatProdErrorMessage(11) );
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
function observeState() {
|
|
529
|
+
if (observer.next) {
|
|
530
|
+
observer.next(getState());
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
observeState();
|
|
535
|
+
var unsubscribe = outerSubscribe(observeState);
|
|
536
|
+
return {
|
|
537
|
+
unsubscribe: unsubscribe
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
}, _ref[$$observable] = function () {
|
|
541
|
+
return this;
|
|
542
|
+
}, _ref;
|
|
543
|
+
} // When a store is created, an "INIT" action is dispatched so that every
|
|
544
|
+
// reducer returns their initial state. This effectively populates
|
|
545
|
+
// the initial state tree.
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
dispatch({
|
|
549
|
+
type: ActionTypes.INIT
|
|
550
|
+
});
|
|
551
|
+
return _ref2 = {
|
|
552
|
+
dispatch: dispatch,
|
|
553
|
+
subscribe: subscribe,
|
|
554
|
+
getState: getState,
|
|
555
|
+
replaceReducer: replaceReducer
|
|
556
|
+
}, _ref2[$$observable] = observable, _ref2;
|
|
557
|
+
}
|
|
558
|
+
|
|
237
559
|
const inicialState = {};
|
|
238
560
|
/////////////////////////////// REDUCERS ///////////////////////////////
|
|
239
561
|
function formReducer(state = inicialState, action) {
|