yuyeon 0.2.0 → 0.2.1-rc.10
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/style.css +1 -1
- package/dist/yuyeon.js +2174 -2154
- package/dist/yuyeon.umd.cjs +3 -3
- package/lib/components/chip/YChip.mjs +50 -42
- package/lib/components/chip/YChip.mjs.map +1 -1
- package/lib/components/chip/YChip.scss +6 -1
- package/lib/components/select/YSelect.mjs +3 -10
- package/lib/components/select/YSelect.mjs.map +1 -1
- package/lib/components/slider/YSlider.mjs +26 -0
- package/lib/components/slider/YSlider.mjs.map +1 -0
- package/lib/components/slider/index.mjs +2 -0
- package/lib/components/slider/index.mjs.map +1 -0
- package/lib/components/table/YDataTableServer.mjs +6 -4
- package/lib/components/table/YDataTableServer.mjs.map +1 -1
- package/lib/components/table/YTable.mjs +12 -17
- package/lib/components/table/YTable.mjs.map +1 -1
- package/lib/components/table/composibles/header.mjs +10 -3
- package/lib/components/table/composibles/header.mjs.map +1 -1
- package/lib/components/table/composibles/measure.mjs +37 -0
- package/lib/components/table/composibles/measure.mjs.map +1 -0
- package/lib/components/table/composibles/selection.mjs +13 -5
- package/lib/components/table/composibles/selection.mjs.map +1 -1
- package/lib/index.mjs +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/util/color/const.mjs +1 -1
- package/lib/util/color/const.mjs.map +1 -1
- package/package.json +1 -1
- package/types/components/chip/YChip.d.ts +32 -17
- package/types/components/select/YSelect.d.ts +15 -27
- package/types/components/slider/YSlider.d.ts +16 -0
- package/types/components/slider/index.d.ts +0 -0
- package/types/components/table/YDataTable.d.ts +11 -11
- package/types/components/table/YDataTableServer.d.ts +11 -11
- package/types/components/table/composibles/measure.d.ts +8 -0
- package/types/components/table/composibles/selection.d.ts +9 -9
- package/types/index.d.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.mjs","names":["inject","provide","ref","watchEffect","getRangeArr","propsFactory","pressDataTableHeader","headers","type","Array","default","Y_DATA_TABLE_HEADER_KEY","Symbol","for","createHeader","props","options","columns","rows","length","flat","flatMap","row","index","map","column","rowIndex","rowCount","defaultHeader","text","sortable","defaultActionHeader","width","enableSelect","value","foundIndex","findIndex","_ref","key","unshift","rowspan","splice","fixedRows","fixedOffsets","fill","forEach","
|
|
1
|
+
{"version":3,"file":"header.mjs","names":["inject","provide","ref","watchEffect","getRangeArr","propsFactory","pressDataTableHeader","headers","type","Array","default","Y_DATA_TABLE_HEADER_KEY","Symbol","for","createHeader","props","options","columns","rows","length","flat","flatMap","row","index","map","column","rowIndex","rowCount","defaultHeader","text","sortable","defaultActionHeader","width","enableSelect","value","foundIndex","findIndex","_ref","key","fixed","some","_ref2","unshift","rowspan","splice","fixedRows","fixedOffsets","fill","forEach","_ref3","i","push","fixedOffset","Number","lastFixed","seen","Set","filtered","has","add","at","data","useHeader","Error","description"],"sources":["../../../../src/components/table/composibles/header.ts"],"sourcesContent":["import { type DeepReadonly, type InjectionKey, type PropType, type Ref, inject, provide, ref, watchEffect } from 'vue';\n\n\n\nimport { getRangeArr } from '@/util/common';\nimport { propsFactory } from '@/util/component';\n\n\n\nimport { type DataTableHeader, type InternalDataTableHeader } from '../types';\n\n\nexport const pressDataTableHeader = propsFactory(\n {\n headers: {\n type: Array as PropType<DeepReadonly<DataTableHeader[]>>,\n default: () => [],\n },\n },\n 'YDataTable--header',\n);\n\nexport const Y_DATA_TABLE_HEADER_KEY: InjectionKey<{\n headers: Ref<InternalDataTableHeader[][]>;\n columns: Ref<InternalDataTableHeader[]>;\n}> = Symbol.for('yuyeon.data-table.header');\n\ntype HeaderProps = {\n headers: DeepReadonly<DataTableHeader[]> | undefined;\n};\n\nexport function createHeader(\n props: HeaderProps,\n options?: {\n enableSelect?: Ref<boolean>;\n },\n) {\n const headers = ref<InternalDataTableHeader[][]>([]);\n const columns = ref<InternalDataTableHeader[]>([]);\n\n watchEffect(() => {\n const rows = props.headers?.length\n ? [props.headers as DataTableHeader[]]\n : [];\n const flat = rows.flatMap((row, index) =>\n row.map((column) => ({ column, rowIndex: index })),\n );\n const rowCount = rows.length;\n const defaultHeader = { text: '', sortable: false };\n const defaultActionHeader = { ...defaultHeader, width: 48 };\n\n if (options?.enableSelect?.value) {\n const foundIndex = flat.findIndex(\n ({ column }) => column.key === 'data-table-select',\n );\n if (foundIndex < 0) {\n const fixed = flat.some(({ column }) => !!column?.fixed);\n flat.unshift({\n column: {\n ...defaultActionHeader,\n key: 'data-table-select',\n rowspan: rowCount,\n fixed,\n },\n rowIndex: 0,\n });\n } else {\n flat.splice(foundIndex, 1, {\n column: {\n ...defaultActionHeader,\n ...flat[foundIndex].column,\n },\n rowIndex: flat[foundIndex].rowIndex,\n });\n }\n }\n\n const fixedRows: InternalDataTableHeader[][] = getRangeArr(rowCount).map(\n () => [],\n );\n const fixedOffsets = getRangeArr(rowCount).fill(0);\n\n flat.forEach(({ column, rowIndex }) => {\n const { key } = column;\n for (\n let i = rowIndex;\n i <= rowIndex + (column.rowspan ?? 1) - 1;\n i += 1\n ) {\n fixedRows[i].push({\n ...column,\n key,\n fixedOffset: fixedOffsets[i],\n sortable: column.sortable ?? !!key,\n });\n fixedOffsets[i] += Number(column.width ?? 0);\n }\n });\n\n fixedRows.forEach((row) => {\n for (let i = row.length; (i -= 1); i >= 0) {\n if (row[i].fixed) {\n row[i].lastFixed = true;\n return;\n }\n }\n });\n\n const seen = new Set();\n headers.value = fixedRows.map((row) => {\n const filtered = [];\n for (const column of row) {\n if (!seen.has(column.key)) {\n seen.add(column.key);\n filtered.push(column);\n }\n }\n return filtered;\n });\n\n columns.value = fixedRows.at(-1) ?? [];\n });\n\n const data = { headers, columns };\n\n provide(Y_DATA_TABLE_HEADER_KEY, data);\n\n return data;\n}\n\nexport function useHeader() {\n const data = inject(Y_DATA_TABLE_HEADER_KEY);\n if (!data) {\n throw new Error(`Not provided: ${Y_DATA_TABLE_HEADER_KEY.description}`);\n }\n return data;\n}\n"],"mappings":"AAA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,CAAA,EAAG;EAC1B,MAAMD,IAAI,GAAG7D,MAAM,CAACW,uBAAuB,CAAC;EAC5C,IAAI,CAACkD,IAAI,EAAE;IACT,MAAM,IAAIE,KAAK,CAAE,iBAAgBpD,uBAAuB,CAACqD,WAAY,EAAC,CAAC;EACzE;EACA,OAAOH,IAAI;AACb"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
import { useResizeObserver } from "../../../composables/index.mjs";
|
|
3
|
+
export function useRectMeasure() {
|
|
4
|
+
const containerRect = ref();
|
|
5
|
+
const wrapperRect = ref();
|
|
6
|
+
const tableRect = ref();
|
|
7
|
+
const {
|
|
8
|
+
resizeObservedRef: containerRef
|
|
9
|
+
} = useResizeObserver(entries => {
|
|
10
|
+
requestAnimationFrame(() => {
|
|
11
|
+
containerRect.value = entries?.[0]?.contentRect;
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
const {
|
|
15
|
+
resizeObservedRef: wrapperRef
|
|
16
|
+
} = useResizeObserver(entries => {
|
|
17
|
+
requestAnimationFrame(() => {
|
|
18
|
+
wrapperRect.value = entries?.[0]?.contentRect;
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
const {
|
|
22
|
+
resizeObservedRef: tableRef
|
|
23
|
+
} = useResizeObserver(entries => {
|
|
24
|
+
requestAnimationFrame(() => {
|
|
25
|
+
tableRect.value = entries?.[0]?.contentRect;
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
containerRef,
|
|
30
|
+
wrapperRef,
|
|
31
|
+
tableRef,
|
|
32
|
+
containerRect,
|
|
33
|
+
wrapperRect,
|
|
34
|
+
tableRect
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=measure.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measure.mjs","names":["ref","useResizeObserver","useRectMeasure","containerRect","wrapperRect","tableRect","resizeObservedRef","containerRef","entries","requestAnimationFrame","value","contentRect","wrapperRef","tableRef"],"sources":["../../../../src/components/table/composibles/measure.ts"],"sourcesContent":["import { ref } from 'vue';\r\nimport { useResizeObserver } from '@/composables';\r\n\r\nexport function useRectMeasure() {\r\n const containerRect = ref<DOMRectReadOnly>();\r\n const wrapperRect = ref<DOMRectReadOnly>();\r\n const tableRect = ref<DOMRectReadOnly>();\r\n\r\n const { resizeObservedRef: containerRef } = useResizeObserver((entries) => {\r\n requestAnimationFrame(() => {\r\n containerRect.value = entries?.[0]?.contentRect;\r\n })\r\n });\r\n\r\n const { resizeObservedRef: wrapperRef } = useResizeObserver((entries) => {\r\n requestAnimationFrame(() => {\r\n wrapperRect.value = entries?.[0]?.contentRect;\r\n })\r\n });\r\n\r\n const { resizeObservedRef: tableRef } = useResizeObserver((entries) => {\r\n requestAnimationFrame(() => {\r\n tableRect.value = entries?.[0]?.contentRect;\r\n })\r\n });\r\n\r\n return {\r\n containerRef,\r\n wrapperRef,\r\n tableRef,\r\n containerRect,\r\n wrapperRect,\r\n tableRect,\r\n }\r\n}\r\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,KAAK;AAAC,SACjBC,iBAAiB;AAE1B,OAAO,SAASC,cAAcA,CAAA,EAAG;EAC/B,MAAMC,aAAa,GAAGH,GAAG,CAAkB,CAAC;EAC5C,MAAMI,WAAW,GAAGJ,GAAG,CAAkB,CAAC;EAC1C,MAAMK,SAAS,GAAGL,GAAG,CAAkB,CAAC;EAExC,MAAM;IAAEM,iBAAiB,EAAEC;EAAa,CAAC,GAAGN,iBAAiB,CAAEO,OAAO,IAAK;IACzEC,qBAAqB,CAAC,MAAM;MAC1BN,aAAa,CAACO,KAAK,GAAGF,OAAO,GAAG,CAAC,CAAC,EAAEG,WAAW;IACjD,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,MAAM;IAAEL,iBAAiB,EAAEM;EAAW,CAAC,GAAGX,iBAAiB,CAAEO,OAAO,IAAK;IACvEC,qBAAqB,CAAC,MAAM;MAC1BL,WAAW,CAACM,KAAK,GAAGF,OAAO,GAAG,CAAC,CAAC,EAAEG,WAAW;IAC/C,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,MAAM;IAAEL,iBAAiB,EAAEO;EAAS,CAAC,GAAGZ,iBAAiB,CAAEO,OAAO,IAAK;IACrEC,qBAAqB,CAAC,MAAM;MAC1BJ,SAAS,CAACK,KAAK,GAAGF,OAAO,GAAG,CAAC,CAAC,EAAEG,WAAW;IAC7C,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAO;IACLJ,YAAY;IACZK,UAAU;IACVC,QAAQ;IACRV,aAAa;IACbC,WAAW;IACXC;EACF,CAAC;AACH"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { computed, inject, provide } from 'vue';
|
|
2
2
|
import { useModelDuplex } from "../../../composables/communication.mjs";
|
|
3
3
|
import { wrapInArray } from "../../../util/array.mjs";
|
|
4
|
-
import { deepEqual } from "../../../util/common.mjs";
|
|
4
|
+
import { deepEqual, getPropertyFromItem } from "../../../util/common.mjs";
|
|
5
5
|
import { propsFactory } from "../../../util/component/index.mjs";
|
|
6
6
|
export const pressDataTableSelectionProps = propsFactory({
|
|
7
7
|
enableSelect: Boolean,
|
|
@@ -13,9 +13,9 @@ export const pressDataTableSelectionProps = propsFactory({
|
|
|
13
13
|
type: Array,
|
|
14
14
|
default: () => []
|
|
15
15
|
},
|
|
16
|
-
|
|
17
|
-
type: Function,
|
|
18
|
-
default: deepEqual
|
|
16
|
+
itemComparator: {
|
|
17
|
+
type: [Function, String],
|
|
18
|
+
default: () => deepEqual
|
|
19
19
|
}
|
|
20
20
|
}, 'YDataTable--selection');
|
|
21
21
|
const singleSelectStrategy = {
|
|
@@ -107,7 +107,15 @@ export function provideSelection(props, _ref9) {
|
|
|
107
107
|
} = _ref9;
|
|
108
108
|
const selected = useModelDuplex(props, 'modelValue', props.modelValue, v => {
|
|
109
109
|
return new Set(wrapInArray(v).map(v => {
|
|
110
|
-
return allItems.value.find(item =>
|
|
110
|
+
return allItems.value.find(item => {
|
|
111
|
+
const {
|
|
112
|
+
itemComparator
|
|
113
|
+
} = props;
|
|
114
|
+
if (typeof itemComparator === 'function') {
|
|
115
|
+
itemComparator(v, item.value);
|
|
116
|
+
}
|
|
117
|
+
return getPropertyFromItem(v, props.itemKey) === item.key;
|
|
118
|
+
})?.value ?? v;
|
|
111
119
|
}));
|
|
112
120
|
}, v => {
|
|
113
121
|
return [...v.values()];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection.mjs","names":["computed","inject","provide","useModelDuplex","wrapInArray","deepEqual","propsFactory","pressDataTableSelectionProps","enableSelect","Boolean","selectStrategy","type","String","Object","default","modelValue","Array","valueEqual","Function","singleSelectStrategy","showSelectAll","allSelected","select","_ref","items","value","Set","selectAll","_ref2","selected","pageSelectStrategy","_ref3","pageItems","_ref4","item","add","delete","_ref5","allSelectStrategy","_ref6","allItems","_ref7","_ref8","Y_DATA_TABLE_SELECTION_KEY","Symbol","for","provideSelection","props","_ref9","v","map","find","values","allSelectables","filter","selectable","pageSelectables","isSelected","every","has","isSomeSelected","some","toggleSelect","selectables","someSelected","data","useSelection","Error","description"],"sources":["../../../../src/components/table/composibles/selection.ts"],"sourcesContent":["import {\n type InjectionKey,\n type PropType,\n type Ref,\n computed,\n inject,\n provide,\n} from 'vue';\n\nimport { useModelDuplex } from '@/composables/communication';\nimport { wrapInArray } from '@/util/array';\nimport { deepEqual } from '@/util/common';\nimport { propsFactory } from '@/util/component';\n\nimport { DataTableProvideSelectionData } from '../types';\nimport { DataTableItemsProps } from './items';\n\nexport interface SelectableItem {\n key: string;\n value: any;\n selectable: boolean;\n}\n\nexport interface DataTableSelectStrategy {\n showSelectAll: boolean;\n allSelected: (data: {\n allItems: SelectableItem[];\n pageItems: SelectableItem[];\n }) => SelectableItem[];\n select: (data: {\n items: SelectableItem[];\n value: boolean;\n selected: Set<unknown>;\n }) => Set<unknown>;\n selectAll: (data: {\n value: boolean;\n allItems: SelectableItem[];\n pageItems: SelectableItem[];\n selected: Set<unknown>;\n }) => Set<unknown>;\n}\n\nexport const pressDataTableSelectionProps = propsFactory(\n {\n enableSelect: Boolean,\n selectStrategy: {\n type: [String, Object] as PropType<'single' | 'page' | 'all'>,\n default: 'page',\n },\n modelValue: {\n type: Array as PropType<readonly any[]>,\n default: () => [],\n },\n valueEqual: {\n type: Function as PropType<typeof deepEqual>,\n default: deepEqual,\n },\n },\n 'YDataTable--selection',\n);\n\ntype DataTableSelectionProps = Pick<DataTableItemsProps, 'itemKey'> & {\n modelValue: readonly any[];\n selectStrategy: 'single' | 'page' | 'all';\n 'onUpdate:modelValue': ((value: any[]) => void) | undefined;\n valueEqual: (a: any, b: any) => boolean;\n};\n\nconst singleSelectStrategy: DataTableSelectStrategy = {\n showSelectAll: false,\n allSelected: () => [],\n select: ({ items, value }) => {\n return new Set(value ? [items[0]?.value] : []);\n },\n selectAll: ({ selected }) => selected,\n};\n\nconst pageSelectStrategy: DataTableSelectStrategy = {\n showSelectAll: true,\n allSelected: ({ pageItems }) => pageItems,\n select: ({ items, value, selected }) => {\n for (const item of items) {\n if (value) selected.add(item.value);\n else selected.delete(item.value);\n }\n\n return selected;\n },\n selectAll: ({ value, pageItems, selected }) =>\n pageSelectStrategy.select({ items: pageItems, value, selected }),\n};\n\nconst allSelectStrategy: DataTableSelectStrategy = {\n showSelectAll: true,\n allSelected: ({ allItems }) => allItems,\n select: ({ items, value, selected }) => {\n for (const item of items) {\n if (value) selected.add(item.value);\n else selected.delete(item.value);\n }\n\n return selected;\n },\n selectAll: ({ value, allItems, selected }) =>\n allSelectStrategy.select({ items: allItems, value, selected }),\n};\n\nexport const Y_DATA_TABLE_SELECTION_KEY: InjectionKey<\n ReturnType<typeof provideSelection>\n> = Symbol.for('yuyeon.data-table.selection');\n\nexport function provideSelection(\n props: DataTableSelectionProps,\n {\n allItems,\n pageItems,\n }: { allItems: Ref<SelectableItem[]>; pageItems: Ref<SelectableItem[]> },\n) {\n const selected = useModelDuplex(\n props,\n 'modelValue',\n props.modelValue,\n (v) => {\n return new Set(\n wrapInArray(v).map((v) => {\n return (\n allItems.value.find((item) => props.valueEqual(v, item.value))\n ?.value ?? v\n );\n }),\n );\n },\n (v) => {\n return [...v.values()];\n },\n );\n\n const allSelectables = computed(() =>\n allItems.value.filter((item) => item.selectable),\n );\n\n const pageSelectables = computed(() =>\n pageItems.value.filter((item) => item.selectable),\n );\n\n const selectStrategy = computed(() => {\n if (typeof props.selectStrategy === 'object') {\n return props.selectStrategy;\n }\n switch (props.selectStrategy) {\n case 'single':\n return singleSelectStrategy;\n case 'all':\n return allSelectStrategy;\n case 'page':\n default:\n return pageSelectStrategy;\n }\n });\n\n function isSelected(items: SelectableItem | SelectableItem[]) {\n return wrapInArray(items).every((item) => selected.value.has(item.value));\n }\n\n function isSomeSelected(items: SelectableItem | SelectableItem[]) {\n return wrapInArray(items).some((item) => selected.value.has(item.value));\n }\n\n function select(items: SelectableItem[], value: boolean) {\n selected.value = selectStrategy.value.select({\n items,\n value,\n selected: new Set(selected.value),\n });\n }\n\n function toggleSelect(item: SelectableItem) {\n select([item], !isSelected([item]));\n }\n\n function selectAll(value: boolean) {\n selected.value = selectStrategy.value.selectAll({\n value,\n allItems: allSelectables.value,\n pageItems: pageSelectables.value,\n selected: new Set(selected.value),\n });\n }\n\n const selectables = computed(() => {\n return selectStrategy.value.allSelected({\n allItems: allSelectables.value,\n pageItems: pageSelectables.value,\n });\n });\n\n const someSelected = computed(() => {\n return isSomeSelected(pageSelectables.value);\n });\n\n const allSelected = computed(() => {\n return isSelected(selectables.value);\n });\n\n const data: DataTableProvideSelectionData = {\n toggleSelect,\n select,\n selectAll,\n isSelected,\n isSomeSelected,\n someSelected,\n allSelected,\n showSelectAll: selectStrategy.value.showSelectAll,\n selectables,\n };\n\n provide(Y_DATA_TABLE_SELECTION_KEY, data);\n\n return data;\n}\n\nexport function useSelection() {\n const data = inject(Y_DATA_TABLE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C/B;IAC7B,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,MAAMuC,YAAY,GAAGhE,QAAQ,CAAC,MAAM;IAClC,OAAO4D,cAAc,CAACJ,eAAe,CAAC/B,KAAK,CAAC;EAC9C,CAAC,CAAC;EAEF,MAAMJ,WAAW,GAAGrB,QAAQ,CAAC,MAAM;IACjC,OAAOyD,UAAU,CAACM,WAAW,CAACtC,KAAK,CAAC;EACtC,CAAC,CAAC;EAEF,MAAMwC,IAAmC,GAAG;IAC1CH,YAAY;IACZxC,MAAM;IACNK,SAAS;IACT8B,UAAU;IACVG,cAAc;IACdI,YAAY;IACZ3C,WAAW;IACXD,aAAa,EAAEV,cAAc,CAACe,KAAK,CAACL,aAAa;IACjD2C;EACF,CAAC;EAED7D,OAAO,CAACyC,0BAA0B,EAAEsB,IAAI,CAAC;EAEzC,OAAOA,IAAI;AACb;AAEA,OAAO,SAASC,YAAYA,CAAA,EAAG;EAC7B,MAAMD,IAAI,GAAGhE,MAAM,CAAC0C,0BAA0B,CAAC;EAC/C,IAAI,CAACsB,IAAI,EAAE;IACT,MAAM,IAAIE,KAAK,CAAE,iBAAgBxB,0BAA0B,CAACyB,WAAY,EAAC,CAAC;EAC5E;EAEA,OAAOH,IAAI;AACb"}
|
|
1
|
+
{"version":3,"file":"selection.mjs","names":["computed","inject","provide","useModelDuplex","wrapInArray","deepEqual","getPropertyFromItem","propsFactory","pressDataTableSelectionProps","enableSelect","Boolean","selectStrategy","type","String","Object","default","modelValue","Array","itemComparator","Function","singleSelectStrategy","showSelectAll","allSelected","select","_ref","items","value","Set","selectAll","_ref2","selected","pageSelectStrategy","_ref3","pageItems","_ref4","item","add","delete","_ref5","allSelectStrategy","_ref6","allItems","_ref7","_ref8","Y_DATA_TABLE_SELECTION_KEY","Symbol","for","provideSelection","props","_ref9","v","map","find","itemKey","key","values","allSelectables","filter","selectable","pageSelectables","isSelected","every","has","isSomeSelected","some","toggleSelect","selectables","someSelected","data","useSelection","Error","description"],"sources":["../../../../src/components/table/composibles/selection.ts"],"sourcesContent":["import {\n type InjectionKey,\n type PropType,\n type Ref,\n computed,\n inject,\n provide,\n} from 'vue';\n\nimport { useModelDuplex } from '@/composables/communication';\nimport { wrapInArray } from '@/util/array';\nimport { deepEqual, getPropertyFromItem } from '@/util/common';\nimport { propsFactory } from '@/util/component';\n\nimport { DataTableProvideSelectionData } from '../types';\nimport { DataTableItemsProps } from './items';\n\nexport interface SelectableItem {\n key: string;\n value: any;\n selectable: boolean;\n}\n\nexport interface DataTableSelectStrategy {\n showSelectAll: boolean;\n allSelected: (data: {\n allItems: SelectableItem[];\n pageItems: SelectableItem[];\n }) => SelectableItem[];\n select: (data: {\n items: SelectableItem[];\n value: boolean;\n selected: Set<unknown>;\n }) => Set<unknown>;\n selectAll: (data: {\n value: boolean;\n allItems: SelectableItem[];\n pageItems: SelectableItem[];\n selected: Set<unknown>;\n }) => Set<unknown>;\n}\n\nexport const pressDataTableSelectionProps = propsFactory(\n {\n enableSelect: Boolean,\n selectStrategy: {\n type: [String, Object] as PropType<'single' | 'page' | 'all'>,\n default: 'page',\n },\n modelValue: {\n type: Array as PropType<readonly any[]>,\n default: () => [],\n },\n itemComparator: {\n type: [Function, String] as PropType<typeof deepEqual | string>,\n default: () => deepEqual,\n },\n },\n 'YDataTable--selection',\n);\n\ntype DataTableSelectionProps = Pick<DataTableItemsProps, 'itemKey'> & {\n modelValue: readonly any[];\n selectStrategy: 'single' | 'page' | 'all';\n 'onUpdate:modelValue': ((value: any[]) => void) | undefined;\n itemComparator: ((a: any, b: any) => boolean) | string;\n};\n\nconst singleSelectStrategy: DataTableSelectStrategy = {\n showSelectAll: false,\n allSelected: () => [],\n select: ({ items, value }) => {\n return new Set(value ? [items[0]?.value] : []);\n },\n selectAll: ({ selected }) => selected,\n};\n\nconst pageSelectStrategy: DataTableSelectStrategy = {\n showSelectAll: true,\n allSelected: ({ pageItems }) => pageItems,\n select: ({ items, value, selected }) => {\n for (const item of items) {\n if (value) selected.add(item.value);\n else selected.delete(item.value);\n }\n\n return selected;\n },\n selectAll: ({ value, pageItems, selected }) =>\n pageSelectStrategy.select({ items: pageItems, value, selected }),\n};\n\nconst allSelectStrategy: DataTableSelectStrategy = {\n showSelectAll: true,\n allSelected: ({ allItems }) => allItems,\n select: ({ items, value, selected }) => {\n for (const item of items) {\n if (value) selected.add(item.value);\n else selected.delete(item.value);\n }\n\n return selected;\n },\n selectAll: ({ value, allItems, selected }) =>\n allSelectStrategy.select({ items: allItems, value, selected }),\n};\n\nexport const Y_DATA_TABLE_SELECTION_KEY: InjectionKey<\n ReturnType<typeof provideSelection>\n> = Symbol.for('yuyeon.data-table.selection');\n\nexport function provideSelection(\n props: DataTableSelectionProps,\n {\n allItems,\n pageItems,\n }: { allItems: Ref<SelectableItem[]>; pageItems: Ref<SelectableItem[]> },\n) {\n const selected = useModelDuplex(\n props,\n 'modelValue',\n props.modelValue,\n (v) => {\n return new Set(\n wrapInArray(v).map((v) => {\n return (\n allItems.value.find((item) => {\n const { itemComparator } = props;\n if (typeof itemComparator === 'function') {\n itemComparator(v, item.value);\n }\n return getPropertyFromItem(v, props.itemKey) === item.key;\n })?.value ?? v\n );\n }),\n );\n },\n (v) => {\n return [...v.values()];\n },\n );\n\n const allSelectables = computed(() =>\n allItems.value.filter((item) => item.selectable),\n );\n\n const pageSelectables = computed(() =>\n pageItems.value.filter((item) => item.selectable),\n );\n\n const selectStrategy = computed(() => {\n if (typeof props.selectStrategy === 'object') {\n return props.selectStrategy;\n }\n switch (props.selectStrategy) {\n case 'single':\n return singleSelectStrategy;\n case 'all':\n return allSelectStrategy;\n case 'page':\n default:\n return pageSelectStrategy;\n }\n });\n\n function isSelected(items: SelectableItem | SelectableItem[]) {\n return wrapInArray(items).every((item) => selected.value.has(item.value));\n }\n\n function isSomeSelected(items: SelectableItem | SelectableItem[]) {\n return wrapInArray(items).some((item) => selected.value.has(item.value));\n }\n\n function select(items: SelectableItem[], value: boolean) {\n selected.value = selectStrategy.value.select({\n items,\n value,\n selected: new Set(selected.value),\n });\n }\n\n function toggleSelect(item: SelectableItem) {\n select([item], !isSelected([item]));\n }\n\n function selectAll(value: boolean) {\n selected.value = selectStrategy.value.selectAll({\n value,\n allItems: allSelectables.value,\n pageItems: pageSelectables.value,\n selected: new Set(selected.value),\n });\n }\n\n const selectables = computed(() => {\n return selectStrategy.value.allSelected({\n allItems: allSelectables.value,\n pageItems: pageSelectables.value,\n });\n });\n\n const someSelected = computed(() => {\n return isSomeSelected(pageSelectables.value);\n });\n\n const allSelected = computed(() => {\n return isSelected(selectables.value);\n });\n\n const data: DataTableProvideSelectionData = {\n toggleSelect,\n select,\n selectAll,\n isSelected,\n isSomeSelected,\n someSelected,\n allSelected,\n showSelectAll: selectStrategy.value.showSelectAll,\n selectables,\n };\n\n provide(Y_DATA_TABLE_SELECTION_KEY, data);\n\n return data;\n}\n\nexport function useSelection() {\n const data = inject(Y_DATA_TABLE_SELECTION_KEY);\n if (!data) {\n throw new Error(`Not provided: ${Y_DATA_TABLE_SELECTION_KEY.description}`);\n }\n\n return data;\n}\n"],"mappings":"AAAA,SAIEA,QAAQ,EACRC,MAAM,EACNC,OAAO,QACF,KAAK;AAAC,SAEJC,cAAc;AAAA,SACdC,WAAW;AAAA,SACXC,SAAS,EAAEC,mBAAmB;AAAA,SAC9BC,YAAY;AA8BrB,OAAO,MAAMC,4BAA4B,GAAGD,YAAY,CACtD;EACEE,YAAY,EAAEC,OAAO;EACrBC,cAAc,EAAE;IACdC,IAAI,EAAE,CAACC,MAAM,EAAEC,MAAM,CAAwC;IAC7DC,OAAO,EAAE;EACX,CAAC;EACDC,UAAU,EAAE;IACVJ,IAAI,EAAEK,KAAiC;IACvCF,OAAO,EAAEA,CAAA,KAAM;EACjB,CAAC;EACDG,cAAc,EAAE;IACdN,IAAI,EAAE,CAACO,QAAQ,EAAEN,MAAM,CAAwC;IAC/DE,OAAO,EAAEA,CAAA,KAAMV;EACjB;AACF,CAAC,EACD,uBACF,CAAC;AASD,MA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IACXD,aAAa,EAAEV,cAAc,CAACe,KAAK,CAACL,aAAa;IACjD6C;EACF,CAAC;EAEDhE,OAAO,CAAC0C,0BAA0B,EAAEwB,IAAI,CAAC;EAEzC,OAAOA,IAAI;AACb;AAEA,OAAO,SAASC,YAAYA,CAAA,EAAG;EAC7B,MAAMD,IAAI,GAAGnE,MAAM,CAAC2C,0BAA0B,CAAC;EAC/C,IAAI,CAACwB,IAAI,EAAE;IACT,MAAM,IAAIE,KAAK,CAAE,iBAAgB1B,0BAA0B,CAAC2B,WAAY,EAAC,CAAC;EAC5E;EAEA,OAAOH,IAAI;AACb"}
|
package/lib/index.mjs
CHANGED
|
@@ -33,7 +33,7 @@ export function init() {
|
|
|
33
33
|
date: dateModule,
|
|
34
34
|
defaults: defaultsModule
|
|
35
35
|
});
|
|
36
|
-
Object.keys(components).forEach(componentName => {
|
|
36
|
+
Object.keys(options?.components ?? components).forEach(componentName => {
|
|
37
37
|
const comp = components[componentName];
|
|
38
38
|
if (typeof comp === 'object' && 'name' in comp) app.component(componentName, comp);
|
|
39
39
|
});
|
package/lib/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["getCurrentInstance","nextTick","reactive","components","YUYEON_DATE_KEY","YUYEON_DATE_OPTIONS_KEY","createDateModule","createDefaultsModule","YUYEON_DEFAULTS_KEY","createI18nModule","YUYEON_I18N_KEY","YUYEON_ICON_KEY","createIconModule","YUYEON_THEME_KEY","createThemeModule","useTheme","PlateWave","YUYEON_LOGO","defaultOptions","credit","init","options","arguments","length","undefined","defaultsModule","defaults","themeModule","theme","i18nModule","i18n","dateModule","date","localeModule","iconModule","icon","install","app","yuyeon","root","instance","rtlModule","Object","keys","forEach","componentName","comp","component","directive","provide","config","globalProperties","$yuyeon","_container","_instance","classList","add","setAttribute","console","log","unmount","mount","vm","scope","stop","useYuyeon","Error","appContext"],"sources":["../src/index.ts"],"sourcesContent":["import type { App, Component, ComponentInternalInstance } from 'vue';\nimport { getCurrentInstance, nextTick, reactive } from 'vue';\n\nimport * as components from '@/components';\nimport {\n YUYEON_DATE_KEY,\n YUYEON_DATE_OPTIONS_KEY,\n createDateModule,\n} from '@/composables/date';\nimport { createDefaultsModule } from '@/composables/defaults';\nimport { YUYEON_DEFAULTS_KEY } from '@/composables/defaults/share';\nimport { createI18nModule } from '@/composables/i18n';\nimport { YUYEON_I18N_KEY } from '@/composables/i18n/share';\nimport { YUYEON_ICON_KEY, createIconModule } from '@/composables/icon';\nimport {\n YUYEON_THEME_KEY,\n createThemeModule,\n useTheme,\n} from '@/composables/theme';\nimport PlateWave from '@/directives/plate-wave';\nimport { YUYEON_LOGO } from '@/etc';\n\nimport './styles/base.scss';\n\nconst defaultOptions = {\n credit: true,\n};\n\ndeclare module 'vue' {\n interface ComponentCustomProperties {\n $yuyeon: any;\n }\n}\n\nexport function init(options: any = defaultOptions) {\n const defaultsModule = createDefaultsModule(options?.defaults);\n const themeModule = createThemeModule(options?.theme);\n const i18nModule = createI18nModule(options?.i18n);\n const dateModule = createDateModule(options?.date, i18nModule.localeModule);\n const iconModule = createIconModule(options?.icon);\n const install = (app: App)
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["getCurrentInstance","nextTick","reactive","components","YUYEON_DATE_KEY","YUYEON_DATE_OPTIONS_KEY","createDateModule","createDefaultsModule","YUYEON_DEFAULTS_KEY","createI18nModule","YUYEON_I18N_KEY","YUYEON_ICON_KEY","createIconModule","YUYEON_THEME_KEY","createThemeModule","useTheme","PlateWave","YUYEON_LOGO","defaultOptions","credit","init","options","arguments","length","undefined","defaultsModule","defaults","themeModule","theme","i18nModule","i18n","dateModule","date","localeModule","iconModule","icon","install","app","yuyeon","root","instance","rtlModule","Object","keys","forEach","componentName","comp","component","directive","provide","config","globalProperties","$yuyeon","_container","_instance","classList","add","setAttribute","console","log","unmount","mount","vm","scope","stop","useYuyeon","Error","appContext"],"sources":["../src/index.ts"],"sourcesContent":["import type { App, Component, ComponentInternalInstance } from 'vue';\nimport { getCurrentInstance, nextTick, reactive } from 'vue';\n\nimport * as components from '@/components';\nimport {\n YUYEON_DATE_KEY,\n YUYEON_DATE_OPTIONS_KEY,\n createDateModule,\n} from '@/composables/date';\nimport { createDefaultsModule } from '@/composables/defaults';\nimport { YUYEON_DEFAULTS_KEY } from '@/composables/defaults/share';\nimport { createI18nModule } from '@/composables/i18n';\nimport { YUYEON_I18N_KEY } from '@/composables/i18n/share';\nimport { YUYEON_ICON_KEY, createIconModule } from '@/composables/icon';\nimport {\n YUYEON_THEME_KEY,\n createThemeModule,\n useTheme,\n} from '@/composables/theme';\nimport PlateWave from '@/directives/plate-wave';\nimport { YUYEON_LOGO } from '@/etc';\n\nimport './styles/base.scss';\n\nconst defaultOptions = {\n credit: true,\n};\n\ndeclare module 'vue' {\n interface ComponentCustomProperties {\n $yuyeon: any;\n }\n}\n\nexport function init(options: any = defaultOptions) {\n const defaultsModule = createDefaultsModule(options?.defaults);\n const themeModule = createThemeModule(options?.theme);\n const i18nModule = createI18nModule(options?.i18n);\n const dateModule = createDateModule(options?.date, i18nModule.localeModule);\n const iconModule = createIconModule(options?.icon);\n const install = (app: App) => {\n themeModule.install(app);\n\n const yuyeon = reactive({\n app: null as ComponentInternalInstance | null,\n root: null as HTMLElement | null,\n theme: themeModule.instance,\n i18n: {\n ...i18nModule.localeModule,\n ...i18nModule.rtlModule,\n },\n date: dateModule,\n defaults: defaultsModule,\n });\n\n Object.keys(options?.components ?? components).forEach((componentName) => {\n const comp = components[componentName as keyof typeof components];\n if (typeof comp === 'object' && 'name' in comp)\n app.component(componentName, comp as Component);\n });\n\n app.directive('plate-wave', PlateWave);\n\n app.provide(YUYEON_DEFAULTS_KEY, defaultsModule);\n app.provide(YUYEON_THEME_KEY, themeModule.instance);\n app.provide(YUYEON_ICON_KEY, iconModule);\n app.provide(YUYEON_I18N_KEY, {\n ...i18nModule.localeModule,\n ...i18nModule.rtlModule,\n });\n app.provide(YUYEON_DATE_OPTIONS_KEY, dateModule.options);\n app.provide(YUYEON_DATE_KEY, dateModule.instance);\n\n app.config.globalProperties.$yuyeon = yuyeon;\n\n nextTick(() => {\n yuyeon.root = app._container;\n yuyeon.app = app._instance as any;\n if (yuyeon.root) {\n yuyeon.root.classList.add('y-root');\n yuyeon.root.setAttribute('data-y-root', '');\n themeModule.init(yuyeon);\n }\n });\n\n if (options?.credit) {\n console.log(YUYEON_LOGO);\n }\n const { unmount, mount } = app;\n app.mount = (...args) => {\n const vm = mount(...args);\n if (!yuyeon.app) {\n yuyeon.app = app._instance as any;\n }\n if (!yuyeon.root) {\n nextTick(() => {\n yuyeon.root = app._container;\n if (yuyeon.root) {\n yuyeon.root.classList.add('y-root');\n yuyeon.root.setAttribute('data-y-root', '');\n themeModule.init(yuyeon);\n }\n });\n }\n app.mount = mount;\n return vm;\n };\n app.unmount = () => {\n unmount();\n themeModule.scope.stop();\n app.unmount = unmount;\n };\n };\n\n return {\n install,\n };\n}\n\nexport function useYuyeon() {\n const vm = getCurrentInstance();\n if (!vm) throw new Error('[yuyeon] Called outside of setup context');\n\n return vm.appContext.config.globalProperties.$yuyeon;\n}\n\nexport { useTheme };\n"],"mappings":"AACA,SAASA,kBAAkB,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,KAAK;AAAC,OAEtD,KAAKC,UAAU;AAAA,SAEpBC,eAAe,EACfC,uBAAuB,EACvBC,gBAAgB;AAAA,SAETC,oBAAoB;AAAA,SACpBC,mBAAmB;AAAA,SACnBC,gBAAgB;AAAA,SAChBC,eAAe;AAAA,SACfC,eAAe,EAAEC,gBAAgB;AAAA,SAExCC,gBAAgB,EAChBC,iBAAiB,EACjBC,QAAQ;AAAA,OAEHC,SAAS;AAAA,SACPC,WAAW;AAEpB;AAEA,MAAMC,cAAc,GAAG;EACrBC,MAAM,EAAE;AACV,CAAC;AAQD,OAAO,SAASC,IAAIA,CAAA,EAAgC;EAAA,IAA/BC,OAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAA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C,MAAM;UACbqC,MAAM,CAACC,IAAI,GAAGF,GAAG,CAACgB,UAAU;UAC5B,IAAIf,MAAM,CAACC,IAAI,EAAE;YACfD,MAAM,CAACC,IAAI,CAACgB,SAAS,CAACC,GAAG,CAAC,QAAQ,CAAC;YACnClB,MAAM,CAACC,IAAI,CAACkB,YAAY,CAAC,aAAa,EAAE,EAAE,CAAC;YAC3C9B,WAAW,CAACP,IAAI,CAACkB,MAAM,CAAC;UAC1B;QACF,CAAC,CAAC;MACJ;MACAD,GAAG,CAACwB,KAAK,GAAGA,KAAK;MACjB,OAAOC,EAAE;IACX,CAAC;IACDzB,GAAG,CAACuB,OAAO,GAAG,MAAM;MAClBA,OAAO,CAAC,CAAC;MACTjC,WAAW,CAACoC,KAAK,CAACC,IAAI,CAAC,CAAC;MACxB3B,GAAG,CAACuB,OAAO,GAAGA,OAAO;IACvB,CAAC;EACH,CAAC;EAED,OAAO;IACLxB;EACF,CAAC;AACH;AAEA,OAAO,SAAS6B,SAASA,CAAA,EAAG;EAC1B,MAAMH,EAAE,GAAG9D,kBAAkB,CAAC,CAAC;EAC/B,IAAI,CAAC8D,EAAE,EAAE,MAAM,IAAII,KAAK,CAAC,0CAA0C,CAAC;EAEpE,OAAOJ,EAAE,CAACK,UAAU,CAACjB,MAAM,CAACC,gBAAgB,CAACC,OAAO;AACtD;AAEA,SAASrC,QAAQ"}
|
package/lib/util/color/const.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const RGBA_REGEX = /rgb(a?)\((?<v>.*)\)/;
|
|
2
|
-
export const HEX_COLOR_REGEX =
|
|
2
|
+
export const HEX_COLOR_REGEX = /^#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/;
|
|
3
3
|
export const SRGB_TO_XYZ = [[0.41233895, 0.35762064, 0.18051042], [0.2126, 0.7152, 0.0722], [0.01932141, 0.11916382, 0.95034478]];
|
|
4
4
|
export const XYZ_TO_SRGB = [[3.2413774792388685, -1.5376652402851851, -0.49885366846268053], [-0.9691452513005321, 1.8758853451067872, 0.04156585616912061], [0.05562093689691305, -0.20395524564742123, 1.0571799111220335]];
|
|
5
5
|
export const WHITE_POINT_D65 = [95.047, 100.0, 108.883];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const.mjs","names":["RGBA_REGEX","HEX_COLOR_REGEX","SRGB_TO_XYZ","XYZ_TO_SRGB","WHITE_POINT_D65"],"sources":["../../../src/util/color/const.ts"],"sourcesContent":["export const RGBA_REGEX = /rgb(a?)\\((?<v>.*)\\)/;\r\nexport const HEX_COLOR_REGEX =
|
|
1
|
+
{"version":3,"file":"const.mjs","names":["RGBA_REGEX","HEX_COLOR_REGEX","SRGB_TO_XYZ","XYZ_TO_SRGB","WHITE_POINT_D65"],"sources":["../../../src/util/color/const.ts"],"sourcesContent":["export const RGBA_REGEX = /rgb(a?)\\((?<v>.*)\\)/;\r\nexport const HEX_COLOR_REGEX = /^#([A-Fa-f0-9]{3}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{8})$/;\r\n\r\nexport const SRGB_TO_XYZ = [\r\n [0.41233895, 0.35762064, 0.18051042],\r\n [0.2126, 0.7152, 0.0722],\r\n [0.01932141, 0.11916382, 0.95034478],\r\n];\r\n\r\nexport const XYZ_TO_SRGB = [\r\n [\r\n 3.2413774792388685,\r\n -1.5376652402851851,\r\n -0.49885366846268053,\r\n ],\r\n [\r\n -0.9691452513005321,\r\n 1.8758853451067872,\r\n 0.04156585616912061,\r\n ],\r\n [\r\n 0.05562093689691305,\r\n -0.20395524564742123,\r\n 1.0571799111220335,\r\n ],\r\n];\r\n\r\nexport const WHITE_POINT_D65 = [95.047, 100.0, 108.883];\r\n"],"mappings":"AAAA,OAAO,MAAMA,UAAU,GAAG,qBAAqB;AAC/C,OAAO,MAAMC,eAAe,GAAG,mDAAmD;AAElF,OAAO,MAAMC,WAAW,GAAG,CACzB,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,EACpC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EACxB,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CACrC;AAED,OAAO,MAAMC,WAAW,GAAG,CACzB,CACE,kBAAkB,EAClB,CAAC,kBAAkB,EACnB,CAAC,mBAAmB,CACrB,EACD,CACE,CAAC,kBAAkB,EACnB,kBAAkB,EAClB,mBAAmB,CACpB,EACD,CACE,mBAAmB,EACnB,CAAC,mBAAmB,EACpB,kBAAkB,CACnB,CACF;AAED,OAAO,MAAMC,eAAe,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,25 +1,40 @@
|
|
|
1
1
|
|
|
2
|
+
export declare const pressYChipPropsOptions: <Defaults extends {
|
|
3
|
+
color?: unknown;
|
|
4
|
+
background?: unknown;
|
|
5
|
+
backgroundOpacity?: unknown;
|
|
6
|
+
small?: unknown;
|
|
7
|
+
} = {}>(defaults?: Defaults | undefined) => {
|
|
8
|
+
color: unknown extends Defaults["color"] ? StringConstructor : {
|
|
9
|
+
type: import('vue').PropType<unknown extends Defaults["color"] ? string : string | Defaults["color"]>;
|
|
10
|
+
default: unknown extends Defaults["color"] ? string : string | Defaults["color"];
|
|
11
|
+
};
|
|
12
|
+
background: unknown extends Defaults["background"] ? StringConstructor : {
|
|
13
|
+
type: import('vue').PropType<unknown extends Defaults["background"] ? string : string | Defaults["background"]>;
|
|
14
|
+
default: unknown extends Defaults["background"] ? string : string | Defaults["background"];
|
|
15
|
+
};
|
|
16
|
+
backgroundOpacity: unknown extends Defaults["backgroundOpacity"] ? {
|
|
17
|
+
type: NumberConstructor;
|
|
18
|
+
default: number;
|
|
19
|
+
} : Omit<{
|
|
20
|
+
type: NumberConstructor;
|
|
21
|
+
default: number;
|
|
22
|
+
}, "type" | "default"> & {
|
|
23
|
+
type: import('vue').PropType<unknown extends Defaults["backgroundOpacity"] ? number : number | Defaults["backgroundOpacity"]>;
|
|
24
|
+
default: unknown extends Defaults["backgroundOpacity"] ? number : number | Defaults["backgroundOpacity"];
|
|
25
|
+
};
|
|
26
|
+
small: unknown extends Defaults["small"] ? BooleanConstructor : {
|
|
27
|
+
type: import('vue').PropType<unknown extends Defaults["small"] ? boolean : boolean | Defaults["small"]>;
|
|
28
|
+
default: unknown extends Defaults["small"] ? boolean : boolean | Defaults["small"];
|
|
29
|
+
};
|
|
30
|
+
};
|
|
2
31
|
export declare const YChip: import('vue').DefineComponent<{
|
|
3
32
|
color: StringConstructor;
|
|
4
33
|
background: StringConstructor;
|
|
5
|
-
|
|
6
|
-
bgOpacity: {
|
|
34
|
+
backgroundOpacity: {
|
|
7
35
|
type: NumberConstructor;
|
|
8
36
|
default: number;
|
|
9
37
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
classes(): {
|
|
13
|
-
'y-chip': boolean;
|
|
14
|
-
'y-chip--small': boolean;
|
|
15
|
-
'y-chip--clickable': boolean;
|
|
16
|
-
};
|
|
17
|
-
backgroundColor(): string;
|
|
18
|
-
styles(): {
|
|
19
|
-
color: string | undefined;
|
|
20
|
-
background: string;
|
|
21
|
-
};
|
|
22
|
-
}, {
|
|
23
|
-
colorRgb(color: string): string;
|
|
24
|
-
}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string>;
|
|
38
|
+
small: BooleanConstructor;
|
|
39
|
+
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string>;
|
|
25
40
|
export type YChip = InstanceType<typeof YChip>;
|
|
@@ -3,8 +3,7 @@ import { ListItem } from '../../composables/list-items';
|
|
|
3
3
|
import { deepEqual } from '../../util/common';
|
|
4
4
|
import { YIconIconProp } from '../icon';
|
|
5
5
|
|
|
6
|
-
export type
|
|
7
|
-
export declare function returnItemEquals(optionsItem: any, valueItem: any, valueKey?: string): boolean;
|
|
6
|
+
export type ItemComparator = (optionsItem: any, valueItem: any, valueKey?: string) => boolean;
|
|
8
7
|
export declare const pressSelectPropsOptions: <Defaults extends {
|
|
9
8
|
returnItem?: unknown;
|
|
10
9
|
items?: unknown;
|
|
@@ -13,8 +12,7 @@ export declare const pressSelectPropsOptions: <Defaults extends {
|
|
|
13
12
|
itemChildren?: unknown;
|
|
14
13
|
opened?: unknown;
|
|
15
14
|
multiple?: unknown;
|
|
16
|
-
|
|
17
|
-
valueEquals?: unknown;
|
|
15
|
+
itemComparator?: unknown;
|
|
18
16
|
defaultSelect?: unknown;
|
|
19
17
|
menuProps?: unknown;
|
|
20
18
|
} = {}>(defaults?: Defaults | undefined) => {
|
|
@@ -82,19 +80,15 @@ export declare const pressSelectPropsOptions: <Defaults extends {
|
|
|
82
80
|
type: PropType<unknown extends Defaults["multiple"] ? boolean : boolean | Defaults["multiple"]>;
|
|
83
81
|
default: unknown extends Defaults["multiple"] ? boolean : boolean | Defaults["multiple"];
|
|
84
82
|
};
|
|
85
|
-
|
|
86
|
-
type: PropType<
|
|
87
|
-
default: unknown extends Defaults["weakEquals"] ? boolean : boolean | Defaults["weakEquals"];
|
|
88
|
-
};
|
|
89
|
-
valueEquals: unknown extends Defaults["valueEquals"] ? {
|
|
90
|
-
type: PropType<SelectEquals>;
|
|
83
|
+
itemComparator: unknown extends Defaults["itemComparator"] ? {
|
|
84
|
+
type: PropType<ItemComparator>;
|
|
91
85
|
default: typeof deepEqual;
|
|
92
86
|
} : Omit<{
|
|
93
|
-
type: PropType<
|
|
87
|
+
type: PropType<ItemComparator>;
|
|
94
88
|
default: typeof deepEqual;
|
|
95
89
|
}, "type" | "default"> & {
|
|
96
|
-
type: PropType<unknown extends Defaults["
|
|
97
|
-
default: unknown extends Defaults["
|
|
90
|
+
type: PropType<unknown extends Defaults["itemComparator"] ? ItemComparator : ItemComparator | Defaults["itemComparator"]>;
|
|
91
|
+
default: unknown extends Defaults["itemComparator"] ? ItemComparator : ItemComparator | Defaults["itemComparator"];
|
|
98
92
|
};
|
|
99
93
|
defaultSelect: unknown extends Defaults["defaultSelect"] ? BooleanConstructor : {
|
|
100
94
|
type: PropType<unknown extends Defaults["defaultSelect"] ? boolean : boolean | Defaults["defaultSelect"]>;
|
|
@@ -1277,8 +1271,7 @@ export declare const pressYSelectPropsOptions: <Defaults extends {
|
|
|
1277
1271
|
itemChildren?: unknown;
|
|
1278
1272
|
opened?: unknown;
|
|
1279
1273
|
multiple?: unknown;
|
|
1280
|
-
|
|
1281
|
-
valueEquals?: unknown;
|
|
1274
|
+
itemComparator?: unknown;
|
|
1282
1275
|
defaultSelect?: unknown;
|
|
1283
1276
|
menuProps?: unknown;
|
|
1284
1277
|
maxHeight?: unknown;
|
|
@@ -1602,19 +1595,15 @@ export declare const pressYSelectPropsOptions: <Defaults extends {
|
|
|
1602
1595
|
type: PropType<unknown extends Defaults["multiple"] ? boolean : boolean | Defaults["multiple"]>;
|
|
1603
1596
|
default: unknown extends Defaults["multiple"] ? boolean : boolean | Defaults["multiple"];
|
|
1604
1597
|
};
|
|
1605
|
-
|
|
1606
|
-
type: PropType<
|
|
1607
|
-
default: unknown extends Defaults["weakEquals"] ? boolean : boolean | Defaults["weakEquals"];
|
|
1608
|
-
};
|
|
1609
|
-
valueEquals: unknown extends Defaults["valueEquals"] ? {
|
|
1610
|
-
type: PropType<SelectEquals>;
|
|
1598
|
+
itemComparator: unknown extends Defaults["itemComparator"] ? {
|
|
1599
|
+
type: PropType<ItemComparator>;
|
|
1611
1600
|
default: typeof deepEqual;
|
|
1612
1601
|
} : Omit<{
|
|
1613
|
-
type: PropType<
|
|
1602
|
+
type: PropType<ItemComparator>;
|
|
1614
1603
|
default: typeof deepEqual;
|
|
1615
1604
|
}, "type" | "default"> & {
|
|
1616
|
-
type: PropType<unknown extends Defaults["
|
|
1617
|
-
default: unknown extends Defaults["
|
|
1605
|
+
type: PropType<unknown extends Defaults["itemComparator"] ? ItemComparator : ItemComparator | Defaults["itemComparator"]>;
|
|
1606
|
+
default: unknown extends Defaults["itemComparator"] ? ItemComparator : ItemComparator | Defaults["itemComparator"];
|
|
1618
1607
|
};
|
|
1619
1608
|
defaultSelect: unknown extends Defaults["defaultSelect"] ? BooleanConstructor : {
|
|
1620
1609
|
type: PropType<unknown extends Defaults["defaultSelect"] ? boolean : boolean | Defaults["defaultSelect"]>;
|
|
@@ -2905,9 +2894,8 @@ export declare const YSelect: import('vue').DefineComponent<{
|
|
|
2905
2894
|
};
|
|
2906
2895
|
opened: PropType<boolean>;
|
|
2907
2896
|
multiple: BooleanConstructor;
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
type: PropType<SelectEquals>;
|
|
2897
|
+
itemComparator: {
|
|
2898
|
+
type: PropType<ItemComparator>;
|
|
2911
2899
|
default: typeof deepEqual;
|
|
2912
2900
|
};
|
|
2913
2901
|
defaultSelect: BooleanConstructor;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
|
|
3
|
+
export declare const pressYSliderPropsOptions: <Defaults extends {
|
|
4
|
+
modelValue?: unknown;
|
|
5
|
+
} = {}>(defaults?: Defaults | undefined) => {
|
|
6
|
+
modelValue: unknown extends Defaults["modelValue"] ? PropType<number> : {
|
|
7
|
+
type: PropType<unknown extends Defaults["modelValue"] ? number : number | Defaults["modelValue"]>;
|
|
8
|
+
default: unknown extends Defaults["modelValue"] ? number : number | Defaults["modelValue"];
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare const YSlider: import('vue').DefineComponent<{
|
|
12
|
+
modelValue: PropType<number>;
|
|
13
|
+
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
14
|
+
'update:modelValue': () => boolean;
|
|
15
|
+
}, string>;
|
|
16
|
+
export type YSlider = InstanceType<typeof YSlider>;
|
|
File without changes
|
|
@@ -14,7 +14,7 @@ export declare const pressDataTableProps: <Defaults extends {
|
|
|
14
14
|
enableSelect?: unknown;
|
|
15
15
|
selectStrategy?: unknown;
|
|
16
16
|
modelValue?: unknown;
|
|
17
|
-
|
|
17
|
+
itemComparator?: unknown;
|
|
18
18
|
sortBy?: unknown;
|
|
19
19
|
items?: unknown;
|
|
20
20
|
itemKey?: unknown;
|
|
@@ -127,15 +127,15 @@ export declare const pressDataTableProps: <Defaults extends {
|
|
|
127
127
|
type: PropType<unknown extends Defaults["modelValue"] ? readonly any[] : readonly any[] | Defaults["modelValue"]>;
|
|
128
128
|
default: unknown extends Defaults["modelValue"] ? readonly any[] : readonly any[] | Defaults["modelValue"];
|
|
129
129
|
};
|
|
130
|
-
|
|
131
|
-
type: PropType<typeof import('../../util').deepEqual>;
|
|
132
|
-
default: typeof import('../../util').deepEqual;
|
|
130
|
+
itemComparator: unknown extends Defaults["itemComparator"] ? {
|
|
131
|
+
type: PropType<string | typeof import('../../util').deepEqual>;
|
|
132
|
+
default: () => typeof import('../../util').deepEqual;
|
|
133
133
|
} : Omit<{
|
|
134
|
-
type: PropType<typeof import('../../util').deepEqual>;
|
|
135
|
-
default: typeof import('../../util').deepEqual;
|
|
134
|
+
type: PropType<string | typeof import('../../util').deepEqual>;
|
|
135
|
+
default: () => typeof import('../../util').deepEqual;
|
|
136
136
|
}, "type" | "default"> & {
|
|
137
|
-
type: PropType<unknown extends Defaults["
|
|
138
|
-
default: unknown extends Defaults["
|
|
137
|
+
type: PropType<unknown extends Defaults["itemComparator"] ? string | typeof import('../../util').deepEqual : NonNullable<string | typeof import('../../util').deepEqual> | Defaults["itemComparator"]>;
|
|
138
|
+
default: unknown extends Defaults["itemComparator"] ? string | typeof import('../../util').deepEqual : NonNullable<string | typeof import('../../util').deepEqual> | Defaults["itemComparator"];
|
|
139
139
|
};
|
|
140
140
|
sortBy: unknown extends Defaults["sortBy"] ? {
|
|
141
141
|
type: PropType<readonly {
|
|
@@ -385,9 +385,9 @@ export declare const YDataTable: import('vue').DefineComponent<{
|
|
|
385
385
|
type: PropType<readonly any[]>;
|
|
386
386
|
default: () => never[];
|
|
387
387
|
};
|
|
388
|
-
|
|
389
|
-
type: PropType<typeof import('../../util').deepEqual>;
|
|
390
|
-
default: typeof import('../../util').deepEqual;
|
|
388
|
+
itemComparator: {
|
|
389
|
+
type: PropType<string | typeof import('../../util').deepEqual>;
|
|
390
|
+
default: () => typeof import('../../util').deepEqual;
|
|
391
391
|
};
|
|
392
392
|
sortBy: {
|
|
393
393
|
type: PropType<readonly {
|
|
@@ -14,7 +14,7 @@ export declare const pressDataTableServerProps: <Defaults extends {
|
|
|
14
14
|
enableSelect?: unknown;
|
|
15
15
|
selectStrategy?: unknown;
|
|
16
16
|
modelValue?: unknown;
|
|
17
|
-
|
|
17
|
+
itemComparator?: unknown;
|
|
18
18
|
sortBy?: unknown;
|
|
19
19
|
items?: unknown;
|
|
20
20
|
itemKey?: unknown;
|
|
@@ -130,15 +130,15 @@ export declare const pressDataTableServerProps: <Defaults extends {
|
|
|
130
130
|
type: PropType<unknown extends Defaults["modelValue"] ? readonly any[] : readonly any[] | Defaults["modelValue"]>;
|
|
131
131
|
default: unknown extends Defaults["modelValue"] ? readonly any[] : readonly any[] | Defaults["modelValue"];
|
|
132
132
|
};
|
|
133
|
-
|
|
134
|
-
type: PropType<typeof import('../../util').deepEqual>;
|
|
135
|
-
default: typeof import('../../util').deepEqual;
|
|
133
|
+
itemComparator: unknown extends Defaults["itemComparator"] ? {
|
|
134
|
+
type: PropType<string | typeof import('../../util').deepEqual>;
|
|
135
|
+
default: () => typeof import('../../util').deepEqual;
|
|
136
136
|
} : Omit<{
|
|
137
|
-
type: PropType<typeof import('../../util').deepEqual>;
|
|
138
|
-
default: typeof import('../../util').deepEqual;
|
|
137
|
+
type: PropType<string | typeof import('../../util').deepEqual>;
|
|
138
|
+
default: () => typeof import('../../util').deepEqual;
|
|
139
139
|
}, "type" | "default"> & {
|
|
140
|
-
type: PropType<unknown extends Defaults["
|
|
141
|
-
default: unknown extends Defaults["
|
|
140
|
+
type: PropType<unknown extends Defaults["itemComparator"] ? string | typeof import('../../util').deepEqual : NonNullable<string | typeof import('../../util').deepEqual> | Defaults["itemComparator"]>;
|
|
141
|
+
default: unknown extends Defaults["itemComparator"] ? string | typeof import('../../util').deepEqual : NonNullable<string | typeof import('../../util').deepEqual> | Defaults["itemComparator"];
|
|
142
142
|
};
|
|
143
143
|
sortBy: unknown extends Defaults["sortBy"] ? {
|
|
144
144
|
type: PropType<readonly {
|
|
@@ -418,9 +418,9 @@ export declare const YDataTableServer: import('vue').DefineComponent<{
|
|
|
418
418
|
type: PropType<readonly any[]>;
|
|
419
419
|
default: () => never[];
|
|
420
420
|
};
|
|
421
|
-
|
|
422
|
-
type: PropType<typeof import('../../util').deepEqual>;
|
|
423
|
-
default: typeof import('../../util').deepEqual;
|
|
421
|
+
itemComparator: {
|
|
422
|
+
type: PropType<string | typeof import('../../util').deepEqual>;
|
|
423
|
+
default: () => typeof import('../../util').deepEqual;
|
|
424
424
|
};
|
|
425
425
|
sortBy: {
|
|
426
426
|
type: PropType<readonly {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function useRectMeasure(): {
|
|
2
|
+
containerRef: import('vue').Ref<HTMLElement | undefined>;
|
|
3
|
+
wrapperRef: import('vue').Ref<HTMLElement | undefined>;
|
|
4
|
+
tableRef: import('vue').Ref<HTMLElement | undefined>;
|
|
5
|
+
containerRect: import('vue').Ref<DOMRectReadOnly | undefined>;
|
|
6
|
+
wrapperRect: import('vue').Ref<DOMRectReadOnly | undefined>;
|
|
7
|
+
tableRect: import('vue').Ref<DOMRectReadOnly | undefined>;
|
|
8
|
+
};
|
|
@@ -30,7 +30,7 @@ export declare const pressDataTableSelectionProps: <Defaults extends {
|
|
|
30
30
|
enableSelect?: unknown;
|
|
31
31
|
selectStrategy?: unknown;
|
|
32
32
|
modelValue?: unknown;
|
|
33
|
-
|
|
33
|
+
itemComparator?: unknown;
|
|
34
34
|
} = {}>(defaults?: Defaults | undefined) => {
|
|
35
35
|
enableSelect: unknown extends Defaults["enableSelect"] ? BooleanConstructor : {
|
|
36
36
|
type: PropType<unknown extends Defaults["enableSelect"] ? boolean : boolean | Defaults["enableSelect"]>;
|
|
@@ -56,22 +56,22 @@ export declare const pressDataTableSelectionProps: <Defaults extends {
|
|
|
56
56
|
type: PropType<unknown extends Defaults["modelValue"] ? readonly any[] : readonly any[] | Defaults["modelValue"]>;
|
|
57
57
|
default: unknown extends Defaults["modelValue"] ? readonly any[] : readonly any[] | Defaults["modelValue"];
|
|
58
58
|
};
|
|
59
|
-
|
|
60
|
-
type: PropType<typeof deepEqual>;
|
|
61
|
-
default: typeof deepEqual;
|
|
59
|
+
itemComparator: unknown extends Defaults["itemComparator"] ? {
|
|
60
|
+
type: PropType<string | typeof deepEqual>;
|
|
61
|
+
default: () => typeof deepEqual;
|
|
62
62
|
} : Omit<{
|
|
63
|
-
type: PropType<typeof deepEqual>;
|
|
64
|
-
default: typeof deepEqual;
|
|
63
|
+
type: PropType<string | typeof deepEqual>;
|
|
64
|
+
default: () => typeof deepEqual;
|
|
65
65
|
}, "type" | "default"> & {
|
|
66
|
-
type: PropType<unknown extends Defaults["
|
|
67
|
-
default: unknown extends Defaults["
|
|
66
|
+
type: PropType<unknown extends Defaults["itemComparator"] ? string | typeof deepEqual : Defaults["itemComparator"] | NonNullable<string | typeof deepEqual>>;
|
|
67
|
+
default: unknown extends Defaults["itemComparator"] ? string | typeof deepEqual : Defaults["itemComparator"] | NonNullable<string | typeof deepEqual>;
|
|
68
68
|
};
|
|
69
69
|
};
|
|
70
70
|
type DataTableSelectionProps = Pick<DataTableItemsProps, 'itemKey'> & {
|
|
71
71
|
modelValue: readonly any[];
|
|
72
72
|
selectStrategy: 'single' | 'page' | 'all';
|
|
73
73
|
'onUpdate:modelValue': ((value: any[]) => void) | undefined;
|
|
74
|
-
|
|
74
|
+
itemComparator: ((a: any, b: any) => boolean) | string;
|
|
75
75
|
};
|
|
76
76
|
export declare const Y_DATA_TABLE_SELECTION_KEY: InjectionKey<ReturnType<typeof provideSelection>>;
|
|
77
77
|
export declare function provideSelection(props: DataTableSelectionProps, { allItems, pageItems, }: {
|