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

Class ExamplesSelectValueRetainer

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

Source from the content-addressed store, hash-verified

59191 }
59192 }
59193 const stringifyUnlessList = (s) => (ze.List.isList(s) ? s : stringify(s))
59194 class ExamplesSelectValueRetainer extends Re.PureComponent {
59195 static defaultProps = {
59196 userHasEditedBody: !1,
59197 examples: (0, ze.Map)({}),
59198 currentNamespace: '__DEFAULT__NAMESPACE__',
59199 setRetainRequestBodyValueFlag: () => {},
59200 onSelect: (...s) =>
59201 console.log('ExamplesSelectValueRetainer: no `onSelect` function was provided', ...s),
59202 updateValue: (...s) =>
59203 console.log(
59204 'ExamplesSelectValueRetainer: no `updateValue` function was provided',
59205 ...s
59206 ),
59207 }
59208 constructor(s) {
59209 super(s)
59210 const o = this._getCurrentExampleValue()
59211 this.state = {
59212 [s.currentNamespace]: (0, ze.Map)({
59213 lastUserEditedValue: this.props.currentUserInputValue,
59214 lastDownstreamValue: o,
59215 isModifiedValueSelected:
59216 this.props.userHasEditedBody || this.props.currentUserInputValue !== o,
59217 }),
59218 }
59219 }
59220 componentWillUnmount() {
59221 this.props.setRetainRequestBodyValueFlag(!1)
59222 }
59223 _getStateForCurrentNamespace = () => {
59224 const { currentNamespace: s } = this.props
59225 return (this.state[s] || (0, ze.Map)()).toObject()
59226 }
59227 _setStateForCurrentNamespace = (s) => {
59228 const { currentNamespace: o } = this.props
59229 return this._setStateForNamespace(o, s)
59230 }
59231 _setStateForNamespace = (s, o) => {
59232 const i = (this.state[s] || (0, ze.Map)()).mergeDeep(o)
59233 return this.setState({ [s]: i })
59234 }
59235 _isCurrentUserInputSameAsExampleValue = () => {
59236 const { currentUserInputValue: s } = this.props
59237 return this._getCurrentExampleValue() === s
59238 }
59239 _getValueForExample = (s, o) => {
59240 const { examples: i } = o || this.props
59241 return stringifyUnlessList((i || (0, ze.Map)({})).getIn([s, 'value']))
59242 }
59243 _getCurrentExampleValue = (s) => {
59244 const { currentKey: o } = s || this.props
59245 return this._getValueForExample(o, s || this.props)
59246 }
59247 _onExamplesSelect = (s, { isSyntheticChange: o } = {}, ...i) => {
59248 const {
59249 onSelect: a,
59250 updateValue: u,

Callers

nothing calls this directly

Calls 4

stringifyUnlessListFunction · 0.85
toObjectMethod · 0.80
uFunction · 0.70
aFunction · 0.70

Tested by

no test coverage detected