@dejwcake/craftable 0.0.2 → 0.0.3
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/admin/Admin.js +33 -35
- package/dist/auth/Form.js +6 -13
- package/dist/base-components/Form/BaseForm.js +53 -88
- package/dist/base-components/Form/BaseUpload.js +112 -84
- package/dist/base-components/Form/bootstrap.js +11 -15
- package/dist/base-components/Listing/BaseListing.js +438 -425
- package/dist/base-components/Listing/components/Pagination.js +90 -95
- package/dist/base-components/Listing/components/Sortable.js +34 -41
- package/dist/base-components/Listing/components/UserDetailTooltip.js +49 -50
- package/dist/index.js +23 -38
- package/dist/overrides/trumbowyg.edit-embed-template.js +63 -67
- package/dist/overrides/trumbowyg.reupload.js +123 -141
- package/dist/overrides/trumbowyg.template.js +56 -59
- package/dist/translation/Form.js +6 -13
- package/dist/translation/Listing.js +255 -266
- package/dist/ui/index.js +27 -28
- package/package.json +7 -7
package/dist/admin/Admin.js
CHANGED
|
@@ -1,42 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
4
|
+
value: true
|
|
5
5
|
});
|
|
6
|
+
exports["default"] = void 0;
|
|
6
7
|
var Admin = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
el: '#app',
|
|
9
|
+
data: function data() {
|
|
10
|
+
return {
|
|
11
|
+
loading: false
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
mounted: function mounted() {
|
|
15
|
+
var _this = this;
|
|
16
|
+
// Add a loader request interceptor
|
|
17
|
+
axios.interceptors.request.use(function (config) {
|
|
18
|
+
_this.setLoading(true);
|
|
19
|
+
return config;
|
|
20
|
+
}, function (error) {
|
|
21
|
+
_this.setLoading(false);
|
|
22
|
+
return Promise.reject(error);
|
|
23
|
+
});
|
|
15
24
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return response;
|
|
29
|
-
}, function (error) {
|
|
30
|
-
_this.setLoading(false);
|
|
31
|
-
return Promise.reject(error);
|
|
32
|
-
});
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
methods: {
|
|
36
|
-
setLoading: function setLoading(value) {
|
|
37
|
-
this.loading = !!value;
|
|
38
|
-
}
|
|
25
|
+
// Add a loader response interceptor
|
|
26
|
+
axios.interceptors.response.use(function (response) {
|
|
27
|
+
_this.setLoading(false);
|
|
28
|
+
return response;
|
|
29
|
+
}, function (error) {
|
|
30
|
+
_this.setLoading(false);
|
|
31
|
+
return Promise.reject(error);
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
methods: {
|
|
35
|
+
setLoading: function setLoading(value) {
|
|
36
|
+
this.loading = !!value;
|
|
39
37
|
}
|
|
38
|
+
}
|
|
40
39
|
};
|
|
41
|
-
|
|
42
|
-
exports.default = Admin;
|
|
40
|
+
var _default = exports["default"] = Admin;
|
package/dist/auth/Form.js
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
var _vue = require(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _BaseForm2 = _interopRequireDefault(_BaseForm);
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
_vue2.default.component('auth-form', {
|
|
14
|
-
mixins: [_BaseForm2.default]
|
|
3
|
+
var _vue = _interopRequireDefault(require("vue"));
|
|
4
|
+
var _BaseForm = _interopRequireDefault(require("../base-components/Form/BaseForm"));
|
|
5
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
6
|
+
_vue["default"].component('auth-form', {
|
|
7
|
+
mixins: [_BaseForm["default"]]
|
|
15
8
|
});
|
|
@@ -1,53 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
require(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
require(
|
|
20
|
-
|
|
21
|
-
require(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
require('trumbowyg/dist/plugins/upload/trumbowyg.upload.js');
|
|
28
|
-
|
|
29
|
-
require('trumbowyg/dist/plugins/noembed/trumbowyg.noembed.js');
|
|
30
|
-
|
|
31
|
-
require('trumbowyg/dist/plugins/pasteembed/trumbowyg.pasteembed.js');
|
|
32
|
-
|
|
33
|
-
require('trumbowyg/dist/plugins/table/ui/trumbowyg.table.css');
|
|
34
|
-
|
|
35
|
-
require('trumbowyg/dist/plugins/table/trumbowyg.table.js');
|
|
36
|
-
|
|
37
|
-
require('../../overrides/trumbowyg.template');
|
|
38
|
-
|
|
39
|
-
require('../../overrides/trumbowyg.reupload');
|
|
40
|
-
|
|
41
|
-
require('../../overrides/trumbowyg.edit-embed-template');
|
|
42
|
-
|
|
43
|
-
var _UserDetailTooltip = require('../Listing/components/UserDetailTooltip');
|
|
44
|
-
|
|
45
|
-
var _UserDetailTooltip2 = _interopRequireDefault(_UserDetailTooltip);
|
|
46
|
-
|
|
47
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
48
|
-
|
|
49
|
-
Vue.component('wysiwyg', _vueTrumbowyg2.default);
|
|
50
|
-
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
require("./bootstrap");
|
|
8
|
+
var _moment = _interopRequireDefault(require("moment"));
|
|
9
|
+
var _vueTrumbowyg = _interopRequireDefault(require("vue-trumbowyg"));
|
|
10
|
+
require("trumbowyg/dist/ui/trumbowyg.css");
|
|
11
|
+
require("trumbowyg/dist/plugins/colors/trumbowyg.colors");
|
|
12
|
+
require("trumbowyg/dist/plugins/colors/ui/trumbowyg.colors.css");
|
|
13
|
+
require("trumbowyg/dist/plugins/base64/trumbowyg.base64.min.js");
|
|
14
|
+
require("trumbowyg/dist/plugins/upload/trumbowyg.upload.js");
|
|
15
|
+
require("trumbowyg/dist/plugins/noembed/trumbowyg.noembed.js");
|
|
16
|
+
require("trumbowyg/dist/plugins/pasteembed/trumbowyg.pasteembed.js");
|
|
17
|
+
require("trumbowyg/dist/plugins/table/ui/trumbowyg.table.css");
|
|
18
|
+
require("trumbowyg/dist/plugins/table/trumbowyg.table.js");
|
|
19
|
+
require("../../overrides/trumbowyg.template");
|
|
20
|
+
require("../../overrides/trumbowyg.reupload");
|
|
21
|
+
require("../../overrides/trumbowyg.edit-embed-template");
|
|
22
|
+
var _UserDetailTooltip = _interopRequireDefault(require("../Listing/components/UserDetailTooltip"));
|
|
23
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
24
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
25
|
+
Vue.component('wysiwyg', _vueTrumbowyg["default"]);
|
|
51
26
|
var BaseForm = {
|
|
52
27
|
props: {
|
|
53
28
|
action: {
|
|
@@ -59,31 +34,30 @@ var BaseForm = {
|
|
|
59
34
|
},
|
|
60
35
|
defaultLocale: {
|
|
61
36
|
type: String,
|
|
62
|
-
default: function _default() {
|
|
37
|
+
"default": function _default() {
|
|
63
38
|
return this.locales instanceof Array && this.locales.length > 0 ? this.locales[0] : '';
|
|
64
39
|
}
|
|
65
40
|
},
|
|
66
41
|
sendEmptyLocales: {
|
|
67
42
|
type: Boolean,
|
|
68
|
-
default: function _default() {
|
|
43
|
+
"default": function _default() {
|
|
69
44
|
return true;
|
|
70
45
|
}
|
|
71
46
|
},
|
|
72
47
|
data: {
|
|
73
48
|
type: Object,
|
|
74
|
-
default: function _default() {
|
|
49
|
+
"default": function _default() {
|
|
75
50
|
return {};
|
|
76
51
|
}
|
|
77
52
|
},
|
|
78
53
|
responsiveBreakpoint: {
|
|
79
54
|
type: Number,
|
|
80
|
-
default: 850
|
|
55
|
+
"default": 850
|
|
81
56
|
}
|
|
82
57
|
},
|
|
83
58
|
components: {
|
|
84
|
-
'user-detail-tooltip':
|
|
59
|
+
'user-detail-tooltip': _UserDetailTooltip["default"]
|
|
85
60
|
},
|
|
86
|
-
|
|
87
61
|
created: function created() {
|
|
88
62
|
if (!!this.locales && this.locales.length > 0) {
|
|
89
63
|
var form = this.form;
|
|
@@ -99,13 +73,10 @@ var BaseForm = {
|
|
|
99
73
|
if (!_.isEmpty(this.data)) {
|
|
100
74
|
this.form = this.data;
|
|
101
75
|
}
|
|
102
|
-
|
|
103
76
|
window.addEventListener('resize', this.onResize);
|
|
104
77
|
},
|
|
105
|
-
|
|
106
78
|
data: function data() {
|
|
107
79
|
var that = this;
|
|
108
|
-
|
|
109
80
|
return {
|
|
110
81
|
form: {},
|
|
111
82
|
wysiwygMedia: [],
|
|
@@ -143,7 +114,19 @@ var BaseForm = {
|
|
|
143
114
|
placeholder: 'Type a text here',
|
|
144
115
|
modules: {
|
|
145
116
|
toolbar: {
|
|
146
|
-
container: [[{
|
|
117
|
+
container: [[{
|
|
118
|
+
header: [1, 2, 3, 4, 5, 6, false]
|
|
119
|
+
}], ['bold', 'italic', 'underline', 'strike'], [{
|
|
120
|
+
list: 'ordered'
|
|
121
|
+
}, {
|
|
122
|
+
list: 'bullet'
|
|
123
|
+
}], [{
|
|
124
|
+
color: []
|
|
125
|
+
}, {
|
|
126
|
+
background: []
|
|
127
|
+
}], [{
|
|
128
|
+
align: []
|
|
129
|
+
}], ['link', 'image'], ['clean']]
|
|
147
130
|
}
|
|
148
131
|
}
|
|
149
132
|
},
|
|
@@ -171,23 +154,19 @@ var BaseForm = {
|
|
|
171
154
|
imageWidthModalEdit: true,
|
|
172
155
|
success: function success(data, trumbowyg, $modal, values) {
|
|
173
156
|
that.wysiwygMedia.push(data.mediaId);
|
|
174
|
-
|
|
175
157
|
function getDeep(object, propertyParts) {
|
|
176
158
|
var mainProperty = propertyParts.shift(),
|
|
177
|
-
|
|
178
|
-
|
|
159
|
+
otherProperties = propertyParts;
|
|
179
160
|
if (object !== null) {
|
|
180
161
|
if (otherProperties.length === 0) {
|
|
181
162
|
return object[mainProperty];
|
|
182
163
|
}
|
|
183
|
-
|
|
184
|
-
if ((typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object') {
|
|
164
|
+
if (_typeof(object) === 'object') {
|
|
185
165
|
return getDeep(object[mainProperty], otherProperties);
|
|
186
166
|
}
|
|
187
167
|
}
|
|
188
168
|
return object;
|
|
189
169
|
}
|
|
190
|
-
|
|
191
170
|
if (!!getDeep(data, trumbowyg.o.plugins.upload.statusPropertyName.split('.'))) {
|
|
192
171
|
var url = getDeep(data, trumbowyg.o.plugins.upload.urlPropertyName.split('.'));
|
|
193
172
|
trumbowyg.execCmd('insertImage', url, false, true);
|
|
@@ -211,7 +190,6 @@ var BaseForm = {
|
|
|
211
190
|
reupload: {
|
|
212
191
|
success: function success(data, trumbowyg, $modal, values, $img) {
|
|
213
192
|
that.wysiwygMedia.push(data.mediaId);
|
|
214
|
-
|
|
215
193
|
$img.attr({
|
|
216
194
|
src: data.file
|
|
217
195
|
});
|
|
@@ -227,18 +205,15 @@ var BaseForm = {
|
|
|
227
205
|
}
|
|
228
206
|
};
|
|
229
207
|
},
|
|
230
|
-
|
|
231
208
|
computed: {
|
|
232
209
|
otherLocales: function otherLocales() {
|
|
233
210
|
var _this = this;
|
|
234
|
-
|
|
235
211
|
return this.locales.filter(function (x) {
|
|
236
212
|
return x != _this.defaultLocale;
|
|
237
213
|
});
|
|
238
214
|
},
|
|
239
215
|
showLocalizedValidationError: function showLocalizedValidationError() {
|
|
240
216
|
var _this2 = this;
|
|
241
|
-
|
|
242
217
|
// TODO ked sme neni na mobile, tak pozerat zo vsetkych
|
|
243
218
|
return this.otherLocales.some(function (lang) {
|
|
244
219
|
return _this2.errors.items.some(function (item) {
|
|
@@ -248,48 +223,43 @@ var BaseForm = {
|
|
|
248
223
|
}
|
|
249
224
|
},
|
|
250
225
|
filters: {
|
|
251
|
-
date: function date(
|
|
226
|
+
date: function date(_date) {
|
|
252
227
|
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'YYYY-MM-DD';
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
228
|
+
return function (_date) {
|
|
229
|
+
var _date = (0, _moment["default"])(_date);
|
|
230
|
+
return _date.isValid() ? _date.format(format) : "";
|
|
231
|
+
}(_date);
|
|
256
232
|
},
|
|
257
233
|
datetime: function datetime(_datetime) {
|
|
258
234
|
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'YYYY-MM-DD HH:mm:ss';
|
|
259
|
-
|
|
260
|
-
var date = (0, _moment2.default)(_datetime);
|
|
235
|
+
var date = (0, _moment["default"])(_datetime);
|
|
261
236
|
return date.isValid() ? date.format(format) : "";
|
|
262
237
|
},
|
|
263
238
|
time: function time(_time) {
|
|
264
239
|
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'HH:mm:ss';
|
|
265
|
-
|
|
266
240
|
// '2000-01-01' is here just because momentjs needs a date
|
|
267
|
-
var date = (0,
|
|
241
|
+
var date = (0, _moment["default"])('2000-01-01 ' + _time);
|
|
268
242
|
return date.isValid() ? date.format(format) : "";
|
|
269
243
|
}
|
|
270
244
|
},
|
|
271
245
|
methods: {
|
|
272
246
|
getPostData: function getPostData() {
|
|
273
247
|
var _this3 = this;
|
|
274
|
-
|
|
275
248
|
if (this.mediaCollections) {
|
|
276
249
|
this.mediaCollections.forEach(function (collection, index, arr) {
|
|
277
250
|
if (_this3.form[collection]) {
|
|
278
251
|
console.warn("MediaUploader warning: Media input must have a unique name, '" + collection + "' is already defined in regular inputs.");
|
|
279
252
|
}
|
|
280
|
-
|
|
281
253
|
if (_this3.$refs[collection + '_uploader']) {
|
|
282
254
|
_this3.form[collection] = _this3.$refs[collection + '_uploader'].getFiles();
|
|
283
255
|
}
|
|
284
256
|
});
|
|
285
257
|
}
|
|
286
258
|
this.form['wysiwygMedia'] = this.wysiwygMedia;
|
|
287
|
-
|
|
288
259
|
return this.form;
|
|
289
260
|
},
|
|
290
261
|
onSubmit: function onSubmit() {
|
|
291
262
|
var _this4 = this;
|
|
292
|
-
|
|
293
263
|
return this.$validator.validateAll().then(function (result) {
|
|
294
264
|
if (!result) {
|
|
295
265
|
_this4.$notify({
|
|
@@ -299,19 +269,16 @@ var BaseForm = {
|
|
|
299
269
|
});
|
|
300
270
|
return false;
|
|
301
271
|
}
|
|
302
|
-
|
|
303
272
|
var data = _this4.form;
|
|
304
273
|
if (!_this4.sendEmptyLocales) {
|
|
305
274
|
data = _.omit(_this4.form, _this4.locales.filter(function (locale) {
|
|
306
275
|
return _.isEmpty(_this4.form[locale]);
|
|
307
276
|
}));
|
|
308
277
|
}
|
|
309
|
-
|
|
310
278
|
_this4.submiting = true;
|
|
311
|
-
|
|
312
279
|
axios.post(_this4.action, _this4.getPostData()).then(function (response) {
|
|
313
280
|
return _this4.onSuccess(response.data);
|
|
314
|
-
})
|
|
281
|
+
})["catch"](function (errors) {
|
|
315
282
|
return _this4.onFail(errors.response.data);
|
|
316
283
|
});
|
|
317
284
|
});
|
|
@@ -324,7 +291,7 @@ var BaseForm = {
|
|
|
324
291
|
},
|
|
325
292
|
onFail: function onFail(data) {
|
|
326
293
|
this.submiting = false;
|
|
327
|
-
if (_typeof(data.errors) !== (typeof undefined ===
|
|
294
|
+
if (_typeof(data.errors) !== (typeof undefined === "undefined" ? "undefined" : _typeof(undefined))) {
|
|
328
295
|
var bag = this.$validator.errors;
|
|
329
296
|
bag.clear();
|
|
330
297
|
Object.keys(data.errors).map(function (key) {
|
|
@@ -342,7 +309,7 @@ var BaseForm = {
|
|
|
342
309
|
});
|
|
343
310
|
}
|
|
344
311
|
});
|
|
345
|
-
if (_typeof(data.message) === (typeof undefined ===
|
|
312
|
+
if (_typeof(data.message) === (typeof undefined === "undefined" ? "undefined" : _typeof(undefined))) {
|
|
346
313
|
this.$notify({
|
|
347
314
|
type: 'error',
|
|
348
315
|
title: 'Error!',
|
|
@@ -350,7 +317,7 @@ var BaseForm = {
|
|
|
350
317
|
});
|
|
351
318
|
}
|
|
352
319
|
}
|
|
353
|
-
if (_typeof(data.message) !== (typeof undefined ===
|
|
320
|
+
if (_typeof(data.message) !== (typeof undefined === "undefined" ? "undefined" : _typeof(undefined))) {
|
|
354
321
|
this.$notify({
|
|
355
322
|
type: 'error',
|
|
356
323
|
title: 'Error!',
|
|
@@ -380,7 +347,6 @@ var BaseForm = {
|
|
|
380
347
|
shouldShowLangGroup: function shouldShowLangGroup(locale) {
|
|
381
348
|
if (!this.onSmallScreen) {
|
|
382
349
|
if (this.defaultLocale == locale) return true;
|
|
383
|
-
|
|
384
350
|
return this.isFormLocalized && this.currentLocale == locale;
|
|
385
351
|
} else {
|
|
386
352
|
return this.currentLocale == locale;
|
|
@@ -391,5 +357,4 @@ var BaseForm = {
|
|
|
391
357
|
}
|
|
392
358
|
}
|
|
393
359
|
};
|
|
394
|
-
|
|
395
|
-
exports.default = BaseForm;
|
|
360
|
+
var _default2 = exports["default"] = BaseForm;
|