MCPcopy Index your code
hub / github.com/dataease/SQLBot / JsonSchema_array

Class JsonSchema_array

frontend/public/swagger-ui-bundle.js:36833–36981  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36831 })
36832 }
36833 }
36834 class JsonSchema_array extends Re.PureComponent {
36835 static defaultProps = ss
36836 constructor(s, o) {
36837 ;(super(s, o), (this.state = { value: valueOrEmptyList(s.value), schema: s.schema }))
36838 }
36839 UNSAFE_componentWillReceiveProps(s) {
36840 const o = valueOrEmptyList(s.value)
36841 ;(o !== this.state.value && this.setState({ value: o }),
36842 s.schema !== this.state.schema && this.setState({ schema: s.schema }))
36843 }
36844 onChange = () => {
36845 this.props.onChange(this.state.value)
36846 }
36847 onItemChange = (s, o) => {
36848 this.setState(({ value: i }) => ({ value: i.set(o, s) }), this.onChange)
36849 }
36850 removeItem = (s) => {
36851 this.setState(({ value: o }) => ({ value: o.delete(s) }), this.onChange)
36852 }
36853 addItem = () => {
36854 const { fn: s } = this.props
36855 let o = valueOrEmptyList(this.state.value)
36856 this.setState(
36857 () => ({
36858 value: o.push(
36859 s.getSampleSchema(this.state.schema.get('items'), !1, { includeWriteOnly: !0 })
36860 ),
36861 }),
36862 this.onChange
36863 )
36864 }
36865 onEnumChange = (s) => {
36866 this.setState(() => ({ value: s }), this.onChange)
36867 }
36868 render() {
36869 let {
36870 getComponent: s,
36871 required: o,
36872 schema: i,
36873 errors: a,
36874 fn: u,
36875 disabled: _,
36876 } = this.props
36877 a = a.toJS ? a.toJS() : Array.isArray(a) ? a : []
36878 const w = a.filter((s) => 'string' == typeof s),
36879 x = a.filter((s) => void 0 !== s.needRemove).map((s) => s.error),
36880 C = this.state.value,
36881 j = !!(C && C.count && C.count() > 0),
36882 L = i.getIn(['items', 'enum']),
36883 B = i.get('items'),
36884 $ = u.getSchemaObjectType(B),
36885 U = u.getSchemaObjectTypeLabel(B),
36886 V = i.getIn(['items', 'format']),
36887 z = i.get('items')
36888 let Y,
36889 Z = !1,
36890 ee = 'file' === $ || ('string' === $ && 'binary' === V)

Callers

nothing calls this directly

Calls 5

valueOrEmptyListFunction · 0.85
getMethod · 0.65
setMethod · 0.45
deleteMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected