@radio-garden/ditojs-admin 2.85.2-0.5067ad799

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.
Files changed (153) hide show
  1. package/README.md +180 -0
  2. package/dist/dito-admin.css +1 -0
  3. package/dist/dito-admin.es.js +12106 -0
  4. package/dist/dito-admin.umd.js +7 -0
  5. package/package.json +96 -0
  6. package/src/DitoAdmin.js +293 -0
  7. package/src/DitoComponent.js +34 -0
  8. package/src/DitoContext.js +318 -0
  9. package/src/DitoTypeComponent.js +42 -0
  10. package/src/DitoUser.js +12 -0
  11. package/src/appState.js +12 -0
  12. package/src/components/DitoAccount.vue +60 -0
  13. package/src/components/DitoAffix.vue +68 -0
  14. package/src/components/DitoAffixes.vue +200 -0
  15. package/src/components/DitoButtons.vue +80 -0
  16. package/src/components/DitoClipboard.vue +186 -0
  17. package/src/components/DitoContainer.vue +374 -0
  18. package/src/components/DitoCreateButton.vue +146 -0
  19. package/src/components/DitoDialog.vue +242 -0
  20. package/src/components/DitoDraggable.vue +117 -0
  21. package/src/components/DitoEditButtons.vue +135 -0
  22. package/src/components/DitoErrors.vue +83 -0
  23. package/src/components/DitoForm.vue +521 -0
  24. package/src/components/DitoFormInner.vue +26 -0
  25. package/src/components/DitoFormNested.vue +17 -0
  26. package/src/components/DitoHeader.vue +84 -0
  27. package/src/components/DitoLabel.vue +200 -0
  28. package/src/components/DitoMenu.vue +186 -0
  29. package/src/components/DitoNavigation.vue +40 -0
  30. package/src/components/DitoNotifications.vue +170 -0
  31. package/src/components/DitoPagination.vue +42 -0
  32. package/src/components/DitoPane.vue +334 -0
  33. package/src/components/DitoPanel.vue +256 -0
  34. package/src/components/DitoPanels.vue +61 -0
  35. package/src/components/DitoRoot.vue +524 -0
  36. package/src/components/DitoSchema.vue +846 -0
  37. package/src/components/DitoSchemaInlined.vue +97 -0
  38. package/src/components/DitoScopes.vue +76 -0
  39. package/src/components/DitoSidebar.vue +50 -0
  40. package/src/components/DitoSpinner.vue +95 -0
  41. package/src/components/DitoTableCell.vue +64 -0
  42. package/src/components/DitoTableHead.vue +121 -0
  43. package/src/components/DitoTabs.vue +103 -0
  44. package/src/components/DitoTrail.vue +124 -0
  45. package/src/components/DitoTreeItem.vue +420 -0
  46. package/src/components/DitoUploadFile.vue +199 -0
  47. package/src/components/DitoVNode.vue +14 -0
  48. package/src/components/DitoView.vue +143 -0
  49. package/src/components/index.js +42 -0
  50. package/src/directives/resize.js +83 -0
  51. package/src/index.js +1 -0
  52. package/src/mixins/ContextMixin.js +68 -0
  53. package/src/mixins/DataMixin.js +131 -0
  54. package/src/mixins/DitoMixin.js +591 -0
  55. package/src/mixins/DomMixin.js +29 -0
  56. package/src/mixins/EmitterMixin.js +158 -0
  57. package/src/mixins/ItemMixin.js +144 -0
  58. package/src/mixins/LoadingMixin.js +23 -0
  59. package/src/mixins/NumberMixin.js +118 -0
  60. package/src/mixins/OptionsMixin.js +304 -0
  61. package/src/mixins/PulldownMixin.js +63 -0
  62. package/src/mixins/ResourceMixin.js +398 -0
  63. package/src/mixins/RouteMixin.js +190 -0
  64. package/src/mixins/SchemaParentMixin.js +33 -0
  65. package/src/mixins/SortableMixin.js +49 -0
  66. package/src/mixins/SourceMixin.js +734 -0
  67. package/src/mixins/TextMixin.js +26 -0
  68. package/src/mixins/TypeMixin.js +280 -0
  69. package/src/mixins/ValidationMixin.js +119 -0
  70. package/src/mixins/ValidatorMixin.js +57 -0
  71. package/src/mixins/ValueMixin.js +31 -0
  72. package/src/styles/_base.scss +17 -0
  73. package/src/styles/_button.scss +191 -0
  74. package/src/styles/_imports.scss +3 -0
  75. package/src/styles/_info.scss +19 -0
  76. package/src/styles/_layout.scss +19 -0
  77. package/src/styles/_pulldown.scss +38 -0
  78. package/src/styles/_scroll.scss +13 -0
  79. package/src/styles/_settings.scss +88 -0
  80. package/src/styles/_table.scss +223 -0
  81. package/src/styles/_tippy.scss +45 -0
  82. package/src/styles/style.scss +9 -0
  83. package/src/types/DitoTypeButton.vue +143 -0
  84. package/src/types/DitoTypeCheckbox.vue +27 -0
  85. package/src/types/DitoTypeCheckboxes.vue +65 -0
  86. package/src/types/DitoTypeCode.vue +199 -0
  87. package/src/types/DitoTypeColor.vue +272 -0
  88. package/src/types/DitoTypeComponent.vue +31 -0
  89. package/src/types/DitoTypeComputed.vue +50 -0
  90. package/src/types/DitoTypeDate.vue +99 -0
  91. package/src/types/DitoTypeLabel.vue +23 -0
  92. package/src/types/DitoTypeList.vue +364 -0
  93. package/src/types/DitoTypeMarkup.vue +700 -0
  94. package/src/types/DitoTypeMultiselect.vue +522 -0
  95. package/src/types/DitoTypeNumber.vue +66 -0
  96. package/src/types/DitoTypeObject.vue +136 -0
  97. package/src/types/DitoTypePanel.vue +18 -0
  98. package/src/types/DitoTypeProgress.vue +40 -0
  99. package/src/types/DitoTypeRadio.vue +45 -0
  100. package/src/types/DitoTypeSection.vue +80 -0
  101. package/src/types/DitoTypeSelect.vue +133 -0
  102. package/src/types/DitoTypeSlider.vue +66 -0
  103. package/src/types/DitoTypeSpacer.vue +11 -0
  104. package/src/types/DitoTypeSwitch.vue +40 -0
  105. package/src/types/DitoTypeText.vue +101 -0
  106. package/src/types/DitoTypeTextarea.vue +48 -0
  107. package/src/types/DitoTypeTreeList.vue +193 -0
  108. package/src/types/DitoTypeUpload.vue +503 -0
  109. package/src/types/index.js +30 -0
  110. package/src/utils/SchemaGraph.js +147 -0
  111. package/src/utils/accessor.js +75 -0
  112. package/src/utils/agent.js +47 -0
  113. package/src/utils/data.js +92 -0
  114. package/src/utils/filter.js +266 -0
  115. package/src/utils/math.js +14 -0
  116. package/src/utils/options.js +48 -0
  117. package/src/utils/path.js +5 -0
  118. package/src/utils/resource.js +44 -0
  119. package/src/utils/route.js +53 -0
  120. package/src/utils/schema.js +1121 -0
  121. package/src/utils/type.js +81 -0
  122. package/src/utils/uid.js +15 -0
  123. package/src/utils/units.js +5 -0
  124. package/src/validators/_creditcard.js +6 -0
  125. package/src/validators/_decimals.js +11 -0
  126. package/src/validators/_domain.js +6 -0
  127. package/src/validators/_email.js +6 -0
  128. package/src/validators/_hostname.js +6 -0
  129. package/src/validators/_integer.js +6 -0
  130. package/src/validators/_max.js +6 -0
  131. package/src/validators/_min.js +6 -0
  132. package/src/validators/_password.js +5 -0
  133. package/src/validators/_range.js +6 -0
  134. package/src/validators/_required.js +9 -0
  135. package/src/validators/_url.js +6 -0
  136. package/src/validators/index.js +12 -0
  137. package/src/verbs.js +17 -0
  138. package/types/index.d.ts +3298 -0
  139. package/types/tests/admin.test-d.ts +27 -0
  140. package/types/tests/component-buttons.test-d.ts +44 -0
  141. package/types/tests/component-list.test-d.ts +159 -0
  142. package/types/tests/component-misc.test-d.ts +137 -0
  143. package/types/tests/component-object.test-d.ts +69 -0
  144. package/types/tests/component-section.test-d.ts +174 -0
  145. package/types/tests/component-select.test-d.ts +107 -0
  146. package/types/tests/components.test-d.ts +81 -0
  147. package/types/tests/context.test-d.ts +31 -0
  148. package/types/tests/fixtures.ts +24 -0
  149. package/types/tests/form.test-d.ts +109 -0
  150. package/types/tests/instance.test-d.ts +20 -0
  151. package/types/tests/schema-features.test-d.ts +402 -0
  152. package/types/tests/variance.test-d.ts +125 -0
  153. package/types/tests/view.test-d.ts +146 -0
