@jsonui/react 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +52 -24
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/stock/components/Button.d.ts +1 -1
- package/dist/cjs/types/stock/components/Fragment.d.ts +1 -5
- package/dist/cjs/types/stock/components/PrimitiveProp.d.ts +1 -4
- package/dist/cjs/types/stock/components/Text.d.ts +1 -1
- package/dist/cjs/types/stock/components/View.d.ts +1 -1
- package/dist/cjs/types/stock/components.d.ts +18 -0
- package/dist/cjs/types/stock/stockToRenderer.d.ts +20 -0
- package/dist/esm/index.js +53 -25
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/stock/components/Button.d.ts +1 -1
- package/dist/esm/types/stock/components/Fragment.d.ts +1 -5
- package/dist/esm/types/stock/components/PrimitiveProp.d.ts +1 -4
- package/dist/esm/types/stock/components/Text.d.ts +1 -1
- package/dist/esm/types/stock/components/View.d.ts +1 -1
- package/dist/esm/types/stock/components.d.ts +18 -0
- package/dist/esm/types/stock/stockToRenderer.d.ts +20 -0
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -6356,9 +6356,10 @@ const REDUX_PATHS = '$$reduxPaths';
|
|
|
6356
6356
|
const V_CHILDREN_PREFIX = '$child';
|
|
6357
6357
|
const PARENT_PROP_NAME = '__parentprop';
|
|
6358
6358
|
const CURRENT_PATH_NAME = '__currentPaths';
|
|
6359
|
+
const UNDEFINED_COMP_NAME = '_Undefined';
|
|
6359
6360
|
const PRIMITIVE_COMP_NAME = '_PrimitiveProp'; // TODO check all literal and replace with this constant
|
|
6360
6361
|
const FRAGMENT_COMP_NAME = 'Fragment'; // TODO check all literal and replace with this constant
|
|
6361
|
-
var constants=/*#__PURE__*/Object.freeze({__proto__:null,SEPARATOR:SEPARATOR,STORE_ERROR_POSTFIX:STORE_ERROR_POSTFIX,PATH_MODIFIERS_KEY:PATH_MODIFIERS_KEY,MODIFIER_KEY:MODIFIER_KEY,ACTION_KEY:ACTION_KEY,PERSIST_STORAGE_KEY:PERSIST_STORAGE_KEY,PERSIST_STORAGE_NAMES:PERSIST_STORAGE_NAMES,REF_ASSETS:REF_ASSETS,REF_LOCALES:REF_LOCALES,REF_VALIDATES:REF_VALIDATES,STYLE_WEB_NAME:STYLE_WEB_NAME,STYLE_RN_NAME:STYLE_RN_NAME,REDUX_GET_FUNCTION:REDUX_GET_FUNCTION,REDUX_SET_FUNCTION:REDUX_SET_FUNCTION,REDUX_FUNCTIONS:REDUX_FUNCTIONS,PATHNAME:PATHNAME,SIMPLE_DATA_TYPES:SIMPLE_DATA_TYPES,V_CHILDREN_NAME:V_CHILDREN_NAME,V_COMP_NAME:V_COMP_NAME,LIST_SEMAPHORE:LIST_SEMAPHORE,LIST_ITEM:LIST_ITEM,LIST_PAGE:LIST_PAGE,LIST_ITEM_PER_PAGE:LIST_ITEM_PER_PAGE,LIST_LENGTH:LIST_LENGTH,LIST_ITEM_PER_PAGE_DEFAULT:LIST_ITEM_PER_PAGE_DEFAULT,REDUX_PATHS:REDUX_PATHS,V_CHILDREN_PREFIX:V_CHILDREN_PREFIX,PARENT_PROP_NAME:PARENT_PROP_NAME,CURRENT_PATH_NAME:CURRENT_PATH_NAME,PRIMITIVE_COMP_NAME:PRIMITIVE_COMP_NAME,FRAGMENT_COMP_NAME:FRAGMENT_COMP_NAME});var jsonpointer = {};var hasExcape = /~/;
|
|
6362
|
+
var constants=/*#__PURE__*/Object.freeze({__proto__:null,SEPARATOR:SEPARATOR,STORE_ERROR_POSTFIX:STORE_ERROR_POSTFIX,PATH_MODIFIERS_KEY:PATH_MODIFIERS_KEY,MODIFIER_KEY:MODIFIER_KEY,ACTION_KEY:ACTION_KEY,PERSIST_STORAGE_KEY:PERSIST_STORAGE_KEY,PERSIST_STORAGE_NAMES:PERSIST_STORAGE_NAMES,REF_ASSETS:REF_ASSETS,REF_LOCALES:REF_LOCALES,REF_VALIDATES:REF_VALIDATES,STYLE_WEB_NAME:STYLE_WEB_NAME,STYLE_RN_NAME:STYLE_RN_NAME,REDUX_GET_FUNCTION:REDUX_GET_FUNCTION,REDUX_SET_FUNCTION:REDUX_SET_FUNCTION,REDUX_FUNCTIONS:REDUX_FUNCTIONS,PATHNAME:PATHNAME,SIMPLE_DATA_TYPES:SIMPLE_DATA_TYPES,V_CHILDREN_NAME:V_CHILDREN_NAME,V_COMP_NAME:V_COMP_NAME,LIST_SEMAPHORE:LIST_SEMAPHORE,LIST_ITEM:LIST_ITEM,LIST_PAGE:LIST_PAGE,LIST_ITEM_PER_PAGE:LIST_ITEM_PER_PAGE,LIST_LENGTH:LIST_LENGTH,LIST_ITEM_PER_PAGE_DEFAULT:LIST_ITEM_PER_PAGE_DEFAULT,REDUX_PATHS:REDUX_PATHS,V_CHILDREN_PREFIX:V_CHILDREN_PREFIX,PARENT_PROP_NAME:PARENT_PROP_NAME,CURRENT_PATH_NAME:CURRENT_PATH_NAME,UNDEFINED_COMP_NAME:UNDEFINED_COMP_NAME,PRIMITIVE_COMP_NAME:PRIMITIVE_COMP_NAME,FRAGMENT_COMP_NAME:FRAGMENT_COMP_NAME});var jsonpointer = {};var hasExcape = /~/;
|
|
6362
6363
|
var escapeMatcher = /~[01]/g;
|
|
6363
6364
|
function escapeReplacer (m) {
|
|
6364
6365
|
switch (m) {
|
|
@@ -8214,11 +8215,11 @@ const getRootWrapperProps = (props, stock) => {
|
|
|
8214
8215
|
newProps.subscriberPaths = subscriberPaths;
|
|
8215
8216
|
return newProps;
|
|
8216
8217
|
};
|
|
8217
|
-
const
|
|
8218
|
+
const isChildrenProp = (propName) => !!propName && typeof propName === 'string' && propName.startsWith(V_CHILDREN_PREFIX);
|
|
8218
8219
|
const getParentProps = (props) => {
|
|
8219
8220
|
return props && typeof props === 'object' && !Array.isArray(props)
|
|
8220
8221
|
? Object.keys(props)
|
|
8221
|
-
.filter((key) => !
|
|
8222
|
+
.filter((key) => !isChildrenProp(key) && key !== PARENT_PROP_NAME)
|
|
8222
8223
|
.reduce((newObj, key) => {
|
|
8223
8224
|
// eslint-disable-next-line no-param-reassign
|
|
8224
8225
|
newObj[key] = props[key];
|
|
@@ -8228,7 +8229,7 @@ const getParentProps = (props) => {
|
|
|
8228
8229
|
};
|
|
8229
8230
|
const getPropsChildrenFilter = ({ props, filter }) => props && typeof props === 'object' && !Array.isArray(props)
|
|
8230
8231
|
? Object.keys(props)
|
|
8231
|
-
.filter((key) => ((filter === 'withoutChildren' && !
|
|
8232
|
+
.filter((key) => ((filter === 'withoutChildren' && !isChildrenProp(key)) || (filter === 'onlyChildren' && isChildrenProp(key))) && key !== PARENT_PROP_NAME)
|
|
8232
8233
|
.reduce((newObj, key) => {
|
|
8233
8234
|
// eslint-disable-next-line no-param-reassign
|
|
8234
8235
|
newObj[key] = props[key];
|
|
@@ -8262,10 +8263,25 @@ const generateNewChildren = (props, { Wrapper }) => {
|
|
|
8262
8263
|
}
|
|
8263
8264
|
return undefined;
|
|
8264
8265
|
};
|
|
8266
|
+
const isTechnicalProp = (propName) => [
|
|
8267
|
+
PARENT_PROP_NAME,
|
|
8268
|
+
STYLE_WEB_NAME,
|
|
8269
|
+
V_COMP_NAME,
|
|
8270
|
+
PATH_MODIFIERS_KEY,
|
|
8271
|
+
CURRENT_PATH_NAME,
|
|
8272
|
+
PATH_MODIFIERS_KEY,
|
|
8273
|
+
LIST_SEMAPHORE,
|
|
8274
|
+
LIST_ITEM,
|
|
8275
|
+
LIST_PAGE,
|
|
8276
|
+
LIST_ITEM_PER_PAGE,
|
|
8277
|
+
LIST_LENGTH,
|
|
8278
|
+
'style',
|
|
8279
|
+
'subscriberPaths',
|
|
8280
|
+
].includes(propName);
|
|
8265
8281
|
const removeTechnicalProps = (changeableProps) => {
|
|
8266
8282
|
const _a = changeableProps, _b = PARENT_PROP_NAME; _a[_b]; const _c = STYLE_WEB_NAME; _a[_c]; const _d = V_COMP_NAME; _a[_d]; const _e = PATH_MODIFIERS_KEY; _a[_e]; const _f = CURRENT_PATH_NAME; _a[_f]; const _g = PATH_MODIFIERS_KEY; _a[_g]; const _h = LIST_SEMAPHORE; _a[_h]; const _j = LIST_ITEM; _a[_j]; const _k = LIST_PAGE; _a[_k]; const _l = LIST_ITEM_PER_PAGE; _a[_l]; const _m = LIST_LENGTH; _a[_m]; const newProps = __rest(_a, [_b + "", "style", _c + "", _d + "", _e + "", _f + "", "subscriberPaths", _g + "", _h + "", _j + "", _k + "", _l + "", _m + ""]);
|
|
8267
8283
|
return newProps;
|
|
8268
|
-
};var wrapperUtil=/*#__PURE__*/Object.freeze({__proto__:null,getFilteredPath:getFilteredPath,actionBuilder:actionBuilder,calculatePropsFromModifier:calculatePropsFromModifier,getCurrentPaths:getCurrentPaths,normalisePrimitives:normalisePrimitives,getRootWrapperProps:getRootWrapperProps,
|
|
8284
|
+
};var wrapperUtil=/*#__PURE__*/Object.freeze({__proto__:null,getFilteredPath:getFilteredPath,actionBuilder:actionBuilder,calculatePropsFromModifier:calculatePropsFromModifier,getCurrentPaths:getCurrentPaths,normalisePrimitives:normalisePrimitives,getRootWrapperProps:getRootWrapperProps,isChildrenProp:isChildrenProp,getParentProps:getParentProps,getPropsChildrenFilter:getPropsChildrenFilter,getChildrensForRoot:getChildrensForRoot,generateChildren:generateChildren,generateNewChildren:generateNewChildren,isTechnicalProp:isTechnicalProp,removeTechnicalProps:removeTechnicalProps});var ajv = {exports: {}};var core$2 = {};var validate = {};var boolSchema = {};var errors = {};var codegen = {};var code$1 = {};(function (exports) {
|
|
8269
8285
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8270
8286
|
exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0;
|
|
8271
8287
|
class _CodeOrName {
|
|
@@ -18523,14 +18539,13 @@ var defaultsDeep = baseRest(function(args) {
|
|
|
18523
18539
|
var defaultsDeep_1 = defaultsDeep;
|
|
18524
18540
|
|
|
18525
18541
|
function Text(_a) {
|
|
18526
|
-
var { value
|
|
18527
|
-
|
|
18528
|
-
return jsxRuntime$1.exports.jsx("p", Object.assign({}, props, { children: wrapperUtil.generateNewChildren(value || children, stock) }), void 0);
|
|
18542
|
+
var { value, children } = _a, props = __rest$1(_a, ["value", "children"]);
|
|
18543
|
+
return jsxRuntime$1.exports.jsx("p", Object.assign({}, props, { children: value || children }), void 0);
|
|
18529
18544
|
}
|
|
18530
18545
|
|
|
18531
|
-
function Button(
|
|
18532
|
-
|
|
18533
|
-
return jsxRuntime$1.exports.jsx("button", Object.assign({}, props), void 0);
|
|
18546
|
+
function Button(_a) {
|
|
18547
|
+
var { children, type } = _a, props = __rest$1(_a, ["children", "type"]);
|
|
18548
|
+
return (jsxRuntime$1.exports.jsx("button", Object.assign({ type: "button" }, props, { children: children }), void 0));
|
|
18534
18549
|
}
|
|
18535
18550
|
|
|
18536
18551
|
function Edit(props) {
|
|
@@ -18564,10 +18579,8 @@ function Edit(props) {
|
|
|
18564
18579
|
return (jsxRuntime$1.exports.jsxs(jsxRuntime$1.exports.Fragment, { children: [jsxRuntime$1.exports.jsx("p", Object.assign({ style: { fontSize: 20, color: error ? 'red' : undefined } }, { children: label }), void 0), jsxRuntime$1.exports.jsx("input", Object.assign({}, ownProps, { value: value || '', onChange: handleChange }), void 0), jsxRuntime$1.exports.jsx("p", Object.assign({ style: { fontSize: 10, color: error ? 'red' : undefined } }, { children: helperText }), void 0)] }, void 0));
|
|
18565
18580
|
}
|
|
18566
18581
|
|
|
18567
|
-
function View(
|
|
18568
|
-
|
|
18569
|
-
const stock = React.useContext(StockContext);
|
|
18570
|
-
return jsxRuntime$1.exports.jsx("div", Object.assign({}, props, { children: wrapperUtil.generateNewChildren(children, stock) }), void 0);
|
|
18582
|
+
function View(props) {
|
|
18583
|
+
return jsxRuntime$1.exports.jsx("div", Object.assign({}, props), void 0);
|
|
18571
18584
|
}
|
|
18572
18585
|
|
|
18573
18586
|
function Image(props) {
|
|
@@ -18640,20 +18653,16 @@ function Undefined(props) {
|
|
|
18640
18653
|
} }, { children: getLabel(props) }), void 0));
|
|
18641
18654
|
}
|
|
18642
18655
|
|
|
18643
|
-
function PrimitiveProp({
|
|
18656
|
+
function PrimitiveProp({ children }) {
|
|
18644
18657
|
return jsxRuntime$1.exports.jsx("span", { children: !constants.SIMPLE_DATA_TYPES.includes(typeof children) || typeof children === 'boolean' ? JSON.stringify(children) : children }, void 0);
|
|
18645
18658
|
}
|
|
18646
18659
|
|
|
18647
|
-
const Fragment = (
|
|
18648
|
-
var _b = constants.V_CHILDREN_NAME, props = _a[_b]; __rest$1(_a, [typeof _b === "symbol" ? _b : _b + ""]);
|
|
18649
|
-
const stock = React.useContext(StockContext);
|
|
18650
|
-
return jsxRuntime$1.exports.jsx(jsxRuntime$1.exports.Fragment, { children: wrapperUtil.generateNewChildren(props, stock) }, void 0);
|
|
18651
|
-
};
|
|
18660
|
+
const Fragment = ({ children }) => children;
|
|
18652
18661
|
|
|
18653
18662
|
const Components = {
|
|
18654
18663
|
View,
|
|
18655
|
-
|
|
18656
|
-
|
|
18664
|
+
[constants.PRIMITIVE_COMP_NAME]: PrimitiveProp,
|
|
18665
|
+
[constants.UNDEFINED_COMP_NAME]: Undefined,
|
|
18657
18666
|
Fragment,
|
|
18658
18667
|
Image,
|
|
18659
18668
|
Text,
|
|
@@ -24140,7 +24149,26 @@ function Wrapper({ props: origProps }) {
|
|
|
24140
24149
|
const newStyle = ownProps.style || ownProps[constants.STYLE_WEB_NAME] ? getStyle(ownProps, component) : undefined;
|
|
24141
24150
|
return (jsxRuntime$1.exports.jsx(ErrorBoundary, Object.assign({ type: "wrapper", id: props.id }, { children: jsxRuntime$1.exports.jsx(ClassNames, { children: ({ css, cx }) => {
|
|
24142
24151
|
ownProps.className = newStyle ? cx(css(newStyle)) : undefined;
|
|
24143
|
-
const newProps =
|
|
24152
|
+
const newProps = Object.keys(ownProps).reduce((newObj, childName) => {
|
|
24153
|
+
// eslint-disable-next-line no-param-reassign
|
|
24154
|
+
if (wrapperUtil.isChildrenProp(childName)) {
|
|
24155
|
+
const res = component === constants.PRIMITIVE_COMP_NAME ? ownProps[childName] : wrapperUtil.generateNewChildren(ownProps[childName], stock);
|
|
24156
|
+
// eslint-disable-next-line no-param-reassign
|
|
24157
|
+
if (childName === constants.V_CHILDREN_NAME) {
|
|
24158
|
+
// eslint-disable-next-line no-param-reassign
|
|
24159
|
+
newObj.children = res;
|
|
24160
|
+
}
|
|
24161
|
+
else {
|
|
24162
|
+
// eslint-disable-next-line no-param-reassign
|
|
24163
|
+
newObj[childName] = res;
|
|
24164
|
+
}
|
|
24165
|
+
}
|
|
24166
|
+
else if (!wrapperUtil.isTechnicalProp(childName)) {
|
|
24167
|
+
// eslint-disable-next-line no-param-reassign
|
|
24168
|
+
newObj[childName] = ownProps[childName];
|
|
24169
|
+
}
|
|
24170
|
+
return newObj;
|
|
24171
|
+
}, {});
|
|
24144
24172
|
// children was {wrapperUtil.generateChildren(ownProps, stock)}
|
|
24145
24173
|
return ownProps[constants.PATH_MODIFIERS_KEY] ? (jsxRuntime$1.exports.jsxs(PathModifierContext.Provider, Object.assign({ value: props[constants.CURRENT_PATH_NAME] }, { children: [jsxRuntime$1.exports.jsx(Comp, Object.assign({}, newProps), void 0), infobox ] }), void 0)) : (jsxRuntime$1.exports.jsxs(jsxRuntime$1.exports.Fragment, { children: [jsxRuntime$1.exports.jsx(Comp, Object.assign({}, newProps), void 0), infobox ] }, void 0));
|
|
24146
24174
|
} }, void 0) }), void 0));
|