@limetech/lime-elements 37.7.1 → 37.8.1

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 (54) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/index.cjs.js +1 -1
  3. package/dist/cjs/index.cjs.js.map +1 -1
  4. package/dist/cjs/limel-form.cjs.entry.js +5 -5
  5. package/dist/cjs/limel-form.cjs.entry.js.map +1 -1
  6. package/dist/cjs/limel-input-field_3.cjs.entry.js +1 -0
  7. package/dist/cjs/limel-input-field_3.cjs.entry.js.map +1 -1
  8. package/dist/collection/components/form/fields/field-helpers.js.map +1 -1
  9. package/dist/collection/components/form/fields/object-field.js.map +1 -1
  10. package/dist/collection/components/form/fields/schema-field.js.map +1 -1
  11. package/dist/collection/components/form/fields/types.js.map +1 -1
  12. package/dist/collection/components/form/form.js +2 -2
  13. package/dist/collection/components/form/form.types.js +1 -1
  14. package/dist/collection/components/form/form.types.js.map +1 -1
  15. package/dist/collection/components/form/schema.js.map +1 -1
  16. package/dist/collection/components/form/templates/array-field-collapsible-item.js.map +1 -1
  17. package/dist/collection/components/form/templates/array-field.js.map +1 -1
  18. package/dist/collection/components/form/templates/common.js +3 -3
  19. package/dist/collection/components/form/templates/common.js.map +1 -1
  20. package/dist/collection/components/form/templates/field.js.map +1 -1
  21. package/dist/collection/components/form/templates/object-field.js.map +1 -1
  22. package/dist/collection/components/form/templates/types.js.map +1 -1
  23. package/dist/collection/components/form/widgets/date-picker.js.map +1 -1
  24. package/dist/collection/components/form/widgets/input-field.js +2 -2
  25. package/dist/collection/components/form/widgets/input-field.js.map +1 -1
  26. package/dist/collection/components/form/widgets/slider.js.map +1 -1
  27. package/dist/collection/components/list/list.js +1 -0
  28. package/dist/collection/components/list/list.js.map +1 -1
  29. package/dist/collection/interface.js +1 -1
  30. package/dist/collection/interface.js.map +1 -1
  31. package/dist/esm/index.js +1 -1
  32. package/dist/esm/index.js.map +1 -1
  33. package/dist/esm/limel-form.entry.js +5 -5
  34. package/dist/esm/limel-form.entry.js.map +1 -1
  35. package/dist/esm/limel-input-field_3.entry.js +1 -0
  36. package/dist/esm/limel-input-field_3.entry.js.map +1 -1
  37. package/dist/lime-elements/index.esm.js.map +1 -1
  38. package/dist/lime-elements/lime-elements.esm.js +1 -1
  39. package/dist/lime-elements/{p-64e352ec.entry.js → p-a88039bf.entry.js} +2 -2
  40. package/dist/lime-elements/p-a88039bf.entry.js.map +1 -0
  41. package/dist/lime-elements/{p-dfa06174.entry.js → p-f6138133.entry.js} +2 -2
  42. package/dist/lime-elements/{p-dfa06174.entry.js.map → p-f6138133.entry.js.map} +1 -1
  43. package/dist/types/components/form/fields/array-field.d.ts +1 -1
  44. package/dist/types/components/form/fields/field-helpers.d.ts +2 -1
  45. package/dist/types/components/form/fields/schema-field.d.ts +2 -1
  46. package/dist/types/components/form/fields/types.d.ts +4 -3
  47. package/dist/types/components/form/form.types.d.ts +337 -6
  48. package/dist/types/components/form/schema.d.ts +6 -5
  49. package/dist/types/components/form/templates/array-field-collapsible-item.d.ts +3 -2
  50. package/dist/types/components/form/templates/common.d.ts +2 -1
  51. package/dist/types/components/form/templates/types.d.ts +2 -2
  52. package/dist/types/interface.d.ts +1 -1
  53. package/package.json +3 -3
  54. package/dist/lime-elements/p-64e352ec.entry.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"schema-field.js","sourceRoot":"","sources":["../../../../src/components/form/fields/schema-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,eAAe,MAAM,8CAA8C,CAAC;AAC3E,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EA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O,SAAS,CAAC;KACpB;IAED,OAAO,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;EACpD,CAAC;CACJ","sourcesContent":["import { LimeElementsAdapter } from '../adapters';\nimport JSONSchemaField from '@rjsf/core/lib/components/fields/SchemaField';\nimport React from 'react';\nimport { FieldProps } from './types';\nimport { isEmpty, capitalize } from 'lodash-es';\nimport { resetDependentFields } from './field-helpers';\nimport { FieldTemplate } from '../templates';\nimport { getHelpComponent } from '../help';\n\n/**\n * If given a value and schema, check if the value should be translated\n * from null to undefined to avoid issues with validation\n *\n * This function needs to be used for several reasons:\n * 1. CustomEvent does not allow `detail` to equal `undefined`, but we can call onChange with `undefined` in React\n * 2. `null` is treated as a valid value in a jsonschema and with marshmallow and it has its own type (null)\n * 3. Without changing `null` to `undefined` there would be no way to remove a field from\n * from the submitted form data once it had any data. (when POSTing, undefined is not posted since its not valid json)\n * 4. The only applies to custom web components since widgets handle transforming null/'' to undefined depending on the widget\n * and its purpose.\n *\n * Example:\n * If I have an object `{ name?: string, email?: string }` that I am using a custom web component for `name`,\n * then initially, the formData will be `{}` which is fine because neither name or email are required. Then if i input a\n * value for name the formData will be `{ name: 'some_value' }` which is also fine. But then if I want to remove name\n * from the form data I would delete all the text from the name input field. Web components would emit this empty value\n * as '' or null. If the web component tries to emit `undefined`, null would be emitted instead because CustomEvent has\n * a default `detail` value of null\n *\n * @param value - the value associated with the schema\n * @param schema - the schema for the value\n * @returns whether or not null should be changed to undefined\n */\nconst shouldChangeToUndefined = (value, schema): boolean => {\n return value === null && !schema.type.includes('null');\n};\n\nconst hasCustomComponent = (schema): boolean => {\n const name = schema.lime?.component?.name;\n if (!name) {\n return false;\n }\n\n try {\n verifyCustomComponentIsDefined(name);\n } catch {\n // eslint-disable-next-line no-console\n console.warn(`Custom component ${name} not defined`);\n\n return false;\n }\n\n return true;\n};\n\nconst verifyCustomComponentIsDefined = (elementName): void => {\n const supportsCustomElements = 'customElements' in window;\n\n if (!supportsCustomElements) {\n throw new Error(\n 'Custom form elements are not supported by this browser!',\n );\n }\n\n if (!customElements.get(elementName)) {\n throw new Error(`Custom form element '${elementName}' is not defined!`);\n }\n};\n\nconst getCustomComponent = (\n schema,\n): { name: string; props: { [key: string]: any } } => {\n const name = schema.lime?.component?.name;\n const props = schema.lime?.component?.props || {};\n\n return { name: name, props: props };\n};\n\n/**\n * Create properties from the factory that is set on `limel-form`\n *\n * @param formContext - the form context\n * @param schema - the schema for the current field\n * @returns the properties created by the factory\n */\nexport function getFactoryProps(\n formContext: any,\n schema: any,\n): Record<string, any> {\n const factory: (schema: any) => Record<string, any> =\n formContext.propsFactory;\n if (typeof factory !== 'function') {\n return {};\n }\n\n const props = factory(schema);\n if (!props) {\n return {};\n }\n\n return props;\n}\n\nexport class SchemaField extends React.Component<FieldProps> {\n state = {\n modified: false,\n };\n\n constructor(props) {\n super(props);\n this.handleChange = this.handleChange.bind(this);\n this.handleCustomComponentChange =\n this.handleCustomComponentChange.bind(this);\n }\n\n private hasValue() {\n const value = this.getValue();\n if (!value) {\n return false;\n }\n\n if (Array.isArray(value)) {\n return !!value.length;\n }\n\n if (typeof value === 'object') {\n return !isEmpty(value);\n }\n\n return true;\n }\n\n private getLabel() {\n const { schema } = this.props;\n\n return schema.title;\n }\n\n private isInvalid() {\n const { modified } = this.state;\n const { errorSchema } = this.props;\n\n return (\n (modified || this.hasValue() || !this.isRequired()) &&\n !isEmpty(errorSchema)\n );\n }\n\n private isRequired() {\n const { required, schema } = this.props;\n\n return required || schema.minItems > 0;\n }\n\n private getHelperText() {\n const { errorSchema, schema } = this.props;\n\n if (!this.isInvalid()) {\n const helperText = schema.lime?.component?.props?.helperText;\n\n return helperText || schema.description;\n }\n\n if (!isEmpty(errorSchema) && '__errors' in errorSchema) {\n return capitalize(errorSchema.__errors[0]); // eslint-disable-line no-underscore-dangle\n }\n\n return schema.description;\n }\n\n private getValue() {\n const { formData } = this.props;\n\n return formData;\n }\n\n private handleCustomComponentChange(event) {\n const { schema } = this.props;\n event.stopPropagation();\n\n let value = event.detail;\n\n if (shouldChangeToUndefined(value, schema)) {\n value = undefined;\n }\n\n this.handleChange(value);\n }\n\n private handleChange(data) {\n const { formData, schema } = this.props;\n const { rootSchema } = this.props.registry;\n\n this.setState({ modified: true });\n\n const newData = resetDependentFields(\n formData,\n data,\n schema,\n rootSchema,\n );\n\n this.props.onChange(newData);\n }\n\n private buildCustomComponentProps() {\n const {\n disabled,\n readonly,\n name,\n registry,\n schema,\n errorSchema,\n idSchema,\n } = this.props;\n const factoryProps = getFactoryProps(registry.formContext, schema);\n\n return {\n ...factoryProps,\n value: this.getValue(),\n required: this.isRequired(),\n readonly: readonly || schema.readOnly,\n disabled: disabled,\n invalid: this.isInvalid(),\n label: this.getLabel(),\n helperText: this.getHelperText(),\n formInfo: {\n schema: schema,\n rootSchema: registry.formContext.schema,\n errorSchema: errorSchema,\n rootValue: registry.formContext.rootValue,\n name: name,\n schemaPath: this.getSchemaPath(idSchema?.$id),\n },\n };\n }\n\n private renderCustomComponent(props: FieldProps) {\n const { name, props: userDefinedComponentProps } = getCustomComponent(\n props.schema,\n );\n\n verifyCustomComponentIsDefined(name);\n\n const component = React.createElement(LimeElementsAdapter, {\n name: name,\n elementProps: {\n ...userDefinedComponentProps,\n ...this.buildCustomComponentProps(),\n },\n events: {\n change: this.handleCustomComponentChange,\n },\n });\n\n return React.createElement(\n FieldTemplate,\n {\n ...this.props,\n classNames: 'form-group field field-custom',\n },\n component,\n getHelpComponent(props.schema),\n );\n }\n\n render() {\n if (hasCustomComponent(this.props.schema)) {\n return this.renderCustomComponent(this.props);\n }\n\n const fieldProps = {\n ...this.props,\n onChange: this.handleChange,\n };\n\n return React.createElement(JSONSchemaField, fieldProps);\n }\n\n /**\n * Gets the path to the current property within the schema\n *\n * @param schemaId - the id of the schema\n * @returns an array with the schema path for the current property\n * @example\n * const schemaId = 'root_sections_0_controls_0_name';\n * const schemaPath = getSchemaPath(schemaId);\n * // ➡ ['sections', '0', 'controls', '0', 'name']\n */\n private getSchemaPath(schemaId: string): string[] {\n if (schemaId === undefined) {\n return undefined;\n }\n\n return schemaId.replace('root_', '').split('_');\n }\n}\n"]}
