@galadrim/galadmin 0.1.213 → 0.1.215
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/api.js +10 -17
- package/dist/api.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +0 -1
- package/package.json +1 -1
- package/src/api.ts +10 -17
- package/src/front/build/asset-manifest.json +3 -3
- package/src/front/build/index.html +1 -1
- package/src/front/build/static/js/{main.8164246f.js → main.f024ade6.js} +3 -3
- package/src/front/build/static/js/{main.8164246f.js.map → main.f024ade6.js.map} +1 -1
- package/src/front/src/utils/getFormattedValue.js +2 -2
- package/src/types/config.ts +0 -3
- package/src/front/src/main.js +0 -208
- /package/src/front/build/static/js/{main.8164246f.js.LICENSE.txt → main.f024ade6.js.LICENSE.txt} +0 -0
|
@@ -3,10 +3,10 @@ import { Link } from "react-router-dom";
|
|
|
3
3
|
|
|
4
4
|
export default (column, record, config, onTable) => {
|
|
5
5
|
const foreignViewIndex =
|
|
6
|
-
column.dataType === "foreign"
|
|
6
|
+
column.dataType === "foreign" || column.dataType === "datalist"
|
|
7
7
|
? config.views.findIndex((x) => x.tableName === column.table)
|
|
8
8
|
: -1;
|
|
9
|
-
if (column.dataType === "foreign" && foreignViewIndex > -1) {
|
|
9
|
+
if ((column.dataType === "foreign" || column.dataType === "datalist") && foreignViewIndex > -1) {
|
|
10
10
|
if (column.formatValue) {
|
|
11
11
|
return (
|
|
12
12
|
<Link
|
package/src/types/config.ts
CHANGED
|
@@ -461,9 +461,6 @@ export type Config = {
|
|
|
461
461
|
/** Clé API Google Maps pour les champs adresses et l'affichage de cartes */
|
|
462
462
|
googleMapsKey?: string;
|
|
463
463
|
|
|
464
|
-
/** Clé API INSEE pour la recherche de sociétés */
|
|
465
|
-
inseeKey?: string;
|
|
466
|
-
|
|
467
464
|
/** Désactiver la sélection multiple dans les vues de type table */
|
|
468
465
|
hideMultiselect?: boolean;
|
|
469
466
|
|
package/src/front/src/main.js
DELETED
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
moment.locale("fr");
|
|
2
|
-
var currentTableNumberOfPages;
|
|
3
|
-
var searchTypingTimeout = null;
|
|
4
|
-
var currentRecordData = null;
|
|
5
|
-
var currentlyEditedRecord = null;
|
|
6
|
-
|
|
7
|
-
$(document).ready(function () {
|
|
8
|
-
showView(0)
|
|
9
|
-
|
|
10
|
-
$(document).on("click touchstart", ".record[data-view-index][data-primary-value]", function () {
|
|
11
|
-
var viewIndex = $(this).data("viewIndex")
|
|
12
|
-
var position = $(this).data("position")
|
|
13
|
-
var table = config.views[viewIndex];
|
|
14
|
-
if (table.notClickable) {
|
|
15
|
-
// nothing
|
|
16
|
-
} else if (table.clickToEdit) {
|
|
17
|
-
showEditRecord(viewIndex, $(this).data("primaryValue"))
|
|
18
|
-
} else {
|
|
19
|
-
showShowRecord(viewIndex, $(this).data("primaryValue"), position)
|
|
20
|
-
}
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
$(document).on("click", ".actionButton", function () {
|
|
24
|
-
$.post($(this).data("route"), $(this).data("data"), function () {
|
|
25
|
-
showView(lastViewShown);
|
|
26
|
-
})
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
$(document).on("click", ".duplicateRecord", function (e) {
|
|
30
|
-
var viewIndex = $(this).data("viewIndex")
|
|
31
|
-
var table = config.views[viewIndex];
|
|
32
|
-
var primaryValue = $(this).data("primaryValue")
|
|
33
|
-
$.post("duplicateRecord", {
|
|
34
|
-
primaryValue: primaryValue,
|
|
35
|
-
table: table.tableName,
|
|
36
|
-
duplicateConfig: table.duplicateConfig
|
|
37
|
-
}, function () {
|
|
38
|
-
showRecords(lastViewShown, lastPageShown, lastSearchQuery, lastOrderBy, lastIsDesc, lastSubviewIndex)
|
|
39
|
-
})
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
$(document).on("click", ".galleryPicture .deleteIcon", function (e) {
|
|
43
|
-
var $elementToRemove = $(this).parent()
|
|
44
|
-
var tableName = $(this).data("tableName")
|
|
45
|
-
var primaryId = $(this).data("primaryId")
|
|
46
|
-
var primaryValue = $(this).data("primaryValue")
|
|
47
|
-
askForDeletion(tableName, primaryId, null, primaryValue, function () {
|
|
48
|
-
$elementToRemove.remove()
|
|
49
|
-
})
|
|
50
|
-
e.stopPropagation()
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
$(document).on("click", ".unfoldPanel", function () {
|
|
54
|
-
$(this).parent().parent().parent().find(".panelTable").toggleClass("folded")
|
|
55
|
-
$(this).html($(this).html() == "Afficher" ? "Masquer" : "Afficher")
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
$(".searchBar").on("input", function (e) {
|
|
59
|
-
if (searchTypingTimeout) {
|
|
60
|
-
clearTimeout(searchTypingTimeout);
|
|
61
|
-
}
|
|
62
|
-
searchTypingTimeout = setTimeout(search, 300);
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
$(".prevButton").on("click", function () {
|
|
66
|
-
showAdjacent(true)
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
$(".nextButton").on("click", function () {
|
|
70
|
-
showAdjacent()
|
|
71
|
-
});
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
function initFileInputs() {
|
|
75
|
-
$(".clickToSelectFile").each(function () {
|
|
76
|
-
var showAsPicture = $(this).data("showAsPicture") == 1
|
|
77
|
-
var filePath = $("input[data-input-id='" + $(this).data("inputId") + "'][name='filePath']").val()
|
|
78
|
-
if (filePath) {
|
|
79
|
-
$(this).html(showAsPicture ? "<div><img src='https://res.cloudinary.com/forest2/image/fetch/w_600,h_300,c_fit/" + $(this).data("baseUrl") + filePath + "' /><div class='deleteFile'><i class='fal fa-trash-alt'></i></div></div>" : "<div class='nonImageFileOutput'><span>Fichier téléchargé</span><div class='deleteFile'><i class='fal fa-trash-alt'></i></div></div>")
|
|
80
|
-
$(this).removeClass("clickToSelectFile")
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function defineTriggers(input, column, isEdit) {
|
|
86
|
-
if (column.triggers) {
|
|
87
|
-
input.on("input", function () {
|
|
88
|
-
for (let i in column.triggers) {
|
|
89
|
-
let trigger = column.triggers[i];
|
|
90
|
-
if (trigger.computedValue) {
|
|
91
|
-
$("input[data-column-name=" + trigger.name + "]").val(evalExpression(trigger.computedValue, getCurrentValues(isEdit)))
|
|
92
|
-
} else if (trigger.type === "refreshList") {
|
|
93
|
-
let viewIndex = input.attr("data-view-index");
|
|
94
|
-
let otherColumn = config.views[viewIndex].columns.find(x => x.name == trigger.name)
|
|
95
|
-
$("[data-column-name=" + trigger.name + "] .datalistContainerInput").val("")
|
|
96
|
-
$("[data-column-name=" + trigger.name + "] .datalistContainerHiddenInput").val("")
|
|
97
|
-
initForeignSelect(otherColumn, $("[data-column-name=" + trigger.name + "] datalist"), null, null, null, isEdit)
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
var currentRecordPrimaryValue = null;
|
|
105
|
-
var currentRecordViewIndex = null;
|
|
106
|
-
var currentRecordPosition = null;
|
|
107
|
-
|
|
108
|
-
function showAdjacent(isPrev) {
|
|
109
|
-
var view = config.views[currentRecordViewIndex];
|
|
110
|
-
|
|
111
|
-
$.post("adjacentRecordId", {
|
|
112
|
-
position: parseInt(currentRecordPosition),
|
|
113
|
-
table: view.tableName,
|
|
114
|
-
filters: sqlAnd([view.filters, lastSubviewIndex != null ? view.subviews[lastSubviewIndex].filters : null].concat(currentFilters.map(function (x) {
|
|
115
|
-
return x.query
|
|
116
|
-
}))),
|
|
117
|
-
join: view.join,
|
|
118
|
-
selectExpression: view.selectExpression,
|
|
119
|
-
orderBy: lastOrderBy || view.orderBy,
|
|
120
|
-
isDesc: typeof lastIsDesc == "undefined" || lastIsDesc === null ? view.isDesc : lastIsDesc,
|
|
121
|
-
primaryId: view.primaryId,
|
|
122
|
-
query: lastSearchQuery,
|
|
123
|
-
groupBy: view.groupBy,
|
|
124
|
-
columns: view.columns,
|
|
125
|
-
offset: isPrev ? -1 : 1
|
|
126
|
-
}, function (data) {
|
|
127
|
-
if (data.recordId) {
|
|
128
|
-
showShowRecord(currentRecordViewIndex, data.recordId, isPrev ? Math.max(currentRecordPosition - 1, 1) : currentRecordPosition + 1)
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function showShowRecord(viewIndex, primaryValue, position) {
|
|
134
|
-
currentRecordPosition = position;
|
|
135
|
-
if (isFinite(position)) {
|
|
136
|
-
$(".adjacentButton").show();
|
|
137
|
-
} else {
|
|
138
|
-
$(".adjacentButton").hide();
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function showCreateRecordFromPanel(createConfig, recordId, viewIndex) {
|
|
143
|
-
pushHistoryState()
|
|
144
|
-
$(".view").hide()
|
|
145
|
-
$(".view[data-view='createRecord']").show()
|
|
146
|
-
let columns = createConfig.columns
|
|
147
|
-
$(".viewTitle").html(createConfig.label)
|
|
148
|
-
let $form = $(".view[data-view='createRecord'] .form")
|
|
149
|
-
$(".view[data-view='createRecord'] .createRecord").data("viewIndex", viewIndex)
|
|
150
|
-
$(".view[data-view='createRecord'] .createRecord").off('click');
|
|
151
|
-
$(".view[data-view='createRecord'] .createRecord").on("click", function (e) {
|
|
152
|
-
createRecordFromPanel(createConfig, recordId, viewIndex)
|
|
153
|
-
e.stopPropagation()
|
|
154
|
-
})
|
|
155
|
-
$form.html("")
|
|
156
|
-
for (let i in columns) {
|
|
157
|
-
if (columns[i].dataType && (columns[i].canEditOnCreation === true || columns[i].canEdit !== false)) {
|
|
158
|
-
let $formElement = $("<div class='formElement'>" +
|
|
159
|
-
"<div class='formLabel'>" + columns[i].label + "</div>" +
|
|
160
|
-
"<div class='formInput'></div>" +
|
|
161
|
-
"</div>")
|
|
162
|
-
let $input = getInputFromDataType(columns[i].dataType, columns[i])
|
|
163
|
-
$input.attr("data-column-name", columns[i].name)
|
|
164
|
-
$input.data("columnName", columns[i].name)
|
|
165
|
-
$formElement.find(".formInput").append($input)
|
|
166
|
-
$form.append($formElement)
|
|
167
|
-
if (columns[i].dataType == "foreign") {
|
|
168
|
-
initForeignSelect(columns[i], $input, null, null, recordId)
|
|
169
|
-
} else if (columns[i].dataType == "datalist") {
|
|
170
|
-
initForeignSelect(columns[i], $input.find("datalist"), null, null, recordId)
|
|
171
|
-
$input.find(".datalistContainerInput").on("input", function () {
|
|
172
|
-
initForeignSelect(columns[i], $input.find("datalist"), null, $(this).val(), recordId)
|
|
173
|
-
})
|
|
174
|
-
}
|
|
175
|
-
if (columns[i].hidden) {
|
|
176
|
-
$formElement.hide()
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
initSpecialInputs()
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function createRecordFromPanel(createConfig, recordId, viewIndex) {
|
|
184
|
-
var $form = $(".view[data-view='createRecord'] .form")
|
|
185
|
-
var data = {}
|
|
186
|
-
$form.find("[data-column-name]").each(function () {
|
|
187
|
-
data[$(this).data("columnName")] = $(this).val()
|
|
188
|
-
})
|
|
189
|
-
for (var key in createConfig.filters) {
|
|
190
|
-
data[key] = createConfig.filters[key]
|
|
191
|
-
}
|
|
192
|
-
data[createConfig.recordId] = recordId
|
|
193
|
-
$(".createRecord").html("Sauvegarde en cours...")
|
|
194
|
-
$(".createRecord").addClass("loading")
|
|
195
|
-
$.post("createRecord", {
|
|
196
|
-
table: createConfig.tableName,
|
|
197
|
-
data: data
|
|
198
|
-
}, function (r) {
|
|
199
|
-
$(".createRecord").html("Sauvegarder")
|
|
200
|
-
$(".createRecord").removeClass("loading")
|
|
201
|
-
if (createConfig.createCallback) {
|
|
202
|
-
$.post(createConfig.createCallback, {
|
|
203
|
-
id: r.id
|
|
204
|
-
})
|
|
205
|
-
}
|
|
206
|
-
showShowRecord(viewIndex, recordId)
|
|
207
|
-
})
|
|
208
|
-
}
|
/package/src/front/build/static/js/{main.8164246f.js.LICENSE.txt → main.f024ade6.js.LICENSE.txt}
RENAMED
|
File without changes
|