glib-web 4.11.1 → 4.11.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/action.js +12 -12
- package/actions/logics/set.js +6 -6
- package/actions/runMultiple.js +2 -2
- package/actions/windows/closeAll.js +2 -2
- package/components/composable/file.js +2 -2
- package/components/composable/form.js +4 -0
- package/components/fields/_select.vue +1 -1
- package/components/fields/check/_featured.vue +57 -7
- package/components/fields/check/_thumbnail.vue +1 -1
- package/components/fields/check.vue +8 -1
- package/components/fields/radio/_featured.vue +10 -4
- package/components/fields/radio/_thumbnail.vue +1 -1
- package/components/helper.js +1 -11
- package/components/icon.vue +2 -2
- package/components/mixins/events.js +2 -3
- package/components/mixins/styles.js +33 -8
- package/components/mixins/tooltip.js +3 -0
- package/components/panels/bulkEdit2.vue +5 -4
- package/components/panels/flow.vue +18 -12
- package/components/validation.js +1 -1
- package/index.js +1 -1
- package/package.json +3 -2
- package/utils/glibDirectUpload.js +0 -2
- package/utils/helper.js +1 -1
- package/utils/http.js +1 -1
- package/utils/public.js +1 -1
- package/utils/type.js +76 -68
- package/utils/url.js +2 -2
package/action.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import TypeUtils from "./utils/type";
|
|
1
|
+
import * as TypeUtils from "./utils/type";
|
|
2
2
|
|
|
3
3
|
import ActionsRunMultiple from "./actions/runMultiple";
|
|
4
4
|
|
|
@@ -200,10 +200,10 @@ const customActions = {};
|
|
|
200
200
|
export default class Action {
|
|
201
201
|
static passthroughFieldValue(spec, component) {
|
|
202
202
|
if (spec.debug) {
|
|
203
|
-
console.debug("[Debug] passthroughFieldValue")
|
|
204
|
-
console.debug("formData:", spec.formData)
|
|
205
|
-
console.debug("current action's input field:", spec.fieldName, spec)
|
|
206
|
-
console.debug("triggering field's name:", component.fieldName)
|
|
203
|
+
console.debug("[Debug] passthroughFieldValue");
|
|
204
|
+
console.debug("formData:", spec.formData);
|
|
205
|
+
console.debug("current action's input field:", spec.fieldName, spec);
|
|
206
|
+
console.debug("triggering field's name:", component.fieldName);
|
|
207
207
|
}
|
|
208
208
|
let fieldValue = null;
|
|
209
209
|
// Pass along the field value from the previous component
|
|
@@ -213,7 +213,7 @@ export default class Action {
|
|
|
213
213
|
fieldValue = formData[fieldName];
|
|
214
214
|
}
|
|
215
215
|
if (spec.debug) {
|
|
216
|
-
console.debug("fieldValue:", fieldValue)
|
|
216
|
+
console.debug("fieldValue:", fieldValue);
|
|
217
217
|
}
|
|
218
218
|
return fieldValue;
|
|
219
219
|
}
|
|
@@ -227,10 +227,10 @@ export default class Action {
|
|
|
227
227
|
let data = action;
|
|
228
228
|
|
|
229
229
|
if (spec.debug) {
|
|
230
|
-
console.debug("[Debug] executeWithFormData")
|
|
231
|
-
console.debug("formData:", spec.formData)
|
|
232
|
-
console.debug("fieldName:", fieldName)
|
|
233
|
-
console.debug("fieldValue:", fieldValue)
|
|
230
|
+
console.debug("[Debug] executeWithFormData");
|
|
231
|
+
console.debug("formData:", spec.formData);
|
|
232
|
+
console.debug("fieldName:", fieldName);
|
|
233
|
+
console.debug("fieldValue:", fieldValue);
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
if (Utils.type.isNotNull(fieldName)) {
|
|
@@ -245,10 +245,10 @@ export default class Action {
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
if (spec.debug) {
|
|
248
|
-
console.debug("Action spec:", data)
|
|
248
|
+
console.debug("Action spec:", data);
|
|
249
249
|
}
|
|
250
250
|
Action.execute(data, component);
|
|
251
|
-
})
|
|
251
|
+
});
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
static execute(spec, component, params = {}) {
|
package/actions/logics/set.js
CHANGED
|
@@ -2,7 +2,7 @@ import jsonLogic from 'json-logic-js';
|
|
|
2
2
|
import merge from 'lodash.merge';
|
|
3
3
|
import { nextTick } from "vue";
|
|
4
4
|
import { sanitize } from "../../components/composable/date";
|
|
5
|
-
import { isPresent } from "../../
|
|
5
|
+
import { isPresent } from "../../utils/type";
|
|
6
6
|
|
|
7
7
|
const sumDate = function (a, b) {
|
|
8
8
|
const date = new Date(a);
|
|
@@ -39,7 +39,7 @@ const sum = function (...args) {
|
|
|
39
39
|
jsonLogic.add_operation("sum", sum);
|
|
40
40
|
|
|
41
41
|
const count = function (args) {
|
|
42
|
-
return args.length
|
|
42
|
+
return args.length;
|
|
43
43
|
};
|
|
44
44
|
jsonLogic.add_operation("count", count);
|
|
45
45
|
|
|
@@ -65,11 +65,11 @@ const printf = function (template, ...args) {
|
|
|
65
65
|
jsonLogic.add_operation("printf", printf);
|
|
66
66
|
|
|
67
67
|
const log = function (value) {
|
|
68
|
-
console.log("JsonLogic value", value)
|
|
68
|
+
console.log("JsonLogic value", value);
|
|
69
69
|
};
|
|
70
70
|
jsonLogic.add_operation("log", log);
|
|
71
71
|
|
|
72
|
-
const isPresentOperator = function(value) {
|
|
72
|
+
const isPresentOperator = function (value) {
|
|
73
73
|
return isPresent(value);
|
|
74
74
|
};
|
|
75
75
|
jsonLogic.add_operation("isPresent", isPresentOperator);
|
|
@@ -111,7 +111,7 @@ export default class {
|
|
|
111
111
|
if (!targetComponent) {
|
|
112
112
|
console.warn("Component ID not found", id);
|
|
113
113
|
}
|
|
114
|
-
return targetComponent
|
|
114
|
+
return targetComponent;
|
|
115
115
|
});
|
|
116
116
|
|
|
117
117
|
// if (targetIds.length > 0) {
|
|
@@ -139,7 +139,7 @@ export default class {
|
|
|
139
139
|
if (dynamicGroupEntry) {
|
|
140
140
|
condition = dynamicGroupEntry.$populateIndexes(condition);
|
|
141
141
|
}
|
|
142
|
-
const variables = Object.assign({}, getFormData(), spec.variables)
|
|
142
|
+
const variables = Object.assign({}, getFormData(), spec.variables);
|
|
143
143
|
if (spec.debug) {
|
|
144
144
|
console.log("Input", condition, key, variables);
|
|
145
145
|
}
|
package/actions/runMultiple.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import merge from 'lodash.merge';
|
|
2
|
-
|
|
3
1
|
export default class {
|
|
4
2
|
logDisabled(spec) {
|
|
5
3
|
if (spec.debug) {
|
|
@@ -9,6 +7,8 @@ export default class {
|
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
execute(spec, component) {
|
|
10
|
+
if (!spec.childActions || spec.childActions.length <= 0) return;
|
|
11
|
+
|
|
12
12
|
const fieldValue = GLib.action.passthroughFieldValue(spec, component);
|
|
13
13
|
|
|
14
14
|
// if (spec.debug) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ifObject } from "../../utils/type";
|
|
2
2
|
|
|
3
3
|
export default class {
|
|
4
4
|
execute(properties, component) {
|
|
5
5
|
|
|
6
6
|
Utils.history.destroy();
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
ifObject(properties["onClose"], it => {
|
|
9
9
|
// Allow time for history.back() to complete, which is important for actions that need
|
|
10
10
|
// to use window.location.href such as windows/reload
|
|
11
11
|
setTimeout(function () {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
|
-
import
|
|
2
|
+
import { isObject } from "../../utils/type";
|
|
3
3
|
import mimeType from "../../utils/mime_type";
|
|
4
4
|
import { showError } from "./alert";
|
|
5
5
|
|
|
@@ -93,7 +93,7 @@ function useFilesState(files) {
|
|
|
93
93
|
|
|
94
94
|
function validateFile(accepts, file) {
|
|
95
95
|
const MB_SIZE = 1000;
|
|
96
|
-
if (
|
|
96
|
+
if (isObject(accepts)) {
|
|
97
97
|
let validFileType = false;
|
|
98
98
|
[accepts.fileType].flat().forEach(key => {
|
|
99
99
|
const acceptsRegex = new RegExp(mimeType[key]);
|
|
@@ -14,6 +14,10 @@ const triggerOnChange = (htmlElement) => {
|
|
|
14
14
|
const triggerOnInput = (htmlElement) => nextTick(() => htmlElement.dispatchEvent(new Event('input', { bubbles: true })));
|
|
15
15
|
|
|
16
16
|
const getFormData = (el, ignoredFields = new Set()) => {
|
|
17
|
+
if (!(el instanceof HTMLFormElement) && el instanceof HTMLElement) {
|
|
18
|
+
el = el.querySelector('form');
|
|
19
|
+
}
|
|
20
|
+
|
|
17
21
|
const formData = new FormData(el);
|
|
18
22
|
const obj = {};
|
|
19
23
|
formData.forEach((value, key) => {
|
|
@@ -37,22 +37,34 @@ export default {
|
|
|
37
37
|
</script>
|
|
38
38
|
|
|
39
39
|
<style scoped>
|
|
40
|
+
.thumbnail-content-wrapper {
|
|
41
|
+
width: 100%;
|
|
42
|
+
position: absolute;
|
|
43
|
+
z-index: -999;
|
|
44
|
+
}
|
|
45
|
+
|
|
40
46
|
.thumbnail-check-img img {
|
|
41
47
|
margin: auto;
|
|
48
|
+
display: flex;
|
|
49
|
+
justify-content: center;
|
|
42
50
|
}
|
|
43
51
|
|
|
44
52
|
.thumbnail-check-label {
|
|
45
53
|
font-size: 22px;
|
|
46
54
|
color: black;
|
|
55
|
+
display: flex;
|
|
56
|
+
justify-content: center;
|
|
47
57
|
}
|
|
48
58
|
|
|
49
59
|
.thumbnail-check-label-checked {
|
|
50
60
|
font-size: 22px;
|
|
51
61
|
font-weight: 700;
|
|
52
62
|
color: #0A2A9E;
|
|
63
|
+
display: flex;
|
|
64
|
+
justify-content: center;
|
|
53
65
|
}
|
|
54
66
|
|
|
55
|
-
.thumbnail-check
|
|
67
|
+
.thumbnail-check :deep(.v-selection-control__wrapper) {
|
|
56
68
|
width: 240px;
|
|
57
69
|
height: 254px;
|
|
58
70
|
position: relative;
|
|
@@ -71,7 +83,47 @@ export default {
|
|
|
71
83
|
}
|
|
72
84
|
}
|
|
73
85
|
|
|
74
|
-
.thumbnail-
|
|
86
|
+
.thumbnail-check :deep(.v-selection-control__input) {
|
|
87
|
+
width: 100%;
|
|
88
|
+
height: 100%;
|
|
89
|
+
border-radius: 24px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.thumbnail-check :deep(.v-selection-control__input::before) {
|
|
93
|
+
width: 100%;
|
|
94
|
+
height: 100%;
|
|
95
|
+
border-radius: 24px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.thumbnail-checked :deep(.v-selection-control__input) {
|
|
99
|
+
width: 100%;
|
|
100
|
+
height: 100%;
|
|
101
|
+
border-radius: 24px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.thumbnail-checked :deep(.v-selection-control__input::before) {
|
|
105
|
+
width: 100%;
|
|
106
|
+
height: 100%;
|
|
107
|
+
border-radius: 24px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.thumbnail-check :deep(.v-selection-control__input>.v-icon) {
|
|
111
|
+
opacity: 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.thumbnail-checked :deep(.v-selection-control__input>.v-icon) {
|
|
115
|
+
opacity: 0;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.thumbnail-check :deep(.v-selection-control--density-default) {
|
|
119
|
+
--v-selection-control-size: 100%;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.thumbnail-checked :deep(.v-selection-control--density-default) {
|
|
123
|
+
--v-selection-control-size: 100%;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.thumbnail-checked :deep(.v-selection-control__wrapper) {
|
|
75
127
|
width: 240px;
|
|
76
128
|
height: 254px;
|
|
77
129
|
position: relative;
|
|
@@ -85,12 +137,10 @@ export default {
|
|
|
85
137
|
height: 254px;
|
|
86
138
|
}
|
|
87
139
|
|
|
88
|
-
|
|
89
|
-
display: none;
|
|
90
|
-
}
|
|
140
|
+
|
|
91
141
|
}
|
|
92
142
|
|
|
93
|
-
.thumbnail-check
|
|
94
|
-
background-color: transparent
|
|
143
|
+
.thumbnail-check :deep(.v-selection-control__input>.v-icon::before) {
|
|
144
|
+
background-color: transparent;
|
|
95
145
|
}
|
|
96
146
|
</style>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div :class="$classes()" :style="$styles()" v-if="loadIf">
|
|
3
3
|
<!-- This hidden field should always be there to make sure the submitted param is not empty,
|
|
4
4
|
which could cause "Not accessible" error on the server. -->
|
|
5
|
-
<input v-model="uncheckValue" type="hidden" :name="fieldName" />
|
|
5
|
+
<input v-if="showUncheck" v-model="uncheckValue" type="hidden" :name="fieldName" />
|
|
6
6
|
<v-checkbox :color="gcolor" v-model="fieldModel" :name="fieldName" :readonly="latestSpec.readOnly"
|
|
7
7
|
:disabled="inputDisabled" :label="fieldModel ? latestSpec.onLabel || latestSpec.label : latestSpec.label"
|
|
8
8
|
:true-icon="latestSpec.onIcon" :false-icon="spec.offIcon" :value="latestSpec.value"
|
|
@@ -25,6 +25,13 @@ export default {
|
|
|
25
25
|
"thumbnail-check": ThumbnailCheck,
|
|
26
26
|
"featured-check": FeaturedCheck,
|
|
27
27
|
},
|
|
28
|
+
computed: {
|
|
29
|
+
showUncheck() {
|
|
30
|
+
if (this.fieldModel == false) return true;
|
|
31
|
+
|
|
32
|
+
return this.spec.checkValue !== this.fieldModel;
|
|
33
|
+
}
|
|
34
|
+
},
|
|
28
35
|
props: {
|
|
29
36
|
spec: { type: Object, required: true }
|
|
30
37
|
},
|
|
@@ -57,12 +57,18 @@ export default {
|
|
|
57
57
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
.custom-radio :deep(.v-label) {
|
|
61
|
+
width: 100%;
|
|
62
|
+
}
|
|
63
|
+
|
|
60
64
|
.custom-radio .custom-radio-content {
|
|
61
65
|
display: flex;
|
|
62
66
|
flex-direction: column;
|
|
63
67
|
align-items: center;
|
|
64
68
|
justify-content: center;
|
|
65
69
|
min-height: 226px;
|
|
70
|
+
width: 100%;
|
|
71
|
+
border-radius: 24px;
|
|
66
72
|
}
|
|
67
73
|
|
|
68
74
|
.custom-radio .custom-radio-label {
|
|
@@ -72,7 +78,7 @@ export default {
|
|
|
72
78
|
word-break: break-word;
|
|
73
79
|
}
|
|
74
80
|
|
|
75
|
-
.custom-radio
|
|
81
|
+
.custom-radio :deep(.v-selection-control__input) {
|
|
76
82
|
width: inherit;
|
|
77
83
|
height: inherit;
|
|
78
84
|
|
|
@@ -83,15 +89,15 @@ export default {
|
|
|
83
89
|
background-color: transparent;
|
|
84
90
|
}
|
|
85
91
|
|
|
86
|
-
.custom-radio
|
|
92
|
+
.custom-radio :deep(.v-selection-control__input::before) {
|
|
87
93
|
background-color: transparent
|
|
88
94
|
}
|
|
89
95
|
|
|
90
|
-
.custom-radio
|
|
96
|
+
.custom-radio :deep(.v-ripple__container) {
|
|
91
97
|
display: none;
|
|
92
98
|
}
|
|
93
99
|
|
|
94
|
-
.custom-radio
|
|
100
|
+
.custom-radio :deep(.v-selection-control__wrapper) {
|
|
95
101
|
display: none;
|
|
96
102
|
}
|
|
97
103
|
|
package/components/helper.js
CHANGED
|
@@ -16,14 +16,4 @@ function htmlElement(component) {
|
|
|
16
16
|
return component.$el.nextElementSibling;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
if (value == undefined) return false;
|
|
21
|
-
if (value == null) return false;
|
|
22
|
-
if (Array.isArray(value) && value.length <= 0) return false;
|
|
23
|
-
if (typeof value == 'string' && value.length <= 0) return false;
|
|
24
|
-
if (typeof value == 'object' && Object.keys(value).length <= 0) return false;
|
|
25
|
-
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export { realComponent, htmlElement, isPresent };
|
|
19
|
+
export { realComponent, htmlElement };
|
package/components/icon.vue
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<a v-if="$href()" :href="$href()" :rel="$rel()" @click="$onClick()">
|
|
3
|
-
<common-icon :spec="iconSpec" />
|
|
3
|
+
<common-icon ref="delegate" :spec="iconSpec" />
|
|
4
4
|
</a>
|
|
5
|
-
<common-icon v-else :spec="iconSpec" />
|
|
5
|
+
<common-icon ref="delegate" v-else :spec="iconSpec" />
|
|
6
6
|
</template>
|
|
7
7
|
|
|
8
8
|
<script>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import Action from "../../action";
|
|
2
2
|
import UrlUtils from "../../utils/url";
|
|
3
|
-
import TypeUtils from "../../utils/type";
|
|
3
|
+
import * as TypeUtils from "../../utils/type";
|
|
4
4
|
import { vueApp } from "../../store";
|
|
5
|
-
import merge from 'lodash.merge';
|
|
6
5
|
|
|
7
6
|
export default {
|
|
8
7
|
data() {
|
|
@@ -194,7 +193,7 @@ export default {
|
|
|
194
193
|
$executeOnChange(newValue) {
|
|
195
194
|
this.$nextTick(() => {
|
|
196
195
|
const value = newValue || this.fieldModel;
|
|
197
|
-
console.log("NEW VALUE1", value)
|
|
196
|
+
console.log("NEW VALUE1", value);
|
|
198
197
|
GLib.action.executeWithFormData(this.spec.onChange || this.spec.onChangeAndLoad, this, value);
|
|
199
198
|
});
|
|
200
199
|
|
|
@@ -4,11 +4,29 @@ import { determineColor } from "../../utils/constant";
|
|
|
4
4
|
import Action from "../../action";
|
|
5
5
|
import { ignoredDirtyCheckFields, triggerOnChange } from "../composable/form";
|
|
6
6
|
import { realComponent } from "../helper";
|
|
7
|
+
import set from "lodash.set";
|
|
7
8
|
const NUMBER_PRECISION = 2;
|
|
8
9
|
const isNeedToBeFixed = (val, component) => {
|
|
9
10
|
return component.type == 'number' && !Number.isInteger(val) && Number.isFinite(val);
|
|
10
11
|
};
|
|
11
12
|
|
|
13
|
+
|
|
14
|
+
// check if there is object with key.subkey and change to normal obj
|
|
15
|
+
const jsonLogicData = (data) => {
|
|
16
|
+
return Object.entries(data).reduce((prev, curr) => {
|
|
17
|
+
const path = curr[0];
|
|
18
|
+
const value = curr[1];
|
|
19
|
+
|
|
20
|
+
if (path.includes('.')) {
|
|
21
|
+
const obj = {};
|
|
22
|
+
set(obj, path, value);
|
|
23
|
+
return Object.assign({}, prev, obj);
|
|
24
|
+
} else {
|
|
25
|
+
return Object.assign({}, prev, { [path]: value });
|
|
26
|
+
}
|
|
27
|
+
}, {});
|
|
28
|
+
};
|
|
29
|
+
|
|
12
30
|
export default {
|
|
13
31
|
data: function () {
|
|
14
32
|
return {
|
|
@@ -171,7 +189,7 @@ export default {
|
|
|
171
189
|
},
|
|
172
190
|
// NOTE: Styles are dynamic, do not save it in $ready().
|
|
173
191
|
$styles(spec) {
|
|
174
|
-
const properties = spec || this.
|
|
192
|
+
const properties = spec || this.latestSpec;
|
|
175
193
|
const styles = {
|
|
176
194
|
// color: properties.color,
|
|
177
195
|
// "background-color": properties.backgroundColor,
|
|
@@ -275,18 +293,25 @@ export default {
|
|
|
275
293
|
comp.fieldModel = this.spec.value;
|
|
276
294
|
},
|
|
277
295
|
action_merge(newSpec) {
|
|
296
|
+
const data = jsonLogicData(newSpec);
|
|
278
297
|
const vm = realComponent(this);
|
|
279
|
-
const val = Utils.type.isNotNull(newSpec.value) ? newSpec.value : this.fieldModel;
|
|
280
|
-
newSpec.value = isNeedToBeFixed(val, vm) ? val.toFixed(vm.spec.precision || NUMBER_PRECISION) : val;
|
|
281
298
|
|
|
282
|
-
|
|
283
|
-
|
|
299
|
+
const val = Utils.type.isNotNull(data.value) ? data.value : this.fieldModel;
|
|
300
|
+
data.value = isNeedToBeFixed(val, vm) ? val.toFixed(vm.spec.precision || NUMBER_PRECISION) : val;
|
|
301
|
+
|
|
302
|
+
if (data.value !== vm.fieldModel) {
|
|
303
|
+
vm.fieldModel = data.value;
|
|
284
304
|
vm.$executeOnChange();
|
|
285
305
|
}
|
|
286
306
|
|
|
287
|
-
if (Utils.type.isNotNull(
|
|
288
|
-
vm._submitWhenNotDisplayed =
|
|
289
|
-
|
|
307
|
+
if (Utils.type.isNotNull(data.displayed)) vm._show = data.displayed;
|
|
308
|
+
vm._submitWhenNotDisplayed = data.submitWhenNotDisplayed;
|
|
309
|
+
|
|
310
|
+
if (!vm.spec.tooltip && data.tooltip) {
|
|
311
|
+
this.initTooltip();
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
Object.assign(vm.spec, data);
|
|
290
315
|
},
|
|
291
316
|
$classes(spec, defaultViewName) {
|
|
292
317
|
const properties = Object.assign(
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<table :class="rowLoaded ? 'loaded' : 'nonLoaded'" width="100%">
|
|
8
8
|
<thead v-if="props.spec.viewHeaders">
|
|
9
9
|
<tr>
|
|
10
|
-
<th class="cell-selection" v-if="rowLoaded"><v-checkbox v-model="checkbox" color="primary"
|
|
10
|
+
<th class="cell-selection" v-if="rowLoaded"><v-checkbox v-model="checkbox" density="compact" color="primary"
|
|
11
11
|
@change="checkAll"></v-checkbox></th>
|
|
12
12
|
<th :class="`cell-column${cellIndex}`" v-for="(cell, cellIndex) in props.spec.viewHeaders" :key="cell.id"
|
|
13
13
|
:style="{ minWidth: `${cell.minWidth || 100}px` }">
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
<tbody>
|
|
20
20
|
<template v-if="rowLoaded">
|
|
21
21
|
<tr v-for="(row, rowIndex) in currentPageRows" :key="`row_${rowIndex}_${row.status}`">
|
|
22
|
-
<td
|
|
23
|
-
<v-checkbox v-model="row.selected" color="primary"></v-checkbox>
|
|
22
|
+
<td class="cell-selection">
|
|
23
|
+
<v-checkbox v-model="row.selected" density="compact" color="primary"></v-checkbox>
|
|
24
24
|
<glib-component :spec="row.icon"></glib-component>
|
|
25
25
|
</td>
|
|
26
26
|
<!-- <td class="cell-status"><v-icon :icon="row.icon.name" :color="row.icon.color"></v-icon></td> -->
|
|
@@ -110,7 +110,8 @@ class Row {
|
|
|
110
110
|
} else {
|
|
111
111
|
return {
|
|
112
112
|
view: 'label',
|
|
113
|
-
|
|
113
|
+
styleClasses: ['status'],
|
|
114
|
+
text: `#${this.index + 1}`
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
117
|
}
|
|
@@ -43,7 +43,6 @@ export default {
|
|
|
43
43
|
},
|
|
44
44
|
cssStyles: function () {
|
|
45
45
|
// const styles = this.$styles();
|
|
46
|
-
console.log(this.sm)
|
|
47
46
|
const styles = Object.assign({}, this.$styles());
|
|
48
47
|
switch (this.$vuetify.display.name) {
|
|
49
48
|
case "xxl":
|
|
@@ -139,18 +138,25 @@ export default {
|
|
|
139
138
|
}
|
|
140
139
|
|
|
141
140
|
if (spec.padding) {
|
|
142
|
-
styles['padding-top'] = `${spec.padding.top}px`
|
|
143
|
-
styles['padding-right'] = `${spec.padding.right}px`
|
|
144
|
-
styles['padding-bottom'] = `${spec.padding.bottom}px`
|
|
145
|
-
styles['padding-left'] = `${spec.padding.left}px`
|
|
146
|
-
|
|
147
|
-
if (spec.padding.x || spec.padding.y) {
|
|
148
|
-
styles['padding'] = `${spec.padding.x}px ${spec.padding.y}px`
|
|
149
|
-
} else if (spec.padding.all) {
|
|
150
|
-
styles['padding'] = `${spec.padding.all}px`
|
|
151
|
-
}
|
|
152
|
-
|
|
153
141
|
|
|
142
|
+
Utils.type.ifObject(spec.padding, padding => {
|
|
143
|
+
Utils.type.ifNumber(
|
|
144
|
+
padding.top || padding.y || padding.all,
|
|
145
|
+
top => (styles["padding-top"] = `${top}px`)
|
|
146
|
+
);
|
|
147
|
+
Utils.type.ifNumber(
|
|
148
|
+
padding.bottom || padding.y || padding.all,
|
|
149
|
+
bottom => (styles["padding-bottom"] = `${bottom}px`)
|
|
150
|
+
);
|
|
151
|
+
Utils.type.ifNumber(
|
|
152
|
+
padding.left || padding.x || padding.all,
|
|
153
|
+
left => (styles["padding-left"] = `${left}px`)
|
|
154
|
+
);
|
|
155
|
+
Utils.type.ifNumber(
|
|
156
|
+
padding.right || padding.x || padding.all,
|
|
157
|
+
right => (styles["padding-right"] = `${right}px`)
|
|
158
|
+
);
|
|
159
|
+
});
|
|
154
160
|
}
|
|
155
161
|
},
|
|
156
162
|
}
|
package/components/validation.js
CHANGED
package/index.js
CHANGED
|
@@ -95,7 +95,7 @@ window.longClickInstance = longClickDirective({ delay: 500, interval: 0 });
|
|
|
95
95
|
Vue.directive("longclick", window.longClickInstance);
|
|
96
96
|
|
|
97
97
|
// TODO: Deprecate
|
|
98
|
-
import TypeUtils from "./utils/type";
|
|
98
|
+
import * as TypeUtils from "./utils/type";
|
|
99
99
|
Vue.use({
|
|
100
100
|
install: function (Vue, options) {
|
|
101
101
|
Vue.config.globalProperties.$type = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glib-web",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"flag-icons": "^7.2.3",
|
|
23
23
|
"json-logic-js": "^2.0.0",
|
|
24
24
|
"lodash.merge": "^4.6.2",
|
|
25
|
+
"lodash.set": "^4.3.2",
|
|
25
26
|
"marked": "^4.0.0",
|
|
26
27
|
"moment": "^2.29.4",
|
|
27
28
|
"moment-timezone": "^0.5.45",
|
|
@@ -46,4 +47,4 @@
|
|
|
46
47
|
"prettier": "^1.18.2",
|
|
47
48
|
"typescript": "^4.9.5"
|
|
48
49
|
}
|
|
49
|
-
}
|
|
50
|
+
}
|
|
@@ -2,8 +2,6 @@ import { DirectUpload } from "@rails/activestorage/src/direct_upload";
|
|
|
2
2
|
import { BlobRecord } from "@rails/activestorage/src/blob_record";
|
|
3
3
|
import { FileChecksum } from "@rails/activestorage/src/file_checksum";
|
|
4
4
|
import { BlobUpload } from "@rails/activestorage/src/blob_upload";
|
|
5
|
-
import Type from "./type";
|
|
6
|
-
import mimeType from "./mime_type";
|
|
7
5
|
import { showError } from "../components/composable/alert";
|
|
8
6
|
|
|
9
7
|
function notify(object, methodName, ...messages) {
|
package/utils/helper.js
CHANGED
|
@@ -2,7 +2,7 @@ import History from "./history";
|
|
|
2
2
|
import Settings from "./settings";
|
|
3
3
|
import Url from "./url";
|
|
4
4
|
import Http from "./http";
|
|
5
|
-
import Type from "./type";
|
|
5
|
+
import * as Type from "./type";
|
|
6
6
|
import App from "./app";
|
|
7
7
|
import Dom from "./dom";
|
|
8
8
|
import Launch from "./launch";
|
package/utils/http.js
CHANGED
package/utils/public.js
CHANGED
package/utils/type.js
CHANGED
|
@@ -1,81 +1,89 @@
|
|
|
1
1
|
import Hash from "./hash";
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
3
|
+
export function isObject(obj) {
|
|
4
|
+
return typeof obj === "object" && obj !== null;
|
|
5
|
+
}
|
|
6
|
+
export function isString(obj) {
|
|
7
|
+
return typeof obj === "string";
|
|
8
|
+
}
|
|
9
|
+
export function isNumber(obj) {
|
|
10
|
+
return typeof obj === "number" && !isNaN(obj);
|
|
11
|
+
}
|
|
12
|
+
export function isBoolean(obj) {
|
|
13
|
+
return typeof obj === "boolean";
|
|
14
|
+
}
|
|
15
|
+
export function isArray(obj) {
|
|
16
|
+
return this.isObject(obj) && Array.isArray(obj);
|
|
17
|
+
}
|
|
18
|
+
export function isFunction(obj) {
|
|
19
|
+
return typeof obj === "function";
|
|
20
|
+
}
|
|
21
|
+
export function isNotNull(obj) {
|
|
22
|
+
return typeof obj !== "undefined" && obj !== null;
|
|
23
|
+
}
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
25
|
+
export function ifObject(obj, ifCommand, elseCommand) {
|
|
26
|
+
if (this.isObject(obj)) {
|
|
27
|
+
ifCommand(obj);
|
|
28
|
+
} else if (elseCommand) {
|
|
29
|
+
elseCommand();
|
|
32
30
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
}
|
|
32
|
+
export function ifHash(obj, ifCommand, elseCommand) {
|
|
33
|
+
if (this.isObject(obj)) {
|
|
34
|
+
ifCommand(new Hash(obj));
|
|
35
|
+
} else if (elseCommand) {
|
|
36
|
+
elseCommand();
|
|
39
37
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
}
|
|
39
|
+
export function ifString(obj, command) {
|
|
40
|
+
if (this.isString(obj)) {
|
|
41
|
+
command(obj);
|
|
44
42
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
}
|
|
44
|
+
export function ifNumber(obj, command) {
|
|
45
|
+
if (this.isNumber(obj)) {
|
|
46
|
+
command(obj);
|
|
49
47
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
}
|
|
49
|
+
export function ifBoolean(obj, command) {
|
|
50
|
+
if (this.isBoolean(obj)) {
|
|
51
|
+
command(obj);
|
|
54
52
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
}
|
|
54
|
+
export function ifArray(obj, command) {
|
|
55
|
+
if (this.isArray(obj)) {
|
|
56
|
+
command(obj);
|
|
59
57
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
}
|
|
59
|
+
export function ifFunction(obj, command) {
|
|
60
|
+
if (this.isFunction(obj)) {
|
|
61
|
+
command(obj);
|
|
64
62
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
}
|
|
64
|
+
export function ifNotNull(obj, command) {
|
|
65
|
+
if (this.isNotNull(obj)) {
|
|
66
|
+
command(obj);
|
|
69
67
|
}
|
|
68
|
+
}
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
70
|
+
export function floatValue(obj) {
|
|
71
|
+
return this.float(obj) || 0;
|
|
72
|
+
}
|
|
73
|
+
export function float(obj) {
|
|
74
|
+
const val = parseFloat(obj);
|
|
75
|
+
return isNaN(val) ? null : val;
|
|
76
|
+
}
|
|
77
|
+
export function string(obj) {
|
|
78
|
+
return this.isString(obj) ? obj : null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function isPresent(value) {
|
|
82
|
+
if (value == undefined) return false;
|
|
83
|
+
if (value == null) return false;
|
|
84
|
+
if (Array.isArray(value) && value.length <= 0) return false;
|
|
85
|
+
if (typeof value == 'string' && value.length <= 0) return false;
|
|
86
|
+
if (typeof value == 'object' && Object.keys(value).length <= 0) return false;
|
|
87
|
+
|
|
88
|
+
return true;
|
|
81
89
|
}
|
package/utils/url.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { isString } from "./type";
|
|
2
2
|
|
|
3
3
|
export default class {
|
|
4
4
|
static htmlUrl(originalUrl) {
|
|
5
|
-
if (
|
|
5
|
+
if (isString(originalUrl)) {
|
|
6
6
|
let url;
|
|
7
7
|
if (originalUrl.indexOf("?") > -1) {
|
|
8
8
|
url = originalUrl.replace(/.json\?/, "?");
|