react-graph-grid 0.1.3 → 0.1.5

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.
Files changed (88) hide show
  1. package/README.md +4 -0
  2. package/dist/index.esm.js +21 -0
  3. package/dist/index.js +56 -0
  4. package/dist/index10.esm.js +3844 -0
  5. package/dist/index10.js +3848 -0
  6. package/dist/index11.esm.js +4121 -0
  7. package/dist/index11.js +4125 -0
  8. package/dist/index12.esm.js +5238 -0
  9. package/dist/index12.js +5242 -0
  10. package/dist/index13.esm.js +5466 -0
  11. package/dist/index13.js +5470 -0
  12. package/dist/index14.esm.js +22 -0
  13. package/dist/index14.js +26 -0
  14. package/dist/index15.esm.js +402 -0
  15. package/dist/index15.js +403 -0
  16. package/dist/index16.esm.js +507 -0
  17. package/dist/index16.js +507 -0
  18. package/dist/index17.esm.js +256 -0
  19. package/dist/index17.js +257 -0
  20. package/dist/index18.esm.js +261 -0
  21. package/dist/index18.js +263 -0
  22. package/dist/index19.esm.js +623 -0
  23. package/dist/index19.js +624 -0
  24. package/dist/index2.esm.js +6 -0
  25. package/dist/index2.js +2 -0
  26. package/dist/index20.esm.js +219 -0
  27. package/dist/index20.js +220 -0
  28. package/dist/index21.esm.js +298 -0
  29. package/dist/index21.js +299 -0
  30. package/dist/index22.esm.js +662 -0
  31. package/dist/index22.js +663 -0
  32. package/dist/index23.esm.js +340 -0
  33. package/dist/index23.js +341 -0
  34. package/dist/index24.esm.js +269 -0
  35. package/dist/index24.js +270 -0
  36. package/dist/index25.esm.js +600 -0
  37. package/dist/index25.js +601 -0
  38. package/dist/index26.esm.js +245 -0
  39. package/dist/index26.js +246 -0
  40. package/dist/index27.esm.js +136 -0
  41. package/dist/index27.js +137 -0
  42. package/dist/index28.esm.js +70 -0
  43. package/dist/index28.js +70 -0
  44. package/dist/index29.esm.js +748 -0
  45. package/dist/index29.js +748 -0
  46. package/dist/index30.esm.js +363 -0
  47. package/dist/index30.js +363 -0
  48. package/dist/index4.esm.js +27 -0
  49. package/dist/index4.js +27 -0
  50. package/dist/index5.esm.js +35 -0
  51. package/dist/index5.js +39 -0
  52. package/dist/index6.esm.js +200 -0
  53. package/dist/index6.js +204 -0
  54. package/dist/index7.esm.js +9 -0
  55. package/dist/index7.js +13 -0
  56. package/dist/index8.esm.js +65 -0
  57. package/dist/index8.js +68 -0
  58. package/dist/index9.esm.js +102 -0
  59. package/dist/index9.js +103 -0
  60. package/{src/css/default.css → dist/react-graph-grid.css} +2 -1
  61. package/package.json +6 -6
  62. package/eslint.config.js +0 -29
  63. package/index.html +0 -13
  64. package/index.js +0 -19
  65. package/npm.aps +0 -0
  66. package/src/Base.jsx +0 -81
  67. package/src/Card.jsx +0 -333
  68. package/src/Dropdown.jsx +0 -339
  69. package/src/FieldEdit.jsx +0 -376
  70. package/src/Graph.jsx +0 -482
  71. package/src/Grid.jsx +0 -887
  72. package/src/GridCD.jsx +0 -180
  73. package/src/GridDB.jsx +0 -897
  74. package/src/GridFE.jsx +0 -753
  75. package/src/GridFL.jsx +0 -468
  76. package/src/GridGR.jsx +0 -311
  77. package/src/GridPK.jsx +0 -414
  78. package/src/Modal.jsx +0 -511
  79. package/src/Overlay.jsx +0 -140
  80. package/src/Tests/DebugApp.jsx +0 -334
  81. package/src/Tests/TestData.jsx +0 -251
  82. package/src/Themes/DefaultGridTheme.jsx +0 -36
  83. package/src/Themes/Images.jsx +0 -438
  84. package/src/Themes/Translate.jsx +0 -76
  85. package/src/css/default_.css +0 -945
  86. package/src/main.jsx +0 -10
  87. package/vite.config.js +0 -14
  88. /package/{public → dist}/IM.svg +0 -0
