@sap-ux/ui-prompting 0.7.4 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Inputs/Input/Input.d.ts +1 -1
- package/dist/components/Inputs/Input/Input.d.ts.map +1 -1
- package/dist/components/Inputs/Input/Input.js +6 -13
- package/dist/components/Inputs/Input/Input.js.map +1 -1
- package/dist/components/Inputs/Input/TranslationInput.d.ts +2 -2
- package/dist/components/Inputs/Input/TranslationInput.d.ts.map +1 -1
- package/dist/components/Inputs/Input/TranslationInput.js +13 -50
- package/dist/components/Inputs/Input/TranslationInput.js.map +1 -1
- package/dist/components/Inputs/Input/index.d.ts +2 -2
- package/dist/components/Inputs/Input/index.d.ts.map +1 -1
- package/dist/components/Inputs/Input/index.js +2 -18
- package/dist/components/Inputs/Input/index.js.map +1 -1
- package/dist/components/Inputs/MultiSelect/MultiSelect.d.ts +1 -1
- package/dist/components/Inputs/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/Inputs/MultiSelect/MultiSelect.js +9 -16
- package/dist/components/Inputs/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/components/Inputs/MultiSelect/index.d.ts +1 -1
- package/dist/components/Inputs/MultiSelect/index.d.ts.map +1 -1
- package/dist/components/Inputs/MultiSelect/index.js +1 -17
- package/dist/components/Inputs/MultiSelect/index.js.map +1 -1
- package/dist/components/Inputs/Select/Select.d.ts +1 -1
- package/dist/components/Inputs/Select/Select.d.ts.map +1 -1
- package/dist/components/Inputs/Select/Select.js +12 -49
- package/dist/components/Inputs/Select/Select.js.map +1 -1
- package/dist/components/Inputs/Select/index.d.ts +1 -1
- package/dist/components/Inputs/Select/index.d.ts.map +1 -1
- package/dist/components/Inputs/Select/index.js +1 -17
- package/dist/components/Inputs/Select/index.js.map +1 -1
- package/dist/components/Inputs/index.d.ts +3 -3
- package/dist/components/Inputs/index.d.ts.map +1 -1
- package/dist/components/Inputs/index.js +3 -19
- package/dist/components/Inputs/index.js.map +1 -1
- package/dist/components/Question/Question.d.ts +1 -1
- package/dist/components/Question/Question.d.ts.map +1 -1
- package/dist/components/Question/Question.js +12 -19
- package/dist/components/Question/Question.js.map +1 -1
- package/dist/components/Question/index.d.ts +1 -1
- package/dist/components/Question/index.d.ts.map +1 -1
- package/dist/components/Question/index.js +1 -17
- package/dist/components/Question/index.js.map +1 -1
- package/dist/components/QuestionGroup/QuestionGroup.js +11 -18
- package/dist/components/QuestionGroup/QuestionGroup.js.map +1 -1
- package/dist/components/QuestionGroup/index.d.ts +1 -1
- package/dist/components/QuestionGroup/index.d.ts.map +1 -1
- package/dist/components/QuestionGroup/index.js +1 -17
- package/dist/components/QuestionGroup/index.js.map +1 -1
- package/dist/components/Questions/Questions.d.ts +2 -2
- package/dist/components/Questions/Questions.d.ts.map +1 -1
- package/dist/components/Questions/Questions.js +25 -61
- package/dist/components/Questions/Questions.js.map +1 -1
- package/dist/components/Questions/index.d.ts +1 -1
- package/dist/components/Questions/index.d.ts.map +1 -1
- package/dist/components/Questions/index.js +1 -17
- package/dist/components/Questions/index.js.map +1 -1
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +3 -19
- package/dist/components/index.js.map +1 -1
- package/dist/context/TranslationContext.d.ts +1 -1
- package/dist/context/TranslationContext.d.ts.map +1 -1
- package/dist/context/TranslationContext.js +7 -45
- package/dist/context/TranslationContext.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -22
- package/dist/index.js.map +1 -1
- package/dist/types.js +4 -7
- package/dist/types.js.map +1 -1
- package/dist/utilities/hooks.d.ts +1 -1
- package/dist/utilities/hooks.d.ts.map +1 -1
- package/dist/utilities/hooks.js +35 -46
- package/dist/utilities/hooks.js.map +1 -1
- package/dist/utilities/index.d.ts +3 -3
- package/dist/utilities/index.d.ts.map +1 -1
- package/dist/utilities/index.js +3 -19
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/renderUtils.js +8 -17
- package/dist/utilities/renderUtils.js.map +1 -1
- package/dist/utilities/utils.d.ts +1 -1
- package/dist/utilities/utils.d.ts.map +1 -1
- package/dist/utilities/utils.js +7 -16
- package/dist/utilities/utils.js.map +1 -1
- package/package.json +10 -11
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { AnswerValue, InputPromptQuestion } from '../../../types';
|
|
2
|
+
import type { AnswerValue, InputPromptQuestion } from '../../../types.js';
|
|
3
3
|
export interface InputProps extends InputPromptQuestion {
|
|
4
4
|
id?: string;
|
|
5
5
|
value?: AnswerValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../../src/components/Inputs/Input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../../src/components/Inputs/Input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE1E,MAAM,WAAW,UAAW,SAAQ,mBAAmB;IACnD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,WAAW,KAAK,IAAI,CAAC;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,KAAK,GAAI,OAAO,UAAU,sBAqBtC,CAAC"}
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Input = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const ui_components_1 = require("@sap-ux/ui-components");
|
|
9
|
-
const utilities_1 = require("../../../utilities");
|
|
10
|
-
const Input = (props) => {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UITextInput } from '@sap-ux/ui-components';
|
|
3
|
+
import { useValue, getLabelRenderer } from '../../../utilities/index.js';
|
|
4
|
+
export const Input = (props) => {
|
|
11
5
|
const { name, onChange, guiOptions = {}, message, errorMessage, id } = props;
|
|
12
6
|
const { mandatory, hint, placeholder } = guiOptions;
|
|
13
|
-
const [value, setValue] =
|
|
7
|
+
const [value, setValue] = useValue('', props.value);
|
|
14
8
|
const onLiveChange = (event, newValue) => {
|
|
15
9
|
setValue(newValue ?? '');
|
|
16
10
|
onChange?.(name, newValue);
|
|
17
11
|
};
|
|
18
|
-
return (
|
|
12
|
+
return (React.createElement(UITextInput, { onRenderLabel: getLabelRenderer(hint), required: mandatory, label: typeof message === 'string' ? message : name, value: value ? value.toString() : '', onChange: onLiveChange, errorMessage: errorMessage, placeholder: placeholder ?? 'Enter a value', id: id }));
|
|
19
13
|
};
|
|
20
|
-
exports.Input = Input;
|
|
21
14
|
//# sourceMappingURL=Input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../../src/components/Inputs/Input/Input.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../../src/components/Inputs/Input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAUzE,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAiB,EAAE,EAAE;IACvC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,GAAG,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC;IAC7E,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC;IACpD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACpD,MAAM,YAAY,GAAG,CAAC,KAAsB,EAAE,QAA6B,EAAE,EAAE;QAC3E,QAAQ,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;QACzB,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC/B,CAAC,CAAC;IAEF,OAAO,CACH,oBAAC,WAAW,IACR,aAAa,EAAE,gBAAgB,CAAC,IAAI,CAAC,EACrC,QAAQ,EAAE,SAAS,EACnB,KAAK,EAAE,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EACnD,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,EACpC,QAAQ,EAAE,YAAY,EACtB,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,IAAI,eAAe,EAC3C,EAAE,EAAE,EAAE,GACR,CACL,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { InputProps } from './Input';
|
|
3
|
-
import type { TranslationProperties } from '../../../types';
|
|
2
|
+
import type { InputProps } from './Input.js';
|
|
3
|
+
import type { TranslationProperties } from '../../../types.js';
|
|
4
4
|
export interface TranslationInputProps extends InputProps {
|
|
5
5
|
properties: TranslationProperties;
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationInput.d.ts","sourceRoot":"","sources":["../../../../src/components/Inputs/Input/TranslationInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAK3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"TranslationInput.d.ts","sourceRoot":"","sources":["../../../../src/components/Inputs/Input/TranslationInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAK3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE/D,MAAM,WAAW,qBAAsB,SAAQ,UAAU;IACrD,UAAU,EAAE,qBAAqB,CAAC;CACrC;AAED,eAAO,MAAM,gBAAgB,GAAI,OAAO,qBAAqB,sBAsD5D,CAAC"}
|
|
@@ -1,70 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.TranslationInput = void 0;
|
|
37
|
-
const react_1 = __importStar(require("react"));
|
|
38
|
-
const ui_components_1 = require("@sap-ux/ui-components");
|
|
39
|
-
const utilities_1 = require("../../../utilities");
|
|
40
|
-
const TranslationContext_1 = require("../../../context/TranslationContext");
|
|
41
|
-
const types_1 = require("../../../types");
|
|
42
|
-
const TranslationInput = (props) => {
|
|
43
|
-
const { bundle, onEvent: triggerEvent, pendingQuestions } = (0, TranslationContext_1.useTranslation)();
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { TranslationKeyGenerator, TranslationTextPattern, UITranslationInput } from '@sap-ux/ui-components';
|
|
3
|
+
import { useValue, getLabelRenderer } from '../../../utilities/index.js';
|
|
4
|
+
import { useTranslation } from '../../../context/TranslationContext.js';
|
|
5
|
+
import { TRANSLATE_EVENT_UPDATE, TRANSLATE_EVENT_SHOW } from '../../../types.js';
|
|
6
|
+
export const TranslationInput = (props) => {
|
|
7
|
+
const { bundle, onEvent: triggerEvent, pendingQuestions } = useTranslation();
|
|
44
8
|
const { name, onChange, guiOptions = {}, message, errorMessage, id, properties } = props;
|
|
45
9
|
const { mandatory, hint, placeholder } = guiOptions;
|
|
46
|
-
const [value, setValue] =
|
|
10
|
+
const [value, setValue] = useValue('', props.value);
|
|
47
11
|
const onLiveChange = (_event, newValue) => {
|
|
48
12
|
setValue(newValue ?? '');
|
|
49
13
|
onChange?.(name, newValue);
|
|
50
14
|
};
|
|
51
|
-
const onCreateNewEntry =
|
|
15
|
+
const onCreateNewEntry = useCallback((entry) => {
|
|
52
16
|
triggerEvent?.(name, {
|
|
53
|
-
name:
|
|
17
|
+
name: TRANSLATE_EVENT_UPDATE,
|
|
54
18
|
entry,
|
|
55
19
|
properties
|
|
56
20
|
});
|
|
57
21
|
}, [name]);
|
|
58
|
-
const onShowExistingEntry =
|
|
22
|
+
const onShowExistingEntry = useCallback((entry) => {
|
|
59
23
|
triggerEvent?.(name, {
|
|
60
|
-
name:
|
|
24
|
+
name: TRANSLATE_EVENT_SHOW,
|
|
61
25
|
entry
|
|
62
26
|
});
|
|
63
27
|
}, [name]);
|
|
64
|
-
return (
|
|
28
|
+
return (React.createElement(UITranslationInput, { onRenderLabel: getLabelRenderer(hint), required: mandatory, label: typeof message === 'string' ? message : name, value: value ? value.toString() : '', onChange: onLiveChange, errorMessage: errorMessage, placeholder: placeholder ?? 'Enter a value', id: id ?? '', allowedPatterns: [TranslationTextPattern.SingleBracketBinding], defaultPattern: TranslationTextPattern.SingleBracketBinding, i18nPrefix: "i18n", namingConvention: TranslationKeyGenerator.CamelCase, entries: bundle, onCreateNewEntry: onCreateNewEntry, onShowExistingEntry: onShowExistingEntry, busy: {
|
|
65
29
|
busy: pendingQuestions?.includes(name),
|
|
66
30
|
useMinWaitingTime: true
|
|
67
31
|
} }));
|
|
68
32
|
};
|
|
69
|
-
exports.TranslationInput = TranslationInput;
|
|
70
33
|
//# sourceMappingURL=TranslationInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationInput.js","sourceRoot":"","sources":["../../../../src/components/Inputs/Input/TranslationInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TranslationInput.js","sourceRoot":"","sources":["../../../../src/components/Inputs/Input/TranslationInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE5G,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,IAAI,CAAC,CACT,CAAC;IAEF,OAAO,CACH,oBAAC,kBAAkB,IACf,aAAa,EAAE,gBAAgB,CAAC,IAAI,CAAC,EACrC,QAAQ,EAAE,SAAS,EACnB,KAAK,EAAE,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EACnD,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,EACpC,QAAQ,EAAE,YAAY,EACtB,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,IAAI,eAAe,EAC3C,EAAE,EAAE,EAAE,IAAI,EAAE,EACZ,eAAe,EAAE,CAAC,sBAAsB,CAAC,oBAAoB,CAAC,EAC9D,cAAc,EAAE,sBAAsB,CAAC,oBAAoB,EAC3D,UAAU,EAAC,MAAM,EACjB,gBAAgB,EAAE,uBAAuB,CAAC,SAAS,EACnD,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,gBAAgB,EAClC,mBAAmB,EAAE,mBAAmB,EACxC,IAAI,EAAE;YACF,IAAI,EAAE,gBAAgB,EAAE,QAAQ,CAAC,IAAI,CAAC;YACtC,iBAAiB,EAAE,IAAI;SAC1B,GACH,CACL,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './Input';
|
|
2
|
-
export * from './TranslationInput';
|
|
1
|
+
export * from './Input.js';
|
|
2
|
+
export * from './TranslationInput.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Inputs/Input/index.tsx"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Inputs/Input/index.tsx"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC"}
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Input"), exports);
|
|
18
|
-
__exportStar(require("./TranslationInput"), exports);
|
|
1
|
+
export * from './Input.js';
|
|
2
|
+
export * from './TranslationInput.js';
|
|
19
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Inputs/Input/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Inputs/Input/index.tsx"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { AnswerValue, CheckboxPromptQuestion, PromptListChoices } from '../../../types';
|
|
2
|
+
import type { AnswerValue, CheckboxPromptQuestion, PromptListChoices } from '../../../types.js';
|
|
3
3
|
export interface MultiSelectProps extends CheckboxPromptQuestion {
|
|
4
4
|
id?: string;
|
|
5
5
|
value?: AnswerValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/Inputs/MultiSelect/MultiSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"MultiSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/Inputs/MultiSelect/MultiSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEhG,MAAM,WAAW,gBAAiB,SAAQ,sBAAsB;IAC5D,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACrD,cAAc,CAAC,EAAE,iBAAiB,CAAC;IACnC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8BAA8B,CAAC,EAAE,OAAO,CAAC;CAC5C;AAED,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,sBAqDlD,CAAC"}
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.MultiSelect = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const ui_components_1 = require("@sap-ux/ui-components");
|
|
9
|
-
const utilities_1 = require("../../../utilities");
|
|
10
|
-
const MultiSelect = (props) => {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UIComboBox, UIComboBoxLoaderType } from '@sap-ux/ui-components';
|
|
3
|
+
import { useValue, getLabelRenderer, useOptions, useMultiSelectKeys } from '../../../utilities/index.js';
|
|
4
|
+
export const MultiSelect = (props) => {
|
|
11
5
|
const { name, message, onChange, guiOptions = {}, pending, errorMessage, dynamicChoices, id, calloutCollisionTransformation } = props;
|
|
12
6
|
const { mandatory, hint, placeholder } = guiOptions;
|
|
13
|
-
const [value, setValue] =
|
|
14
|
-
const options =
|
|
15
|
-
const { checkedOptions, selectedKeys } =
|
|
7
|
+
const [value, setValue] = useValue('', props.value?.toString() ?? '');
|
|
8
|
+
const options = useOptions(props, dynamicChoices);
|
|
9
|
+
const { checkedOptions, selectedKeys } = useMultiSelectKeys(options, value ?? '');
|
|
16
10
|
const handleSubmitValue = (userSelections) => {
|
|
17
11
|
return [...checkedOptions, ...userSelections].join(',');
|
|
18
12
|
};
|
|
19
|
-
return (
|
|
13
|
+
return (React.createElement(UIComboBox, { label: typeof message === 'string' ? message : name, options: options, highlight: true, allowFreeform: true, useComboBoxAsMenuMinWidth: true, autoComplete: "on", required: mandatory, isLoading: pending ? [UIComboBoxLoaderType.Input, UIComboBoxLoaderType.List] : undefined, selectedKey: selectedKeys, multiSelect: true, disabled: false, calloutCollisionTransformation: calloutCollisionTransformation, onChange: (_, changedOption) => {
|
|
20
14
|
let updatedValue;
|
|
21
15
|
if (changedOption?.selected) {
|
|
22
16
|
updatedValue = [...selectedKeys, changedOption.key];
|
|
@@ -27,7 +21,6 @@ const MultiSelect = (props) => {
|
|
|
27
21
|
const updatedValueString = handleSubmitValue(updatedValue);
|
|
28
22
|
setValue(updatedValueString);
|
|
29
23
|
onChange(name, updatedValueString);
|
|
30
|
-
}, onRenderLabel:
|
|
24
|
+
}, onRenderLabel: getLabelRenderer(hint), errorMessage: errorMessage, placeholder: placeholder, id: id }));
|
|
31
25
|
};
|
|
32
|
-
exports.MultiSelect = MultiSelect;
|
|
33
26
|
//# sourceMappingURL=MultiSelect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelect.js","sourceRoot":"","sources":["../../../../src/components/Inputs/MultiSelect/MultiSelect.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MultiSelect.js","sourceRoot":"","sources":["../../../../src/components/Inputs/MultiSelect/MultiSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAazG,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAuB,EAAE,EAAE;IACnD,MAAM,EACF,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,UAAU,GAAG,EAAE,EACf,OAAO,EACP,YAAY,EACZ,cAAc,EACd,EAAE,EACF,8BAA8B,EACjC,GAAG,KAAK,CAAC;IACV,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC;IACpD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACtE,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IAClD,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,kBAAkB,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IAElF,MAAM,iBAAiB,GAAG,CAAC,cAAwB,EAAU,EAAE;QAC3D,OAAO,CAAC,GAAG,cAAc,EAAE,GAAG,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5D,CAAC,CAAC;IAEF,OAAO,CACH,oBAAC,UAAU,IACP,KAAK,EAAE,OAAO,OAAO,KAAK,QAAQ,CAAC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3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Inputs/MultiSelect/index.tsx"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Inputs/MultiSelect/index.tsx"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./MultiSelect"), exports);
|
|
1
|
+
export * from './MultiSelect.js';
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Inputs/MultiSelect/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Inputs/MultiSelect/index.tsx"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Answers } from 'inquirer';
|
|
3
|
-
import type { AnswerValue, ListPromptQuestion, PromptListChoices } from '../../../types';
|
|
3
|
+
import type { AnswerValue, ListPromptQuestion, PromptListChoices } from '../../../types.js';
|
|
4
4
|
export interface SelectProps extends ListPromptQuestion {
|
|
5
5
|
id?: string;
|
|
6
6
|
value?: AnswerValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../src/components/Inputs/Select/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAiB,OAAO,EAAE,MAAM,UAAU,CAAC;AAIvD,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../src/components/Inputs/Select/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAiB,OAAO,EAAE,MAAM,UAAU,CAAC;AAIvD,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE5F,MAAM,WAAW,WAAY,SAAQ,kBAAkB;IACnD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACrD,cAAc,CAAC,EAAE,iBAAiB,CAAC;IACnC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,MAAM,GAAI,OAAO,WAAW,sBA+FxC,CAAC"}
|
|
@@ -1,49 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.Select = void 0;
|
|
37
|
-
const react_1 = __importStar(require("react"));
|
|
38
|
-
const ui_components_1 = require("@sap-ux/ui-components");
|
|
39
|
-
const utilities_1 = require("../../../utilities");
|
|
40
|
-
const Select = (props) => {
|
|
1
|
+
import React, { useEffect, useMemo } from 'react';
|
|
2
|
+
import { UIComboBox, UIComboBoxLoaderType, UITextInput } from '@sap-ux/ui-components';
|
|
3
|
+
import { useValue, getLabelRenderer, useOptions, usePromptMessage } from '../../../utilities/index.js';
|
|
4
|
+
export const Select = (props) => {
|
|
41
5
|
const { name, message, onChange, guiOptions = {}, pending, errorMessage, dynamicChoices, id, answers } = props;
|
|
42
6
|
const { mandatory, hint, placeholder, creation } = guiOptions;
|
|
43
|
-
const [value, setValue] =
|
|
44
|
-
const inputRef =
|
|
45
|
-
const options =
|
|
46
|
-
const defaultValue =
|
|
7
|
+
const [value, setValue] = useValue('', props.value ?? '');
|
|
8
|
+
const inputRef = React.createRef();
|
|
9
|
+
const options = useOptions(props, dynamicChoices);
|
|
10
|
+
const defaultValue = useMemo(() => {
|
|
47
11
|
// Single option - auto-select
|
|
48
12
|
if (options.length === 1) {
|
|
49
13
|
return options[0].data?.value;
|
|
@@ -56,9 +20,9 @@ const Select = (props) => {
|
|
|
56
20
|
// do not preselect any value by default
|
|
57
21
|
return undefined;
|
|
58
22
|
}, [options]);
|
|
59
|
-
const resolvedMessage =
|
|
23
|
+
const resolvedMessage = usePromptMessage(message, answers);
|
|
60
24
|
const label = resolvedMessage?.trim() ? resolvedMessage : name;
|
|
61
|
-
|
|
25
|
+
useEffect(() => {
|
|
62
26
|
if (defaultValue !== undefined && value !== defaultValue) {
|
|
63
27
|
setValue(defaultValue);
|
|
64
28
|
onChange(name, defaultValue);
|
|
@@ -90,8 +54,7 @@ const Select = (props) => {
|
|
|
90
54
|
}
|
|
91
55
|
};
|
|
92
56
|
const isTextField = creation && !options?.length && !pending; // show loader in comboBox
|
|
93
|
-
const component = isTextField ? (
|
|
94
|
-
return
|
|
57
|
+
const component = isTextField ? (React.createElement(UITextInput, { componentRef: inputRef, label: label, value: value?.toString(), placeholder: creation.placeholder, errorMessage: errorMessage, required: mandatory, onChange: onChangeTextInput, onRenderLabel: getLabelRenderer(hint), id: id })) : (React.createElement(UIComboBox, { label: label, options: options, highlight: true, allowFreeform: true, useComboBoxAsMenuMinWidth: true, autoComplete: "on", required: mandatory, isLoading: pending ? [UIComboBoxLoaderType.Input, UIComboBoxLoaderType.List] : undefined, selectedKey: value?.toString(), disabled: false, text: creation ? value?.toString() : undefined, onChange: onChangeSelect, onRenderLabel: getLabelRenderer(hint), errorMessage: errorMessage, placeholder: placeholder, id: id }));
|
|
58
|
+
return React.createElement(React.Fragment, null, component);
|
|
95
59
|
};
|
|
96
|
-
exports.Select = Select;
|
|
97
60
|
//# sourceMappingURL=Select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../../src/components/Inputs/Select/Select.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../../src/components/Inputs/Select/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEtF,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAavG,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAkB,EAAE,EAAE;IACzC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,GAAG,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAC/G,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC;IAC9D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAC1D,MAAM,QAAQ,GAAG,KAAK,CAAC,SAAS,EAAc,CAAC;IAC/C,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,EAAE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ACP,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,IAAI,EACf,aAAa,EAAE,IAAI,EACnB,yBAAyB,EAAE,IAAI,EAC/B,YAAY,EAAC,IAAI,EACjB,QAAQ,EAAE,SAAS,EACnB,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,KAAK,EAAE,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,EACxF,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,EAC9B,QAAQ,EAAE,KAAK,EACf,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,EAC9C,QAAQ,EAAE,cAAc,EACxB,aAAa,EAAE,gBAAgB,CAAC,IAAI,CAAC,EACrC,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,EACxB,EAAE,EAAE,EAAE,GACR,CACL,CAAC;IACF,OAAO,0CAAG,SAAS,CAAI,CAAC;AAC5B,CAAC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './Select';
|
|
1
|
+
export * from './Select.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Inputs/Select/index.tsx"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Inputs/Select/index.tsx"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Select"), exports);
|
|
1
|
+
export * from './Select.js';
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Inputs/Select/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Inputs/Select/index.tsx"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './MultiSelect';
|
|
2
|
-
export * from './Input';
|
|
3
|
-
export * from './Select';
|
|
1
|
+
export * from './MultiSelect/index.js';
|
|
2
|
+
export * from './Input/index.js';
|
|
3
|
+
export * from './Select/index.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Inputs/index.tsx"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Inputs/index.tsx"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./MultiSelect"), exports);
|
|
18
|
-
__exportStar(require("./Input"), exports);
|
|
19
|
-
__exportStar(require("./Select"), exports);
|
|
1
|
+
export * from './MultiSelect/index.js';
|
|
2
|
+
export * from './Input/index.js';
|
|
3
|
+
export * from './Select/index.js';
|
|
20
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Inputs/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Inputs/index.tsx"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Answers } from 'inquirer';
|
|
3
|
-
import type { PromptQuestion, ValidationResults, AnswerValue, PromptListChoices } from '../../types';
|
|
3
|
+
import type { PromptQuestion, ValidationResults, AnswerValue, PromptListChoices } from '../../types.js';
|
|
4
4
|
import './Question.scss';
|
|
5
5
|
export interface QuestionProps {
|
|
6
6
|
id?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Question.d.ts","sourceRoot":"","sources":["../../../src/components/Question/Question.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGxC,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Question.d.ts","sourceRoot":"","sources":["../../../src/components/Question/Question.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGxC,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExG,OAAO,iBAAiB,CAAC;AAEzB,MAAM,WAAW,aAAa;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IACtD,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,8BAA8B,CAAC,EAAE,OAAO,CAAC;CAC5C;AAED,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,sBA+E5C,CAAC"}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.Question = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const Inputs_1 = require("../Inputs");
|
|
9
|
-
const utilities_1 = require("../../utilities");
|
|
10
|
-
require("./Question.scss");
|
|
11
|
-
const Question = (props) => {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Input, Select, MultiSelect, TranslationInput } from '../Inputs/index.js';
|
|
3
|
+
import { getAnswer } from '../../utilities/index.js';
|
|
4
|
+
import './Question.scss';
|
|
5
|
+
export const Question = (props) => {
|
|
12
6
|
const { question, onChange, answers, choices, pending, validation = {}, id, isI18nInputSupported, calloutCollisionTransformation } = props;
|
|
13
7
|
let questionInput;
|
|
14
8
|
let errorMessage = '';
|
|
15
|
-
const value =
|
|
9
|
+
const value = getAnswer(answers, question.name);
|
|
16
10
|
if (validation[question.name]?.isValid === false && validation[question.name]?.errorMessage) {
|
|
17
11
|
errorMessage = validation[question.name].errorMessage;
|
|
18
12
|
}
|
|
@@ -21,15 +15,15 @@ const Question = (props) => {
|
|
|
21
15
|
case 'input': {
|
|
22
16
|
const { translationProperties } = question.guiOptions ?? {};
|
|
23
17
|
if (isI18nInputSupported && translationProperties) {
|
|
24
|
-
questionInput = (
|
|
18
|
+
questionInput = (React.createElement(TranslationInput, { value: value, ...question, onChange: onChange, errorMessage: errorMessage, id: inputId, properties: translationProperties }));
|
|
25
19
|
}
|
|
26
20
|
else {
|
|
27
|
-
questionInput = (
|
|
21
|
+
questionInput = (React.createElement(Input, { value: value, ...question, onChange: onChange, errorMessage: errorMessage, id: inputId }));
|
|
28
22
|
}
|
|
29
23
|
break;
|
|
30
24
|
}
|
|
31
25
|
case 'checkbox': {
|
|
32
|
-
questionInput = (
|
|
26
|
+
questionInput = (React.createElement(MultiSelect
|
|
33
27
|
// change to pass the relevant answer
|
|
34
28
|
, {
|
|
35
29
|
// change to pass the relevant answer
|
|
@@ -37,7 +31,7 @@ const Question = (props) => {
|
|
|
37
31
|
break;
|
|
38
32
|
}
|
|
39
33
|
case 'list': {
|
|
40
|
-
questionInput = (
|
|
34
|
+
questionInput = (React.createElement(Select
|
|
41
35
|
// change to pass the relevant answer
|
|
42
36
|
, {
|
|
43
37
|
// change to pass the relevant answer
|
|
@@ -45,11 +39,10 @@ const Question = (props) => {
|
|
|
45
39
|
break;
|
|
46
40
|
}
|
|
47
41
|
default: {
|
|
48
|
-
questionInput =
|
|
42
|
+
questionInput = React.createElement("div", null, "Unsupported");
|
|
49
43
|
break;
|
|
50
44
|
}
|
|
51
45
|
}
|
|
52
|
-
return
|
|
46
|
+
return React.createElement("div", { className: "prompt-entry" }, questionInput);
|
|
53
47
|
};
|
|
54
|
-
exports.Question = Question;
|
|
55
48
|
//# sourceMappingURL=Question.js.map
|