@dejwcake/craftable 0.0.1 → 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 +56 -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
|
},
|
|
@@ -165,26 +148,25 @@ var BaseForm = {
|
|
|
165
148
|
upload: {
|
|
166
149
|
// https://alex-d.github.io/Trumbowyg/documentation/plugins/#plugin-upload
|
|
167
150
|
serverPath: '/admin/wysiwyg-media',
|
|
151
|
+
headers: {
|
|
152
|
+
'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').getAttribute('content')
|
|
153
|
+
},
|
|
168
154
|
imageWidthModalEdit: true,
|
|
169
155
|
success: function success(data, trumbowyg, $modal, values) {
|
|
170
156
|
that.wysiwygMedia.push(data.mediaId);
|
|
171
|
-
|
|
172
157
|
function getDeep(object, propertyParts) {
|
|
173
158
|
var mainProperty = propertyParts.shift(),
|
|
174
|
-
|
|
175
|
-
|
|
159
|
+
otherProperties = propertyParts;
|
|
176
160
|
if (object !== null) {
|
|
177
161
|
if (otherProperties.length === 0) {
|
|
178
162
|
return object[mainProperty];
|
|
179
163
|
}
|
|
180
|
-
|
|
181
|
-
if ((typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object') {
|
|
164
|
+
if (_typeof(object) === 'object') {
|
|
182
165
|
return getDeep(object[mainProperty], otherProperties);
|
|
183
166
|
}
|
|
184
167
|
}
|
|
185
168
|
return object;
|
|
186
169
|
}
|
|
187
|
-
|
|
188
170
|
if (!!getDeep(data, trumbowyg.o.plugins.upload.statusPropertyName.split('.'))) {
|
|
189
171
|
var url = getDeep(data, trumbowyg.o.plugins.upload.urlPropertyName.split('.'));
|
|
190
172
|
trumbowyg.execCmd('insertImage', url, false, true);
|
|
@@ -208,7 +190,6 @@ var BaseForm = {
|
|
|
208
190
|
reupload: {
|
|
209
191
|
success: function success(data, trumbowyg, $modal, values, $img) {
|
|
210
192
|
that.wysiwygMedia.push(data.mediaId);
|
|
211
|
-
|
|
212
193
|
$img.attr({
|
|
213
194
|
src: data.file
|
|
214
195
|
});
|
|
@@ -224,18 +205,15 @@ var BaseForm = {
|
|
|
224
205
|
}
|
|
225
206
|
};
|
|
226
207
|
},
|
|
227
|
-
|
|
228
208
|
computed: {
|
|
229
209
|
otherLocales: function otherLocales() {
|
|
230
210
|
var _this = this;
|
|
231
|
-
|
|
232
211
|
return this.locales.filter(function (x) {
|
|
233
212
|
return x != _this.defaultLocale;
|
|
234
213
|
});
|
|
235
214
|
},
|
|
236
215
|
showLocalizedValidationError: function showLocalizedValidationError() {
|
|
237
216
|
var _this2 = this;
|
|
238
|
-
|
|
239
217
|
// TODO ked sme neni na mobile, tak pozerat zo vsetkych
|
|
240
218
|
return this.otherLocales.some(function (lang) {
|
|
241
219
|
return _this2.errors.items.some(function (item) {
|
|
@@ -245,48 +223,43 @@ var BaseForm = {
|
|
|
245
223
|
}
|
|
246
224
|
},
|
|
247
225
|
filters: {
|
|
248
|
-
date: function date(
|
|
226
|
+
date: function date(_date) {
|
|
249
227
|
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'YYYY-MM-DD';
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
228
|
+
return function (_date) {
|
|
229
|
+
var _date = (0, _moment["default"])(_date);
|
|
230
|
+
return _date.isValid() ? _date.format(format) : "";
|
|
231
|
+
}(_date);
|
|
253
232
|
},
|
|
254
233
|
datetime: function datetime(_datetime) {
|
|
255
234
|
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'YYYY-MM-DD HH:mm:ss';
|
|
256
|
-
|
|
257
|
-
var date = (0, _moment2.default)(_datetime);
|
|
235
|
+
var date = (0, _moment["default"])(_datetime);
|
|
258
236
|
return date.isValid() ? date.format(format) : "";
|
|
259
237
|
},
|
|
260
238
|
time: function time(_time) {
|
|
261
239
|
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'HH:mm:ss';
|
|
262
|
-
|
|
263
240
|
// '2000-01-01' is here just because momentjs needs a date
|
|
264
|
-
var date = (0,
|
|
241
|
+
var date = (0, _moment["default"])('2000-01-01 ' + _time);
|
|
265
242
|
return date.isValid() ? date.format(format) : "";
|
|
266
243
|
}
|
|
267
244
|
},
|
|
268
245
|
methods: {
|
|
269
246
|
getPostData: function getPostData() {
|
|
270
247
|
var _this3 = this;
|
|
271
|
-
|
|
272
248
|
if (this.mediaCollections) {
|
|
273
249
|
this.mediaCollections.forEach(function (collection, index, arr) {
|
|
274
250
|
if (_this3.form[collection]) {
|
|
275
251
|
console.warn("MediaUploader warning: Media input must have a unique name, '" + collection + "' is already defined in regular inputs.");
|
|
276
252
|
}
|
|
277
|
-
|
|
278
253
|
if (_this3.$refs[collection + '_uploader']) {
|
|
279
254
|
_this3.form[collection] = _this3.$refs[collection + '_uploader'].getFiles();
|
|
280
255
|
}
|
|
281
256
|
});
|
|
282
257
|
}
|
|
283
258
|
this.form['wysiwygMedia'] = this.wysiwygMedia;
|
|
284
|
-
|
|
285
259
|
return this.form;
|
|
286
260
|
},
|
|
287
261
|
onSubmit: function onSubmit() {
|
|
288
262
|
var _this4 = this;
|
|
289
|
-
|
|
290
263
|
return this.$validator.validateAll().then(function (result) {
|
|
291
264
|
if (!result) {
|
|
292
265
|
_this4.$notify({
|
|
@@ -296,19 +269,16 @@ var BaseForm = {
|
|
|
296
269
|
});
|
|
297
270
|
return false;
|
|
298
271
|
}
|
|
299
|
-
|
|
300
272
|
var data = _this4.form;
|
|
301
273
|
if (!_this4.sendEmptyLocales) {
|
|
302
274
|
data = _.omit(_this4.form, _this4.locales.filter(function (locale) {
|
|
303
275
|
return _.isEmpty(_this4.form[locale]);
|
|
304
276
|
}));
|
|
305
277
|
}
|
|
306
|
-
|
|
307
278
|
_this4.submiting = true;
|
|
308
|
-
|
|
309
279
|
axios.post(_this4.action, _this4.getPostData()).then(function (response) {
|
|
310
280
|
return _this4.onSuccess(response.data);
|
|
311
|
-
})
|
|
281
|
+
})["catch"](function (errors) {
|
|
312
282
|
return _this4.onFail(errors.response.data);
|
|
313
283
|
});
|
|
314
284
|
});
|
|
@@ -321,7 +291,7 @@ var BaseForm = {
|
|
|
321
291
|
},
|
|
322
292
|
onFail: function onFail(data) {
|
|
323
293
|
this.submiting = false;
|
|
324
|
-
if (_typeof(data.errors) !== (typeof undefined ===
|
|
294
|
+
if (_typeof(data.errors) !== (typeof undefined === "undefined" ? "undefined" : _typeof(undefined))) {
|
|
325
295
|
var bag = this.$validator.errors;
|
|
326
296
|
bag.clear();
|
|
327
297
|
Object.keys(data.errors).map(function (key) {
|
|
@@ -339,7 +309,7 @@ var BaseForm = {
|
|
|
339
309
|
});
|
|
340
310
|
}
|
|
341
311
|
});
|
|
342
|
-
if (_typeof(data.message) === (typeof undefined ===
|
|
312
|
+
if (_typeof(data.message) === (typeof undefined === "undefined" ? "undefined" : _typeof(undefined))) {
|
|
343
313
|
this.$notify({
|
|
344
314
|
type: 'error',
|
|
345
315
|
title: 'Error!',
|
|
@@ -347,7 +317,7 @@ var BaseForm = {
|
|
|
347
317
|
});
|
|
348
318
|
}
|
|
349
319
|
}
|
|
350
|
-
if (_typeof(data.message) !== (typeof undefined ===
|
|
320
|
+
if (_typeof(data.message) !== (typeof undefined === "undefined" ? "undefined" : _typeof(undefined))) {
|
|
351
321
|
this.$notify({
|
|
352
322
|
type: 'error',
|
|
353
323
|
title: 'Error!',
|
|
@@ -377,7 +347,6 @@ var BaseForm = {
|
|
|
377
347
|
shouldShowLangGroup: function shouldShowLangGroup(locale) {
|
|
378
348
|
if (!this.onSmallScreen) {
|
|
379
349
|
if (this.defaultLocale == locale) return true;
|
|
380
|
-
|
|
381
350
|
return this.isFormLocalized && this.currentLocale == locale;
|
|
382
351
|
} else {
|
|
383
352
|
return this.currentLocale == locale;
|
|
@@ -388,5 +357,4 @@ var BaseForm = {
|
|
|
388
357
|
}
|
|
389
358
|
}
|
|
390
359
|
};
|
|
391
|
-
|
|
392
|
-
exports.default = BaseForm;
|
|
360
|
+
var _default2 = exports["default"] = BaseForm;
|