@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,48 @@
1
+ // A mini-replication of vue's internal `resolveMergedOptions()` but only
2
+ // handling our own added options properties and merging them early instead
3
+ // of lazily.
4
+
5
+ export function resolveMergedOptions(options) {
6
+ const { mixins } = options
7
+ return mixins || options.extends
8
+ ? mergeOptions(
9
+ { ...options },
10
+ options
11
+ )
12
+ : options
13
+ }
14
+
15
+ export function mergeOptions(to, from) {
16
+ if (from.extends) {
17
+ mergeOptions(to, from.extends)
18
+ }
19
+ if (from.mixins) {
20
+ for (const mixin of from.mixins) {
21
+ mergeOptions(to, mixin)
22
+ }
23
+ }
24
+ for (const key of ditoOptionKeys) {
25
+ if (key in from) {
26
+ to[key] = from[key]
27
+ }
28
+ }
29
+ return to
30
+ }
31
+
32
+ const ditoOptionKeys = [
33
+ 'defaultValue',
34
+ 'defaultNested',
35
+ 'defaultVisible',
36
+ 'generateLabel',
37
+ 'excludeValue',
38
+ 'ignoreMissingValue',
39
+ 'omitSpacing',
40
+ 'processValue',
41
+ 'processSchema',
42
+ 'getPanelSchema',
43
+ 'getFormSchemasForProcessing',
44
+ // Vue 3 / Vue-router 4 forgets these.
45
+ // TODO: Create bug-report?
46
+ 'beforeRouteUpdate',
47
+ 'beforeRouteLeave'
48
+ ]
@@ -0,0 +1,5 @@
1
+ export function resolvePath(path) {
2
+ // For paths staring with `/`, we can use the native `URL()` class to resolve
3
+ // the path, which will also handle `..` and `.` segments:
4
+ return new URL(`file:${path}`).pathname
5
+ }
@@ -0,0 +1,44 @@
1
+ import { isFunction, isObject, isString, pickBy } from '@ditojs/utils'
2
+
3
+ export function hasResource(schema) {
4
+ return !!getResource(schema.resource)
5
+ }
6
+
7
+ export function getResource(resource, defaults = {}) {
8
+ const { parent, ...defs } = defaults
9
+ if (isFunction(resource)) {
10
+ resource = resource(defaults)
11
+ }
12
+ resource = isObject(resource)
13
+ ? { ...defs, ...resource }
14
+ : isString(resource)
15
+ ? { ...defs, path: resource }
16
+ : null
17
+ // Only set parent if path doesn't start with '/', so relative URLs are
18
+ // dealt with correctly.
19
+ if (
20
+ resource &&
21
+ parent !== undefined &&
22
+ resource.parent === undefined &&
23
+ !resource.path?.startsWith('/')
24
+ ) {
25
+ resource.parent = parent
26
+ if (!resource.path) {
27
+ resource.path = '.'
28
+ }
29
+ }
30
+ return resource
31
+ }
32
+
33
+ export function getMemberResource(id, resource) {
34
+ return id != null && resource?.type === 'collection'
35
+ ? {
36
+ type: 'member',
37
+ ...pickBy(
38
+ resource,
39
+ (value, key) => ['method', 'path', 'parent'].includes(key)
40
+ ),
41
+ id: `${id}`
42
+ }
43
+ : null
44
+ }
@@ -0,0 +1,53 @@
1
+ import { isArray } from '@ditojs/utils'
2
+
3
+ export function formatQuery(query) {
4
+ const entries = query
5
+ ? isArray(query)
6
+ ? query
7
+ : Object.entries(query)
8
+ : []
9
+ return (
10
+ new URLSearchParams(
11
+ // Expand array values into multiple entries under the same key, so
12
+ // `formatQuery({ foo: [1, 2], bar: 3 })` => 'foo=1&foo=2&bar=3'.
13
+ entries.reduce(
14
+ (entries, [key, value]) => {
15
+ if (isArray(value)) {
16
+ for (const val of value) {
17
+ // Prevent null or undefined values from becoming strings,
18
+ // but since they're entries in an array, we still include them.
19
+ entries.push([key, val ?? ''])
20
+ }
21
+ } else if (value != null) {
22
+ entries.push([key, value])
23
+ }
24
+ return entries
25
+ },
26
+ []
27
+ )
28
+ )
29
+ .toString()
30
+ // decode all these encoded characters to have the same behavior as
31
+ // vue-router's own query encoding.
32
+ .replaceAll(/%(?:21|24|28|29|2C|2F|3A|3B|3D|3F|40)/g, decodeURIComponent)
33
+ )
34
+ }
35
+
36
+ export function replaceRoute({ path, query, hash }) {
37
+ // Preserve `history.state`, see:
38
+ // https://router.vuejs.org/guide/migration/#usage-of-history-state
39
+ const { location } = window
40
+ history.replaceState(
41
+ history.state,
42
+ null,
43
+ `${
44
+ location.origin
45
+ }${
46
+ path ?? location.pathname
47
+ }?${
48
+ query ? formatQuery(query) : location.search.slice(1)
49
+ }${
50
+ hash ?? location.hash
51
+ }`
52
+ )
53
+ }