@ui-schema/react
Version:
Schema-driven UI generator for React using JSON Schema. Build powerful form and interface generators with headless components and hooks.
36 lines (35 loc) • 1.91 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.scopeUpdaterInternals2 = exports.scopeUpdaterInternals = void 0;
var _UIStore = require("@ui-schema/react/UIStore");
var _storeScopeUpdater = require("@ui-schema/react/storeScopeUpdater");
var _storeBuildScopeTree = require("@ui-schema/react/storeBuildScopeTree");
var _immutable = require("immutable");
var scopeUpdaterInternals = exports.scopeUpdaterInternals = function scopeUpdaterInternals(store, storeKeys, newValue, op) {
var storeBuild = (0, _storeBuildScopeTree.storeBuildScopeTree)(storeKeys, 'internals', store, op === 'set' ? function (key) {
return typeof key === 'number' ? (0, _immutable.List)() : (0, _immutable.Map)();
} : undefined, function () {
return (0, _immutable.Map)({
self: (0, _immutable.Map)()
});
});
if (storeBuild.incomplete) {
return store;
}
return (0, _storeScopeUpdater.updateStoreScope)(storeBuild.store, 'internals', (storeKeys.size ? (0, _UIStore.addNestKey)('children', storeKeys) : Array.isArray(storeKeys) ? (0, _immutable.List)(storeKeys) : storeKeys).push('self'), newValue);
};
var scopeUpdaterInternals2 = exports.scopeUpdaterInternals2 = function scopeUpdaterInternals2(store, storeKeys, op, updater) {
var storeBuild = (0, _storeBuildScopeTree.storeBuildScopeTree)(storeKeys, 'internals', store, op === 'set' ? function (key) {
return typeof key === 'number' ? (0, _immutable.List)() : (0, _immutable.Map)();
} : undefined, function () {
return (0, _immutable.Map)({
self: (0, _immutable.Map)()
});
});
if (storeBuild.incomplete) {
return store;
}
return storeBuild.store.updateIn(storeKeys.size ? (0, _UIStore.prependKey)(storeKeys.size ? (0, _UIStore.addNestKey)('children', storeKeys) : Array.isArray(storeKeys) ? (0, _immutable.List)(storeKeys) : storeKeys, 'internals') : ['internals'], updater);
};
;