@ditojs/admin 2.0.5 → 2.1.0
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/dito-admin.es.js +1511 -1435
- package/dist/dito-admin.umd.js +4 -4
- package/dist/style.css +1 -1
- package/package.json +31 -31
- package/src/DitoAdmin.js +66 -31
- package/src/DitoComponent.js +4 -1
- package/src/DitoContext.js +13 -5
- package/src/{TypeComponent.js → DitoTypeComponent.js} +8 -5
- package/src/components/DitoAccount.vue +20 -19
- package/src/components/DitoButtons.vue +14 -12
- package/src/components/DitoClipboard.vue +16 -8
- package/src/components/DitoContainer.vue +56 -43
- package/src/components/DitoCreateButton.vue +20 -15
- package/src/components/DitoDialog.vue +69 -48
- package/src/components/DitoEditButtons.vue +16 -14
- package/src/components/DitoElement.vue +2 -3
- package/src/components/DitoErrors.vue +18 -13
- package/src/components/DitoForm.vue +41 -24
- package/src/components/DitoFormNested.vue +12 -10
- package/src/components/DitoHeader.vue +103 -69
- package/src/components/DitoLabel.vue +108 -81
- package/src/components/DitoMenu.vue +52 -36
- package/src/components/DitoPagination.vue +9 -7
- package/src/components/DitoPane.vue +53 -45
- package/src/components/DitoPanel.vue +62 -42
- package/src/components/DitoPanels.vue +11 -10
- package/src/components/DitoRoot.vue +57 -46
- package/src/components/DitoSchema.vue +179 -131
- package/src/components/DitoSchemaInlined.vue +39 -28
- package/src/components/DitoScopes.vue +41 -31
- package/src/components/DitoSpinner.vue +31 -40
- package/src/components/DitoTableCell.vue +9 -9
- package/src/components/DitoTableHead.vue +52 -37
- package/src/components/DitoTabs.vue +39 -29
- package/src/components/DitoTreeItem.vue +140 -86
- package/src/components/DitoVNode.vue +1 -1
- package/src/components/DitoView.vue +13 -11
- package/src/mixins/DataMixin.js +11 -9
- package/src/mixins/DitoMixin.js +47 -25
- package/src/mixins/EmitterMixin.js +2 -1
- package/src/mixins/ItemMixin.js +15 -10
- package/src/mixins/LoadingMixin.js +2 -1
- package/src/mixins/NumberMixin.js +15 -10
- package/src/mixins/OptionsMixin.js +24 -12
- package/src/mixins/ResourceMixin.js +42 -34
- package/src/mixins/RouteMixin.js +8 -8
- package/src/mixins/SortableMixin.js +1 -1
- package/src/mixins/SourceMixin.js +68 -34
- package/src/mixins/TypeMixin.js +5 -4
- package/src/mixins/ValidationMixin.js +3 -0
- package/src/styles/_base.scss +17 -0
- package/src/styles/_button.scss +212 -0
- package/src/styles/_imports.scss +2 -0
- package/src/styles/_layout.scss +22 -0
- package/src/styles/_notifications.scss +54 -0
- package/src/styles/_pulldown.scss +39 -0
- package/src/styles/_scroll.scss +15 -0
- package/src/styles/_settings.scss +68 -0
- package/src/styles/_sortable.scss +13 -0
- package/src/styles/_table.scss +224 -0
- package/src/styles/style.scss +9 -0
- package/src/types/DitoTypeButton.vue +72 -0
- package/src/types/{TypeCheckbox.vue → DitoTypeCheckbox.vue} +12 -11
- package/src/types/{TypeCheckboxes.vue → DitoTypeCheckboxes.vue} +21 -15
- package/src/types/{TypeCode.vue → DitoTypeCode.vue} +46 -34
- package/src/types/{TypeColor.vue → DitoTypeColor.vue} +71 -52
- package/src/types/{TypeComponent.vue → DitoTypeComponent.vue} +2 -2
- package/src/types/DitoTypeComputed.vue +54 -0
- package/src/types/DitoTypeDate.vue +64 -0
- package/src/types/DitoTypeLabel.vue +23 -0
- package/src/types/{TypeList.vue → DitoTypeList.vue} +83 -61
- package/src/types/{TypeMarkup.vue → DitoTypeMarkup.vue} +172 -122
- package/src/types/DitoTypeMultiselect.vue +434 -0
- package/src/types/DitoTypeNumber.vue +46 -0
- package/src/types/{TypeObject.vue → DitoTypeObject.vue} +41 -26
- package/src/types/{TypePanel.vue → DitoTypePanel.vue} +2 -2
- package/src/types/{TypeProgress.vue → DitoTypeProgress.vue} +4 -6
- package/src/types/{TypeRadio.vue → DitoTypeRadio.vue} +17 -13
- package/src/types/{TypeSection.vue → DitoTypeSection.vue} +17 -17
- package/src/types/{TypeSelect.vue → DitoTypeSelect.vue} +39 -35
- package/src/types/{TypeSlider.vue → DitoTypeSlider.vue} +29 -23
- package/src/types/{TypeSwitch.vue → DitoTypeSwitch.vue} +15 -13
- package/src/types/DitoTypeText.vue +77 -0
- package/src/types/{TypeTextarea.vue → DitoTypeTextarea.vue} +17 -14
- package/src/types/DitoTypeTreeList.vue +191 -0
- package/src/types/{TypeUpload.vue → DitoTypeUpload.vue} +92 -65
- package/src/types/index.js +26 -26
- package/src/utils/SchemaGraph.js +21 -13
- package/src/utils/accessor.js +17 -9
- package/src/utils/data.js +4 -1
- package/src/utils/filter.js +8 -10
- package/src/utils/options.js +3 -3
- package/src/utils/resource.js +12 -10
- package/src/utils/schema.js +190 -125
- package/src/utils/type.js +31 -20
- package/src/validations/_decimals.js +1 -2
- package/types/index.d.ts +27 -23
- package/src/styles/_base.sass +0 -15
- package/src/styles/_button.sass +0 -127
- package/src/styles/_imports.sass +0 -2
- package/src/styles/_layout.sass +0 -13
- package/src/styles/_notifications.sass +0 -33
- package/src/styles/_pulldown.sass +0 -26
- package/src/styles/_scroll.sass +0 -13
- package/src/styles/_settings.sass +0 -55
- package/src/styles/_sortable.sass +0 -9
- package/src/styles/_table.sass +0 -153
- package/src/styles/style.sass +0 -10
- package/src/types/TypeButton.vue +0 -73
- package/src/types/TypeComputed.vue +0 -53
- package/src/types/TypeDate.vue +0 -64
- package/src/types/TypeLabel.vue +0 -19
- package/src/types/TypeMultiselect.vue +0 -376
- package/src/types/TypeNumber.vue +0 -44
- package/src/types/TypeText.vue +0 -67
- package/src/types/TypeTreeList.vue +0 -164
package/src/mixins/TypeMixin.js
CHANGED
|
@@ -238,7 +238,7 @@ export default {
|
|
|
238
238
|
// If the element is disabled, `focus()` will likely not have the
|
|
239
239
|
// desired effect. Use `scrollIntoView()` if available:
|
|
240
240
|
if (this.disabled) {
|
|
241
|
-
(element.$el || element).scrollIntoView?.()
|
|
241
|
+
;(element.$el || element).scrollIntoView?.()
|
|
242
242
|
}
|
|
243
243
|
})
|
|
244
244
|
}
|
|
@@ -276,9 +276,10 @@ export default {
|
|
|
276
276
|
onChange() {
|
|
277
277
|
this.markDirty()
|
|
278
278
|
this.emitEvent('change', {
|
|
279
|
-
context:
|
|
280
|
-
|
|
281
|
-
|
|
279
|
+
context:
|
|
280
|
+
this.parsedValue !== undefined
|
|
281
|
+
? { value: this.parsedValue }
|
|
282
|
+
: null,
|
|
282
283
|
// Pass `schemaComponent` as parent, so change events can propagate up.
|
|
283
284
|
parent: this.schemaComponent
|
|
284
285
|
})
|
|
@@ -3,6 +3,8 @@ import * as validations from '../validations/index.js'
|
|
|
3
3
|
|
|
4
4
|
// @vue/component
|
|
5
5
|
export default {
|
|
6
|
+
emits: ['errors'],
|
|
7
|
+
|
|
6
8
|
data() {
|
|
7
9
|
return {
|
|
8
10
|
isTouched: false,
|
|
@@ -30,6 +32,7 @@ export default {
|
|
|
30
32
|
const { value } = this
|
|
31
33
|
// console.log('validate', this.dataPath, value, this.validations)
|
|
32
34
|
for (const [rule, setting] of Object.entries(this.validations)) {
|
|
35
|
+
// eslint-disable-next-line import/namespace
|
|
33
36
|
const validator = validations[rule]
|
|
34
37
|
if (validator && (validator.nullish || value != null)) {
|
|
35
38
|
const { validate, message } = validator
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@include reset;
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--font-size: #{$font-size};
|
|
5
|
+
--line-height: #{$line-height};
|
|
6
|
+
--color-text: #{$color-text};
|
|
7
|
+
|
|
8
|
+
font-size: var(--font-size);
|
|
9
|
+
line-height: var(--line-height);
|
|
10
|
+
color: var(--color-text);
|
|
11
|
+
background: $content-color-background;
|
|
12
|
+
font-family: $font-family-sans;
|
|
13
|
+
-moz-osx-font-smoothing: grayscale;
|
|
14
|
+
-webkit-font-smoothing: antialiased;
|
|
15
|
+
overflow-x: hidden;
|
|
16
|
+
max-width: 100%;
|
|
17
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
|
|
3
|
+
.dito-button {
|
|
4
|
+
// .dito-button with order-arrows:
|
|
5
|
+
.dito-order-arrows {
|
|
6
|
+
display: inline-block;
|
|
7
|
+
width: math.round($button-order-arrow-size * $math-sqrt2);
|
|
8
|
+
padding-left: $form-spacing;
|
|
9
|
+
|
|
10
|
+
$arrow-offset: calc($button-order-arrow-size / 2 + $border-width);
|
|
11
|
+
|
|
12
|
+
&::before {
|
|
13
|
+
@include arrow($button-order-arrow-size, 'up');
|
|
14
|
+
|
|
15
|
+
bottom: $arrow-offset;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&::after {
|
|
19
|
+
@include arrow($button-order-arrow-size, 'down');
|
|
20
|
+
|
|
21
|
+
top: $arrow-offset;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&.dito-order-asc .dito-order-arrows {
|
|
26
|
+
&::before {
|
|
27
|
+
bottom: 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&::after {
|
|
31
|
+
display: none;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&.dito-order-desc .dito-order-arrows {
|
|
36
|
+
&::before {
|
|
37
|
+
display: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&::after {
|
|
41
|
+
top: 0;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.dito-button-create:empty::before {
|
|
47
|
+
content: 'Create';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.dito-button-add:empty::before {
|
|
51
|
+
content: 'Add';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.dito-button-delete:empty::before {
|
|
55
|
+
content: 'Delete';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.dito-button-remove:empty::before {
|
|
59
|
+
content: 'Remove';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.dito-button-edit:empty::before {
|
|
63
|
+
content: 'Edit';
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.dito-button-save:empty::before {
|
|
67
|
+
content: 'Save';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.dito-button-apply:empty::before {
|
|
71
|
+
content: 'Apply';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.dito-button-login:empty::before {
|
|
75
|
+
content: 'Login';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.dito-button-ok:empty::before {
|
|
79
|
+
content: 'OK';
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.dito-button-cancel:empty::before {
|
|
83
|
+
content: 'Cancel';
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.dito-button-close:empty::before {
|
|
87
|
+
content: 'Close';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.dito-button-drag:empty::before {
|
|
91
|
+
content: 'Drag';
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.dito-button-copy:empty::before {
|
|
95
|
+
content: 'Copy';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.dito-button-paste:empty::before {
|
|
99
|
+
content: 'Paste';
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.dito-button-drag {
|
|
103
|
+
cursor: grab;
|
|
104
|
+
|
|
105
|
+
&:active {
|
|
106
|
+
cursor: grabbing;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.dito-buttons {
|
|
111
|
+
&.dito-buttons-large {
|
|
112
|
+
--button-margin: 3px;
|
|
113
|
+
|
|
114
|
+
font-size: $menu-font-size;
|
|
115
|
+
flex-flow: row wrap;
|
|
116
|
+
justify-content: center;
|
|
117
|
+
|
|
118
|
+
.dito-container {
|
|
119
|
+
// Do not specify this on .dito-buttons directly as it would break borders
|
|
120
|
+
margin-top: $content-padding;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.dito-button {
|
|
124
|
+
border-radius: 2em;
|
|
125
|
+
padding: $button-round-padding;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&.dito-buttons-main {
|
|
130
|
+
position: sticky;
|
|
131
|
+
bottom: 0;
|
|
132
|
+
width: 100%;
|
|
133
|
+
align-self: flex-end;
|
|
134
|
+
z-index: 500;
|
|
135
|
+
padding-bottom: $content-padding;
|
|
136
|
+
margin-bottom: -$content-padding;
|
|
137
|
+
margin-top: 2 * $content-padding;
|
|
138
|
+
box-shadow: 0 (-$content-padding) $content-padding (-$content-padding)
|
|
139
|
+
$color-shadow;
|
|
140
|
+
background: $content-color-background;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&.dito-buttons-round,
|
|
144
|
+
&.dito-buttons-small {
|
|
145
|
+
// For now, nothing for these:
|
|
146
|
+
// .dito-button-create:empty::before,
|
|
147
|
+
// .dito-button-add:empty::before
|
|
148
|
+
// Special .dito-button-add-upload without :empty:
|
|
149
|
+
.dito-button-add-upload::before {
|
|
150
|
+
@extend %icon-add;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.dito-button-delete:empty::before,
|
|
154
|
+
.dito-button-remove:empty::before {
|
|
155
|
+
@extend %icon-remove;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.dito-button-edit:empty::before {
|
|
159
|
+
@extend %icon-edit;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.dito-button-drag:empty::before {
|
|
163
|
+
@extend %icon-drag;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.dito-button-copy:empty::before {
|
|
167
|
+
@extend %icon-copy;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.dito-button-paste:empty::before {
|
|
171
|
+
@extend %icon-paste;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.dito-button-overlay {
|
|
177
|
+
position: absolute;
|
|
178
|
+
right: $border-width;
|
|
179
|
+
top: $border-width;
|
|
180
|
+
bottom: $border-width;
|
|
181
|
+
border: 0;
|
|
182
|
+
border-radius: $border-radius;
|
|
183
|
+
cursor: pointer;
|
|
184
|
+
|
|
185
|
+
&.dito-button-clear {
|
|
186
|
+
width: $input-height;
|
|
187
|
+
z-index: 1;
|
|
188
|
+
background: $color-white;
|
|
189
|
+
display: none;
|
|
190
|
+
|
|
191
|
+
$button-clear: &;
|
|
192
|
+
|
|
193
|
+
@at-root .dito-component:hover {
|
|
194
|
+
// Support two levels of nesting inside .dito-component, used by TypeColor
|
|
195
|
+
& > #{$button-clear},
|
|
196
|
+
& > * > #{$button-clear},
|
|
197
|
+
& > * > * > #{$button-clear} {
|
|
198
|
+
display: block;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
&::before {
|
|
203
|
+
@extend %icon-clear;
|
|
204
|
+
|
|
205
|
+
color: $color-grey;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
&:hover::before {
|
|
209
|
+
color: $color-black;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// TODO: Convert to flexbox
|
|
2
|
+
|
|
3
|
+
.dito-layout-vertical {
|
|
4
|
+
display: table;
|
|
5
|
+
|
|
6
|
+
> * {
|
|
7
|
+
display: table-row;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.dito-layout-horizontal {
|
|
12
|
+
display: table-row;
|
|
13
|
+
|
|
14
|
+
> * {
|
|
15
|
+
display: table-cell;
|
|
16
|
+
|
|
17
|
+
/* stylelint-disable-next-line selector-max-universal */
|
|
18
|
+
& + * {
|
|
19
|
+
padding-left: $form-spacing;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
@use 'sass:color';
|
|
2
|
+
|
|
3
|
+
@mixin type($background) {
|
|
4
|
+
background: color.adjust($background, $lightness: 5%);
|
|
5
|
+
color: $color-white;
|
|
6
|
+
border-left: 12px solid color.adjust($background, $lightness: -10%);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.dito-notifications {
|
|
10
|
+
.dito-notification {
|
|
11
|
+
padding: 8px;
|
|
12
|
+
margin: 12px 12px 0;
|
|
13
|
+
font-size: inherit;
|
|
14
|
+
color: $color-white;
|
|
15
|
+
border-radius: $border-radius;
|
|
16
|
+
box-shadow: $shadow-window;
|
|
17
|
+
|
|
18
|
+
.notification-title {
|
|
19
|
+
font-weight: bold;
|
|
20
|
+
padding-bottom: 8px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.notification-content {
|
|
24
|
+
p {
|
|
25
|
+
margin: 0;
|
|
26
|
+
|
|
27
|
+
& + p {
|
|
28
|
+
margin-top: 8px;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&,
|
|
34
|
+
&.info {
|
|
35
|
+
@include type($color-active);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&.success {
|
|
39
|
+
@include type($color-success);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&.warning {
|
|
43
|
+
@include type($color-warning);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&.error {
|
|
47
|
+
@include type($color-error);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.vue-notification-wrapper {
|
|
52
|
+
overflow: visible;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
ul.dito-pulldown {
|
|
2
|
+
display: none;
|
|
3
|
+
position: absolute;
|
|
4
|
+
top: 0;
|
|
5
|
+
z-index: 1000;
|
|
6
|
+
border-radius: $pulldown-radius;
|
|
7
|
+
box-shadow: $shadow-window;
|
|
8
|
+
|
|
9
|
+
&.dito-open {
|
|
10
|
+
display: block;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
li {
|
|
14
|
+
@include user-select(none);
|
|
15
|
+
|
|
16
|
+
a {
|
|
17
|
+
display: block;
|
|
18
|
+
text-align: center;
|
|
19
|
+
padding: $pulldown-padding;
|
|
20
|
+
line-height: 1;
|
|
21
|
+
background: $button-color;
|
|
22
|
+
|
|
23
|
+
&:hover {
|
|
24
|
+
background: $color-active;
|
|
25
|
+
color: $color-white;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&:first-child a {
|
|
30
|
+
border-top-left-radius: $pulldown-radius;
|
|
31
|
+
border-top-right-radius: $pulldown-radius;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:last-child a {
|
|
35
|
+
border-bottom-left-radius: $pulldown-radius;
|
|
36
|
+
border-bottom-right-radius: $pulldown-radius;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.dito-scroll {
|
|
2
|
+
flex: 1;
|
|
3
|
+
max-height: 100%;
|
|
4
|
+
overflow-x: hidden;
|
|
5
|
+
overflow-y: auto;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.dito-scroll-parent {
|
|
9
|
+
// To make vertical scrolling in .dito-scroll work:
|
|
10
|
+
flex: 1;
|
|
11
|
+
display: flex;
|
|
12
|
+
position: relative;
|
|
13
|
+
flex-flow: column;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Typography
|
|
2
|
+
$font-family-sans: -apple-system, 'BlinkMacSystemFont', 'Segoe UI', 'Roboto',
|
|
3
|
+
'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
4
|
+
'Helvetica', 'Arial', sans-serif;
|
|
5
|
+
$font-family-mono: 'Menlo', 'Consolas', 'Monaco', 'Vera Mono', 'Andale Mono',
|
|
6
|
+
'Ubuntu Mono', monospace;
|
|
7
|
+
$font-size: 13px;
|
|
8
|
+
$font-size-small: 11px;
|
|
9
|
+
// Adjust line-height so that it fulfils this equation, which is used
|
|
10
|
+
// to reach equal height for icon-buttons (`height: 2em`), table headers & co.:
|
|
11
|
+
// `(2 * $font-size - 2 * ($border-width + $input-padding-ver)) / $font-size`
|
|
12
|
+
// TODO: Ideally, this would be handled in @ditojs/ui, but it would have to be
|
|
13
|
+
// done in a way independent of `$font-size`. The right approach would probably
|
|
14
|
+
// be to use `$input-height` and vertical centering instead for all inputs that
|
|
15
|
+
// have a height of one line?
|
|
16
|
+
// NOTE: Due to higher precision in dart-sass, this needs to be rounded to 5
|
|
17
|
+
// fractional digits, otherwise CSS creates the wrong resulting line-height with
|
|
18
|
+
// 1 missing pixel.
|
|
19
|
+
$line-height: rounded(
|
|
20
|
+
calc(
|
|
21
|
+
$input-height-factor - 2 * ($border-width + $input-padding-ver) / $font-size
|
|
22
|
+
),
|
|
23
|
+
5
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
// Button
|
|
27
|
+
$button-order-arrow-size: 4px;
|
|
28
|
+
|
|
29
|
+
// Pulldown
|
|
30
|
+
$pulldown-radius: 0.5em;
|
|
31
|
+
$pulldown-padding-ver: 0.5em;
|
|
32
|
+
$pulldown-padding-hor: 1em;
|
|
33
|
+
$pulldown-padding: $pulldown-padding-ver $pulldown-padding-hor;
|
|
34
|
+
|
|
35
|
+
// Content
|
|
36
|
+
$content-width: 900px;
|
|
37
|
+
$content-sidebar-width: 360px;
|
|
38
|
+
$content-padding: 16px;
|
|
39
|
+
$content-padding-half: calc($content-padding / 2);
|
|
40
|
+
$content-color-background: $color-lightest;
|
|
41
|
+
|
|
42
|
+
// Form
|
|
43
|
+
$form-spacing: $input-padding-hor;
|
|
44
|
+
$form-spacing-half: calc($form-spacing / 2);
|
|
45
|
+
|
|
46
|
+
// Menu
|
|
47
|
+
$menu-font-size: 14px;
|
|
48
|
+
$menu-line-height: 1;
|
|
49
|
+
$menu-z-index: 1000;
|
|
50
|
+
$menu-padding-ver: $menu-font-size;
|
|
51
|
+
$menu-padding-hor: $content-padding;
|
|
52
|
+
$menu-padding: $menu-padding-ver $menu-padding-hor;
|
|
53
|
+
$menu-height: $menu-font-size + 2 * $menu-padding-ver;
|
|
54
|
+
|
|
55
|
+
// Tabs
|
|
56
|
+
$tab-margin: 6px;
|
|
57
|
+
$tab-padding-hor: 12px;
|
|
58
|
+
$tab-padding-ver: calc(($menu-padding-ver * 2 - $tab-margin) / 2);
|
|
59
|
+
$tab-radius: 4px;
|
|
60
|
+
// $border-radius
|
|
61
|
+
|
|
62
|
+
// Patterns
|
|
63
|
+
$pattern-transparency-size: ($font-size - $border-width) * $input-height-factor;
|
|
64
|
+
$pattern-transparency: repeating-conic-gradient(
|
|
65
|
+
transparent 0% 25%,
|
|
66
|
+
#eeeeee 0% 50%
|
|
67
|
+
)
|
|
68
|
+
0% 0% / #{$pattern-transparency-size} #{$pattern-transparency-size};
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
@mixin table-border {
|
|
2
|
+
// Note: No border-width set here on purpose!
|
|
3
|
+
border-style: solid;
|
|
4
|
+
border-color: $border-color;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
@mixin table-border-left {
|
|
8
|
+
border-left-width: $border-width;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@mixin table-border-right {
|
|
12
|
+
border-right-width: $border-width;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@mixin table-border-top {
|
|
16
|
+
border-top-width: $border-width;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@mixin table-border-bottom {
|
|
20
|
+
border-bottom-width: $border-width;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@mixin table-border-top-left {
|
|
24
|
+
@include table-border-top;
|
|
25
|
+
@include table-border-left;
|
|
26
|
+
|
|
27
|
+
border-top-left-radius: $border-radius;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@mixin table-border-top-right {
|
|
31
|
+
@include table-border-top;
|
|
32
|
+
@include table-border-right;
|
|
33
|
+
|
|
34
|
+
border-top-right-radius: $border-radius;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@mixin table-border-bottom-left {
|
|
38
|
+
@include table-border-bottom;
|
|
39
|
+
@include table-border-left;
|
|
40
|
+
|
|
41
|
+
border-bottom-left-radius: $border-radius;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@mixin table-border-bottom-right {
|
|
45
|
+
@include table-border-bottom;
|
|
46
|
+
@include table-border-right;
|
|
47
|
+
|
|
48
|
+
border-bottom-right-radius: $border-radius;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
table.dito-table {
|
|
52
|
+
--separator-width: #{$border-width};
|
|
53
|
+
|
|
54
|
+
width: 100%;
|
|
55
|
+
height: min-content;
|
|
56
|
+
border-radius: $border-radius;
|
|
57
|
+
|
|
58
|
+
> tbody,
|
|
59
|
+
> tfoot {
|
|
60
|
+
> tr {
|
|
61
|
+
vertical-align: baseline;
|
|
62
|
+
|
|
63
|
+
> td {
|
|
64
|
+
padding: $form-spacing 0 $form-spacing $form-spacing;
|
|
65
|
+
background: $content-color-background;
|
|
66
|
+
|
|
67
|
+
&:last-child {
|
|
68
|
+
padding-right: $form-spacing;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&.dito-cell-edit-buttons {
|
|
72
|
+
width: 1%;
|
|
73
|
+
|
|
74
|
+
&,
|
|
75
|
+
.dito-button {
|
|
76
|
+
// To align better with `vertical-align: baseline` in normal td:
|
|
77
|
+
vertical-align: top;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&.dito-table-larger-padding {
|
|
85
|
+
// Add more spacing to cells in tables except those containing edit buttons,
|
|
86
|
+
// to better align cell texts with edit buttons.
|
|
87
|
+
td:not(.dito-cell-edit-buttons) {
|
|
88
|
+
$padding: $form-spacing * 1.5;
|
|
89
|
+
|
|
90
|
+
padding: $padding 0 $padding $padding;
|
|
91
|
+
}
|
|
92
|
+
// Variants of list styles: separators and alternate colors.
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&.dito-table-separators {
|
|
96
|
+
> tbody > tr + tr,
|
|
97
|
+
> tbody:not(:empty) + tfoot > tr {
|
|
98
|
+
> td {
|
|
99
|
+
border-top: var(--separator-width) solid $border-color;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&.dito-table-alternate-colors {
|
|
105
|
+
> tbody > tr:nth-child(odd),
|
|
106
|
+
&.dito-table-even-count > tfoot > tr {
|
|
107
|
+
> td {
|
|
108
|
+
background: $color-white;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&.dito-table-background {
|
|
114
|
+
> tbody,
|
|
115
|
+
> tfoot {
|
|
116
|
+
> tr > td {
|
|
117
|
+
background: $color-white;
|
|
118
|
+
}
|
|
119
|
+
// Add top/top-left/top-right borders to the thead cells, using the special
|
|
120
|
+
// convention that they're added to the first element inside them instead of
|
|
121
|
+
// the cell itself, so buttons can keep the border themselves and display
|
|
122
|
+
// focus nicely.
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
> thead > tr > th {
|
|
127
|
+
// Use `:not(:focus)` to avoid overriding button focus border styling.
|
|
128
|
+
> * {
|
|
129
|
+
box-sizing: content-box;
|
|
130
|
+
|
|
131
|
+
&:not(:focus) {
|
|
132
|
+
@include table-border;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
& {
|
|
136
|
+
@include table-border-top;
|
|
137
|
+
@include table-border-bottom;
|
|
138
|
+
@include table-border-left;
|
|
139
|
+
@include table-border-right;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&:first-child > * {
|
|
144
|
+
@include table-border-top-left;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&:last-child > * {
|
|
148
|
+
@include table-border-top-right;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
& + th > * {
|
|
152
|
+
margin-left: -1px;
|
|
153
|
+
// Don't cover the focused border of buttons:
|
|
154
|
+
&:focus {
|
|
155
|
+
z-index: 1;
|
|
156
|
+
}
|
|
157
|
+
// Add left/rigth borders to the normal tbody cells.
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
> tbody > tr > td {
|
|
162
|
+
border: 0;
|
|
163
|
+
@include table-border;
|
|
164
|
+
|
|
165
|
+
&:first-child {
|
|
166
|
+
@include table-border-left;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&:last-child {
|
|
170
|
+
@include table-border-right;
|
|
171
|
+
}
|
|
172
|
+
// If there is no thead, add top/top-left/top-right borders borders to the
|
|
173
|
+
// first row of the tbody cells.
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
> tbody:first-child > tr:first-child > td,
|
|
177
|
+
/* Use :first-child to exclude situation where there's a thead and empty tbody*/
|
|
178
|
+
> tbody:first-child:empty + tfoot > tr > td {
|
|
179
|
+
@include table-border-top;
|
|
180
|
+
|
|
181
|
+
&:first-child {
|
|
182
|
+
@include table-border-top-left;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
&:last-child {
|
|
186
|
+
@include table-border-top-right;
|
|
187
|
+
}
|
|
188
|
+
// If there is no toot, add top/top-left/top-right borders borders to the
|
|
189
|
+
// first row of the tbody cells.
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
> tbody:last-child > tr:last-child > td {
|
|
193
|
+
@include table-border-bottom;
|
|
194
|
+
|
|
195
|
+
&:first-child {
|
|
196
|
+
@include table-border-bottom-left;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
&:last-child {
|
|
200
|
+
@include table-border-bottom-right;
|
|
201
|
+
}
|
|
202
|
+
// Add bottom/bottom-left/bottom-right borders to the thead cells.
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
> tfoot > tr > td {
|
|
206
|
+
border-width: 0;
|
|
207
|
+
@include table-border;
|
|
208
|
+
@include table-border-bottom;
|
|
209
|
+
|
|
210
|
+
&:first-child {
|
|
211
|
+
@include table-border-bottom-left;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
&:last-child {
|
|
215
|
+
@include table-border-bottom-right;
|
|
216
|
+
}
|
|
217
|
+
// Nested .dito-table:
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
table.dito-table table.dito-table,
|
|
222
|
+
.dito-form-nested table.dito-table {
|
|
223
|
+
margin: 0;
|
|
224
|
+
}
|