1
+ {"version":3,"file":"schema-field.js","sourceRoot":"","sources":["../../../../src/components/form/fields/schema-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,eAAe,MAAM,8CAA8C,CAAC;AAC3E,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG3C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,uBAAuB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAW,EAAE;EACvD,OAAO,KAAK,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC3D,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAW,EAAE;;EAC3C,MAAM,IAAI,GAAG,MAAA,MAAA,MAAM,CAAC,IAAI,0CAAE,SAAS,0CAAE,IAAI,CAAC;EAC1C,IAAI,CAAC,IAAI,EAAE;IACP,OAAO,KAAK,CAAC;GAChB;EAED,IAAI;IACA,8BAA8B,CAAC,IAAI,CAAC,CAAC;GACxC;EAAC,WAAM;IACJ,sCAAsC;IACtC,OAAO,CAAC,IAAI,CAAC,oBAAoB,IAAI,cAAc,CAAC,CAAC;IAErD,OAAO,KAAK,CAAC;GAChB;EAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,8BAA8B,GAAG,CA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IAAI,CAAC,KAAK,KACb,UAAU,EAAE,+BAA+B,KAE/C,SAAS,EACT,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,CACjC,CAAC;EACN,CAAC;EAED,MAAM;IACF,IAAI,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;MACvC,OAAO,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACjD;IAED,MAAM,UAAU,mCACT,IAAI,CAAC,KAAK,KACb,QAAQ,EAAE,IAAI,CAAC,YAAY,GAC9B,CAAC;IAEF,OAAO,KAAK,CAAC,aAAa,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;EAC5D,CAAC;EAED;;;;;;;;;KASG;EACK,aAAa,CAAC,QAAgB;IAClC,IAAI,QAAQ,KAAK,SAAS,EAAE;MACxB,OAAO,SAAS,CAAC;KACpB;IAED,OAAO,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;EACpD,CAAC;CACJ","sourcesContent":["import { LimeElementsAdapter } from '../adapters';\nimport JSONSchemaField from '@rjsf/core/lib/components/fields/SchemaField';\nimport React from 'react';\nimport { FieldProps } from './types';\nimport { isEmpty, capitalize } from 'lodash-es';\nimport { resetDependentFields } from './field-helpers';\nimport { FieldTemplate } from '../templates';\nimport { getHelpComponent } from '../help';\nimport { FormSchema } from '../form.types';\n\n/**\n * If given a value and schema, check if the value should be translated\n * from null to undefined to avoid issues with validation\n *\n * This function needs to be used for several reasons:\n * 1. CustomEvent does not allow `detail` to equal `undefined`, but we can call onChange with `undefined` in React\n * 2. `null` is treated as a valid value in a jsonschema and with marshmallow and it has its own type (null)\n * 3. Without changing `null` to `undefined` there would be no way to remove a field from\n * from the submitted form data once it had any data. (when POSTing, undefined is not posted since its not valid json)\n * 4. The only applies to custom web components since widgets handle transforming null/'' to undefined depending on the widget\n * and its purpose.\n *\n * Example:\n * If I have an object `{ name?: string, email?: string }` that I am using a custom web component for `name`,\n * then initially, the formData will be `{}` which is fine because neither name or email are required. Then if i input a\n * value for name the formData will be `{ name: 'some_value' }` which is also fine. But then if I want to remove name\n * from the form data I would delete all the text from the name input field. Web components would emit this empty value\n * as '' or null. If the web component tries to emit `undefined`, null would be emitted instead because CustomEvent has\n * a default `detail` value of null\n *\n * @param value - the value associated with the schema\n * @param schema - the schema for the value\n * @returns whether or not null should be changed to undefined\n */\nconst shouldChangeToUndefined = (value, schema): boolean => {\n return value === null && !schema.type.includes('null');\n};\n\nconst hasCustomComponent = (schema): boolean => {\n const name = schema.lime?.component?.name;\n if (!name) {\n return false;\n }\n\n try {\n verifyCustomComponentIsDefined(name);\n } catch {\n // eslint-disable-next-line no-console\n console.warn(`Custom component ${name} not defined`);\n\n return false;\n }\n\n return true;\n};\n\nconst verifyCustomComponentIsDefined = (elementName): void => {\n const supportsCustomElements = 'customElements' in window;\n\n if (!supportsCustomElements) {\n throw new Error(\n 'Custom form elements are not supported by this browser!',\n );\n }\n\n if (!customElements.get(elementName)) {\n throw new Error(`Custom form element '${elementName}' is not defined!`);\n }\n};\n\nconst getCustomComponent = (\n schema,\n): { name: string; props: { [key: string]: any } } => {\n const name = schema.lime?.component?.name;\n const props = schema.lime?.component?.props || {};\n\n return { name: name, props: props };\n};\n\n/**\n * Create properties from the factory that is set on `limel-form`\n *\n * @param formContext - the form context\n * @param schema - the schema for the current field\n * @returns the properties created by the factory\n */\nexport function getFactoryProps(\n formContext: any,\n schema: FormSchema,\n): Record<string, any> {\n const factory: (schema: FormSchema) => Record<string, any> =\n formContext.propsFactory;\n if (typeof factory !== 'function') {\n return {};\n }\n\n const props = factory(schema);\n if (!props) {\n return {};\n }\n\n return props;\n}\n\nexport class SchemaField extends React.Component<FieldProps> {\n state = {\n modified: false,\n };\n\n constructor(props) {\n super(props);\n this.handleChange = this.handleChange.bind(this);\n this.handleCustomComponentChange =\n this.handleCustomComponentChange.bind(this);\n }\n\n private hasValue() {\n const value = this.getValue();\n if (!value) {\n return false;\n }\n\n if (Array.isArray(value)) {\n return !!value.length;\n }\n\n if (typeof value === 'object') {\n return !isEmpty(value);\n }\n\n return true;\n }\n\n private getLabel() {\n const { schema } = this.props;\n\n return schema.title;\n }\n\n private isInvalid() {\n const { modified } = this.state;\n const { errorSchema } = this.props;\n\n return (\n (modified || this.hasValue() || !this.isRequired()) &&\n !isEmpty(errorSchema)\n );\n }\n\n private isRequired() {\n const { required, schema } = this.props;\n\n return required || schema.minItems > 0;\n }\n\n private getHelperText() {\n const { errorSchema, schema } = this.props;\n\n if (!this.isInvalid()) {\n const helperText = schema.lime?.component?.props?.helperText;\n\n return helperText || schema.description;\n }\n\n if (!isEmpty(errorSchema) && '__errors' in errorSchema) {\n return capitalize(errorSchema.__errors[0]); // eslint-disable-line no-underscore-dangle\n }\n\n return schema.description;\n }\n\n private getValue() {\n const { formData } = this.props;\n\n return formData;\n }\n\n private handleCustomComponentChange(event) {\n const { schema } = this.props;\n event.stopPropagation();\n\n let value = event.detail;\n\n if (shouldChangeToUndefined(value, schema)) {\n value = undefined;\n }\n\n this.handleChange(value);\n }\n\n private handleChange(data) {\n const { formData, schema } = this.props;\n const { rootSchema } = this.props.registry;\n\n this.setState({ modified: true });\n\n const newData = resetDependentFields(\n formData,\n data,\n schema,\n rootSchema,\n );\n\n this.props.onChange(newData);\n }\n\n private buildCustomComponentProps() {\n const {\n disabled,\n readonly,\n name,\n registry,\n schema,\n errorSchema,\n idSchema,\n } = this.props;\n const factoryProps = getFactoryProps(registry.formContext, schema);\n\n return {\n ...factoryProps,\n value: this.getValue(),\n required: this.isRequired(),\n readonly: readonly || schema.readOnly,\n disabled: disabled,\n invalid: this.isInvalid(),\n label: this.getLabel(),\n helperText: this.getHelperText(),\n formInfo: {\n schema: schema,\n rootSchema: registry.formContext.schema,\n errorSchema: errorSchema,\n rootValue: registry.formContext.rootValue,\n name: name,\n schemaPath: this.getSchemaPath(idSchema?.$id),\n },\n };\n }\n\n private renderCustomComponent(props: FieldProps) {\n const { name, props: userDefinedComponentProps } = getCustomComponent(\n props.schema,\n );\n\n verifyCustomComponentIsDefined(name);\n\n const component = React.createElement(LimeElementsAdapter, {\n name: name,\n elementProps: {\n ...userDefinedComponentProps,\n ...this.buildCustomComponentProps(),\n },\n events: {\n change: this.handleCustomComponentChange,\n },\n });\n\n return React.createElement(\n FieldTemplate,\n {\n ...this.props,\n classNames: 'form-group field field-custom',\n },\n component,\n getHelpComponent(props.schema),\n );\n }\n\n render() {\n if (hasCustomComponent(this.props.schema)) {\n return this.renderCustomComponent(this.props);\n }\n\n const fieldProps = {\n ...this.props,\n onChange: this.handleChange,\n };\n\n return React.createElement(JSONSchemaField, fieldProps);\n }\n\n /**\n * Gets the path to the current property within the schema\n *\n * @param schemaId - the id of the schema\n * @returns an array with the schema path for the current property\n * @example\n * const schemaId = 'root_sections_0_controls_0_name';\n * const schemaPath = getSchemaPath(schemaId);\n * // ➡ ['sections', '0', 'controls', '0', 'name']\n */\n private getSchemaPath(schemaId: string): string[] {\n if (schemaId === undefined) {\n return undefined;\n }\n\n return schemaId.replace('root_', '').split('_');\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/form/fields/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface FieldProps {\n readonly: boolean;\n title?: string;\n disabled: boolean;\n required: boolean;\n name: string;\n schema: any;\n uiSchema: any;\n idSchema: any;\n formData: any;\n errorSchema: any;\n registry: Registry;\n formContext: any;\n onChange: (formData: any) => void;\n}\n\nexport interface ArrayProps {\n disabled: boolean;\n errorSchema: any;\n formContext: any;\n formData: any;\n idPrefix: any;\n idSchema: any;\n name: string;\n rawErrors: any;\n readonly: boolean;\n registry: any;\n required: boolean;\n schema: any;\n uiSchema: any;\n wasPropertyKeyModified: boolean;\n onChange: (formData: any, errorSchema: any) => void;\n}\n\nexport interface Registry {\n fields: any;\n widgets: any;\n rootSchema: any;\n formContext: any;\n definitions: any;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/form/fields/types.ts"],"names":[],"mappings":"","sourcesContent":["import { FormSchema } from '../form.types';\n\nexport interface FieldProps {\n readonly: boolean;\n title?: string;\n disabled: boolean;\n required: boolean;\n name: string;\n schema: FormSchema;\n uiSchema: any;\n idSchema: any;\n formData: any;\n errorSchema: any;\n registry: Registry;\n formContext: any;\n onChange: (formData: any) => void;\n}\n\nexport interface ArrayProps {\n disabled: boolean;\n errorSchema: any;\n formContext: any;\n formData: any;\n idPrefix: any;\n idSchema: any;\n name: string;\n rawErrors: any;\n readonly: boolean;\n registry: any;\n required: boolean;\n schema: FormSchema;\n uiSchema: any;\n wasPropertyKeyModified: boolean;\n onChange: (formData: any, errorSchema: any) => void;\n}\n\nexport interface Registry {\n fields: any;\n widgets: any;\n rootSchema: FormSchema;\n formContext: any;\n definitions: any;\n}\n"]}
@@ -206,7 +206,7 @@ export class Form {
206
206
  "mutable": false,
207
207
  "complexType": {
208
208
  "original": "FormSchema",
209
- "resolved": "FormSchema",
209
+ "resolved": "FormSchema<any>",
210
210
  "references": {
211
211
  "FormSchema": {
212
212
  "location": "import",
@@ -260,7 +260,7 @@ export class Form {
260
260
  "mutable": false,
261
261
  "complexType": {
262
262
  "original": "(schema: FormSchema) => Record<string, any>",
263
- "resolved": "(schema: FormSchema) => Record<string, any>",
263
+ "resolved": "(schema: FormSchema<any>) => Record<string, any>",
264
264
  "references": {
265
265
  "FormSchema": {
266
266
  "location": "import",
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @public
3
2
  * Represents the layout types for a form.
3
+ * @public
4
4
  */
5
5
  export var FormLayoutType;
6
6
  (function (FormLayoutType) {
@@ -1 +1 @@
1
- {"version":3,"file":"form.types.js","sourceRoot":"","sources":["../../../src/components/form/form.types.ts"],"names":[],"mappings":"AAwSA;;;GAGG;AACH,MAAM,CAAN,IAAY,cAmBX;AAnBD,WAAY,cAAc;EACtB;;KAEG;EACH,qCAAmB,CAAA;EAEnB;;KAEG;EACH,+BAAa,CAAA;EAEb;;;;;;KAMG;EACH,6BAAW,CAAA;AACf,CAAC,EAnBW,cAAc,KAAd,cAAc,QAmBzB","sourcesContent":["import { JSONSchema7 } from 'json-schema';\nimport { Help } from '../help/help.types';\nimport { EventEmitter } from '@stencil/core';\n\n/**\n * EventEmitter from `@stencil/core`.\n *\n * @public\n */\nexport { EventEmitter } from '@stencil/core';\n\ndeclare module 'json-schema' {\n interface JSONSchema7 {\n /**\n * @internal\n * Unique identifier for the schema\n */\n id?: string;\n\n /**\n * Lime elements specific options that can be specified in a schema\n */\n lime?: Omit<LimeSchemaOptions, 'layout'> & {\n layout?: Partial<LimeLayoutOptions>;\n };\n }\n}\n\n/**\n * @public\n */\nexport interface ValidationStatus {\n /**\n * True if the form is valid, false otherwise\n *\n * If the form is invalid, any errors can be found on the `errors` property\n */\n valid: boolean;\n\n /**\n * List of validation errors\n */\n errors?: FormError[];\n}\n\n/**\n * @public\n */\nexport interface FormError {\n /**\n * Name of the error\n */\n name: string;\n\n /**\n * Params of the error\n */\n params?: unknown;\n\n /**\n * Name of the invalid property\n */\n property: string;\n\n /**\n * Path to the property within the schema\n */\n schemaPath: string;\n\n /**\n * String describing the error\n */\n message: string;\n}\n\n/**\n * @public\n */\nexport type ValidationError = {\n /**\n * Name of the field the error belongs to\n */\n [key: string]: string[] | ValidationError;\n};\n\n/**\n * @public\n */\nexport interface FormComponent<T = any> {\n /**\n * The value of the current property\n */\n value: T;\n\n /**\n * Whether or not the current property is required\n */\n required?: boolean;\n\n /**\n * Whether or not the current property is readonly\n */\n readonly?: boolean;\n\n /**\n * Whether or not the current property is disabled\n */\n disabled?: boolean;\n\n /**\n * The label of the current property\n */\n label?: string;\n\n /**\n * The helper text for the current property\n */\n helperText?: string;\n\n /**\n * Additional contextual information about the form\n */\n formInfo?: FormInfo;\n\n /**\n * The event to emit when the value of the current property has changed\n */\n change: EventEmitter<T>;\n}\n\n/**\n * @public\n */\nexport interface FormInfo {\n /**\n * The schema of the current property\n */\n schema?: FormSchema;\n\n /**\n * The schema of the whole form\n */\n rootSchema?: FormSchema;\n\n /**\n * A tree of errors for this property and its children\n */\n errorSchema?: object;\n\n /**\n * The value of the whole form\n */\n rootValue?: any;\n\n /**\n * The name of the current property\n */\n name?: string;\n\n /**\n * Path to the property within the schema\n */\n schemaPath?: string[];\n}\n\n/**\n * Lime elements specific options that can be specified under the `lime` key in\n * a schema, e.g.\n *\n * ```ts\n * const schema = {\n * type: 'object',\n * lime: {\n * collapsible: true,\n * },\n * };\n * ```\n *\n * @public\n */\nexport interface LimeSchemaOptions {\n /**\n * When specified on an object it will render all sub components inside a\n * collapsible section\n */\n collapsible?: boolean;\n\n /**\n * When `collapsible` is `true`, set this to `false` to make the\n * collapsible section load in the open state.\n * Defaults to `true`.\n */\n collapsed?: boolean;\n\n /**\n * Will render the field using the specified component. The component\n * should implement the `FormComponent` interface\n */\n component?: FormComponentOptions;\n\n /**\n * When specified on an object it will render the sub components with the\n * specified layout\n */\n layout?: LimeLayoutOptions;\n\n /**\n * Mark the field as disabled\n */\n disabled?: boolean;\n\n help?: string | Partial<Help>;\n}\n\n/**\n * @public\n * Options for a layout to be used in a form\n */\nexport type LimeLayoutOptions = GridLayoutOptions & RowLayoutOptions;\n\n/**\n * Options for a component to be rendered inside a form\n *\n * @public\n */\nexport interface FormComponentOptions {\n /**\n * Name of the component\n */\n name?: string;\n\n /**\n * Extra properties to give the component in addition to the properties\n * specified on the `FormComponent` interface\n */\n props?: Record<string, any>;\n}\n\n/**\n * @public\n */\nexport interface FormLayoutOptions<\n T extends FormLayoutType | `${FormLayoutType}` = FormLayoutType.Default,\n> {\n /**\n * The type of layout to use\n */\n type: T;\n}\n\n/**\n * @public\n * Layout options for a grid layout\n */\nexport interface GridLayoutOptions\n extends FormLayoutOptions<FormLayoutType | `${FormLayoutType}`> {\n /**\n * When specified on a component within the grid, the component will take\n * up the the specified number of columns in the form\n */\n // eslint-disable-next-line no-magic-numbers\n colSpan?: 1 | 2 | 3 | 4 | 5 | 'all';\n\n /**\n * When specified on a component within the grid, the component will take\n * up the the specified number of rows in the form\n */\n rowSpan?: number;\n\n /**\n * Number of columns to use in the layout\n */\n // eslint-disable-next-line no-magic-numbers\n columns?: 1 | 2 | 3 | 4 | 5;\n\n /**\n * Attempts to fill in holes earlier in the grid, if smaller items come up\n * later. This may cause items to appear out-of-order, when doing so would\n * fill holes left by larger items. Defaults to `true`.\n */\n dense?: boolean;\n}\n\n/**\n * @public\n * Layout options for a row layout\n */\nexport interface RowLayoutOptions\n extends FormLayoutOptions<FormLayoutType | `${FormLayoutType}`> {\n /**\n * When specified on a field, the chosen icon will be displayed\n * on the left side of the row, beside the title.\n */\n icon?: string;\n}\n\n/**\n * @public\n * Represents the layout types for a form.\n */\nexport enum FormLayoutType {\n /**\n * The default layout\n */\n Default = 'default',\n\n /**\n * Render the form fields using a responsive grid layout\n */\n Grid = 'grid',\n\n /**\n * Render the form fields in full-width rows.\n * Each row can have a leading `icon`, and a field.\n * `title` and `description` provided by the schema will be placed\n * on the row itself, and not on the field.\n * This layout is good for creating UIs for user settings pages.\n */\n Row = 'row',\n}\n\n/**\n * @public\n * Represents the JSON schema with Lime specific options\n */\nexport interface FormSchema extends JSONSchema7 {}\n"]}
1
+ {"version":3,"file":"form.types.js","sourceRoot":"","sources":["../../../src/components/form/form.types.ts"],"names":[],"mappings":"AAwSA;;;GAGG;AACH,MAAM,CAAN,IAAY,cAmBX;AAnBD,WAAY,cAAc;EACtB;;KAEG;EACH,qCAAmB,CAAA;EAEnB;;KAEG;EACH,+BAAa,CAAA;EAEb;;;;;;KAMG;EACH,6BAAW,CAAA;AACf,CAAC,EAnBW,cAAc,KAAd,cAAc,QAmBzB","sourcesContent":["import { JSONSchema7 } from 'json-schema';\nimport { Help } from '../help/help.types';\nimport { EventEmitter } from '@stencil/core';\n\n/**\n * EventEmitter from `@stencil/core`.\n *\n * @public\n */\nexport { EventEmitter } from '@stencil/core';\n\ndeclare module 'json-schema' {\n interface JSONSchema7 {\n /**\n * @internal\n * Unique identifier for the schema\n */\n id?: string;\n\n /**\n * Lime elements specific options that can be specified in a schema\n */\n lime?: Omit<LimeSchemaOptions, 'layout'> & {\n layout?: Partial<LimeLayoutOptions>;\n };\n }\n}\n\n/**\n * @public\n */\nexport interface ValidationStatus {\n /**\n * True if the form is valid, false otherwise\n *\n * If the form is invalid, any errors can be found on the `errors` property\n */\n valid: boolean;\n\n /**\n * List of validation errors\n */\n errors?: FormError[];\n}\n\n/**\n * @public\n */\nexport interface FormError {\n /**\n * Name of the error\n */\n name: string;\n\n /**\n * Params of the error\n */\n params?: unknown;\n\n /**\n * Name of the invalid property\n */\n property: string;\n\n /**\n * Path to the property within the schema\n */\n schemaPath: string;\n\n /**\n * String describing the error\n */\n message: string;\n}\n\n/**\n * @public\n */\nexport type ValidationError = {\n /**\n * Name of the field the error belongs to\n */\n [key: string]: string[] | ValidationError;\n};\n\n/**\n * @public\n */\nexport interface FormComponent<T = any> {\n /**\n * The value of the current property\n */\n value: T;\n\n /**\n * Whether or not the current property is required\n */\n required?: boolean;\n\n /**\n * Whether or not the current property is readonly\n */\n readonly?: boolean;\n\n /**\n * Whether or not the current property is disabled\n */\n disabled?: boolean;\n\n /**\n * The label of the current property\n */\n label?: string;\n\n /**\n * The helper text for the current property\n */\n helperText?: string;\n\n /**\n * Additional contextual information about the form\n */\n formInfo?: FormInfo;\n\n /**\n * The event to emit when the value of the current property has changed\n */\n change: EventEmitter<T>;\n}\n\n/**\n * @public\n */\nexport interface FormInfo {\n /**\n * The schema of the current property\n */\n schema?: FormSchema;\n\n /**\n * The schema of the whole form\n */\n rootSchema?: FormSchema;\n\n /**\n * A tree of errors for this property and its children\n */\n errorSchema?: object;\n\n /**\n * The value of the whole form\n */\n rootValue?: any;\n\n /**\n * The name of the current property\n */\n name?: string;\n\n /**\n * Path to the property within the schema\n */\n schemaPath?: string[];\n}\n\n/**\n * Lime elements specific options that can be specified under the `lime` key in\n * a schema, e.g.\n *\n * ```ts\n * const schema = {\n * type: 'object',\n * lime: {\n * collapsible: true,\n * },\n * };\n * ```\n *\n * @public\n */\nexport interface LimeSchemaOptions {\n /**\n * When specified on an object it will render all sub components inside a\n * collapsible section\n */\n collapsible?: boolean;\n\n /**\n * When `collapsible` is `true`, set this to `false` to make the\n * collapsible section load in the open state.\n * Defaults to `true`.\n */\n collapsed?: boolean;\n\n /**\n * Will render the field using the specified component. The component\n * should implement the `FormComponent` interface\n */\n component?: FormComponentOptions;\n\n /**\n * When specified on an object it will render the sub components with the\n * specified layout\n */\n layout?: LimeLayoutOptions;\n\n /**\n * Mark the field as disabled\n */\n disabled?: boolean;\n\n help?: string | Partial<Help>;\n}\n\n/**\n * Options for a layout to be used in a form\n * @public\n */\nexport type LimeLayoutOptions = GridLayoutOptions & RowLayoutOptions;\n\n/**\n * Options for a component to be rendered inside a form\n *\n * @public\n */\nexport interface FormComponentOptions {\n /**\n * Name of the component\n */\n name?: string;\n\n /**\n * Extra properties to give the component in addition to the properties\n * specified on the `FormComponent` interface\n */\n props?: Record<string, any>;\n}\n\n/**\n * @public\n */\nexport interface FormLayoutOptions<\n T extends FormLayoutType | `${FormLayoutType}` = FormLayoutType.Default,\n> {\n /**\n * The type of layout to use\n */\n type: T;\n}\n\n/**\n * Layout options for a grid layout\n * @public\n */\nexport interface GridLayoutOptions\n extends FormLayoutOptions<FormLayoutType | `${FormLayoutType}`> {\n /**\n * When specified on a component within the grid, the component will take\n * up the the specified number of columns in the form\n */\n // eslint-disable-next-line no-magic-numbers\n colSpan?: 1 | 2 | 3 | 4 | 5 | 'all';\n\n /**\n * When specified on a component within the grid, the component will take\n * up the the specified number of rows in the form\n */\n rowSpan?: number;\n\n /**\n * Number of columns to use in the layout\n */\n // eslint-disable-next-line no-magic-numbers\n columns?: 1 | 2 | 3 | 4 | 5;\n\n /**\n * Attempts to fill in holes earlier in the grid, if smaller items come up\n * later. This may cause items to appear out-of-order, when doing so would\n * fill holes left by larger items. Defaults to `true`.\n */\n dense?: boolean;\n}\n\n/**\n * Layout options for a row layout\n * @public\n */\nexport interface RowLayoutOptions\n extends FormLayoutOptions<FormLayoutType | `${FormLayoutType}`> {\n /**\n * When specified on a field, the chosen icon will be displayed\n * on the left side of the row, beside the title.\n */\n icon?: string;\n}\n\n/**\n * Represents the layout types for a form.\n * @public\n */\nexport enum FormLayoutType {\n /**\n * The default layout\n */\n Default = 'default',\n\n /**\n * Render the form fields using a responsive grid layout\n */\n Grid = 'grid',\n\n /**\n * Render the form fields in full-width rows.\n * Each row can have a leading `icon`, and a field.\n * `title` and `description` provided by the schema will be placed\n * on the row itself, and not on the field.\n * This layout is good for creating UIs for user settings pages.\n */\n Row = 'row',\n}\n\n/**\n * Represents the JSON schema with Lime specific options\n * @public\n */\nexport interface FormSchema<T extends Record<string, any> = any>\n extends JSONSchema7 {\n /**\n * The value of \"items\" MUST be either a valid JSON Schema or an array\n * of valid JSON Schemas.\n *\n * This keyword determines how child instances validate for arrays, and\n * does not directly validate the immediate instance itself.\n *\n * If \"items\" is a schema, validation succeeds if all elements in the\n * array successfully validate against that schema.\n *\n * If \"items\" is an array of schemas, validation succeeds if each\n * element of the instance validates against the schema at the same\n * position, if any.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.4.1\n */\n items?: FormSchemaArrayItem<T> | Array<FormSchemaArrayItem<T>>;\n\n /**\n * The value of \"items\" MUST be either a valid JSON Schema or an array\n * of valid JSON Schemas.\n *\n * This keyword determines how child instances validate for arrays, and\n * does not directly validate the immediate instance itself.\n *\n * If \"items\" is a schema, validation succeeds if all elements in the\n * array successfully validate against that schema.\n *\n * If \"items\" is an array of schemas, validation succeeds if each\n * element of the instance validates against the schema at the same\n * position, if any.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.4.2\n */\n additionalItems?: FormSchemaArrayItem<T>;\n\n /**\n * The value of this keyword MUST be a valid JSON Schema.\n *\n * An array instance is valid against \"contains\" if at least one of its\n * elements is valid against the given schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.4.6\n */\n contains?: FormSchemaArrayItem<T>;\n\n /**\n * The value of this keyword MUST be an array. Elements of this array,\n * if any, MUST be strings, and MUST be unique.\n *\n * An object instance is valid against this keyword if every item in the\n * array is the name of a property in the instance.\n *\n * Omitting this keyword has the same behavior as an empty array.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.3\n */\n required?: Array<ReplaceObjectType<T, Extract<keyof T, string>, string>>;\n\n /**\n * The value of \"properties\" MUST be an object. Each value of this\n * object MUST be a valid JSON Schema.\n *\n * This keyword determines how child instances validate for objects, and\n * does not directly validate the immediate instance itself.\n *\n * Validation succeeds if, for each name that appears in both the\n * instance and as a name within this keyword's value, the child\n * instance for that name successfully validates against the\n * corresponding schema.\n *\n * Omitting this keyword has the same behavior as an empty object.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.4\n */\n properties?: ReplaceObjectType<\n T,\n FormSubKeySchema<T>,\n Record<string, FormSchema>\n >;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the\n * array MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it\n * validates successfully against all schemas defined by this keyword's\n * value.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7.1\n */\n allOf?: Array<FormSchemaArrayItem<T>>;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the\n * array MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it\n * validates successfully against at least one schema defined by this\n * keyword's value.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7.2\n */\n anyOf?: Array<FormSchemaArrayItem<T>>;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the\n * array MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it\n * validates successfully against exactly one schema defined by this\n * keyword's value.\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7.3\n */\n oneOf?: Array<FormSchemaArrayItem<T>>;\n\n /**\n * The value of \"patternProperties\" MUST be an object. Each property\n * name of this object SHOULD be a valid regular expression, according\n * to the ECMA 262 regular expression dialect. Each property value of\n * this object MUST be a valid JSON Schema.\n *\n * This keyword determines how child instances validate for objects, and\n * does not directly validate the immediate instance itself. Validation\n * of the primitive instance type against this keyword always succeeds.\n *\n * Validation succeeds if, for each instance name that matches any\n * regular expressions that appear as a property name in this keyword's\n * value, the child instance for that name successfully validates\n * against each schema that corresponds to a matching regular\n * expression.\n *\n * Omitting this keyword has the same behavior as an empty object.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.5\n */\n patternProperties?: Record<string, FormSchema>;\n\n /**\n * The value of \"additionalProperties\" MUST be a valid JSON Schema.\n *\n * This keyword determines how child instances validate for objects, and\n * does not directly validate the immediate instance itself.\n *\n * Validation with \"additionalProperties\" applies only to the child\n * values of instance names that do not match any names in \"properties\",\n * and do not match any regular expression in \"patternProperties\".\n *\n * For all such properties, validation succeeds if the child instance\n * validates against the \"additionalProperties\" schema.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.6\n */\n additionalProperties?: FormSchema | boolean;\n\n /**\n * This keyword specifies rules that are evaluated if the instance is an\n * object and contains a certain property.\n *\n * This keyword's value MUST be an object. Each property specifies a\n * dependency. Each dependency value MUST be an array or a valid JSON\n * Schema.\n *\n * If the dependency value is a subschema, and the dependency key is a\n * property in the instance, the entire instance must validate against\n * the dependency value.\n *\n * If the dependency value is an array, each element in the array, if\n * any, MUST be a string, and MUST be unique. If the dependency key is\n * a property in the instance, each of the items in the dependency value\n * must be a property that exists in the instance.\n *\n * Omitting this keyword has the same behavior as an empty object.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.7\n */\n dependencies?: Record<string, FormSchema | string[]>;\n\n /**\n * The value of \"propertyNames\" MUST be a valid JSON Schema.\n *\n * If the instance is an object, this keyword validates if every\n * property name in the instance validates against the provided schema.\n * Note the property name that the schema is testing will always be a\n * string.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.5.8\n */\n propertyNames?: FormSchema;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * This validation outcome of this keyword's subschema has no direct\n * effect on the overall validation result. Rather, it controls which\n * of the \"then\" or \"else\" keywords are evaluated.\n *\n * Instances that successfully validate against this keyword's subschema\n * MUST also be valid against the subschema value of the \"then\" keyword,\n * if present.\n *\n * Instances that fail to validate against this keyword's subschema MUST\n * also be valid against the subschema value of the \"else\" keyword, if\n * present.\n *\n * If annotations (Section 3.3) are being collected, they are collected\n * from this keyword's subschema in the usual way, including when the\n * keyword is present without either \"then\" or \"else\".\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.6.1\n */\n if?: FormSchema;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * This validation outcome of this keyword's subschema has no direct\n * effect on the overall validation result. Rather, it controls which\n * of the \"then\" or \"else\" keywords are evaluated.\n *\n * Instances that successfully validate against this keyword's subschema\n * MUST also be valid against the subschema value of the \"then\" keyword,\n * if present.\n *\n * Instances that fail to validate against this keyword's subschema MUST\n * also be valid against the subschema value of the \"else\" keyword, if\n * present.\n *\n * If annotations (Section 3.3) are being collected, they are collected\n * from this keyword's subschema in the usual way, including when the\n * keyword is present without either \"then\" or \"else\".\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.6.2\n */\n then?: FormSchema;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * When \"if\" is present, and the instance fails to validate against its\n * subschema, then valiation succeeds against this keyword if the\n * instance successfully validates against this keyword's subschema.\n *\n * This keyword has no effect when \"if\" is absent, or when the instance\n * successfully validates against its subschema. Implementations MUST\n * NOT evaluate the instance against this keyword, for either validation\n * or annotation collection purposes, in such cases.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.6.3\n */\n else?: FormSchema;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * An instance is valid against this keyword if it fails to validate\n * successfully against the schema defined by this keyword.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-6.7.4\n */\n not?: FormSchema;\n\n /**\n * The \"$defs\" keywords provides a standardized location for\n * schema authors to inline re-usable JSON Schemas into a more general\n * schema. The keyword does not directly affect the validation result.\n *\n * This keyword's value MUST be an object. Each member value of this\n * object MUST be a valid JSON Schema.\n *\n * As an example, here is a schema describing an array of positive\n * integers, where the positive integer constraint is a subschema in\n * \"definitions\":\n * ```\n * {\n * \"type\": \"array\",\n * \"items\": { \"$ref\": \"#/definitions/positiveInteger\" },\n * \"definitions\": {\n * \"positiveInteger\": {\n * \"type\": \"integer\",\n * \"exclusiveMinimum\": 0\n * }\n * }\n * }\n * ```\n *\n * $defs is the newer keyword introduced in the JSON Schema Draft 2019-09, while definitions is from the older drafts.\n *\n * The main difference is that definitions is no longer an official keyword in the latest JSON Schema specification (Draft 2019-09 and later),\n * but it is still widely supported for backward compatibility.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-9\n */\n $defs?: Record<string, FormSchema>;\n\n /**\n * The \"definitions\" keywords provides a standardized location for\n * schema authors to inline re-usable JSON Schemas into a more general\n * schema. The keyword does not directly affect the validation result.\n *\n * This keyword's value MUST be an object. Each member value of this\n * object MUST be a valid JSON Schema.\n *\n * As an example, here is a schema describing an array of positive\n * integers, where the positive integer constraint is a subschema in\n * \"definitions\":\n * ```\n * {\n * \"type\": \"array\",\n * \"items\": { \"$ref\": \"#/definitions/positiveInteger\" },\n * \"definitions\": {\n * \"positiveInteger\": {\n * \"type\": \"integer\",\n * \"exclusiveMinimum\": 0\n * }\n * }\n * }\n * ```\n *\n * $defs is the newer keyword introduced in the JSON Schema Draft 2019-09, while definitions is from the older drafts.\n *\n * The main difference is that definitions is no longer an official keyword in the latest JSON Schema specification (Draft 2019-09 and later),\n * but it is still widely supported for backward compatibility.\n *\n * @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-9\n */\n definitions?: Record<string, FormSchema>;\n}\n\n/**\n * Utility type for replacing object types with a specified type\n * @public\n */\nexport type ReplaceObjectType<T, AllowedType, ElseType> = T extends any[]\n ? ElseType\n : T extends Record<string, any>\n ? AllowedType\n : ElseType;\n\n/**\n * Utility type for supporting nested sub items in arrays\n * @public\n */\nexport type FormSchemaArrayItem<T> = T extends any[]\n ? FormSchema<T[Extract<keyof T, number>]>\n : FormSchema;\n\n/**\n * Utility type for recursive properties in a schema\n * @public\n */\nexport type FormSubKeySchema<TObj> = Partial<{\n [Key in Extract<keyof TObj, any>]: FormSchema<TObj[Key]>;\n}>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/components/form/schema.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY,CAAC,SAAc,EAAE;EACzC,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAW;EACnC,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAW;EACpC,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAW;EACpC,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAAW;EACrC,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,MAAM,CAAC,KAAwB,EAAE,IAAY;EAClD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;IACtB,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;GAC/B;EAED,OAAO,KAAK,KAAK,IAAI,CAAC;AAC1B,CAAC","sourcesContent":["export function isObjectType(schema: any = {}) {\n return isType(schema.type, 'object');\n}\n\nexport function isArrayType(schema: any) {\n return isType(schema.type, 'array');\n}\n\nexport function isStringType(schema: any) {\n return isType(schema.type, 'string');\n}\n\nexport function isNumberType(schema: any) {\n return isType(schema.type, 'number');\n}\n\nexport function isIntegerType(schema: any) {\n return isType(schema.type, 'integer');\n}\n\nfunction isType(input: string | string[], type: string) {\n if (Array.isArray(input)) {\n return input.includes(type);\n }\n\n return input === type;\n}\n"]}
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/components/form/schema.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,YAAY,CAAC,SAAqB,EAAE;EAChD,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAkB;EAC1C,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAkB;EAC3C,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAkB;EAC3C,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAAkB;EAC5C,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,MAAM,CAAC,KAAyB,EAAE,IAAyB;EAChE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;IACtB,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;GAC/B;EAED,OAAO,KAAK,KAAK,IAAI,CAAC;AAC1B,CAAC","sourcesContent":["import { JSONSchema7TypeName } from 'json-schema';\nimport { FormSchema } from './form.types';\n\nexport function isObjectType(schema: FormSchema = {}) {\n return isType(schema.type, 'object');\n}\n\nexport function isArrayType(schema: FormSchema) {\n return isType(schema.type, 'array');\n}\n\nexport function isStringType(schema: FormSchema) {\n return isType(schema.type, 'string');\n}\n\nexport function isNumberType(schema: FormSchema) {\n return isType(schema.type, 'number');\n}\n\nexport function isIntegerType(schema: FormSchema) {\n return isType(schema.type, 'integer');\n}\n\nfunction isType(input: FormSchema['type'], type: JSONSchema7TypeName) {\n if (Array.isArray(input)) {\n return input.includes(type);\n }\n\n return input === type;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"array-field-collapsible-item.js","sourceRoot":"","sources":["../../../../src/components/form/templates/array-field-collapsible-item.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6BpC,MAAM,OAAO,uBAAwB,SAAQ,KAAK,CAAC,SAAS;EAIxD,YAAmB,KAA2B;IAC1C,KAAK,CAAC,KAAK,CAAC,CAAC;IADE,UAAK,GAAL,KAAK,CAAsB;IAE1C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjD,IAAI,CAAC,WAAW,GAAG,IAAI,CA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AAQ,EAAE,CAAC,IAAI,CAAC,WAAW;QAC3B,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC;OAC7C;MACD;QACI,EAAE,EAAE,IAAI;QACR,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,CAAC,IAAI,CAAC,SAAS;QACzB,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC;OAC7C;MACD;QACI,EAAE,EAAE,QAAQ;QACZ,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,CAAC,IAAI,CAAC,SAAS;QACzB,GAAG,EAAE,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC;OACpC;KACJ,CAAC;IAEF,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;EAC9B,CAAC;EAEO,YAAY,CAAC,KAAqC;IACtD,KAAK,CAAC,eAAe,EAAE,CAAC;IACxB,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;EAC5B,CAAC;EAEO,WAAW,CAAC,IAAI;IACpB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;MAC1B,OAAO,KAAK,CAAC;KAChB;IAED,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE;MACf,OAAO,IAAI,CAAC;KACf;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;EACvD,CAAC;CACJ","sourcesContent":["import { Action } from '../../collapsible-section/action';\nimport React from 'react';\nimport { findTitle } from './common';\nimport { ArrayFieldItem, Runnable } from './types';\nimport { isEmpty } from 'lodash-es';\n\ninterface CollapsibleItemProps {\n /**\n * Data from reach-jsonschema-form\n */\n item: ArrayFieldItem;\n\n /**\n * The index of the field in the array\n */\n index: number;\n\n /**\n * The value of the field\n */\n data: any;\n\n /**\n * Schema for the field\n */\n schema: any;\n\n /**\n * Schema for the entire form\n */\n formSchema: any;\n}\n\nexport class CollapsibleItemTemplate extends React.Component {\n public refs: { section: any };\n private isOpen: boolean;\n\n constructor(public props: CollapsibleItemProps) {\n super(props);\n this.handleAction = this.handleAction.bind(this);\n this.isDeepEmpty = this.isDeepEmpty.bind(this);\n\n this.isOpen = this.isDeepEmpty(props.data);\n }\n\n public componentDidMount() {\n const section: HTMLLimelCollapsibleSectionElement = this.refs.section;\n section.addEventListener('action', this.handleAction);\n\n this.setActions(section);\n }\n\n public componentDidUpdate() {\n const section: HTMLLimelCollapsibleSectionElement = this.refs.section;\n this.setActions(section);\n }\n\n public componentWillUnmount() {\n const section: HTMLLimelCollapsibleSectionElement = this.refs.section;\n section.removeEventListener('action', this.handleAction);\n }\n\n public render() {\n const { data, schema, formSchema } = this.props;\n\n return React.createElement(\n 'limel-collapsible-section',\n {\n header: findTitle(data, schema, formSchema) || 'New item',\n class: 'limel-form-array-item--object',\n ref: 'section',\n 'is-open': this.isOpen,\n },\n this.props.item.children,\n );\n }\n\n private setActions(element: HTMLLimelCollapsibleSectionElement) {\n const { item, index } = this.props;\n const actions: Array<Action & Runnable> = [\n {\n id: 'down',\n icon: 'down_arrow',\n disabled: !item.hasMoveDown,\n run: item.onReorderClick(index, index + 1),\n },\n {\n id: 'up',\n icon: 'up_arrow',\n disabled: !item.hasMoveUp,\n run: item.onReorderClick(index, index - 1),\n },\n {\n id: 'remove',\n icon: 'trash',\n disabled: !item.hasRemove,\n run: item.onDropIndexClick(index),\n },\n ];\n\n element.actions = actions;\n }\n\n private handleAction(event: CustomEvent<Action & Runnable>) {\n event.stopPropagation();\n event.detail.run(event);\n }\n\n private isDeepEmpty(data) {\n if (typeof data !== 'object') {\n return false;\n }\n\n if (isEmpty(data)) {\n return true;\n }\n\n return Object.values(data).every(this.isDeepEmpty);\n }\n}\n"]}
1
+ {"version":3,"file":"array-field-collapsible-item.js","sourceRoot":"","sources":["../../../../src/components/form/templates/array-field-collapsible-item.ts"],"names":[],"mappings":"AACA,OA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MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;EACvD,CAAC;CACJ","sourcesContent":["import { Action } from '../../collapsible-section/action';\nimport React from 'react';\nimport { findTitle } from './common';\nimport { ArrayFieldItem, Runnable } from './types';\nimport { isEmpty } from 'lodash-es';\nimport { JSONSchema7 } from 'json-schema';\n\ninterface CollapsibleItemProps {\n /**\n * Data from reach-jsonschema-form\n */\n item: ArrayFieldItem;\n\n /**\n * The index of the field in the array\n */\n index: number;\n\n /**\n * The value of the field\n */\n data: any;\n\n /**\n * Schema for the field\n */\n schema: JSONSchema7;\n\n /**\n * Schema for the entire form\n */\n formSchema: JSONSchema7;\n}\n\nexport class CollapsibleItemTemplate extends React.Component {\n public refs: { section: any };\n private isOpen: boolean;\n\n constructor(public props: CollapsibleItemProps) {\n super(props);\n this.handleAction = this.handleAction.bind(this);\n this.isDeepEmpty = this.isDeepEmpty.bind(this);\n\n this.isOpen = this.isDeepEmpty(props.data);\n }\n\n public componentDidMount() {\n const section: HTMLLimelCollapsibleSectionElement = this.refs.section;\n section.addEventListener('action', this.handleAction);\n\n this.setActions(section);\n }\n\n public componentDidUpdate() {\n const section: HTMLLimelCollapsibleSectionElement = this.refs.section;\n this.setActions(section);\n }\n\n public componentWillUnmount() {\n const section: HTMLLimelCollapsibleSectionElement = this.refs.section;\n section.removeEventListener('action', this.handleAction);\n }\n\n public render() {\n const { data, schema, formSchema } = this.props;\n\n return React.createElement(\n 'limel-collapsible-section',\n {\n header: findTitle(data, schema, formSchema) || 'New item',\n class: 'limel-form-array-item--object',\n ref: 'section',\n 'is-open': this.isOpen,\n },\n this.props.item.children,\n );\n }\n\n private setActions(element: HTMLLimelCollapsibleSectionElement) {\n const { item, index } = this.props;\n const actions: Array<Action & Runnable> = [\n {\n id: 'down',\n icon: 'down_arrow',\n disabled: !item.hasMoveDown,\n run: item.onReorderClick(index, index + 1),\n },\n {\n id: 'up',\n icon: 'up_arrow',\n disabled: !item.hasMoveUp,\n run: item.onReorderClick(index, index - 1),\n },\n {\n id: 'remove',\n icon: 'trash',\n disabled: !item.hasRemove,\n run: item.onDropIndexClick(index),\n },\n ];\n\n element.actions = actions;\n }\n\n private handleAction(event: CustomEvent<Action & Runnable>) {\n event.stopPropagation();\n event.detail.run(event);\n }\n\n private isDeepEmpty(data) {\n if (typeof data !== 'object') {\n return false;\n }\n\n if (isEmpty(data)) {\n return true;\n }\n\n return Object.values(data).every(this.isDeepEmpty);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"array-field.js","sourceRoot":"","sources":["../../../../src/components/form/templates/array-field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG1D,MAAM,OAAO,kBAAmB,SAAQ,KAAK,CAAC,SAAS;EACnD,YAAmB,KAA8B;IAC7C,KAAK,CAAC,KAAK,CAAC,CAAC;IADE,UAAK,GAAL,KAAK,CAAyB;IAE7C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7C,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;EACzD,CAAC;EAEM,MAAM;IACT,OAAO,KAAK,CAAC,aAAa,CACtB,KAAK,EACL,EAAE,EACF,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAC7B,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,EAChD,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,EACrC,IAAI,CAAC,eAAe,EAAE,CACzB,CAAC;EACN,CAAC;EAEO,eAAe;IACnB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;MACpB,OAAO;KACV;IAED,OAAO,KAAK,CAAC,aAAa,CAAC,cAAc,EAAE;MACvC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK;MAChC,OAAO,EAAE,IAAI,CAAC,cAAc;MAC5B,IAAI,EAAE,WAAW;MACjB,KAAK,EAAE,gBAAgB;KAC1B,CAAC,CAAC;EACP,CAAC;EAEO,UAAU,CAAC,IAAoB,EAAE,KAAa;IAClD,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;IAErD,IAAI,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;MAC5B,OAAO,KAAK,CAAC,aAAa,CAAC,uBAAuB,EAAE;QAChD,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC;QACrB,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,WAAW,CAAC,MAAM;QAC9B,KAAK,EAAE,KAAK;OACf,CAAC,CAAC;KACN;IAED,OAAO,KAAK,CAAC,aAAa,CAAC,kBAAkB,EAAE;MAC3C,GAAG,EAAE,IAAI,CAAC,GAAG;MACb,IAAI,EAAE,IAAI;MACV,KAAK,EAAE,KAAK;KACf,CAAC,CAAC;EACP,CAAC;EAEO,cAAc,CAAC,KAAiB;IACpC,KAAK,CAAC,eAAe,EAAE,CAAC;IACxB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;EACjC,CAAC;CACJ","sourcesContent":["import React from 'react';\nimport { isObjectType } from '../schema';\nimport { CollapsibleItemTemplate } from './array-field-collapsible-item';\nimport { SimpleItemTemplate } from './array-field-simple-item';\nimport { renderDescription, renderTitle } from './common';\nimport { ArrayFieldItem, ArrayFieldTemplateProps } from './types';\n\nexport class ArrayFieldTemplate extends React.Component {\n constructor(public props: ArrayFieldTemplateProps) {\n super(props);\n this.renderItem = this.renderItem.bind(this);\n this.handleAddClick = this.handleAddClick.bind(this);\n }\n\n public render() {\n return React.createElement(\n 'div',\n {},\n renderTitle(this.props.title),\n renderDescription(this.props.schema.description),\n this.props.items.map(this.renderItem),\n this.renderAddButton(),\n );\n }\n\n private renderAddButton() {\n if (!this.props.canAdd) {\n return;\n }\n\n return React.createElement('limel-button', {\n label: this.props.title || 'Add',\n onClick: this.handleAddClick,\n icon: 'plus_math',\n class: 'button-add-new',\n });\n }\n\n private renderItem(item: ArrayFieldItem, index: number) {\n const { schema, formData, formContext } = this.props;\n\n if (isObjectType(schema.items)) {\n return React.createElement(CollapsibleItemTemplate, {\n key: item.key,\n item: item,\n data: formData[index],\n schema: schema,\n formSchema: formContext.schema,\n index: index,\n });\n }\n\n return React.createElement(SimpleItemTemplate, {\n key: item.key,\n item: item,\n index: index,\n });\n }\n\n private handleAddClick(event: MouseEvent) {\n event.stopPropagation();\n this.props.onAddClick(event);\n }\n}\n"]}
1
+ {"version":3,"file":"array-field.js","sourceRoot":"","sources":["../../../../src/components/form/templates/array-field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAI1D,MAAM,OAAO,kBAAmB,SAAQ,KAAK,CAAC,SAAS;EACnD,YAAmB,KAA8B;IAC7C,KAAK,CAAC,KAAK,CAAC,CAAC;IADE,UAAK,GAAL,KAAK,CAAyB;IAE7C,IAA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N;IAED,OAAO,KAAK,CAAC,aAAa,CAAC,kBAAkB,EAAE;MAC3C,GAAG,EAAE,IAAI,CAAC,GAAG;MACb,IAAI,EAAE,IAAI;MACV,KAAK,EAAE,KAAK;KACf,CAAC,CAAC;EACP,CAAC;EAEO,cAAc,CAAC,KAAiB;IACpC,KAAK,CAAC,eAAe,EAAE,CAAC;IACxB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;EACjC,CAAC;CACJ","sourcesContent":["import React from 'react';\nimport { isObjectType } from '../schema';\nimport { CollapsibleItemTemplate } from './array-field-collapsible-item';\nimport { SimpleItemTemplate } from './array-field-simple-item';\nimport { renderDescription, renderTitle } from './common';\nimport { ArrayFieldItem, ArrayFieldTemplateProps } from './types';\nimport { FormSchema } from '../form.types';\n\nexport class ArrayFieldTemplate extends React.Component {\n constructor(public props: ArrayFieldTemplateProps) {\n super(props);\n this.renderItem = this.renderItem.bind(this);\n this.handleAddClick = this.handleAddClick.bind(this);\n }\n\n public render() {\n return React.createElement(\n 'div',\n {},\n renderTitle(this.props.title),\n renderDescription(this.props.schema.description),\n this.props.items.map(this.renderItem),\n this.renderAddButton(),\n );\n }\n\n private renderAddButton() {\n if (!this.props.canAdd) {\n return;\n }\n\n return React.createElement('limel-button', {\n label: this.props.title || 'Add',\n onClick: this.handleAddClick,\n icon: 'plus_math',\n class: 'button-add-new',\n });\n }\n\n private renderItem(item: ArrayFieldItem, index: number) {\n const { schema, formData, formContext } = this.props;\n\n if (isObjectType(schema.items as FormSchema)) {\n return React.createElement(CollapsibleItemTemplate, {\n key: item.key,\n item: item,\n data: formData[index],\n schema: schema,\n formSchema: formContext.schema,\n index: index,\n });\n }\n\n return React.createElement(SimpleItemTemplate, {\n key: item.key,\n item: item,\n index: index,\n });\n }\n\n private handleAddClick(event: MouseEvent) {\n event.stopPropagation();\n this.props.onAddClick(event);\n }\n}\n"]}
@@ -90,15 +90,15 @@ function findSubSchema(schema, formSchema) {
90
90
  }
91
91
  function findSchemaTitle(value, schema) {
92
92
  var _a;
93
- if (isArrayType(schema) && schema.items.anyOf) {
93
+ if (isArrayType(schema) &&
94
+ schema.items.anyOf) {
94
95
  const titles = schema.items.anyOf
95
96
  .filter((item) => value.includes(item.const))
96
97
  .map((item) => item.title);
97
98
  return titles.join(', ');
98
99
  }
99
100
  if (schema.oneOf) {
100
- return (((_a = schema.oneOf.find((item) => value === item.const)) === null || _a === void 0 ? void 0 : _a.title) ||
101
- `${value} is an invalid option`);
101
+ return (((_a = schema.oneOf.find((item) => value === item.const)) === null || _a === void 0 ? void 0 : _a.title) || `${value} is an invalid option`);
102
102
  }
103
103
  return value;
104
104
  }
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/components/form/templates/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEtD,MAAM,UAAU,WAAW,CAAC,KAAa;EACrC,IAAI,CAAC,KAAK,EAAE;IACR,OAAO;GACV;EAED,OAAO,KAAK,CAAC,aAAa,CACtB,IAAI,EACJ,EAAE,SAAS,EAAE,0CAA0C,EAAE,EACzD,KAAK,CACR,CAAC;AACN,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,WAAmB;EACjD,IAAI,CAAC,WAAW,EAAE;IACd,OAAO;GACV;EAED,OAAO,KAAK,CAAC,aAAa,CACtB,GAAG,EACH,EAAE,SAAS,EAAE,sCAAsC,EAAE,EACrD,WAAW,CACd,CAAC;AACN,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,SAAS,CAAC,IAAS,EAAE,WAAgB,EAAE,UAAe;EAClE,IAAI,CAAC,IAAI,EAAE;IACP,OAAO,IAAI,CAAC;GACf;EAED,IAAI,KAAK,CAAC,OAAO,CAAC,IAA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AAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1D,SAAS,GAAG,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;GACrC;EAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,SAAS,eAAe,CAAC,KAAU,EAAE,MAAW;;EAC5C,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE;IAC3C,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK;OAC5B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;OAC5C,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAE/B,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;GAC5B;EAED,IAAI,MAAM,CAAC,KAAK,EAAE;IACd,OAAO,CACH,CAAA,MAAA,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,0CAAE,KAAK;MACxD,GAAG,KAAK,uBAAuB,CAClC,CAAC;GACL;EAED,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import { get, isEmpty } from 'lodash-es';\nimport React from 'react';\nimport { isArrayType, isObjectType } from '../schema';\n\nexport function renderTitle(title: string) {\n if (!title) {\n return;\n }\n\n return React.createElement(\n 'h1',\n { className: 'mdc-typography mdc-typography--headline1' },\n title,\n );\n}\n\nexport function renderDescription(description: string) {\n if (!description) {\n return;\n }\n\n return React.createElement(\n 'p',\n { className: 'mdc-typography mdc-typography--body1' },\n description,\n );\n}\n\n/**\n * Find a suitable title for a nested structure.\n *\n * If an object has the key 'title' it will have priority, followed by the key 'name'.\n * If 'title' nor 'name' is found, a required item will be considered.\n * Otherwise the first occurrence of a nonempty string is chosen.\n *\n * @param data - the data to find the title for\n * @param fieldSchema - schema for the item\n * @param formSchema - schema for the form\n * @returns describing title of the data\n */\nexport function findTitle(data: any, fieldSchema: any, formSchema: any) {\n if (!data) {\n return null;\n }\n\n if (Array.isArray(data) && isObjectType(fieldSchema.items)) {\n return findTitle(data[0], fieldSchema, formSchema);\n }\n\n if (Array.isArray(data) || typeof data !== 'object') {\n return findSchemaTitle(data, fieldSchema);\n }\n\n const subSchema = findSubSchema(fieldSchema, formSchema);\n\n data = sortDataByProperties(data, subSchema.properties);\n\n const firstEntry = findFirstEntry(data, subSchema);\n if (!firstEntry) {\n return null;\n }\n\n if (!subSchema.properties) {\n return null;\n }\n\n const [key, value] = firstEntry;\n\n return findTitle(value, subSchema.properties[key], formSchema);\n}\n\nfunction sortDataByProperties(data: any, properties: object) {\n if (!properties || isEmpty(properties)) {\n return data;\n }\n\n const newData = {};\n Object.keys(properties).forEach((key) => (newData[key] = data[key]));\n\n return newData;\n}\n\nfunction findFirstEntry(data: any, subSchema: any) {\n const entries = [\n ['title', data.title],\n ['name', data.name],\n getRequiredEntry(data, subSchema),\n ...Object.entries(data),\n ];\n\n return entries.filter((entry) => {\n const value = entry[1];\n\n return !!value && typeof value !== 'boolean';\n })[0];\n}\n\nfunction getRequiredEntry(data: any, subSchema: any) {\n if (!('required' in subSchema)) {\n return [null, null];\n }\n\n const firstNonEmptyRequiredKey = Object.keys(data).find((key) =>\n subSchema.required.includes(key),\n );\n if (!firstNonEmptyRequiredKey) {\n return [null, null];\n }\n\n return [firstNonEmptyRequiredKey, data[firstNonEmptyRequiredKey]];\n}\n\nfunction findSubSchema(schema: any, formSchema: any) {\n let subSchema = schema;\n if (isArrayType(schema)) {\n subSchema = schema.items;\n }\n\n if (subSchema.$ref) {\n const path = subSchema.$ref.split('/').slice(1).join('.');\n subSchema = get(formSchema, path);\n }\n\n return subSchema;\n}\n\nfunction findSchemaTitle(value: any, schema: any) {\n if (isArrayType(schema) && schema.items.anyOf) {\n const titles = schema.items.anyOf\n .filter((item) => value.includes(item.const))\n .map((item) => item.title);\n\n return titles.join(', ');\n }\n\n if (schema.oneOf) {\n return (\n schema.oneOf.find((item) => value === item.const)?.title ||\n `${value} is an invalid option`\n );\n }\n\n return value;\n}\n"]}
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/components/form/templates/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAItD,MAAM,UAAU,WAAW,CAAC,KAAa;EACrC,IAAI,CAAC,KAAK,EAAE;IACR,OAAO;GACV;EAED,OAAO,KAAK,CAAC,aAAa,CACtB,IAAI,EACJ,EAAE,SAAS,EAAE,0CAA0C,EAAE,EACzD,KAAK,CACR,CAAC;AACN,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,WAAmB;EACjD,IAAI,CAAC,WAAW,EAAE;IACd,OAAO;GACV;EAED,OAAO,KAAK,CAAC,aAAa,CACtB,GAAG,EACH,EAAE,SAAS,EAAE,sCAAsC,EAAE,EACrD,WAAW,CACd,CAAC;AACN,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,SAAS,CACrB,IAAS,EACT,WAAwB,EACxB,UAAuB;EAEvB,IAAI,CAAC,IAAI,EAAE;IACP,OAAO,IAAI,CAAC;GACf;EAED,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,WAAW,CAAC,KAAmB,CAAC,EAAE;IACtE,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;GACtD;EAED,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;IACjD,OAAO,eAAe,CAAC,IAAI,EAAE,W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AAK,EACrC;IACE,MAAM,MAAM,GAAK,MAAM,CAAC,KAAqB,CAAC,KAAuB;OAChE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;OAC5C,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAE/B,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;GAC5B;EAED,IAAI,MAAM,CAAC,KAAK,EAAE;IACd,OAAO,CACH,CAAA,MAAC,MAAM,CAAC,KAAuB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,0CAC9D,KAAK,KAAI,GAAG,KAAK,uBAAuB,CACjD,CAAC;GACL;EAED,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import { get, isEmpty } from 'lodash-es';\nimport React from 'react';\nimport { isArrayType, isObjectType } from '../schema';\nimport { FormSchema } from '../form.types';\nimport { JSONSchema7 } from 'json-schema';\n\nexport function renderTitle(title: string) {\n if (!title) {\n return;\n }\n\n return React.createElement(\n 'h1',\n { className: 'mdc-typography mdc-typography--headline1' },\n title,\n );\n}\n\nexport function renderDescription(description: string) {\n if (!description) {\n return;\n }\n\n return React.createElement(\n 'p',\n { className: 'mdc-typography mdc-typography--body1' },\n description,\n );\n}\n\n/**\n * Find a suitable title for a nested structure.\n *\n * If an object has the key 'title' it will have priority, followed by the key 'name'.\n * If 'title' nor 'name' is found, a required item will be considered.\n * Otherwise the first occurrence of a nonempty string is chosen.\n *\n * @param data - the data to find the title for\n * @param fieldSchema - schema for the item\n * @param formSchema - schema for the form\n * @returns describing title of the data\n */\nexport function findTitle(\n data: any,\n fieldSchema: JSONSchema7,\n formSchema: JSONSchema7,\n) {\n if (!data) {\n return null;\n }\n\n if (Array.isArray(data) && isObjectType(fieldSchema.items as FormSchema)) {\n return findTitle(data[0], fieldSchema, formSchema);\n }\n\n if (Array.isArray(data) || typeof data !== 'object') {\n return findSchemaTitle(data, fieldSchema);\n }\n\n const subSchema = findSubSchema(\n fieldSchema as FormSchema,\n formSchema as FormSchema,\n );\n\n data = sortDataByProperties(data, subSchema.properties);\n\n const firstEntry = findFirstEntry(data, subSchema);\n if (!firstEntry) {\n return null;\n }\n\n if (!subSchema.properties) {\n return null;\n }\n\n const [key, value] = firstEntry;\n\n return findTitle(value, subSchema.properties[key], formSchema);\n}\n\nfunction sortDataByProperties(data: any, properties: object) {\n if (!properties || isEmpty(properties)) {\n return data;\n }\n\n const newData = {};\n Object.keys(properties).forEach((key) => (newData[key] = data[key]));\n\n return newData;\n}\n\nfunction findFirstEntry(data: any, subSchema: FormSchema) {\n const entries = [\n ['title', data.title],\n ['name', data.name],\n getRequiredEntry(data, subSchema),\n ...Object.entries(data),\n ];\n\n return entries.filter((entry) => {\n const value = entry[1];\n\n return !!value && typeof value !== 'boolean';\n })[0];\n}\n\nfunction getRequiredEntry(data: any, subSchema: FormSchema) {\n if (!('required' in subSchema)) {\n return [null, null];\n }\n\n const firstNonEmptyRequiredKey = Object.keys(data).find((key) =>\n subSchema.required.includes(key),\n );\n if (!firstNonEmptyRequiredKey) {\n return [null, null];\n }\n\n return [firstNonEmptyRequiredKey, data[firstNonEmptyRequiredKey]];\n}\n\nfunction findSubSchema(schema: FormSchema, formSchema: FormSchema) {\n let subSchema = schema;\n if (isArrayType(schema)) {\n subSchema = schema.items as FormSchema;\n }\n\n if (subSchema.$ref) {\n const path = subSchema.$ref.split('/').slice(1).join('.');\n subSchema = get(formSchema, path);\n }\n\n return subSchema;\n}\n\nfunction findSchemaTitle(value: any, schema: JSONSchema7) {\n if (\n isArrayType(schema as FormSchema) &&\n (schema.items as JSONSchema7).anyOf\n ) {\n const titles = ((schema.items as JSONSchema7).anyOf as JSONSchema7[])\n .filter((item) => value.includes(item.const))\n .map((item) => item.title);\n\n return titles.join(', ');\n }\n\n if (schema.oneOf) {\n return (\n (schema.oneOf as JSONSchema7[]).find((item) => value === item.const)\n ?.title || `${value} is an invalid option`\n );\n }\n\n return value;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"field.js","sourceRoot":"","sources":["../../../../src/components/form/templates/field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,EAAE;EACnC,IAAI,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;EAClC,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;EACzC,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;EACzC,IAAI,KAAoB,CAAC;EAEzB,IAAI,OAAO,EAAE;IACT,UAAU,IAAI,+BAA+B,OAAO,EAAE,CAAC;GAC1D;EAED,IAAI,OAAO,EAAE;IACT,KAAK,GAAG;MACJ,OAAO,EAAE,QAAQ,OAAO,EAAE;MAC1B,SAAS,EAAE,uCAAuC,OAAO,GAAG;KAC/D,CAAC;GACL;EAED,OAAO,KAAK,CAAC,aAAa,CACtB,KAAK,EACL;IACI,SAAS,EAAE,UAAU;IACrB,KAAK,EAAE,KAAK;GACf,EACD,KAAK,CAAC,QAAQ,CACjB,CAAC;AACN,CAAC,CAAC;AAEF,SAAS,UAAU,CAAC,MAAW;;EAC3B,MAAM,MAAM,GAAsB,MAAA,MAAM,CAAC,IAAI,0CAAE,MAAM,CAAC;EACtD,MAAM,OAAO,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,CAAC;EAEhC,IAAI,CAAC,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,EAAE;IAClC,OAAO,KAAK,CAAC;GAChB;EAED,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,SAAS,UAAU,CAAC,MAAW;;EAC3B,MAAM,MAAM,GAAsB,MAAA,MAAM,CAAC,IAAI,0CAAE,MAAM,CAAC;EAEtD,OAAO,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,CAAC;AAC3B,CAAC","sourcesContent":["import React, { CSSProperties } from 'react';\nimport { GridLayoutOptions } from '../form.types';\nimport { isObjectType } from '../schema';\n\nexport const FieldTemplate = (props) => {\n let classNames = props.classNames;\n const colSpan = getColSpan(props.schema);\n const rowSpan = getRowSpan(props.schema);\n let style: CSSProperties;\n\n if (colSpan) {\n classNames += ` limel-form-layout-colspan--${colSpan}`;\n }\n\n if (rowSpan) {\n style = {\n gridRow: `span ${rowSpan}`,\n minHeight: `calc(var(--min-height-of-one-row) * ${rowSpan})`,\n };\n }\n\n return React.createElement(\n 'div',\n {\n className: classNames,\n style: style,\n },\n props.children,\n );\n};\n\nfunction getColSpan(schema: any) {\n const layout: GridLayoutOptions = schema.lime?.layout;\n const colSpan = layout?.colSpan;\n\n if (!colSpan && isObjectType(schema)) {\n return 'all';\n }\n\n return colSpan;\n}\n\nfunction getRowSpan(schema: any) {\n const layout: GridLayoutOptions = schema.lime?.layout;\n\n return layout?.rowSpan;\n}\n"]}
1
+ {"version":3,"file":"field.js","sourceRoot":"","sources":["../../../../src/components/form/templates/field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,EAAE;EACnC,IAAI,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;EAClC,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;EACzC,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;EACzC,IAAI,KAAoB,CAAC;EAEzB,IAAI,OAAO,EAAE;IACT,UAAU,IAAI,+BAA+B,OAAO,EAAE,CAAC;GAC1D;EAED,IAAI,OAAO,EAAE;IACT,KAAK,GAAG;MACJ,OAAO,EAAE,QAAQ,OAAO,EAAE;MAC1B,SAAS,EAAE,uCAAuC,OAAO,GAAG;KAC/D,CAAC;GACL;EAED,OAAO,KAAK,CAAC,aAAa,CACtB,KAAK,EACL;IACI,SAAS,EAAE,UAAU;IACrB,KAAK,EAAE,KAAK;GACf,EACD,KAAK,CAAC,QAAQ,CACjB,CAAC;AACN,CAAC,CAAC;AAEF,SAAS,UAAU,CAAC,MAAkB;;EAClC,MAAM,MAAM,GAAG,MAAA,MAAM,CAAC,IAAI,0CAAE,MAAM,CAAC;EACnC,MAAM,OAAO,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,CAAC;EAEhC,IAAI,CAAC,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,EAAE;IAClC,OAAO,KAAK,CAAC;GAChB;EAED,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,SAAS,UAAU,CAAC,MAAkB;;EAClC,MAAM,MAAM,GAAG,MAAA,MAAM,CAAC,IAAI,0CAAE,MAAM,CAAC;EAEnC,OAAO,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,CAAC;AAC3B,CAAC","sourcesContent":["import React, { CSSProperties } from 'react';\nimport { FormSchema } from '../form.types';\nimport { isObjectType } from '../schema';\n\nexport const FieldTemplate = (props) => {\n let classNames = props.classNames;\n const colSpan = getColSpan(props.schema);\n const rowSpan = getRowSpan(props.schema);\n let style: CSSProperties;\n\n if (colSpan) {\n classNames += ` limel-form-layout-colspan--${colSpan}`;\n }\n\n if (rowSpan) {\n style = {\n gridRow: `span ${rowSpan}`,\n minHeight: `calc(var(--min-height-of-one-row) * ${rowSpan})`,\n };\n }\n\n return React.createElement(\n 'div',\n {\n className: classNames,\n style: style,\n },\n props.children,\n );\n};\n\nfunction getColSpan(schema: FormSchema) {\n const layout = schema.lime?.layout;\n const colSpan = layout?.colSpan;\n\n if (!colSpan && isObjectType(schema)) {\n return 'all';\n }\n\n return colSpan;\n}\n\nfunction getRowSpan(schema: FormSchema) {\n const layout = schema.lime?.layout;\n\n return layout?.rowSpan;\n}\n"]}
@@ -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;AAO1B,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAmC,EAAE,EAAE;EACvE,MAAM,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;EAC9B,IAAI,EAAE,KAAK,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;IAC/C,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC;GACtC;EAED,IAAI,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;IAC7B,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;GACxC;EAED,OAAO,gBAAgB,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5D,CAAC,CAAC;AAEF,SAAS,oBAAoB,CAAC,KAAmC;EAC7D,OAAO,KAAK,CAAC,aAAa,CACtB,KAAK,CAAC,QAAQ,EACd,EAAE,EACF,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,EACxB,iBAAiB,CAAC,KAAK,CAAC,WAAW,CAAC,EACpC,gBAAgB,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CACnD,CAAC;AACN,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAmC;EAC/D,MAAM,WAAW,GAAG,CAAC,WAAW,CAAC,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AC;EAEF,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,mBAAmB,CAAC,UAAiC;EAC1D,OAAO,KAAK,CAAC,aAAa,CACtB,KAAK,EACL;IACI,SAAS,EAAE,4BAA4B;GAC1C,EACD,UAAU,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAC/C,CAAC;AACN,CAAC;AAED,SAAS,gBAAgB,CACrB,UAAiC,EACjC,MAAyB;EAEzB,OAAO,KAAK,CAAC,aAAa,CACtB,UAAU,EACV;IACI,OAAO,EAAE,MAAM;GAClB,EACD,UAAU,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAC/C,CAAC;AACN,CAAC;AAED,SAAS,eAAe,CAAC,UAAiC;EACtD,OAAO,KAAK,CAAC,aAAa,CACtB,SAAS,EACT,EAAE,EACF,UAAU,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAC/C,CAAC;AACN,CAAC;AAED,SAAS,aAAa,CAAC,MAAkB;;EACrC,OAAO,CAAC,CAAC,CAAA,MAAA,MAAM,CAAC,IAAI,0CAAE,WAAW,CAAA,CAAC;AACtC,CAAC;AAED,SAAS,WAAW,CAAC,MAAkB;EACnC,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC;AAC3C,CAAC","sourcesContent":["import React from 'react';\nimport {\n FormLayoutType,\n FormSchema,\n LimeLayoutOptions,\n FormLayoutOptions,\n} from '../form.types';\nimport { renderDescription, renderTitle } from './common';\nimport { GridLayout } from './grid-layout';\nimport { RowLayout } from './row-layout';\nimport { LimeObjectFieldTemplateProps, ObjectFieldProperty } from './types';\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 renderTitle(props.title),\n renderDescription(props.description),\n renderProperties(props.properties, props.schema),\n );\n}\n\nfunction renderCollapsibleField(props: LimeObjectFieldTemplateProps) {\n const defaultOpen = !isCollapsed(props.schema);\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 renderDescription(props.description),\n renderProperties(props.properties, props.schema),\n );\n}\n\nfunction getSchemaObjectPropertyPath(schema: any, subSchema: FormSchema) {\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: FormSchema,\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: FormSchema) {\n return !!schema.lime?.collapsible;\n}\n\nfunction isCollapsed(schema: FormSchema) {\n return schema.lime.collapsed !== false;\n}\n"]}
1
+ {"version":3,"file":"object-field.js","sourceRoot":"","sources":["../../../../src/components/form/templates/object-field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAmC,EAAE,EAAE;EACvE,MAAM,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;EAC9B,IAAI,EAAE,KAAK,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;IAC/C,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC;GACtC;EAED,IAAI,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;IAC7B,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;GACxC;EAED,OAAO,gBAAgB,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5D,CAAC,CAAC;AAEF,SAAS,oBAAoB,CAAC,KAAmC;EAC7D,OAAO,KAAK,CAAC,aAAa,CACtB,KAAK,CAAC,QAAQ,EACd,EAAE,EACF,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,EACxB,iBAAiB,CAAC,KAAK,CAAC,WAAW,CAAC,EACpC,gBAAgB,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CACnD,CAAC;AACN,CAAC;AAED,SAAS,sBAAsB,CAAC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B,IAAI,EAAE,gBAAgB;IACtB,GAAG,EAAE,eAAe;GACvB,CAAC;EAEF,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,mBAAmB,CAAC,UAAiC;EAC1D,OAAO,KAAK,CAAC,aAAa,CACtB,KAAK,EACL;IACI,SAAS,EAAE,4BAA4B;GAC1C,EACD,UAAU,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAC/C,CAAC;AACN,CAAC;AAED,SAAS,gBAAgB,CACrB,UAAiC,EACjC,MAAyB;EAEzB,OAAO,KAAK,CAAC,aAAa,CACtB,UAAU,EACV;IACI,OAAO,EAAE,MAAM;GAClB,EACD,UAAU,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAC/C,CAAC;AACN,CAAC;AAED,SAAS,eAAe,CAAC,UAAiC;EACtD,OAAO,KAAK,CAAC,aAAa,CACtB,SAAS,EACT,EAAE,EACF,UAAU,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAC/C,CAAC;AACN,CAAC;AAED,SAAS,aAAa,CAAC,MAAmB;;EACtC,OAAO,CAAC,CAAC,CAAA,MAAA,MAAM,CAAC,IAAI,0CAAE,WAAW,CAAA,CAAC;AACtC,CAAC;AAED,SAAS,WAAW,CAAC,MAAmB;EACpC,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC;AAC3C,CAAC","sourcesContent":["import React from 'react';\nimport {\n FormLayoutType,\n LimeLayoutOptions,\n FormLayoutOptions,\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';\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 renderTitle(props.title),\n renderDescription(props.description),\n renderProperties(props.properties, props.schema),\n );\n}\n\nfunction renderCollapsibleField(props: LimeObjectFieldTemplateProps) {\n const defaultOpen = !isCollapsed(props.schema);\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 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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/form/templates/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ObjectFieldTemplateProps, ArrayFieldTemplateProps } from '@rjsf/core';\nimport { FormSchema } from '../form.types';\nexport { FieldTemplateProps, ArrayFieldTemplateProps } from '@rjsf/core';\n\nexport type TemplateProps = ObjectFieldTemplateProps | ArrayFieldTemplateProps;\n\nexport type ObjectFieldProperty = ObjectFieldTemplateProps['properties'][0];\n\nexport type ArrayFieldItem = ArrayFieldTemplateProps['items'][0];\n\nexport interface LimeObjectFieldTemplateProps extends ObjectFieldTemplateProps {\n schema: FormSchema;\n}\n\nexport interface Runnable {\n run: (event: any) => void;\n}\n\nexport interface RowProps {\n children?: any;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/form/templates/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ObjectFieldTemplateProps, ArrayFieldTemplateProps } from '@rjsf/core';\nimport { JSONSchema7 } from 'json-schema';\n\nexport { FieldTemplateProps, ArrayFieldTemplateProps } from '@rjsf/core';\n\nexport type TemplateProps = ObjectFieldTemplateProps | ArrayFieldTemplateProps;\n\nexport type ObjectFieldProperty = ObjectFieldTemplateProps['properties'][0];\n\nexport type ArrayFieldItem = ArrayFieldTemplateProps['items'][0];\n\nexport interface LimeObjectFieldTemplateProps extends ObjectFieldTemplateProps {\n schema: JSONSchema7;\n}\n\nexport interface Runnable {\n run: (event: any) => void;\n}\n\nexport interface RowProps {\n children?: any;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.js","sourceRoot":"","sources":["../../../../src/components/form/widgets/date-picker.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,eAAe,CAAC;AACnC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,OAAO,UAAW,SAAQ,KAAK,CAAC,SAAS;EAM3C,YAAmB,KAAkB;IACjC,KAAK,CAAC,KAAK,CAAC,CAAC;IADE,UAAK,GAAL,KAAK,CAAa;IAJ9B,UAAK,GAAG;MACX,QAAQ,EAAE,KAAK;KAClB,CAAC;IAIE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;EACrD,CAAC;EAEM,MAAM;IACT,MAAM,KAAK,GAAgB,IAAI,CAAC,KAAK,CAAC;IACtC,MAAM,eAAe,GAAG,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAEzD,OAAO,KAAK,CAAC,aAAa,CAAC,yBAAyB,EAAE;MAClD,IAAI,EAAE,mBAAmB;MACzB,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE;MACtB,MAAM,EAAE;QACJ,MAAM,EAAE,IAAI,CAAC,YAAY;OAC5B;MACD,WAAW,EAAE,KAAK;MAClB,UAAU,oBACH,eAAe,CACrB;KACJ,CAAC,CAAC;EACP,CAAC;EAEO,QAAQ;IACZ,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,QAAQ,EAAE;MACtC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACrC;SAAM;MACH,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;KAC3B;EACL,CAAC;EAEO,YAAY,CAAC,KAAwB;IACzC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IACzB,KAAK,CAAC,eAAe,EAAE,CAAC;IAExB,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;MACjB,OAAO;KACV;IAED,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;MACf,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;MAErB,OAAO;KACV;IAED,MAAM,aAAa,GAAG;MAClB,WAAW,EAAE,sBAAsB;MACnC,IAAI,EAAE,YAAY;MAClB,IAAI,EAAE,UAAU;KACnB,CAAC;IACF,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAC1C,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CACrC,CAAC;IACF,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;EAC/B,CAAC;CACJ;AAED,SAAS,kBAAkB,CAAC,MAAW;;EACnC,IAAI,KAAK,GAAQ,EAAE,CAAC;EAEpB,IAAI,MAAA,MAAA,MAAM,CAAC,IAAI,0CAAE,SAAS,0CAAE,KAAK,EAAE;IAC/B,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;GACvC;EAED,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import moment from 'moment/moment';\nimport React from 'react';\nimport { WidgetProps } from './types';\nimport { LimeElementsWidgetAdapter } from '../adapters';\n\nexport class DatePicker extends React.Component {\n public refs: any;\n public state = {\n modified: false,\n };\n\n constructor(public props: WidgetProps) {\n super(props);\n this.handleChange = this.handleChange.bind(this);\n }\n\n public render() {\n const props: WidgetProps = this.props;\n const additionalProps = getAdditionalProps(props.schema);\n\n return React.createElement(LimeElementsWidgetAdapter, {\n name: 'limel-date-picker',\n value: this.getValue(),\n events: {\n change: this.handleChange,\n },\n widgetProps: props,\n extraProps: {\n ...additionalProps,\n },\n });\n }\n\n private getValue() {\n if (typeof this.props.value === 'string') {\n return new Date(this.props.value);\n } else {\n return this.props.value;\n }\n }\n\n private handleChange(event: CustomEvent<Date>) {\n const props = this.props;\n event.stopPropagation();\n\n if (!props.onChange) {\n return;\n }\n\n if (!event.detail) {\n props.onChange(null);\n\n return;\n }\n\n const formatMapping = {\n 'date-time': 'YYYY-MM-DDTHH:mm:ssZ',\n date: 'YYYY-MM-DD',\n time: 'HH:mm:ss',\n };\n const dateString = moment(event.detail).format(\n formatMapping[props.schema.format],\n );\n props.onChange(dateString);\n }\n}\n\nfunction getAdditionalProps(schema: any) {\n let props: any = {};\n\n if (schema.lime?.component?.props) {\n props = schema.lime.component.props;\n }\n\n return props;\n}\n"]}
1
+ {"version":3,"file":"date-picker.js","sourceRoot":"","sources":["../../../../src/components/form/widgets/date-picker.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,eAAe,CAAC;AACnC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAGxD,MAAM,OAAO,UAAW,SAAQ,KAAK,CAAC,SAAS;EAM3C,YAAmB,KAAkB;IACjC,KAAK,CAAC,KAAK,CAAC,CAAC;IADE,UAAK,GAAL,KAAK,CAAa;IAJ9B,UAAK,GAAG;MACX,QAAQ,EAAE,KAAK;KAClB,CAAC;IAIE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;EACrD,CAAC;EAEM,MAAM;IACT,MAAM,KAAK,GAAgB,IAAI,CAAC,KAAK,CAAC;IACtC,MAAM,eAAe,GAAG,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAEzD,OAAO,KAAK,CAAC,aAAa,CAAC,yBAAyB,EAAE;MAClD,IAAI,EAAE,mBAAmB;MACzB,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE;MACtB,MAAM,EAAE;QACJ,MAAM,EAAE,IAAI,CAAC,YAAY;OAC5B;MACD,WAAW,EAAE,KAAK;MAClB,UAAU,oBACH,eAAe,CACrB;KACJ,CAAC,CAAC;EACP,CAAC;EAEO,QAAQ;IACZ,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,QAAQ,EAAE;MACtC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACrC;SAAM;MACH,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;KAC3B;EACL,CAAC;EAEO,YAAY,CAAC,KAAwB;IACzC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IACzB,KAAK,CAAC,eAAe,EAAE,CAAC;IAExB,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;MACjB,OAAO;KACV;IAED,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;MACf,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;MAErB,OAAO;KACV;IAED,MAAM,aAAa,GAAG;MAClB,WAAW,EAAE,sBAAsB;MACnC,IAAI,EAAE,YAAY;MAClB,IAAI,EAAE,UAAU;KACnB,CAAC;IACF,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAC1C,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CACrC,CAAC;IACF,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;EAC/B,CAAC;CACJ;AAED,SAAS,kBAAkB,CAAC,MAAkB;;EAC1C,IAAI,KAAK,GAAQ,EAAE,CAAC;EAEpB,IAAI,MAAA,MAAA,MAAM,CAAC,IAAI,0CAAE,SAAS,0CAAE,KAAK,EAAE;IAC/B,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;GACvC;EAED,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import moment from 'moment/moment';\nimport React from 'react';\nimport { WidgetProps } from './types';\nimport { LimeElementsWidgetAdapter } from '../adapters';\nimport { FormSchema } from '../form.types';\n\nexport class DatePicker extends React.Component {\n public refs: any;\n public state = {\n modified: false,\n };\n\n constructor(public props: WidgetProps) {\n super(props);\n this.handleChange = this.handleChange.bind(this);\n }\n\n public render() {\n const props: WidgetProps = this.props;\n const additionalProps = getAdditionalProps(props.schema);\n\n return React.createElement(LimeElementsWidgetAdapter, {\n name: 'limel-date-picker',\n value: this.getValue(),\n events: {\n change: this.handleChange,\n },\n widgetProps: props,\n extraProps: {\n ...additionalProps,\n },\n });\n }\n\n private getValue() {\n if (typeof this.props.value === 'string') {\n return new Date(this.props.value);\n } else {\n return this.props.value;\n }\n }\n\n private handleChange(event: CustomEvent<Date>) {\n const props = this.props;\n event.stopPropagation();\n\n if (!props.onChange) {\n return;\n }\n\n if (!event.detail) {\n props.onChange(null);\n\n return;\n }\n\n const formatMapping = {\n 'date-time': 'YYYY-MM-DDTHH:mm:ssZ',\n date: 'YYYY-MM-DD',\n time: 'HH:mm:ss',\n };\n const dateString = moment(event.detail).format(\n formatMapping[props.schema.format],\n );\n props.onChange(dateString);\n }\n}\n\nfunction getAdditionalProps(schema: FormSchema) {\n let props: any = {};\n\n if (schema.lime?.component?.props) {\n props = schema.lime.component.props;\n }\n\n return props;\n}\n"]}
@@ -57,10 +57,10 @@ function getInputType(schema) {
57
57
  }
58
58
  function getStepSize(schema) {
59
59
  if (isNumberType(schema) && schema.multipleOf) {
60
- return parseFloat(schema.multipleOf) || 'any';
60
+ return +schema.multipleOf || 'any';
61
61
  }
62
62
  if (isIntegerType(schema)) {
63
- return parseInt(schema.multipleOf, 10) || 1;
63
+ return Math.floor(+schema.multipleOf) || 1;
64
64
  }
65
65
  return 'any';
66
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"input-field.js","sourceRoot":"","sources":["../../../../src/components/form/widgets/input-field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,EAAE,yBAAyB,EAAE,MAAM,a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ED,IAAI,MAAM,CAAC,SAAS,EAAE;IAClB,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;GACtC;EAED,IAAI,MAAM,CAAC,SAAS,EAAE;IAClB,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;GACtC;EAED,IAAI,MAAA,MAAA,MAAM,CAAC,IAAI,0CAAE,SAAS,0CAAE,KAAK,EAAE;IAC/B,KAAK,mCACE,KAAK,GACL,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CACjC,CAAC;GACL;EAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAS,OAAO,CAAC,MAAW;EACxB,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE;IACjD,OAAO,KAAK,CAAC;GAChB;EAED,OAAO,SAAS,IAAI,MAAM,IAAI,SAAS,IAAI,MAAM,IAAI,YAAY,IAAI,MAAM,CAAC;AAChF,CAAC","sourcesContent":["import React from 'react';\nimport { InputType } from '../../input-field/input-field.types';\nimport { isIntegerType, isNumberType } from '../schema';\nimport { WidgetProps } from './types';\nimport { LimeElementsWidgetAdapter } from '../adapters';\nimport { Slider } from './slider';\n\nexport class InputField extends React.Component {\n constructor(public props: WidgetProps) {\n super(props);\n this.handleChange = this.handleChange.bind(this);\n }\n\n public render() {\n const props: WidgetProps = this.props;\n\n if (isRange(props.schema)) {\n return React.createElement(Slider, props);\n }\n\n const type: InputType = getInputType(props.schema);\n const step: number | 'any' = getStepSize(props.schema);\n const additionalProps = getAdditionalProps(props.schema);\n\n return React.createElement(LimeElementsWidgetAdapter, {\n name: 'limel-input-field',\n value: props.value,\n events: {\n change: this.handleChange,\n },\n widgetProps: props,\n extraProps: {\n step: step,\n type: type,\n ...additionalProps,\n },\n });\n }\n\n private handleChange(event: CustomEvent<string>) {\n event.stopPropagation();\n const props = this.props;\n const type = getInputType(props.schema);\n\n if (!props.onChange) {\n return;\n }\n\n let value: string;\n if (event.detail || typeof event.detail === 'number') {\n value = event.detail;\n } else if (type === 'number') {\n value = null;\n } else {\n value = props.required ? null : '';\n }\n\n props.onChange(value);\n }\n}\n\nfunction getInputType(schema: any): InputType {\n if (isNumberType(schema) || isIntegerType(schema)) {\n return 'number';\n }\n\n if (schema.format === 'email') {\n return 'email';\n }\n\n return 'text';\n}\n\nfunction getStepSize(schema: any): 'any' | number {\n if (isNumberType(schema) && schema.multipleOf) {\n return parseFloat(schema.multipleOf) || 'any';\n }\n\n if (isIntegerType(schema)) {\n return parseInt(schema.multipleOf, 10) || 1;\n }\n\n return 'any';\n}\n\nfunction getAdditionalProps(schema: any) {\n let props: any = {};\n\n if (schema.minimum) {\n props.min = schema.minimum;\n }\n\n if (schema.maximum) {\n props.max = schema.maximum;\n }\n\n if (schema.maxLength) {\n props.maxlength = schema.maxLength;\n }\n\n if (schema.minLength) {\n props.minlength = schema.minLength;\n }\n\n if (schema.lime?.component?.props) {\n props = {\n ...props,\n ...schema.lime.component.props,\n };\n }\n\n return props;\n}\n\nfunction isRange(schema: any): boolean {\n if (!isNumberType(schema) && !isIntegerType(schema)) {\n return false;\n }\n\n return 'minimum' in schema && 'maximum' in schema && 'multipleOf' in schema;\n}\n"]}
1
+ {"version":3,"file":"input-field.js","sourceRoot":"","sources":["../../../../src/components/form/widgets/input-field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,MAAM,OAAO,UAAW,SAAQ,KAAK,CAAC,SAAS;EAC3C,YAAmB,KAAkB;IACjC,KAAK,CAAC,KAAK,CAAC,CAAC;IADE,UAAK,GAAL,KAAK,CAAa;IAEjC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YA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AE,KAAK,EAAE;IAC/B,KAAK,mCACE,KAAK,GACL,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CACjC,CAAC;GACL;EAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAS,OAAO,CAAC,MAAkB;EAC/B,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE;IACjD,OAAO,KAAK,CAAC;GAChB;EAED,OAAO,SAAS,IAAI,MAAM,IAAI,SAAS,IAAI,MAAM,IAAI,YAAY,IAAI,MAAM,CAAC;AAChF,CAAC","sourcesContent":["import React from 'react';\nimport { InputType } from '../../input-field/input-field.types';\nimport { isIntegerType, isNumberType } from '../schema';\nimport { WidgetProps } from './types';\nimport { LimeElementsWidgetAdapter } from '../adapters';\nimport { Slider } from './slider';\nimport { FormSchema } from '../form.types';\n\nexport class InputField extends React.Component {\n constructor(public props: WidgetProps) {\n super(props);\n this.handleChange = this.handleChange.bind(this);\n }\n\n public render() {\n const props: WidgetProps = this.props;\n\n if (isRange(props.schema)) {\n return React.createElement(Slider, props);\n }\n\n const type: InputType = getInputType(props.schema);\n const step: number | 'any' = getStepSize(props.schema);\n const additionalProps = getAdditionalProps(props.schema);\n\n return React.createElement(LimeElementsWidgetAdapter, {\n name: 'limel-input-field',\n value: props.value,\n events: {\n change: this.handleChange,\n },\n widgetProps: props,\n extraProps: {\n step: step,\n type: type,\n ...additionalProps,\n },\n });\n }\n\n private handleChange(event: CustomEvent<string>) {\n event.stopPropagation();\n const props = this.props;\n const type = getInputType(props.schema);\n\n if (!props.onChange) {\n return;\n }\n\n let value: string;\n if (event.detail || typeof event.detail === 'number') {\n value = event.detail;\n } else if (type === 'number') {\n value = null;\n } else {\n value = props.required ? null : '';\n }\n\n props.onChange(value);\n }\n}\n\nfunction getInputType(schema: FormSchema): InputType {\n if (isNumberType(schema) || isIntegerType(schema)) {\n return 'number';\n }\n\n if (schema.format === 'email') {\n return 'email';\n }\n\n return 'text';\n}\n\nfunction getStepSize(schema: FormSchema): 'any' | number {\n if (isNumberType(schema) && schema.multipleOf) {\n return +schema.multipleOf || 'any';\n }\n\n if (isIntegerType(schema)) {\n return Math.floor(+schema.multipleOf) || 1;\n }\n\n return 'any';\n}\n\nfunction getAdditionalProps(schema: FormSchema) {\n let props: any = {};\n\n if (schema.minimum) {\n props.min = schema.minimum;\n }\n\n if (schema.maximum) {\n props.max = schema.maximum;\n }\n\n if (schema.maxLength) {\n props.maxlength = schema.maxLength;\n }\n\n if (schema.minLength) {\n props.minlength = schema.minLength;\n }\n\n if (schema.lime?.component?.props) {\n props = {\n ...props,\n ...schema.lime.component.props,\n };\n }\n\n return props;\n}\n\nfunction isRange(schema: FormSchema): boolean {\n if (!isNumberType(schema) && !isIntegerType(schema)) {\n return false;\n }\n\n return 'minimum' in schema && 'maximum' in schema && 'multipleOf' in schema;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"slider.js","sourceRoot":"","sources":["../../../../src/components/form/widgets/slider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAGxD,MAAM,OAAO,MAAO,SAAQ,KAAK,CAAC,SAAS;EACvC,YAAmB,KAAkB;IACjC,KAAK,CAAC,KAAK,CAAC,CAAC;IADE,UAAK,GAAL,KAAK,CAAa;IAEjC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;EACrD,CAAC;EAEM,MAAM;IACT,MAAM,KAAK,GAAgB,IAAI,CAAC,KAAK,CAAC;IACtC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAC5B,IAAI,MAAM,CAAC;IACX,IAAI,IAAI,CAAC;IACT,MAAM,eAAe,GAAG,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAEzD,IAAI,SAAS,CAAC,MAAM,CA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'../adapters';\nimport { WidgetProps } from './types';\n\nexport class Slider extends React.Component {\n constructor(public props: WidgetProps) {\n super(props);\n this.handleChange = this.handleChange.bind(this);\n }\n\n public render() {\n const props: WidgetProps = this.props;\n const schema = props.schema;\n let factor;\n let unit;\n const additionalProps = getAdditionalProps(props.schema);\n\n if (isPercent(schema)) {\n factor = 100; // eslint-disable-line no-magic-numbers\n unit = '%';\n }\n\n return React.createElement(LimeElementsWidgetAdapter, {\n name: 'limel-slider',\n value: props.value,\n events: {\n change: this.handleChange,\n },\n widgetProps: props,\n extraProps: {\n valuemin: schema.minimum,\n valuemax: schema.maximum,\n step: schema.multipleOf,\n factor: factor,\n unit: unit,\n ...additionalProps,\n },\n });\n }\n\n private handleChange(event: CustomEvent<number>) {\n const props = this.props;\n event.stopPropagation();\n\n if (!props.onChange) {\n return;\n }\n\n props.onChange(event.detail);\n }\n}\n\nfunction isPercent(schema: any): boolean {\n return (\n schema.multipleOf < 1 && schema.minimum === 0 && schema.maximum === 1\n );\n}\n\nfunction getAdditionalProps(schema: any) {\n let props: any = {};\n\n if (schema.lime?.component?.props) {\n props = {\n ...props,\n ...schema.lime.component.props,\n };\n }\n\n return props;\n}\n"]}
1
+ {"version":3,"file":"slider.js","sourceRoot":"","sources":["../../../../src/components/form/widgets/slider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAIxD,MAAM,OAAO,MAAO,SAAQ,KAAK,CAAC,SAAS;EACvC,YAAmB,KAAkB;IACjC,KAAK,CAAC,KAAK,CAAC,CAAC;IADE,UAAK,GAAL,KAAK,CAAa;IAEjC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;EACrD,CAAC;EAEM,MAAM;IACT,MAAM,KAAK,GAAgB,IAAI,CAAC,KAAK,CAAC;IACtC,MAAM,MAAM,GAAG,KAAK,CA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IAC/B,KAAK,mCACE,KAAK,GACL,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CACjC,CAAC;GACL;EAED,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import React from 'react';\nimport { LimeElementsWidgetAdapter } from '../adapters';\nimport { WidgetProps } from './types';\nimport { FormSchema } from '../form.types';\n\nexport class Slider extends React.Component {\n constructor(public props: WidgetProps) {\n super(props);\n this.handleChange = this.handleChange.bind(this);\n }\n\n public render() {\n const props: WidgetProps = this.props;\n const schema = props.schema;\n let factor;\n let unit;\n const additionalProps = getAdditionalProps(props.schema);\n\n if (isPercent(schema)) {\n factor = 100; // eslint-disable-line no-magic-numbers\n unit = '%';\n }\n\n return React.createElement(LimeElementsWidgetAdapter, {\n name: 'limel-slider',\n value: props.value,\n events: {\n change: this.handleChange,\n },\n widgetProps: props,\n extraProps: {\n valuemin: schema.minimum,\n valuemax: schema.maximum,\n step: schema.multipleOf,\n factor: factor,\n unit: unit,\n ...additionalProps,\n },\n });\n }\n\n private handleChange(event: CustomEvent<number>) {\n const props = this.props;\n event.stopPropagation();\n\n if (!props.onChange) {\n return;\n }\n\n props.onChange(event.detail);\n }\n}\n\nfunction isPercent(schema: FormSchema): boolean {\n return (\n schema.multipleOf < 1 && schema.minimum === 0 && schema.maximum === 1\n );\n}\n\nfunction getAdditionalProps(schema: FormSchema) {\n let props: any = {};\n\n if (schema.lime?.component?.props) {\n props = {\n ...props,\n ...schema.lime.component.props,\n };\n }\n\n return props;\n}\n"]}
@@ -73,6 +73,7 @@ export class List {
73
73
  return !!item.selected;
74
74
  });
75
75
  if (selectedItem) {
76
+ this.mdcList.selectedIndex = -1;
76
77
  this.change.emit(Object.assign(Object.assign({}, selectedItem), { selected: false }));
77
78
  }
78
79
  if (listItems[index] !== selectedItem) {
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/components/list/list.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAsB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AAc,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CACpC,CAAC;QAEF,IAAI,aAAa,KAAK,CAAC,CAAC,EAAE;UACtB,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;SACrC;aAAM;UACH,IAAI,CAAC,OAAO,CAAC,aAAa,GAAG,aAAa,CAAC;SAC9C;OACJ;IACL,CAAC,EAAE,CAAC,CAAC,CAAC;EACV,CAAC;EA2GO,uBAAuB;IAC3B,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,IAAI,IAAI,CAAC,EAAE;MAChD,yCAAyC;MACzC,OAAO,CAAC,IAAI,CACR,sKAAsK,CACzK,CAAC;KACL;EACL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { IconSize } from '../icon/icon.types';\nimport { ListItem, ListSeparator } from './list-item.types';\nimport { ListType } from './list.types';\nimport { MDCList, MDCListActionEvent } from '@material/list';\nimport { strings as listStrings } from '@material/list/constants';\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n Watch,\n} from '@stencil/core';\nimport { ListRenderer } from './list-renderer';\nimport { ListRendererConfig } from './list-renderer-config';\n\nconst { ACTION_EVENT } = listStrings;\n\n/**\n * @exampleComponent limel-example-list\n * @exampleComponent limel-example-list-secondary\n * @exampleComponent limel-example-list-separator\n * @exampleComponent limel-example-list-selectable\n * @exampleComponent limel-example-list-icons\n * @exampleComponent limel-example-list-badge-icons\n * @exampleComponent limel-example-list-checkbox\n * @exampleComponent limel-example-list-checkbox-icons\n * @exampleComponent limel-example-list-radio-button\n * @exampleComponent limel-example-list-radio-button-icons\n * @exampleComponent limel-example-list-action\n * @exampleComponent limel-example-list-striped\n * @exampleComponent limel-example-list-badge-icons-with-multiple-lines\n * @exampleComponent limel-example-list-grid\n * @exampleComponent limel-example-list-primary-component\n */\n@Component({\n tag: 'limel-list',\n shadow: true,\n styleUrl: 'list.scss',\n})\nexport class List {\n /**\n * List of items to display\n */\n @Prop()\n public items: Array<ListItem | ListSeparator>;\n\n /**\n * Set to `true` if the list should display larger icons with a background\n */\n @Prop()\n public badgeIcons: boolean;\n\n /**\n * Size of the icons in the list\n */\n @Prop()\n public iconSize: IconSize = 'small';\n\n /**\n * The type of the list, omit to get a regular list. Available types are:\n * `selectable`: regular list with single selection.\n * `radio`: radio button list with single selection.\n * `checkbox`: checkbox list with multiple selection.\n */\n @Prop()\n public type: ListType;\n\n /**\n * By default, lists will display 3 lines of text, and then truncate the rest.\n * Consumers can increase or decrease this number by specifying\n * `maxLinesSecondaryText`. If consumer enters zero or negative\n * numbers we default to 1; and if they type decimals we round up.\n */\n // eslint-disable-next-line no-magic-numbers\n @Prop() maxLinesSecondaryText: number = 3;\n\n @Element()\n private element: HTMLLimelListElement;\n\n private config: ListRendererConfig;\n private listRenderer = new ListRenderer();\n private mdcList: MDCList;\n private multiple: boolean;\n private selectable: boolean;\n\n /**\n * Fired when a new value has been selected from the list.\n * Only fired if `type` is set to `selectable`, `radio` or `checkbox`.\n */\n @Event()\n private change: EventEmitter<ListItem | ListItem[]>;\n\n /**\n * Fired when an action has been selected from the action menu of a list item\n */\n @Event()\n protected select: EventEmitter<ListItem | ListItem[]>;\n\n public connectedCallback() {\n this.setup();\n }\n\n public disconnectedCallback() {\n this.teardown();\n }\n\n public componentDidLoad() {\n this.setup();\n this.triggerIconColorWarning();\n }\n\n public render() {\n this.config = {\n badgeIcons: this.badgeIcons,\n type: this.type,\n iconSize: this.iconSize,\n };\n let maxLinesSecondaryText = +this.maxLinesSecondaryText?.toFixed();\n if (this.maxLinesSecondaryText < 1) {\n maxLinesSecondaryText = 1;\n }\n\n const html = this.listRenderer.render(this.items, this.config);\n\n return (\n <Host\n style={{\n '--maxLinesSecondaryText': `${maxLinesSecondaryText}`,\n }}\n >\n {html}\n </Host>\n );\n }\n\n @Watch('type')\n protected handleType() {\n this.setupListeners();\n }\n\n @Watch('items')\n protected itemsChanged() {\n if (!this.mdcList) {\n return;\n }\n\n setTimeout(() => {\n this.setup();\n\n const listItems = this.items.filter(this.isListItem);\n\n if (this.multiple) {\n this.mdcList.selectedIndex = listItems\n .filter((item: ListItem) => item.selected)\n .map((item: ListItem) => listItems.indexOf(item));\n } else {\n const selectedIndex = listItems.findIndex(\n (item: ListItem) => item.selected,\n );\n\n if (selectedIndex === -1) {\n this.mdcList.initializeListType();\n } else {\n this.mdcList.selectedIndex = selectedIndex;\n }\n }\n }, 0);\n }\n\n private setup = () => {\n this.setupList();\n\n this.setupListeners();\n };\n\n private setupList = () => {\n if (this.mdcList) {\n this.teardown();\n this.mdcList = null;\n }\n\n const element = this.element.shadowRoot.querySelector(\n '.mdc-deprecated-list',\n );\n if (!element) {\n return;\n }\n\n this.mdcList = new MDCList(element);\n this.mdcList.hasTypeahead = true;\n };\n\n private setupListeners = () => {\n if (!this.mdcList) {\n return;\n }\n\n this.mdcList.unlisten(ACTION_EVENT, this.handleAction);\n\n this.selectable = ['selectable', 'radio', 'checkbox'].includes(\n this.type,\n );\n this.multiple = this.type === 'checkbox';\n\n if (!this.selectable) {\n return;\n }\n\n this.mdcList.listen(ACTION_EVENT, this.handleAction);\n this.mdcList.singleSelection = !this.multiple;\n };\n\n private teardown = () => {\n this.mdcList?.unlisten(ACTION_EVENT, this.handleAction);\n this.mdcList?.destroy();\n };\n\n private handleAction = (event: MDCListActionEvent) => {\n if (!this.multiple) {\n this.handleSingleSelect(event.detail.index);\n\n return;\n }\n\n this.handleMultiSelect(event.detail.index);\n };\n\n private handleSingleSelect = (index: number) => {\n const listItems = this.items.filter(this.isListItem) as ListItem[];\n if (listItems[index].disabled) {\n return;\n }\n\n const selectedItem: ListItem = listItems.find((item: ListItem) => {\n return !!item.selected;\n });\n\n if (selectedItem) {\n this.change.emit({ ...selectedItem, selected: false });\n }\n\n if (listItems[index] !== selectedItem) {\n this.change.emit({ ...listItems[index], selected: true });\n }\n };\n\n private handleMultiSelect = (index: number) => {\n const listItems = this.items.filter(this.isListItem) as ListItem[];\n if (listItems[index].disabled) {\n return;\n }\n\n const selectedItems: ListItem[] = listItems\n .filter((item: ListItem, listIndex: number) => {\n if (listIndex === index) {\n // This is the item that was selected or deselected,\n // so we negate its previous selection status.\n return !item.selected;\n }\n\n // This is an item that didn't change, so we keep its selection status.\n return item.selected;\n })\n .map((item: ListItem) => {\n return { ...item, selected: true };\n });\n\n this.change.emit(selectedItems);\n };\n\n private isListItem = (item: ListItem): boolean => {\n return !('separator' in item);\n };\n\n private triggerIconColorWarning() {\n if (this.items.some((item) => 'iconColor' in item)) {\n /* eslint-disable-next-line no-console */\n console.warn(\n \"The `iconColor` prop is deprecated now! Use the new `Icon` interface and instead of `iconColor: 'color-name'` write `icon {name: 'icon-name', color: 'color-name'}`.\",\n );\n }\n }\n}\n"]}
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/components/list/list.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAsB,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EACH,SAAS,EACT,OAAO,EACP,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,IAAI,EACJ,KAAK,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,MAAM,EAAE,YAAY,EAAE,GAAG,WAAW,CAAC;AAErC;;;;;;;;;;;;;;;;GAgBG;AAMH,MAAM,OAAO,IAAI;;IAyCL,iBAAY,GAAG,IAAI,YAAY,EAAE,CAAC;IAyFlC,UAAK,GAAG,GAAG,EAAE;MACjB,IA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I,CAAC,EAAE;MAChD,yCAAyC;MACzC,OAAO,CAAC,IAAI,CACR,sKAAsK,CACzK,CAAC;KACL;EACL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { IconSize } from '../icon/icon.types';\nimport { ListItem, ListSeparator } from './list-item.types';\nimport { ListType } from './list.types';\nimport { MDCList, MDCListActionEvent } from '@material/list';\nimport { strings as listStrings } from '@material/list/constants';\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n Watch,\n} from '@stencil/core';\nimport { ListRenderer } from './list-renderer';\nimport { ListRendererConfig } from './list-renderer-config';\n\nconst { ACTION_EVENT } = listStrings;\n\n/**\n * @exampleComponent limel-example-list\n * @exampleComponent limel-example-list-secondary\n * @exampleComponent limel-example-list-separator\n * @exampleComponent limel-example-list-selectable\n * @exampleComponent limel-example-list-icons\n * @exampleComponent limel-example-list-badge-icons\n * @exampleComponent limel-example-list-checkbox\n * @exampleComponent limel-example-list-checkbox-icons\n * @exampleComponent limel-example-list-radio-button\n * @exampleComponent limel-example-list-radio-button-icons\n * @exampleComponent limel-example-list-action\n * @exampleComponent limel-example-list-striped\n * @exampleComponent limel-example-list-badge-icons-with-multiple-lines\n * @exampleComponent limel-example-list-grid\n * @exampleComponent limel-example-list-primary-component\n */\n@Component({\n tag: 'limel-list',\n shadow: true,\n styleUrl: 'list.scss',\n})\nexport class List {\n /**\n * List of items to display\n */\n @Prop()\n public items: Array<ListItem | ListSeparator>;\n\n /**\n * Set to `true` if the list should display larger icons with a background\n */\n @Prop()\n public badgeIcons: boolean;\n\n /**\n * Size of the icons in the list\n */\n @Prop()\n public iconSize: IconSize = 'small';\n\n /**\n * The type of the list, omit to get a regular list. Available types are:\n * `selectable`: regular list with single selection.\n * `radio`: radio button list with single selection.\n * `checkbox`: checkbox list with multiple selection.\n */\n @Prop()\n public type: ListType;\n\n /**\n * By default, lists will display 3 lines of text, and then truncate the rest.\n * Consumers can increase or decrease this number by specifying\n * `maxLinesSecondaryText`. If consumer enters zero or negative\n * numbers we default to 1; and if they type decimals we round up.\n */\n // eslint-disable-next-line no-magic-numbers\n @Prop() maxLinesSecondaryText: number = 3;\n\n @Element()\n private element: HTMLLimelListElement;\n\n private config: ListRendererConfig;\n private listRenderer = new ListRenderer();\n private mdcList: MDCList;\n private multiple: boolean;\n private selectable: boolean;\n\n /**\n * Fired when a new value has been selected from the list.\n * Only fired if `type` is set to `selectable`, `radio` or `checkbox`.\n */\n @Event()\n private change: EventEmitter<ListItem | ListItem[]>;\n\n /**\n * Fired when an action has been selected from the action menu of a list item\n */\n @Event()\n protected select: EventEmitter<ListItem | ListItem[]>;\n\n public connectedCallback() {\n this.setup();\n }\n\n public disconnectedCallback() {\n this.teardown();\n }\n\n public componentDidLoad() {\n this.setup();\n this.triggerIconColorWarning();\n }\n\n public render() {\n this.config = {\n badgeIcons: this.badgeIcons,\n type: this.type,\n iconSize: this.iconSize,\n };\n let maxLinesSecondaryText = +this.maxLinesSecondaryText?.toFixed();\n if (this.maxLinesSecondaryText < 1) {\n maxLinesSecondaryText = 1;\n }\n\n const html = this.listRenderer.render(this.items, this.config);\n\n return (\n <Host\n style={{\n '--maxLinesSecondaryText': `${maxLinesSecondaryText}`,\n }}\n >\n {html}\n </Host>\n );\n }\n\n @Watch('type')\n protected handleType() {\n this.setupListeners();\n }\n\n @Watch('items')\n protected itemsChanged() {\n if (!this.mdcList) {\n return;\n }\n\n setTimeout(() => {\n this.setup();\n\n const listItems = this.items.filter(this.isListItem);\n\n if (this.multiple) {\n this.mdcList.selectedIndex = listItems\n .filter((item: ListItem) => item.selected)\n .map((item: ListItem) => listItems.indexOf(item));\n } else {\n const selectedIndex = listItems.findIndex(\n (item: ListItem) => item.selected,\n );\n\n if (selectedIndex === -1) {\n this.mdcList.initializeListType();\n } else {\n this.mdcList.selectedIndex = selectedIndex;\n }\n }\n }, 0);\n }\n\n private setup = () => {\n this.setupList();\n\n this.setupListeners();\n };\n\n private setupList = () => {\n if (this.mdcList) {\n this.teardown();\n this.mdcList = null;\n }\n\n const element = this.element.shadowRoot.querySelector(\n '.mdc-deprecated-list',\n );\n if (!element) {\n return;\n }\n\n this.mdcList = new MDCList(element);\n this.mdcList.hasTypeahead = true;\n };\n\n private setupListeners = () => {\n if (!this.mdcList) {\n return;\n }\n\n this.mdcList.unlisten(ACTION_EVENT, this.handleAction);\n\n this.selectable = ['selectable', 'radio', 'checkbox'].includes(\n this.type,\n );\n this.multiple = this.type === 'checkbox';\n\n if (!this.selectable) {\n return;\n }\n\n this.mdcList.listen(ACTION_EVENT, this.handleAction);\n this.mdcList.singleSelection = !this.multiple;\n };\n\n private teardown = () => {\n this.mdcList?.unlisten(ACTION_EVENT, this.handleAction);\n this.mdcList?.destroy();\n };\n\n private handleAction = (event: MDCListActionEvent) => {\n if (!this.multiple) {\n this.handleSingleSelect(event.detail.index);\n\n return;\n }\n\n this.handleMultiSelect(event.detail.index);\n };\n\n private handleSingleSelect = (index: number) => {\n const listItems = this.items.filter(this.isListItem) as ListItem[];\n if (listItems[index].disabled) {\n return;\n }\n\n const selectedItem: ListItem = listItems.find((item: ListItem) => {\n return !!item.selected;\n });\n\n if (selectedItem) {\n this.mdcList.selectedIndex = -1;\n this.change.emit({ ...selectedItem, selected: false });\n }\n\n if (listItems[index] !== selectedItem) {\n this.change.emit({ ...listItems[index], selected: true });\n }\n };\n\n private handleMultiSelect = (index: number) => {\n const listItems = this.items.filter(this.isListItem) as ListItem[];\n if (listItems[index].disabled) {\n return;\n }\n\n const selectedItems: ListItem[] = listItems\n .filter((item: ListItem, listIndex: number) => {\n if (listIndex === index) {\n // This is the item that was selected or deselected,\n // so we negate its previous selection status.\n return !item.selected;\n }\n\n // This is an item that didn't change, so we keep its selection status.\n return item.selected;\n })\n .map((item: ListItem) => {\n return { ...item, selected: true };\n });\n\n this.change.emit(selectedItems);\n };\n\n private isListItem = (item: ListItem): boolean => {\n return !('separator' in item);\n };\n\n private triggerIconColorWarning() {\n if (this.items.some((item) => 'iconColor' in item)) {\n /* eslint-disable-next-line no-console */\n console.warn(\n \"The `iconColor` prop is deprecated now! Use the new `Icon` interface and instead of `iconColor: 'color-name'` write `icon {name: 'icon-name', color: 'color-name'}`.\",\n );\n }\n }\n}\n"]}
@@ -11,7 +11,7 @@ export * from './components/dialog/dialog.types';
11
11
  export * from './components/dock/dock.types';
12
12
  export * from './components/file/file.types';
13
13
  export * from './components/flex-container/flex-container.types';
14
- export * from './components/form/form.types';
14
+ export { FormLayoutType, } from './components/form/form.types';
15
15
  export * from './components/help/help.types';
16
16
  export * from './components/icon/icon.types';
17
17
  export * from './components/info-tile/info-tile.types';
@@ -1 +1 @@
1
- {"version":3,"file":"interface.js","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wDAAwD,CAAC;AACvE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kDAAkD,CAAC;AACjE,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wCAAwC,CAAC;AACvD,cAAc,4CAA4C,CAAC;AAE3D,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wCAAwC,CAAC;AACvD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC","sourcesContent":["export * from './components/action-bar/action-bar.types';\nexport * from './components/breadcrumbs/breadcrumbs.types';\nexport * from './components/button/button.types';\nexport * from './components/callout/callout.types';\nexport * from './components/chip-set/chip.types';\nexport * from './components/circular-progress/circular-progress.types';\nexport * from './components/code-editor/code-editor.types';\nexport * from './components/collapsible-section/action';\nexport * from './components/date-picker/date.types';\nexport * from './components/dialog/dialog.types';\nexport * from './components/dock/dock.types';\nexport * from './components/file/file.types';\nexport * from './components/flex-container/flex-container.types';\nexport * from './components/form/form.types';\nexport * from './components/help/help.types';\nexport * from './components/icon/icon.types';\nexport * from './components/info-tile/info-tile.types';\nexport * from './components/input-field/input-field.types';\nexport { ListComponent } from './components/list/list-item.types';\nexport * from './components/list/list.types';\nexport * from './components/menu/menu.types';\nexport * from './components/menu-list/menu-list.types';\nexport * from './components/picker/actions.types';\nexport * from './components/picker/searcher.types';\nexport * from './components/progress-flow/progress-flow.types';\nexport * from './components/select/option.types';\nexport * from './components/spinner/spinner.types';\nexport * from './components/tab-panel/tab-panel.types';\nexport * from './components/table/table.types';\nexport * from './global/shared-types/separator.types';\n"]}
1
+ {"version":3,"file":"interface.js","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,wDAAwD,CAAC;AACvE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kDAAkD,CAAC;AACjE,OAAO,EAaH,cAAc,GAIjB,MAAM,8BAA8B,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wCAAwC,CAAC;AACvD,cAAc,4CAA4C,CAAC;AAE3D,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wCAAwC,CAAC;AACvD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wCAAwC,CAAC;AACvD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC","sourcesContent":["export * from './components/action-bar/action-bar.types';\nexport * from './components/breadcrumbs/breadcrumbs.types';\nexport * from './components/button/button.types';\nexport * from './components/callout/callout.types';\nexport * from './components/chip-set/chip.types';\nexport * from './components/circular-progress/circular-progress.types';\nexport * from './components/code-editor/code-editor.types';\nexport * from './components/collapsible-section/action';\nexport * from './components/date-picker/date.types';\nexport * from './components/dialog/dialog.types';\nexport * from './components/dock/dock.types';\nexport * from './components/file/file.types';\nexport * from './components/flex-container/flex-container.types';\nexport {\n EventEmitter,\n ValidationStatus,\n FormError,\n ValidationError,\n FormComponent,\n FormInfo,\n LimeSchemaOptions,\n LimeLayoutOptions,\n FormComponentOptions,\n FormLayoutOptions,\n GridLayoutOptions,\n RowLayoutOptions,\n FormLayoutType,\n ReplaceObjectType,\n FormSchemaArrayItem,\n FormSubKeySchema,\n} from './components/form/form.types';\nexport * from './components/help/help.types';\nexport * from './components/icon/icon.types';\nexport * from './components/info-tile/info-tile.types';\nexport * from './components/input-field/input-field.types';\nexport { ListComponent } from './components/list/list-item.types';\nexport * from './components/list/list.types';\nexport * from './components/menu/menu.types';\nexport * from './components/menu-list/menu-list.types';\nexport * from './components/picker/actions.types';\nexport * from './components/picker/searcher.types';\nexport * from './components/progress-flow/progress-flow.types';\nexport * from './components/select/option.types';\nexport * from './components/spinner/spinner.types';\nexport * from './components/tab-panel/tab-panel.types';\nexport * from './components/table/table.types';\nexport * from './global/shared-types/separator.types';\n"]}
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @public
3
2
  * Represents the layout types for a form.
3
+ * @public
4
4
  */
5
5
  var FormLayoutType;
6
6
  (function (FormLayoutType) {