12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- export const singleOpenStrategy = {
- open: _ref => {
- let {
- id,
- value,
- opened,
- parents
- } = _ref;
- if (value) {
- const newOpened = new Set();
- newOpened.add(id);
- let parent = parents.get(id);
- while (parent != null) {
- newOpened.add(parent);
- parent = parents.get(parent);
- }
- return newOpened;
- } else {
- opened.delete(id);
- return opened;
- }
- },
- select: () => null
- };
- export const multipleOpenStrategy = {
- open: _ref2 => {
- let {
- id,
- value,
- opened,
- parents
- } = _ref2;
- if (value) {
- let parent = parents.get(id);
- opened.add(id);
- while (parent != null && parent !== id) {
- opened.add(parent);
- parent = parents.get(parent);
- }
- return opened;
- } else {
- opened.delete(id);
- }
- return opened;
- },
- select: () => null
- };
- export const listOpenStrategy = {
- open: multipleOpenStrategy.open,
- select: _ref3 => {
- let {
- id,
- value,
- opened,
- parents
- } = _ref3;
- if (!value) return opened;
- const path = [];
- let parent = parents.get(id);
- while (parent != null) {
- path.push(parent);
- parent = parents.get(parent);
- }
- return new Set(path);
- }
- };
- //# sourceMappingURL=openStrategies.mjs.map
|