@limetech/lime-elements 38.32.0 → 38.33.0
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/CHANGELOG.md +8 -0
- package/dist/cjs/limel-form.cjs.entry.js +30 -19
- package/dist/cjs/limel-form.cjs.entry.js.map +1 -1
- package/dist/collection/components/form/help/help.js +4 -3
- package/dist/collection/components/form/help/help.js.map +1 -1
- package/dist/collection/components/form/templates/object-field.js +13 -2
- package/dist/collection/components/form/templates/object-field.js.map +1 -1
- package/dist/esm/limel-form.entry.js +30 -19
- package/dist/esm/limel-form.entry.js.map +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-a1a32893.entry.js → p-9af45dec.entry.js} +2 -2
- package/dist/lime-elements/p-9af45dec.entry.js.map +1 -0
- package/dist/types/components/form/help/help.d.ts +8 -2
- package/package.json +1 -1
- package/dist/lime-elements/p-a1a32893.entry.js.map +0 -1
|
@@ -2,17 +2,18 @@ import React from 'react';
|
|
|
2
2
|
/**
|
|
3
3
|
*
|
|
4
4
|
* @param schema
|
|
5
|
+
* @param extraProps - additional props to pass to the limel-help element
|
|
5
6
|
*/
|
|
6
|
-
export function getHelpComponent(schema) {
|
|
7
|
+
export function getHelpComponent(schema, extraProps) {
|
|
7
8
|
var _a;
|
|
8
9
|
const help = (_a = schema.lime) === null || _a === void 0 ? void 0 : _a.help;
|
|
9
10
|
if (!help) {
|
|
10
11
|
return;
|
|
11
12
|
}
|
|
12
13
|
if (typeof help === 'string') {
|
|
13
|
-
return React.createElement('limel-help', { value: help });
|
|
14
|
+
return React.createElement('limel-help', Object.assign({ value: help }, extraProps));
|
|
14
15
|
}
|
|
15
16
|
const helpProps = help;
|
|
16
|
-
return React.createElement('limel-help', helpProps);
|
|
17
|
+
return React.createElement('limel-help', Object.assign(Object.assign({}, helpProps), extraProps));
|
|
17
18
|
}
|
|
18
19
|
//# sourceMappingURL=help.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../../../src/components/form/help/help.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../../../src/components/form/help/help.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC5B,MAAkB,EAClB,UAAoC;;EAEpC,MAAM,IAAI,GAAG,MAAA,MAAM,CAAC,IAAI,0CAAE,IAAI,CAAC;EAE/B,IAAI,CAAC,IAAI,EAAE;IACP,OAAO;GACV;EAED,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;IAC1B,OAAO,KAAK,CAAC,aAAa,CAAC,YAAY,kBACnC,KAAK,EAAE,IAAI,IACR,UAAU,EACf,CAAC;GACN;EAED,MAAM,SAAS,GAAG,IAAI,CAAC;EAEvB,OAAO,KAAK,CAAC,aAAa,CAAC,YAAY,kCAAO,SAAS,GAAK,UAAU,EAAG,CAAC;AAC9E,CAAC","sourcesContent":["import React from 'react';\nimport { FormSchema } from '../form.types';\n\n/**\n *\n * @param schema\n * @param extraProps - additional props to pass to the limel-help element\n */\nexport function getHelpComponent(\n schema: FormSchema,\n extraProps?: Record<string, unknown>\n) {\n const help = schema.lime?.help;\n\n if (!help) {\n return;\n }\n\n if (typeof help === 'string') {\n return React.createElement('limel-help', {\n value: help,\n ...extraProps,\n });\n }\n\n const helpProps = help;\n\n return React.createElement('limel-help', { ...helpProps, ...extraProps });\n}\n"]}
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { renderDescription, renderTitle } from './common';
|
|
3
3
|
import { GridLayout } from './grid-layout';
|
|
4
4
|
import { RowLayout } from './row-layout';
|
|
5
|
+
import { getHelpComponent } from '../help';
|
|
5
6
|
export const ObjectFieldTemplate = (props) => {
|
|
6
7
|
const id = props.idSchema.$id;
|
|
7
8
|
if (id === 'root' || !isCollapsible(props.schema)) {
|
|
@@ -13,15 +14,25 @@ export const ObjectFieldTemplate = (props) => {
|
|
|
13
14
|
return renderProperties(props.properties, props.schema);
|
|
14
15
|
};
|
|
15
16
|
function renderFieldWithTitle(props) {
|
|
16
|
-
return React.createElement(React.Fragment, {},
|
|
17
|
+
return React.createElement(React.Fragment, {}, renderSectionHeader(props), renderDescription(props.description), renderProperties(props.properties, props.schema));
|
|
18
|
+
}
|
|
19
|
+
function renderSectionHeader(props) {
|
|
20
|
+
const help = getHelpComponent(props.schema);
|
|
21
|
+
if (!help) {
|
|
22
|
+
return renderTitle(props.title);
|
|
23
|
+
}
|
|
24
|
+
return React.createElement(React.Fragment, {}, renderTitle(props.title), help);
|
|
17
25
|
}
|
|
18
26
|
function renderCollapsibleField(props) {
|
|
19
27
|
const defaultOpen = !isCollapsed(props.schema);
|
|
28
|
+
const helpElement = getHelpComponent(props.schema, {
|
|
29
|
+
slot: 'header',
|
|
30
|
+
});
|
|
20
31
|
return React.createElement('limel-collapsible-section', {
|
|
21
32
|
header: props.title,
|
|
22
33
|
id: getSchemaObjectPropertyPath(props.formContext.schema, props.idSchema),
|
|
23
34
|
'is-open': defaultOpen,
|
|
24
|
-
}, renderDescription(props.description), renderProperties(props.properties, props.schema));
|
|
35
|
+
}, helpElement, renderDescription(props.description), renderProperties(props.properties, props.schema));
|
|
25
36
|
}
|
|
26
37
|
function getSchemaObjectPropertyPath(schema, subSchema) {
|
|
27
38
|
var _a, _b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-field.js","sourceRoot":"","sources":["../../../../src/components/form/templates/object-field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"object-field.js","sourceRoot":"","sources":["../../../../src/components/form/templates/object-field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAE,iBAA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,\n FormLayoutOptions,\n FormSchema,\n} from '../form.types';\nimport { renderDescription, renderTitle } from './common';\nimport { GridLayout } from './grid-layout';\nimport { RowLayout } from './row-layout';\nimport { LimeObjectFieldTemplateProps, ObjectFieldProperty } from './types';\nimport { JSONSchema7 } from 'json-schema';\nimport { getHelpComponent } from '../help';\n\nexport const ObjectFieldTemplate = (props: LimeObjectFieldTemplateProps) => {\n const id = props.idSchema.$id;\n if (id === 'root' || !isCollapsible(props.schema)) {\n return renderFieldWithTitle(props);\n }\n\n if (isCollapsible(props.schema)) {\n return renderCollapsibleField(props);\n }\n\n return renderProperties(props.properties, props.schema);\n};\n\nfunction renderFieldWithTitle(props: LimeObjectFieldTemplateProps) {\n return React.createElement(\n React.Fragment,\n {},\n renderSectionHeader(props),\n renderDescription(props.description),\n renderProperties(props.properties, props.schema)\n );\n}\n\nfunction renderSectionHeader(props: LimeObjectFieldTemplateProps) {\n const help = getHelpComponent(props.schema as FormSchema);\n if (!help) {\n return renderTitle(props.title);\n }\n\n return React.createElement(\n React.Fragment,\n {},\n renderTitle(props.title),\n help\n );\n}\n\nfunction renderCollapsibleField(props: LimeObjectFieldTemplateProps) {\n const defaultOpen = !isCollapsed(props.schema);\n const helpElement = getHelpComponent(props.schema as FormSchema, {\n slot: 'header',\n });\n\n return React.createElement(\n 'limel-collapsible-section',\n {\n header: props.title,\n id: getSchemaObjectPropertyPath(\n props.formContext.schema,\n props.idSchema\n ),\n 'is-open': defaultOpen,\n },\n helpElement,\n renderDescription(props.description),\n renderProperties(props.properties, props.schema)\n );\n}\n\nfunction getSchemaObjectPropertyPath(\n schema: JSONSchema7,\n subSchema: JSONSchema7\n) {\n const refPrefixLength = 2;\n const matchAllForwardSlashes = /\\//g;\n const rootPath = (schema.$ref as string)\n ?.replace(matchAllForwardSlashes, '.')\n .slice(refPrefixLength);\n const subSchemaPath = subSchema.$id?.replace('_', '.properties.');\n\n return subSchemaPath.replace('root', rootPath);\n}\n\nfunction renderProperties(\n properties: ObjectFieldProperty[],\n schema: JSONSchema7\n) {\n const layout = schema.lime?.layout;\n\n return renderLayout(properties, layout);\n}\n\nfunction renderLayout(\n properties: ObjectFieldProperty[],\n layout: Partial<LimeLayoutOptions>\n) {\n const type = layout?.type || 'default';\n const layouts: Record<FormLayoutType, Function> = {\n default: renderDefaultLayout,\n grid: renderGridLayout,\n row: renderRowLayout,\n };\n\n return layouts[type](properties, layout);\n}\n\nfunction renderDefaultLayout(properties: ObjectFieldProperty[]) {\n return React.createElement(\n 'div',\n {\n className: 'limel-form-layout--default',\n },\n properties.map((element) => element.content)\n );\n}\n\nfunction renderGridLayout(\n properties: ObjectFieldProperty[],\n layout: FormLayoutOptions\n) {\n return React.createElement(\n GridLayout,\n {\n options: layout,\n },\n properties.map((element) => element.content)\n );\n}\n\nfunction renderRowLayout(properties: ObjectFieldProperty[]) {\n return React.createElement(\n RowLayout,\n {},\n properties.map((element) => element.content)\n );\n}\n\nfunction isCollapsible(schema: JSONSchema7) {\n return !!schema.lime?.collapsible;\n}\n\nfunction isCollapsed(schema: JSONSchema7) {\n return schema.lime.collapsed !== false;\n}\n"]}
|
|
@@ -42531,6 +42531,24 @@ class RowLayout extends react.Component {
|
|
|
42531
42531
|
}
|
|
42532
42532
|
}
|
|
42533
42533
|
|
|
42534
|
+
/**
|
|
42535
|
+
*
|
|
42536
|
+
* @param schema
|
|
42537
|
+
* @param extraProps - additional props to pass to the limel-help element
|
|
42538
|
+
*/
|
|
42539
|
+
function getHelpComponent(schema, extraProps) {
|
|
42540
|
+
var _a;
|
|
42541
|
+
const help = (_a = schema.lime) === null || _a === void 0 ? void 0 : _a.help;
|
|
42542
|
+
if (!help) {
|
|
42543
|
+
return;
|
|
42544
|
+
}
|
|
42545
|
+
if (typeof help === 'string') {
|
|
42546
|
+
return react.createElement('limel-help', Object.assign({ value: help }, extraProps));
|
|
42547
|
+
}
|
|
42548
|
+
const helpProps = help;
|
|
42549
|
+
return react.createElement('limel-help', Object.assign(Object.assign({}, helpProps), extraProps));
|
|
42550
|
+
}
|
|
42551
|
+
|
|
42534
42552
|
const ObjectFieldTemplate = (props) => {
|
|
42535
42553
|
const id = props.idSchema.$id;
|
|
42536
42554
|
if (id === 'root' || !isCollapsible(props.schema)) {
|
|
@@ -42542,15 +42560,25 @@ const ObjectFieldTemplate = (props) => {
|
|
|
42542
42560
|
return renderProperties(props.properties, props.schema);
|
|
42543
42561
|
};
|
|
42544
42562
|
function renderFieldWithTitle(props) {
|
|
42545
|
-
return react.createElement(react.Fragment, {},
|
|
42563
|
+
return react.createElement(react.Fragment, {}, renderSectionHeader(props), renderDescription(props.description), renderProperties(props.properties, props.schema));
|
|
42564
|
+
}
|
|
42565
|
+
function renderSectionHeader(props) {
|
|
42566
|
+
const help = getHelpComponent(props.schema);
|
|
42567
|
+
if (!help) {
|
|
42568
|
+
return renderTitle(props.title);
|
|
42569
|
+
}
|
|
42570
|
+
return react.createElement(react.Fragment, {}, renderTitle(props.title), help);
|
|
42546
42571
|
}
|
|
42547
42572
|
function renderCollapsibleField(props) {
|
|
42548
42573
|
const defaultOpen = !isCollapsed(props.schema);
|
|
42574
|
+
const helpElement = getHelpComponent(props.schema, {
|
|
42575
|
+
slot: 'header',
|
|
42576
|
+
});
|
|
42549
42577
|
return react.createElement('limel-collapsible-section', {
|
|
42550
42578
|
header: props.title,
|
|
42551
42579
|
id: getSchemaObjectPropertyPath(props.formContext.schema, props.idSchema),
|
|
42552
42580
|
'is-open': defaultOpen,
|
|
42553
|
-
}, renderDescription(props.description), renderProperties(props.properties, props.schema));
|
|
42581
|
+
}, helpElement, renderDescription(props.description), renderProperties(props.properties, props.schema));
|
|
42554
42582
|
}
|
|
42555
42583
|
function getSchemaObjectPropertyPath(schema, subSchema) {
|
|
42556
42584
|
var _a, _b;
|
|
@@ -47063,23 +47091,6 @@ function isAdditionalProperty(schema) {
|
|
|
47063
47091
|
return schema[ADDITIONAL_PROPERTY_FLAG] === true;
|
|
47064
47092
|
}
|
|
47065
47093
|
|
|
47066
|
-
/**
|
|
47067
|
-
*
|
|
47068
|
-
* @param schema
|
|
47069
|
-
*/
|
|
47070
|
-
function getHelpComponent(schema) {
|
|
47071
|
-
var _a;
|
|
47072
|
-
const help = (_a = schema.lime) === null || _a === void 0 ? void 0 : _a.help;
|
|
47073
|
-
if (!help) {
|
|
47074
|
-
return;
|
|
47075
|
-
}
|
|
47076
|
-
if (typeof help === 'string') {
|
|
47077
|
-
return react.createElement('limel-help', { value: help });
|
|
47078
|
-
}
|
|
47079
|
-
const helpProps = help;
|
|
47080
|
-
return react.createElement('limel-help', helpProps);
|
|
47081
|
-
}
|
|
47082
|
-
|
|
47083
47094
|
/**
|
|
47084
47095
|
* A widget is a concept in react-jsonschema-form (rjsf).
|
|
47085
47096
|
* It represents a HTML tag for the user to enter data, eg. input, select, etc.
|