@milaboratories/uikit 2.2.45 → 2.2.47
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/CHANGELOG.md +12 -0
- package/dist/pl-uikit.js +7729 -5295
- package/dist/pl-uikit.umd.cjs +12 -8
- package/dist/src/components/PlChartHistogram/PlChartHistogram.vue.d.ts +6 -0
- package/dist/src/components/PlChartHistogram/createGridlines.d.ts +3 -0
- package/dist/src/components/PlChartHistogram/createLabels.d.ts +3 -0
- package/dist/src/components/PlChartHistogram/createSvgContainer.d.ts +3 -0
- package/dist/src/components/PlChartHistogram/drawBins.d.ts +2 -0
- package/dist/src/components/PlChartHistogram/drawThreshold.d.ts +2 -0
- package/dist/src/components/PlChartHistogram/histogram.d.ts +4 -0
- package/dist/src/components/PlChartHistogram/index.d.ts +1 -0
- package/dist/src/components/PlChartHistogram/logspace.d.ts +1 -0
- package/dist/src/components/PlChartHistogram/normalizeBins.d.ts +2 -0
- package/dist/src/components/PlChartHistogram/scales.spec.d.ts +1 -0
- package/dist/src/components/PlChartHistogram/types.d.ts +58 -0
- package/dist/src/components/PlDialogModal/PlDialogModal.vue.d.ts +10 -0
- package/dist/src/components/PlDropdownMultiRef/PlDropdownMultiRef.vue.d.ts +1 -0
- package/dist/src/composition/useComponentProp.d.ts +33 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/types.d.ts +2 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +4 -2
- package/src/colors/__tests__/colors.spec.ts +0 -2
- package/src/components/PlChartHistogram/PlChartHistogram.vue +90 -0
- package/src/components/PlChartHistogram/createGridlines.ts +42 -0
- package/src/components/PlChartHistogram/createLabels.ts +32 -0
- package/src/components/PlChartHistogram/createSvgContainer.ts +23 -0
- package/src/components/PlChartHistogram/drawBins.ts +55 -0
- package/src/components/PlChartHistogram/drawThreshold.ts +19 -0
- package/src/components/PlChartHistogram/histogram.ts +136 -0
- package/src/components/PlChartHistogram/index.ts +1 -0
- package/src/components/PlChartHistogram/logspace.ts +13 -0
- package/src/components/PlChartHistogram/normalizeBins.ts +19 -0
- package/src/components/PlChartHistogram/scales.spec.ts +10 -0
- package/src/components/PlChartHistogram/types.ts +66 -0
- package/src/components/PlDialogModal/PlDialogModal.vue +41 -2
- package/src/components/PlDropdownMulti/PlDropdownMulti.vue +1 -2
- package/src/components/PlDropdownMultiRef/PlDropdownMultiRef.vue +1 -0
- package/src/components/PlDropdownMultiRef/__tests__/PlDropdownMultiRef.spec.ts +1 -3
- package/src/components/PlProgressCell/PlProgressCell.vue +0 -2
- package/src/composition/useComponentProp.ts +36 -0
- package/src/helpers/index.ts +1 -1
- package/src/index.ts +2 -0
- package/src/types.ts +3 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { InferComponentProps } from '@/types';
|
|
2
|
+
import { computed, type Component, type ComputedRef } from 'vue';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A utility function that creates a reactive computed property
|
|
6
|
+
* based on a specific prop of a Vue component.
|
|
7
|
+
*
|
|
8
|
+
*
|
|
9
|
+
* @template C - The Vue component type.
|
|
10
|
+
* @template P - The prop name.
|
|
11
|
+
*
|
|
12
|
+
* @param cb - A factory function that returns the value of the prop from the inferred component props.
|
|
13
|
+
*
|
|
14
|
+
* @returns A `ComputedRef` of the specified prop
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { ref, defineComponent } from 'vue';
|
|
19
|
+
* import { useComponentProp } from '@platforma-sdk/ui-vue';
|
|
20
|
+
*
|
|
21
|
+
* const MyComponent = defineComponent({
|
|
22
|
+
* props: {
|
|
23
|
+
* myProp: {
|
|
24
|
+
* type: String,
|
|
25
|
+
* required: true
|
|
26
|
+
* }
|
|
27
|
+
* }
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* const propValue = useComponentProp<typeof MyComponent, 'myProp'>(() => 'example');
|
|
31
|
+
* console.log(propValue.value); // Outputs: 'example'
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export function useComponentProp<C extends Component, P extends keyof InferComponentProps<C>>(cb: () => InferComponentProps<C>[P]): ComputedRef<InferComponentProps<C>[P]> {
|
|
35
|
+
return computed(cb);
|
|
36
|
+
}
|
package/src/helpers/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -63,6 +63,7 @@ export * from './components/PlIcon16';
|
|
|
63
63
|
export * from './components/PlIcon24';
|
|
64
64
|
|
|
65
65
|
export * from './components/PlChartStackedBar';
|
|
66
|
+
export * from './components/PlChartHistogram';
|
|
66
67
|
|
|
67
68
|
export * from './colors';
|
|
68
69
|
|
|
@@ -93,6 +94,7 @@ export { useInterval } from './composition/useInterval';
|
|
|
93
94
|
export { useFormState } from './composition/useFormState';
|
|
94
95
|
export { useQuery } from './composition/useQuery.ts';
|
|
95
96
|
export { useDraggable } from './composition/useDraggable';
|
|
97
|
+
export { useComponentProp } from './composition/useComponentProp';
|
|
96
98
|
|
|
97
99
|
/**
|
|
98
100
|
* Utils/Partials
|
package/src/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ImportFileHandle, Platforma, StorageHandle, PlRef as ModelRef } from '@platforma-sdk/model';
|
|
2
|
-
import type { Ref, ComputedRef } from 'vue';
|
|
2
|
+
import type { Ref, ComputedRef, Component } from 'vue';
|
|
3
3
|
import { maskIcons16 } from './generated/icons-16';
|
|
4
4
|
import { maskIcons24 } from './generated/icons-24';
|
|
5
5
|
|
|
@@ -78,6 +78,8 @@ export type ImportedFiles = {
|
|
|
78
78
|
files: ImportFileHandle[];
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
+
export type InferComponentProps<C extends Component> = C extends Component<infer P> ? P : never;
|
|
82
|
+
|
|
81
83
|
declare global {
|
|
82
84
|
const platforma: Platforma | undefined;
|
|
83
85
|
interface Window {
|