@@ -0,0 +1,81 @@
1
+ import {
2
+ isArray,
3
+ isObject,
4
+ isString,
5
+ isBoolean,
6
+ isNumber,
7
+ isFunction,
8
+ isDate,
9
+ isRegExp,
10
+ asArray
11
+ } from '@ditojs/utils'
12
+
13
+ const typeCheckers = {
14
+ Boolean: isBoolean,
15
+ Number: isNumber,
16
+ String: isString,
17
+ Date: isDate,
18
+ Array: isArray,
19
+ Object: isObject,
20
+ RegExp: isRegExp,
21
+ Function: isFunction
22
+ }
23
+
24
+ // Declare these separately from the `typeConverters` object, to prevent
25
+ // Babel issues with `Object` overriding the global `Object`:
26
+ const toBoolean = value => !!value
27
+ const toNumber = value => +value
28
+ const toString = value => String(value)
29
+
30
+ const toDate = value =>
31
+ isDate(value)
32
+ ? value
33
+ : new Date(value)
34
+
35
+ const toArray = value =>
36
+ isArray(value)
37
+ ? value
38
+ : isString(value)
39
+ ? value.split(',')
40
+ : asArray(value)
41
+
42
+ const toObject = value =>
43
+ isObject(value)
44
+ ? value
45
+ : // If a Object is expected but a Boolean provide, convert to an empty
46
+ // object. Used by `creatable` & co, that can be both.
47
+ value === true
48
+ ? {}
49
+ : null
50
+
51
+ const toRegExp = value =>
52
+ isRegExp(value)
53
+ ? value
54
+ : new RegExp(value)
55
+
56
+ const typeConverters = {
57
+ Boolean: toBoolean,
58
+ Number: toNumber,
59
+ String: toString,
60
+ Date: toDate,
61
+ Array: toArray,
62
+ Object: toObject,
63
+ RegExp: toRegExp
64
+ }
65
+
66
+ export function isMatchingType(types, value) {
67
+ // See if any of the expect types match, return immediately if they do:
68
+ if (types && value != null) {
69
+ for (const type of types) {
70
+ if (typeCheckers[type.name]?.(value)) {
71
+ return true
72
+ }
73
+ }
74
+ }
75
+ return false
76
+ }
77
+
78
+ export function convertType(type, value) {
79
+ const converter = type && typeConverters[type.name || type]
80
+ return converter ? converter(value) : value
81
+ }
@@ -0,0 +1,15 @@
1
+ import { toRaw } from 'vue'
2
+
3
+ const uidMap = new WeakMap()
4
+
5
+ // Generated and remembers unique ids per passed object using a weak map.
6
+ let uid = 0
7
+ export function getUid(item, getItemId = null) {
8
+ const raw = toRaw(item)
9
+ let id = uidMap.get(raw)
10
+ if (!id && item) {
11
+ id = getItemId?.(item) || `@${++uid}`
12
+ uidMap.set(raw, id)
13
+ }
14
+ return id
15
+ }
@@ -0,0 +1,5 @@
1
+ import { filesize } from 'filesize'
2
+
3
+ export function formatFileSize(size) {
4
+ return filesize(size, { base: 10 })
5
+ }
@@ -0,0 +1,6 @@
1
+ import { isCreditCard } from '@ditojs/utils'
2
+
3
+ export const creditcard = {
4
+ validate: value => isCreditCard(value),
5
+ message: 'is invalid'
6
+ }
@@ -0,0 +1,11 @@
1
+ export const decimals = {
2
+ validate: (value, decimals) => {
3
+ const match = decimals === '*' ? '+' : `{1,${decimals}}`
4
+ return new RegExp(`^[-+]?\\d*(\\.\\d${match})?$`).test(value)
5
+ },
6
+
7
+ message: (value, decimals) =>
8
+ `must be numeric and may contain ${
9
+ !decimals || decimals === '*' ? '' : decimals
10
+ } decimal points`
11
+ }
@@ -0,0 +1,6 @@
1
+ import { isDomain } from '@ditojs/utils'
2
+
3
+ export const domain = {
4
+ validate: value => isDomain(value),
5
+ message: 'is not a domain'
6
+ }
@@ -0,0 +1,6 @@
1
+ import { isEmail } from '@ditojs/utils'
2
+
3
+ export const email = {
4
+ validate: value => isEmail(value),
5
+ message: 'must be a valid email'
6
+ }
@@ -0,0 +1,6 @@
1
+ import { isHostname } from '@ditojs/utils'
2
+
3
+ export const hostname = {
4
+ validate: value => isHostname(value),
5
+ message: 'is not a host name'
6
+ }
@@ -0,0 +1,6 @@
1
+ import { isInteger } from '@ditojs/utils'
2
+
3
+ export const integer = {
4
+ validate: value => isInteger(value),
5
+ message: 'must be whole number'
6
+ }
@@ -0,0 +1,6 @@
1
+ export const max = {
2
+ validate: (value, max) => value <= max,
3
+ message(value, max) {
4
+ return `must be ${max} or less`
5
+ }
6
+ }
@@ -0,0 +1,6 @@
1
+ export const min = {
2
+ validate: (value, min) => value >= min,
3
+ message(value, min) {
4
+ return `must be ${min} or more`
5
+ }
6
+ }
@@ -0,0 +1,5 @@
1
+ export const password = {
2
+ // Allow any value. For now this is only used as a marker, to allow the
3
+ // required validation to handle unchanged passwords separately.
4
+ validate: () => true
5
+ }
@@ -0,0 +1,6 @@
1
+ export const range = {
2
+ validate: (value, [min, max]) => value >= min && value <= max,
3
+ message(value, [min, max]) {
4
+ return `must be between ${min} and ${max}`
5
+ }
6
+ }
@@ -0,0 +1,9 @@
1
+ export const required = {
2
+ validate: (value, settings, { password }) => (
3
+ (value != null && value !== '') ||
4
+ // Password fields use `undefined` as opposed to `null` when they're set
5
+ // but unchanged, allow this to pass through:
6
+ (password && value === undefined)
7
+ ),
8
+ message: 'is required'
9
+ }
@@ -0,0 +1,6 @@
1
+ import { isUrl } from '@ditojs/utils'
2
+
3
+ export const url = {
4
+ validate: value => isUrl(value),
5
+ message: 'is not a valid URL'
6
+ }
@@ -0,0 +1,12 @@
1
+ export * from './_creditcard.js'
2
+ export * from './_decimals.js'
3
+ export * from './_email.js'
4
+ export * from './_hostname.js'
5
+ export * from './_domain.js'
6
+ export * from './_integer.js'
7
+ export * from './_max.js'
8
+ export * from './_min.js'
9
+ export * from './_password.js'
10
+ export * from './_range.js'
11
+ export * from './_required.js'
12
+ export * from './_url.js'
package/src/verbs.js ADDED
@@ -0,0 +1,17 @@
1
+ export default [
2
+ 'create', 'created',
3
+ 'save', 'saved',
4
+ 'apply', 'applied',
5
+ 'submit', 'submitted',
6
+ 'delete', 'deleted',
7
+ 'remove', 'removed',
8
+ 'clear', 'cleared',
9
+ 'edit', 'edited',
10
+ 'close', 'closed',
11
+ 'cancel', 'cancelled',
12
+ 'drag', 'dragged',
13
+ 'login', 'logged in'
14
+ ].reduce((verbs, verb) => {
15
+ verbs[verb] = verb
16
+ return verbs
17
+ }, {})