@@ -0,0 +1,137 @@
1
+ const require_jsx_runtime$1 = require("./index7.js");
2
+ const require_GridFE = require("./index25.js");
3
+ const require_Card = require("./index26.js");
4
+ let react = require("react");
5
+ var import_jsx_runtime = require_jsx_runtime$1.default;
6
+ function GridCD(props) {
7
+ let grid = null;
8
+ const [gridState, setState] = (0, react.useState)({
9
+ grid,
10
+ ind: 0
11
+ });
12
+ grid = gridState.grid;
13
+ let needGetRows = false;
14
+ if (!grid || grid.uid !== props.uid && props.uid != null) {
15
+ grid = null;
16
+ if (props.findGrid) grid = props.findGrid(props);
17
+ grid = grid || new GridCDClass(props);
18
+ needGetRows = !props.noAutoRefresh && !grid.hasVisibleParentGrids();
19
+ }
20
+ if (props.init) props.init(grid);
21
+ grid.refreshState = function() {
22
+ setState({
23
+ grid,
24
+ ind: grid.stateind++
25
+ });
26
+ };
27
+ (0, react.useEffect)(() => {
28
+ grid.setupEvents();
29
+ if (needGetRows && (grid.rows.length <= 0 || grid.columns.length <= 0) || grid._forceRefresh) {
30
+ grid._forceRefresh = false;
31
+ grid._waitingRows = true;
32
+ grid.getRows({
33
+ filters: grid.collectFilters(),
34
+ grid
35
+ }).then((rows) => {
36
+ grid.rows = rows;
37
+ grid.afterGetRows();
38
+ grid.refreshState();
39
+ }).finally(() => {
40
+ grid._waitingRows = false;
41
+ grid.refreshState();
42
+ });
43
+ } else if (grid.columns.length <= 0 && grid.getColumns) grid.prepareColumns().then(() => grid.refreshState());
44
+ return () => {
45
+ grid.clearEvents();
46
+ };
47
+ }, [grid, needGetRows]);
48
+ return grid.render();
49
+ }
50
+ var GridCDClass = class extends require_GridFE.GridFEClass {
51
+ constructor(props) {
52
+ super(props);
53
+ const grid = this;
54
+ grid.allowView = true;
55
+ grid._buttonsDict["view"].getVisible = () => {
56
+ return true;
57
+ };
58
+ }
59
+ render() {
60
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: super.render() });
61
+ }
62
+ renderPopupContent(wnd) {
63
+ const grid = this;
64
+ return grid.cardIsShowing ? grid.renderCardContent(wnd) : super.renderPopupContent(wnd);
65
+ }
66
+ renderCardContent() {
67
+ const grid = this;
68
+ return grid.allowView == false ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
69
+ className: `graph-filter-title graph-filter-required`,
70
+ children: grid.translate("Insufficient rights to view")
71
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(require_Card.Card, {
72
+ cardRow: grid.cardRow || {},
73
+ isNewRecord: grid.isNewRecord,
74
+ allowEdit: grid.allowEdit,
75
+ uid: (grid.uid || grid.id) + "_card_",
76
+ keyField: grid.keyField,
77
+ level: grid.level + 1,
78
+ findGrid: () => {
79
+ const selRow = grid.cardRow || grid.selectedRow();
80
+ if (grid._card && selRow && grid._card.changedRow[grid.keyField] === selRow[grid.keyField]) return grid._card;
81
+ },
82
+ init: (card) => {
83
+ if (grid._card == card) return;
84
+ grid._card = card;
85
+ card.visible = true;
86
+ card.columns = [];
87
+ for (let col of grid.columns) {
88
+ const remGetRows = col.getRows;
89
+ delete col._fieldEditObj;
90
+ delete col.grid;
91
+ delete col._filterEditObj;
92
+ delete col.getRows;
93
+ let clone = structuredClone(col);
94
+ card.columns.push(clone);
95
+ clone.getRows = col.getRows = remGetRows;
96
+ col.grid = grid;
97
+ }
98
+ card.close = (e) => {
99
+ grid.onClosePopup(e);
100
+ grid.refreshState();
101
+ };
102
+ }
103
+ });
104
+ }
105
+ viewRecord(e) {
106
+ const grid = this;
107
+ const shift = (grid.level + 1) * 20;
108
+ grid.cardPos = grid.cardPos || {
109
+ x: 100 + shift,
110
+ y: 100 + shift,
111
+ w: 800,
112
+ h: 600
113
+ };
114
+ grid.popupPos = grid.cardPos;
115
+ grid.cardRow = grid.selectedRow();
116
+ grid.isNewRecord = false;
117
+ grid.cardIsShowing = true;
118
+ grid.popupIsShowing = true;
119
+ grid.popupTitle = grid.title;
120
+ grid.refreshState();
121
+ }
122
+ onClosePopup(e) {
123
+ const grid = this;
124
+ if (grid.cardIsShowing && grid._card) {
125
+ if (grid._card.isEditing() && (grid.isNewRecord || grid.isRowChanged(grid._card.changedRow, grid.selectedRow()))) {
126
+ e.cancel = !confirm(grid.translate("The row is changed. Discard changes?"));
127
+ if (e.cancel) return;
128
+ }
129
+ delete grid._card;
130
+ }
131
+ super.onClosePopup(e);
132
+ if (e.cancel) return;
133
+ if (grid.cardIsShowing) grid.cardIsShowing = false;
134
+ }
135
+ };
136
+ exports.GridCD = GridCD;
137
+ exports.GridCDClass = GridCDClass;
@@ -0,0 +1,70 @@
1
+ var Translate = class Translate {
2
+ static language = null;
3
+ static translate(text) {
4
+ if (text == null) return "";
5
+ if (Translate.language != "ru") return text;
6
+ return {
7
+ "ADD": "Добавить",
8
+ "ADD NEW RECORD": "Добавить новую строку",
9
+ "ADJUST COLUMN VISIBILITY": "Настроить видимость колонок",
10
+ "BUTTONS SIZE": "Размер кнопок",
11
+ "CANCEL": "Отмена",
12
+ "COLLAPSE": "Свернуть",
13
+ "COPY": "Копировать",
14
+ "COPY RECORD": "Копировать строку",
15
+ "CLEAR ALL FILTERS": "Очистить все фильтры",
16
+ "COMMIT": "Сохранить",
17
+ "COMMIT CHANGES": "Сохранить изменения",
18
+ "CURRENT PAGE": "Текущая страница",
19
+ "DEFAULT": "По умолчанию",
20
+ "DEFAULT THEME": "Тема по умолчанию",
21
+ "DELETE": "Удалить",
22
+ "DELETE RECORD": "Удалить строку",
23
+ "DESC": "убыв",
24
+ "ERROR GETTING ROWS": "Ошибка при получении строк",
25
+ "EXPAND": "Развернуть",
26
+ "EXPORT TO CSV": "Экспорт в CSV",
27
+ "EXIT": "Выход",
28
+ "FIRST": "К началу",
29
+ "INSUFFICIENT RIGHTS TO VIEW": "Недостаточно прав для просмотра",
30
+ "INVISIBLE COLUMNS": "Невидимые колонки",
31
+ "LARGE BUTTONS": "Большие",
32
+ "LAST": "В конец",
33
+ "LOAD MORE RECORDS": "Загрузить еще строк",
34
+ "LOADING": "Загрузка",
35
+ "MEDIUM BUTTONS": "Средние",
36
+ "MORE": "еще",
37
+ "NEXT": "Следующая",
38
+ "NEW CONFIGURATION": "Новая конфигурация",
39
+ "NO DATA DEFINED TO SAVE": "Не опеределены данные для сохранения",
40
+ "OF": "из",
41
+ "PAGE SIZE": "Размер страницы",
42
+ "PARAMETER": "Параметр",
43
+ "POCKET": "Карман",
44
+ "PREV": "Предыдущая",
45
+ "REFRESH": "Обновить",
46
+ "RESET COLUMNS ORDER": "Сбросить порядок колонок",
47
+ "RESET COLUMNS SORT": "Сбросить сортировку колонок",
48
+ "RESET COLUMNS WIDTHS": "Сбросить ширину колонок",
49
+ "ROLLBACK": "Откатить",
50
+ "ROLLBACK CHANGES": "Откатить изменения",
51
+ "SETTINGS": "Настройки",
52
+ "SELECT": "Выбор",
53
+ "SELECT VALUE": "Выбрать значение",
54
+ "SERVER TYPE": "Тип сервера",
55
+ "SMALL BUTTONS": "Маленькие",
56
+ "SORT": "Сортировка",
57
+ "THEME": "Тема",
58
+ "THE ROW IS CHANGED. DISCARD CHANGES?": "Запись изменена. Отказаться от изменений?",
59
+ "TOTAL PAGES": "Всего страниц",
60
+ "TOTAL ROWS": "Всего строк",
61
+ "TREE": "Дерево",
62
+ "VALUE": "Значение",
63
+ "VIEW": "Просмотр",
64
+ "VIEW RECORD": "Карточка",
65
+ "VISIBLE COLUMNS": "Видимые колонки",
66
+ "USER": "Пользователь"
67
+ }[text.toUpperCase()] || text;
68
+ }
69
+ };
70
+ export { Translate };
@@ -0,0 +1,70 @@
1
+ var Translate = class Translate {
2
+ static language = null;
3
+ static translate(text) {
4
+ if (text == null) return "";
5
+ if (Translate.language != "ru") return text;
6
+ return {
7
+ "ADD": "Добавить",
8
+ "ADD NEW RECORD": "Добавить новую строку",
9
+ "ADJUST COLUMN VISIBILITY": "Настроить видимость колонок",
10
+ "BUTTONS SIZE": "Размер кнопок",
11
+ "CANCEL": "Отмена",
12
+ "COLLAPSE": "Свернуть",
13
+ "COPY": "Копировать",
14
+ "COPY RECORD": "Копировать строку",
15
+ "CLEAR ALL FILTERS": "Очистить все фильтры",
16
+ "COMMIT": "Сохранить",
17
+ "COMMIT CHANGES": "Сохранить изменения",
18
+ "CURRENT PAGE": "Текущая страница",
19
+ "DEFAULT": "По умолчанию",
20
+ "DEFAULT THEME": "Тема по умолчанию",
21
+ "DELETE": "Удалить",
22
+ "DELETE RECORD": "Удалить строку",
23
+ "DESC": "убыв",
24
+ "ERROR GETTING ROWS": "Ошибка при получении строк",
25
+ "EXPAND": "Развернуть",
26
+ "EXPORT TO CSV": "Экспорт в CSV",
27
+ "EXIT": "Выход",
28
+ "FIRST": "К началу",
29
+ "INSUFFICIENT RIGHTS TO VIEW": "Недостаточно прав для просмотра",
30
+ "INVISIBLE COLUMNS": "Невидимые колонки",
31
+ "LARGE BUTTONS": "Большие",
32
+ "LAST": "В конец",
33
+ "LOAD MORE RECORDS": "Загрузить еще строк",
34
+ "LOADING": "Загрузка",
35
+ "MEDIUM BUTTONS": "Средние",
36
+ "MORE": "еще",
37
+ "NEXT": "Следующая",
38
+ "NEW CONFIGURATION": "Новая конфигурация",
39
+ "NO DATA DEFINED TO SAVE": "Не опеределены данные для сохранения",
40
+ "OF": "из",
41
+ "PAGE SIZE": "Размер страницы",
42
+ "PARAMETER": "Параметр",
43
+ "POCKET": "Карман",
44
+ "PREV": "Предыдущая",
45
+ "REFRESH": "Обновить",
46
+ "RESET COLUMNS ORDER": "Сбросить порядок колонок",
47
+ "RESET COLUMNS SORT": "Сбросить сортировку колонок",
48
+ "RESET COLUMNS WIDTHS": "Сбросить ширину колонок",
49
+ "ROLLBACK": "Откатить",
50
+ "ROLLBACK CHANGES": "Откатить изменения",
51
+ "SETTINGS": "Настройки",
52
+ "SELECT": "Выбор",
53
+ "SELECT VALUE": "Выбрать значение",
54
+ "SERVER TYPE": "Тип сервера",
55
+ "SMALL BUTTONS": "Маленькие",
56
+ "SORT": "Сортировка",
57
+ "THEME": "Тема",
58
+ "THE ROW IS CHANGED. DISCARD CHANGES?": "Запись изменена. Отказаться от изменений?",
59
+ "TOTAL PAGES": "Всего страниц",
60
+ "TOTAL ROWS": "Всего строк",
61
+ "TREE": "Дерево",
62
+ "VALUE": "Значение",
63
+ "VIEW": "Просмотр",
64
+ "VIEW RECORD": "Карточка",
65
+ "VISIBLE COLUMNS": "Видимые колонки",
66
+ "USER": "Пользователь"
67
+ }[text.toUpperCase()] || text;
68
+ }
69
+ };
70
+ exports.Translate = Translate;