Выставлены типы
This commit is contained in:
parent
50e4add1db
commit
55ccfba006
@ -9,12 +9,6 @@ import WorkSpace from "./workSpace";
|
|||||||
import Header from "./header";
|
import Header from "./header";
|
||||||
import { saveCondition, getCondition } from "./lsBacking";
|
import { saveCondition, getCondition } from "./lsBacking";
|
||||||
import type {ElementsOfObject} from "./questionTypes"
|
import type {ElementsOfObject} from "./questionTypes"
|
||||||
//Значения, собираемые для отправки на бэк
|
|
||||||
interface Values {
|
|
||||||
title: string;
|
|
||||||
children: string;
|
|
||||||
description: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const types = [
|
const types = [
|
||||||
{desc:"текст", value:"text"},
|
{desc:"текст", value:"text"},
|
||||||
@ -25,19 +19,6 @@ const types = [
|
|||||||
{desc: "описание", value: "description"},
|
{desc: "описание", value: "description"},
|
||||||
{desc:"ничего", value:"none"},
|
{desc:"ничего", value:"none"},
|
||||||
]
|
]
|
||||||
export const TextField = (props: any) => {
|
|
||||||
|
|
||||||
const [field, meta, helpers] = useField(props);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Textarea resize="none" width="80%" {...field} {...props} />
|
|
||||||
{meta.touched && meta.error ? (
|
|
||||||
<div className="error">{meta.error}</div>
|
|
||||||
) : null}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
//Для первого ознакомления рекомендую свернуть все функции и почитать их названия и описания
|
//Для первого ознакомления рекомендую свернуть все функции и почитать их названия и описания
|
||||||
|
|
||||||
@ -51,7 +32,7 @@ const getFreeNumber = (array:Array<ElementsOfObject>):number => {
|
|||||||
//Для всех последующих элементов
|
//Для всех последующих элементов
|
||||||
|
|
||||||
//Создаём массив, состоящий из id всех существующих модалок
|
//Создаём массив, состоящий из id всех существующих модалок
|
||||||
let indexes:any = []
|
let indexes:Array<number> = []
|
||||||
//И берём только последние числа от строк, превращая их в числа
|
//И берём только последние числа от строк, превращая их в числа
|
||||||
for (let i = 0; i < array.length; i++) {
|
for (let i = 0; i < array.length; i++) {
|
||||||
//Строка состоит из чисел, разделённых пробелом.
|
//Строка состоит из чисел, разделённых пробелом.
|
||||||
@ -63,7 +44,7 @@ const getFreeNumber = (array:Array<ElementsOfObject>):number => {
|
|||||||
indexes.push(Number(stringArr[0]))
|
indexes.push(Number(stringArr[0]))
|
||||||
}
|
}
|
||||||
//Сортируем в порядке возрастания
|
//Сортируем в порядке возрастания
|
||||||
indexes.sort(function compare(a:any, b:any):any {
|
indexes.sort(function compare(a:number, b:number):number {
|
||||||
if (a < b) { return -1;}
|
if (a < b) { return -1;}
|
||||||
if (a > b) { return 1;}
|
if (a > b) { return 1;}
|
||||||
return 0;
|
return 0;
|
||||||
@ -72,15 +53,15 @@ const getFreeNumber = (array:Array<ElementsOfObject>):number => {
|
|||||||
let max = indexes[indexes.length - 1]
|
let max = indexes[indexes.length - 1]
|
||||||
|
|
||||||
//Создаём массив - маску от 0 до самого высокого значения id
|
//Создаём массив - маску от 0 до самого высокого значения id
|
||||||
let mask:any = []
|
let mask:Array<number> = []
|
||||||
for (let i = 0; i <= max; i++) {
|
for (let i = 0; i <= max; i++) {
|
||||||
mask.push(i)
|
mask.push(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Ищем разницу между существующими id окон и маской. Список пропущенных значений есть список доступных имён.
|
//Ищем разницу между существующими id окон и маской. Список пропущенных значений есть список доступных имён.
|
||||||
let difference = indexes
|
let difference = indexes
|
||||||
.filter((num:any):any => !mask.includes(num))
|
.filter((num:number):boolean => !mask.includes(num))
|
||||||
.concat(mask.filter((num:any):any => !indexes.includes(num)));
|
.concat(mask.filter((num:number):boolean => !indexes.includes(num)));
|
||||||
|
|
||||||
// difference - массив нехватающих в списке номеров.
|
// difference - массив нехватающих в списке номеров.
|
||||||
// Если все окна у нас по порядку, без пропусков - нужно добавить новый номер
|
// Если все окна у нас по порядку, без пропусков - нужно добавить новый номер
|
||||||
@ -94,7 +75,7 @@ const getFreeNumber = (array:Array<ElementsOfObject>):number => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Прохождение по полю children в поисках нужного id
|
//Прохождение по полю children в поисках нужного id
|
||||||
const getIndexById = (id:string, array:Array<ElementsOfObject>):number => {
|
const getIndexById = (id:string, array:Array<ElementsOfObject>):number | undefined => {
|
||||||
let index
|
let index
|
||||||
for (let i = 0; i <= array.length; i++) {
|
for (let i = 0; i <= array.length; i++) {
|
||||||
if (array[i] !== undefined) {
|
if (array[i] !== undefined) {
|
||||||
@ -107,14 +88,13 @@ const getIndexById = (id:string, array:Array<ElementsOfObject>):number => {
|
|||||||
if (typeof index === "number") {
|
if (typeof index === "number") {
|
||||||
return index
|
return index
|
||||||
} else {
|
} else {
|
||||||
console.log("Я не нашёл нужный индекс, вывел 0")
|
return undefined
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Извлечение информации из id для поиска пути к ребёнку.
|
//Извлечение информации из id для поиска пути к ребёнку.
|
||||||
const getObjectFromId = (id:string, array:any):any => {
|
const getObjectFromId = (id:string, array:Array<ElementsOfObject>): ElementsOfObject | undefined => {
|
||||||
//Делим строку на массив чисел
|
//Делим строку на массив чисел
|
||||||
let IDs = id.split(" ")
|
let IDs = id.split(" ")
|
||||||
|
|
||||||
@ -135,12 +115,12 @@ const getObjectFromId = (id:string, array:any):any => {
|
|||||||
//Счётчик вложенности
|
//Счётчик вложенности
|
||||||
let nestingCounter = 0
|
let nestingCounter = 0
|
||||||
//В пересчётах в каждом слое вложенности сюда сохраняется найденный объект
|
//В пересчётах в каждом слое вложенности сюда сохраняется найденный объект
|
||||||
let bufferObject
|
let bufferObject: ElementsOfObject | undefined
|
||||||
|
|
||||||
//Считаем до какого уровня вложенности нам вообще искать ребёнка
|
//Считаем до какого уровня вложенности нам вообще искать ребёнка
|
||||||
let stopIndex = IDs.length
|
let stopIndex = IDs.length
|
||||||
|
|
||||||
const searchId = (array:any) => {
|
const searchId = (array:Array<ElementsOfObject>) => {
|
||||||
if (nestingCounter === stopIndex) {
|
if (nestingCounter === stopIndex) {
|
||||||
//Мы достигли нужного уровня вложенности
|
//Мы достигли нужного уровня вложенности
|
||||||
return
|
return
|
||||||
@ -150,7 +130,7 @@ const getObjectFromId = (id:string, array:any):any => {
|
|||||||
let calcId = getNewIdString(nestingCounter)
|
let calcId = getNewIdString(nestingCounter)
|
||||||
return (
|
return (
|
||||||
//Здесь можно в заранее созданную переменную оповещать нашли ли мы нужный id. И обработать ошибку если нет
|
//Здесь можно в заранее созданную переменную оповещать нашли ли мы нужный id. И обработать ошибку если нет
|
||||||
array.forEach((element:any) => {
|
array.forEach((element:ElementsOfObject) => {
|
||||||
if (element.id === calcId) {
|
if (element.id === calcId) {
|
||||||
//Записываем найденный объект и ищем на следующем уровне
|
//Записываем найденный объект и ищем на следующем уровне
|
||||||
bufferObject = element
|
bufferObject = element
|
||||||
@ -163,7 +143,12 @@ const getObjectFromId = (id:string, array:any):any => {
|
|||||||
|
|
||||||
}
|
}
|
||||||
searchId(array)
|
searchId(array)
|
||||||
|
if (bufferObject !== undefined && bufferObject.id === id) {
|
||||||
return bufferObject
|
return bufferObject
|
||||||
|
} else {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Есть два варианта поиска:
|
//Есть два варианта поиска:
|
||||||
//Рекурсивно пройтись по хранилищу тупо ожидая наткнуться на нужного ребёнка
|
//Рекурсивно пройтись по хранилищу тупо ожидая наткнуться на нужного ребёнка
|
||||||
@ -175,7 +160,7 @@ const getObjectFromId = (id:string, array:any):any => {
|
|||||||
export default () => {
|
export default () => {
|
||||||
//Id - строится на основании всех id родителя + свободное число от 0 до +бесконечности.
|
//Id - строится на основании всех id родителя + свободное число от 0 до +бесконечности.
|
||||||
//Разделение айдишников в строке посредством пробела
|
//Разделение айдишников в строке посредством пробела
|
||||||
const [stockroom, setStockroom] = React.useState<any>([
|
const [stockroom, setStockroom] = React.useState<Array<ElementsOfObject>>([
|
||||||
{id: "0", type: 7, children: [
|
{id: "0", type: 7, children: [
|
||||||
{
|
{
|
||||||
id: "0 0", type: 7, children: [
|
id: "0 0", type: 7, children: [
|
||||||
@ -211,9 +196,13 @@ export default () => {
|
|||||||
|
|
||||||
//Функция пересоздаёт дерево с проверкой каждого объекта.
|
//Функция пересоздаёт дерево с проверкой каждого объекта.
|
||||||
// Если объект в фокусе - создаётся новый объект и в него высыпаются старые поля, затем новые поля
|
// Если объект в фокусе - создаётся новый объект и в него высыпаются старые поля, затем новые поля
|
||||||
const createNewTreeFields = (value:any, tree = stockroom) => {
|
//ФУНКЦИЯ УДАЛЯЕТ ДЕТЕЙ У НЕ КОНТЕЙНЕРОВ (контейнер div и селект)
|
||||||
|
const createNewTreeFields = (value:Object, tree = stockroom):Array<ElementsOfObject> => {
|
||||||
return (
|
return (
|
||||||
tree.map((node: any) => {
|
tree.map((node: ElementsOfObject) => {
|
||||||
|
if (node.type !== 7 && node.type !== 1) {
|
||||||
|
node.children = []
|
||||||
|
}
|
||||||
|
|
||||||
if (node.id === focus) {
|
if (node.id === focus) {
|
||||||
let obj = {
|
let obj = {
|
||||||
@ -233,9 +222,14 @@ export default () => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
//Создание дерева с обновлённым объектом
|
//Создание дерева с обновлённым объектом
|
||||||
const createNewTreeObject = (value:any, tree = stockroom) => {
|
//ФУНКЦИЯ УДАЛЯЕТ ДЕТЕЙ У НЕ КОНТЕЙНЕРОВ (контейнер div и селект)
|
||||||
|
const createNewTreeObject = (value:ElementsOfObject, tree = stockroom):Array<ElementsOfObject> => {
|
||||||
return (
|
return (
|
||||||
tree.map((node: any) => {
|
tree.map((node: ElementsOfObject) => {
|
||||||
|
if (node.type !== 7 && node.type !== 1) {
|
||||||
|
node.children = []
|
||||||
|
}
|
||||||
|
|
||||||
if (node.id === value.id) {
|
if (node.id === value.id) {
|
||||||
return value
|
return value
|
||||||
} else if (node.children.length !== 0) {
|
} else if (node.children.length !== 0) {
|
||||||
@ -250,31 +244,30 @@ export default () => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Изменение типа очищает все поля
|
const typeHC = (type:number): void => {
|
||||||
const typeHC = (type:any): void => {
|
|
||||||
if (focus !== undefined) {
|
if (focus !== undefined) {
|
||||||
setStockroom(createNewTreeFields({type:type}))
|
setStockroom(createNewTreeFields({type:type}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const colorHC = (color:any) => {
|
const colorHC = (color:string) => {
|
||||||
if (focus !== undefined) {
|
if (focus !== undefined) {
|
||||||
setStockroom(createNewTreeFields({color:color}))
|
setStockroom(createNewTreeFields({color:color}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const createObject = (obj:any, type:number = 4) => {
|
const createObject = (type:number = 4) => {
|
||||||
if (focus !== undefined) {
|
if (focus !== undefined) {
|
||||||
//Если фокусный элемент - контейнер, добавление происходит внутрь него
|
//Если фокусный элемент - контейнер, добавление происходит внутрь него
|
||||||
//Если фокусный элемент - не контейнер, добавление происходит после объекта с фокусом
|
//Если фокусный элемент - не контейнер, добавление происходит после объекта с фокусом
|
||||||
const focusedObj = getObjectFromId(focus, stockroom)
|
const focusedObj = getObjectFromId(focus, stockroom)
|
||||||
|
|
||||||
|
if (focusedObj !== undefined) {
|
||||||
if (focusedObj.type === 7) {
|
if (focusedObj.children !== undefined && focusedObj.type === 7) {
|
||||||
//Кладём внутрь фокусного объекта
|
//Кладём внутрь фокусного объекта
|
||||||
|
|
||||||
//Находим свободный ид и прикрепляем его к родительскому id
|
//Находим свободный ид и прикрепляем его к родительскому id
|
||||||
let newId:any = getFreeNumber(focusedObj.children)
|
let newId = getFreeNumber(focusedObj.children).toString()
|
||||||
newId = focusedObj.id + " " + newId
|
newId = focusedObj.id + " " + newId
|
||||||
//Создаём новый объект
|
//Создаём новый объект
|
||||||
const newObj = {
|
const newObj = {
|
||||||
@ -294,13 +287,14 @@ export default () => {
|
|||||||
|
|
||||||
//Находим родителя
|
//Находим родителя
|
||||||
//Отфигачиваем последний id
|
//Отфигачиваем последний id
|
||||||
let parentId:any = focus.split(" ")
|
let parentId:string | string[] = focus.split(" ")
|
||||||
parentId.pop()
|
parentId.pop()
|
||||||
parentId = parentId.join(' ')
|
parentId = parentId.join(' ')
|
||||||
const parentObj = getObjectFromId(parentId, stockroom)
|
const parentObj = getObjectFromId(parentId, stockroom)
|
||||||
|
|
||||||
|
if (parentObj !== undefined) {
|
||||||
//Находим свободный ид и прикрепляем его к родительскому id
|
//Находим свободный ид и прикрепляем его к родительскому id
|
||||||
let newId:any = getFreeNumber(parentObj.children)
|
let newId:string = getFreeNumber(parentObj.children).toString()
|
||||||
newId = parentId + " " + newId
|
newId = parentId + " " + newId
|
||||||
//Создаём новый объект
|
//Создаём новый объект
|
||||||
const newObj = {
|
const newObj = {
|
||||||
@ -328,6 +322,8 @@ export default () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const deleteObject = () => {
|
const deleteObject = () => {
|
||||||
if (focus !== undefined) {
|
if (focus !== undefined) {
|
||||||
@ -337,12 +333,13 @@ export default () => {
|
|||||||
const focusedObj = getObjectFromId(focus, stockroom)
|
const focusedObj = getObjectFromId(focus, stockroom)
|
||||||
|
|
||||||
//Отфигачиваем последний id
|
//Отфигачиваем последний id
|
||||||
let parentId:any = focus.split(" ")
|
let parentId:string | string[] = focus.split(" ")
|
||||||
parentId.pop()
|
parentId.pop()
|
||||||
parentId = parentId.join(' ')
|
parentId = parentId.join(' ')
|
||||||
|
|
||||||
const parentObj = getObjectFromId(parentId, stockroom)
|
const parentObj = getObjectFromId(parentId, stockroom)
|
||||||
|
|
||||||
|
if (parentObj !== undefined) {
|
||||||
//Создаём новый массив для поля-children-родителя, не включая в него фокусный объект
|
//Создаём новый массив для поля-children-родителя, не включая в него фокусный объект
|
||||||
let newChildrenArr = []
|
let newChildrenArr = []
|
||||||
for (let i = 0; parentObj.children.length > i ; i++) {
|
for (let i = 0; parentObj.children.length > i ; i++) {
|
||||||
@ -355,121 +352,11 @@ export default () => {
|
|||||||
|
|
||||||
|
|
||||||
let newTree = createNewTreeObject(parentObj)
|
let newTree = createNewTreeObject(parentObj)
|
||||||
console.log(stockroom)
|
|
||||||
console.log(newTree)
|
|
||||||
setStockroom(newTree)
|
setStockroom(newTree)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// const changeFocus = (id: number): void => {
|
|
||||||
// //Не менять фокус если снова выбрано то же окно
|
|
||||||
// if (focus !== id) {
|
|
||||||
// //Хранилище с отменённым фокусом у объектов (по задумке у одного элемента)
|
|
||||||
// let newArr = stockroom.map((e:ElementsOfObject) => {
|
|
||||||
// e.isFocus = false
|
|
||||||
// return e
|
|
||||||
// })
|
|
||||||
//
|
|
||||||
// //Получаем индексы фокусированных объектов. Новый и, если есть, старый
|
|
||||||
// let index = getIndexById(id, stockroom)
|
|
||||||
//
|
|
||||||
// //Устанавливаем новый фокус и пересоздаём массив
|
|
||||||
// setFocus(id)
|
|
||||||
// saveCondition("focus", id)
|
|
||||||
//
|
|
||||||
// newArr[index].isFocus = true
|
|
||||||
// setStockroom([...newArr])
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// const changeBgColor = (color: string): void => {
|
|
||||||
// if (focus !== undefined) {
|
|
||||||
// let index = getIndexById(focus, stockroom)
|
|
||||||
//
|
|
||||||
// let newArr = stockroom
|
|
||||||
// newArr[index].color = color
|
|
||||||
// setStockroom([...newArr])
|
|
||||||
// saveCondition("stockroom", newArr)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// const changeText = (text: string): void => {
|
|
||||||
// if (focus !== undefined) {
|
|
||||||
// let index = getIndexById(focus, stockroom)
|
|
||||||
// let newArr = stockroom
|
|
||||||
// newArr[index].text = text
|
|
||||||
// setStockroom([...newArr])
|
|
||||||
// saveCondition("stockroom", newArr)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// const createObject = (obj:ElementsOfObject) => {
|
|
||||||
//
|
|
||||||
// //Получаем и присваиваем первый свободный айдишник (по возрастанию)
|
|
||||||
// const free = getFreeNumber(stockroom)
|
|
||||||
// obj.id = free
|
|
||||||
//
|
|
||||||
// //Хранилище с отменённым фокусом у объектов (по задумке у одного элемента)
|
|
||||||
// let newArr = stockroom.map((e:ElementsOfObject) => {
|
|
||||||
// e.isFocus = false
|
|
||||||
// return e
|
|
||||||
// })
|
|
||||||
//
|
|
||||||
// //Мы должны вставить новый объект следующим после того, на котором фокус. Это достигается позиционированием в массив
|
|
||||||
// if (focus === undefined){ //фокуса нет - добавляем в конец массива
|
|
||||||
// newArr.push(obj)
|
|
||||||
// setStockroom([...newArr])
|
|
||||||
// saveCondition("stockroom", newArr)
|
|
||||||
// //Говорим стейту с фокусом, что фокус изменился
|
|
||||||
// setFocus(newArr.length - 1)
|
|
||||||
// } else { //фокус есть - добавляем после объекта с фокусом
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// let index = getIndexById(focus, stockroom)
|
|
||||||
// let current = stockroom[index]
|
|
||||||
// //Объект в фокусе - контейнер. Новый объект создаётся с указанием, что контейнер - родитель
|
|
||||||
// if (current.type === 7) {
|
|
||||||
// obj.parent = current.id
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// newArr.splice(index + 1, 0, obj)
|
|
||||||
//
|
|
||||||
// //Говорим стейту с фокусом, что фокус изменился
|
|
||||||
// setFocus(index + 1)
|
|
||||||
// setStockroom([...newArr])
|
|
||||||
// saveCondition("stockroom", newArr)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// const deleteObject = (id: number): void => {
|
|
||||||
// let index = getIndexById(id, stockroom)
|
|
||||||
// //Проверка, что объект с таким id существует
|
|
||||||
// if (stockroom[index] !== undefined) {
|
|
||||||
// //Если удалён был фокусный объект - фокус теперь неизвестен
|
|
||||||
// if (stockroom[index].isFocus) {
|
|
||||||
// setFocus(undefined)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// let newArr:any = []
|
|
||||||
// //Если удалённый объект был хранилищем (контейнером, или селектом), мы не вложим в новый массив его и его потомков
|
|
||||||
// if (stockroom[index].type === 1 || stockroom[index].type === 7) {
|
|
||||||
// stockroom.forEach((e:any, i:number) => {
|
|
||||||
// if (e.id !== id) {
|
|
||||||
// if (e.parent !== id) {
|
|
||||||
// newArr.push(e)
|
|
||||||
// } else {
|
|
||||||
// if (e.isFocus) {
|
|
||||||
// setFocus(undefined)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// } else {
|
|
||||||
// newArr = stockroom
|
|
||||||
// newArr.splice(index, 1)
|
|
||||||
// }
|
|
||||||
// setStockroom([...newArr])
|
|
||||||
// saveCondition("stockroom", newArr)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return(
|
return(
|
||||||
<>
|
<>
|
||||||
<Header/>
|
<Header/>
|
||||||
|
|||||||
@ -2,11 +2,9 @@
|
|||||||
interface ElementsOfObject {
|
interface ElementsOfObject {
|
||||||
text?: string;
|
text?: string;
|
||||||
id: string;
|
id: string;
|
||||||
// isFocus: boolean;
|
|
||||||
color?: string;
|
color?: string;
|
||||||
type: number
|
type: number
|
||||||
parent: undefined | number
|
children: Array<ElementsOfObject>
|
||||||
children: Array<ElementsOfObject> | undefined
|
|
||||||
}
|
}
|
||||||
interface QuestionProps {
|
interface QuestionProps {
|
||||||
type: number;
|
type: number;
|
||||||
|
|||||||
@ -6,22 +6,11 @@ import Viewer from "./viewer";
|
|||||||
|
|
||||||
export default (props: any) => {
|
export default (props: any) => {
|
||||||
|
|
||||||
let current:any
|
|
||||||
if (props.focus !== undefined) {
|
|
||||||
if (props.stockroom !== undefined) {
|
|
||||||
const index = props.getIndexById(props.focus, props.stockroom)
|
|
||||||
|
|
||||||
if (index !== undefined) {
|
|
||||||
current = props.stockroom[index]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Select
|
<Select
|
||||||
placeholder='тип вопроса'
|
placeholder='тип вопроса'
|
||||||
value={current === undefined ? 0 : current.type}
|
// value={current === undefined ? 0 : current.type}
|
||||||
onChange={e => {
|
onChange={e => {
|
||||||
props.typeHC(Number(e.target.value))
|
props.typeHC(Number(e.target.value))
|
||||||
}}
|
}}
|
||||||
@ -48,7 +37,7 @@ export default (props: any) => {
|
|||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
props.createObject({text: "", color: "", isFocus: true, type: 0, id: -1, parent: undefined})
|
props.createObject()
|
||||||
|
|
||||||
}}
|
}}
|
||||||
>добавить</Button>
|
>добавить</Button>
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import {
|
|||||||
Select, Checkbox, Button, Box, VStack, HStack, Textarea
|
Select, Checkbox, Button, Box, VStack, HStack, Textarea
|
||||||
} from '@chakra-ui/react'
|
} from '@chakra-ui/react'
|
||||||
|
|
||||||
import {TextField} from "./createQuestion";
|
// import {TextField} from "./createQuestion";
|
||||||
import type {QuestionProps} from "./questionTypes"
|
import type {QuestionProps} from "./questionTypes"
|
||||||
|
|
||||||
export default ({focused, element, stockroom = [], changeFocus, keyInfo, shiftKeyInfo, focus} : any) => {
|
export default ({focused, element, stockroom = [], changeFocus, keyInfo, shiftKeyInfo, focus} : any) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user