@welldot/vue 0.1.1 → 0.2.1
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/README.md +55 -14
- package/dist/grid/cells/GridUnitEditor.d.ts +2 -0
- package/dist/grid/cells/GridUnitEditor.d.ts.map +1 -1
- package/dist/grid/cells/GridUnitEditor.js.map +1 -1
- package/dist/grid/cells/GridUnitEditor.vue_vue_type_script_setup_true_lang.js +19 -18
- package/dist/grid/cells/GridUnitEditor.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/grid/useWellGridColumns.d.ts +21 -0
- package/dist/grid/useWellGridColumns.d.ts.map +1 -1
- package/dist/grid/useWellGridColumns.js +91 -86
- package/dist/grid/useWellGridColumns.js.map +1 -1
- package/dist/tailwind.css +7 -144
- package/dist/theme/define.d.ts +2 -2
- package/dist/theme/define.js.map +1 -1
- package/dist/theme/preset.d.ts.map +1 -1
- package/dist/theme/preset.js +31 -126
- package/dist/theme/preset.js.map +1 -1
- package/dist/theme.css +149 -0
- package/dist/tokens.css +127 -0
- package/package.json +13 -11
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
Vue 3 + PrimeVue base components, theme and composables for `.well` water well editors, with a Nuxt module. Part of the [welldot](https://github.com/
|
|
5
|
+
Vue 3 + PrimeVue base components, theme and composables for `.well` water well editors, with a Nuxt module. Part of the [welldot](https://github.com/welldothq/welldot) open-source ecosystem.
|
|
6
6
|
|
|
7
7
|
Labeled fields, chips, tag selects, info popovers, number and unit inputs, an FGDC texture picker, a spreadsheet-style data grid and a map-based location picker, all sharing one PrimeVue theme and Tailwind tokens. No i18n library and no store: text props accept a plain string or a `LanguageText` (`{ en, pt, … }`), and app-wide settings come from one `createWelldot` plugin.
|
|
8
8
|
|
|
@@ -16,6 +16,7 @@ This README covers installation, Vue and Nuxt setup, the Tailwind tokens, `creat
|
|
|
16
16
|
- [Nuxt](#nuxt)
|
|
17
17
|
- [Tailwind setup](#tailwind-setup)
|
|
18
18
|
- [Overriding the tokens](#overriding-the-tokens)
|
|
19
|
+
- [Custom palette](#custom-palette)
|
|
19
20
|
- [Configuration](#configuration)
|
|
20
21
|
- [Layering](#layering)
|
|
21
22
|
- [Text and i18n](#text-and-i18n)
|
|
@@ -76,6 +77,8 @@ app.use(createWelldot({ locale: 'pt' }));
|
|
|
76
77
|
app.mount('#app');
|
|
77
78
|
```
|
|
78
79
|
|
|
80
|
+
`WelldotPreset` reads its colors from CSS variables, so the app must also load `@welldot/vue/tailwind.css` (see [Tailwind setup](#tailwind-setup)) or, without Tailwind, `@welldot/vue/tokens.css`. Without one of them, PrimeVue components render with no colors.
|
|
81
|
+
|
|
79
82
|
```vue
|
|
80
83
|
<script setup lang="ts">
|
|
81
84
|
import { WellLabeledField, WellUnitInput } from '@welldot/vue';
|
|
@@ -143,18 +146,26 @@ The components are styled with Tailwind CSS 4 utilities and the Welldot tokens.
|
|
|
143
146
|
@import '@welldot/vue/tailwind.css';
|
|
144
147
|
```
|
|
145
148
|
|
|
146
|
-
`@welldot/vue/tailwind.css` brings the `@theme` tokens, the `dark` variant (`.dark-mode`), the base layer, the data grid's styles and the components' own styles, and adds the package's built files as a Tailwind `@source`. It must be imported from the app's CSS (not from JS) so the tokens join the app's Tailwind compilation.
|
|
149
|
+
`@welldot/vue/tailwind.css` brings the color tokens, the `@theme` tokens, the `dark` variant (`.dark-mode`), the base layer, the data grid's styles and the components' own styles, and adds the package's built files as a Tailwind `@source`. It must be imported from the app's CSS (not from JS) so the tokens join the app's Tailwind compilation.
|
|
150
|
+
|
|
151
|
+
The colors are plain CSS variables (`--w-*`) declared in `@welldot/vue/tokens.css`, which both `WelldotPreset` and the Tailwind theme read. `tailwind.css` is built from two files you can also import on their own, for example in an app that doesn't use PrimeVue:
|
|
152
|
+
|
|
153
|
+
```css
|
|
154
|
+
@import 'tailwindcss';
|
|
155
|
+
@import '@welldot/vue/tokens.css'; /* --w-* color variables, light and dark */
|
|
156
|
+
@import '@welldot/vue/theme.css'; /* dark variant, @theme tokens, base layer */
|
|
157
|
+
```
|
|
147
158
|
|
|
148
159
|
### Overriding the tokens
|
|
149
160
|
|
|
150
161
|
Everything in `tailwind.css` can be overridden from the app's own stylesheet, **after** the import:
|
|
151
162
|
|
|
152
|
-
| Token | Where it comes from | Override with
|
|
153
|
-
| ------------------------------------------------------------------------- | ---------------------------------------- |
|
|
154
|
-
| Colors (`--color-{surface,content,primary,error,warning,success,info}-*`) |
|
|
155
|
-
| Fonts (`--font-display`, `--font-serif`, `--font-mono`) | `@theme static` | The app's `@theme` block
|
|
156
|
-
| Radii (`--radius-{sm,md,lg,xl,2xl,pill}`) | `@theme static` | The app's `@theme` block
|
|
157
|
-
| Focus/error rings (`--color-focus-ring`, `--color-error-ring`) | `@layer base` (`:root` and `.dark-mode`) | The app's `@layer base`
|
|
163
|
+
| Token | Where it comes from | Override with |
|
|
164
|
+
| ------------------------------------------------------------------------- | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
165
|
+
| Colors (`--color-{surface,content,primary,error,warning,success,info}-*`) | `--w-*` variables in `tokens.css` | Redeclare the `--w-*` variables (see [Custom palette](#custom-palette)), so PrimeVue components and Tailwind utilities stay in sync |
|
|
166
|
+
| Fonts (`--font-display`, `--font-serif`, `--font-mono`) | `@theme static` | The app's `@theme` block |
|
|
167
|
+
| Radii (`--radius-{sm,md,lg,xl,2xl,pill}`) | `@theme static` | The app's `@theme` block |
|
|
168
|
+
| Focus/error rings (`--color-focus-ring`, `--color-error-ring`) | `@layer base` (`:root` and `.dark-mode`) | The app's `@layer base` |
|
|
158
169
|
|
|
159
170
|
```css
|
|
160
171
|
/* app main.css */
|
|
@@ -177,7 +188,37 @@ Everything in `tailwind.css` can be overridden from the app's own stylesheet, **
|
|
|
177
188
|
}
|
|
178
189
|
```
|
|
179
190
|
|
|
180
|
-
Avoid overriding a color token in `@theme` directly: Tailwind utilities would change while PrimeVue components keep the
|
|
191
|
+
Avoid overriding a color token in `@theme` directly: Tailwind utilities would change while PrimeVue components keep the old color. Change the `--w-*` variable instead. Fonts and radii are declared `static` so they're always emitted, even when only component styles read them through `var()`. The fonts themselves aren't loaded by the package; load them in the app (e.g. `@nuxt/fonts`).
|
|
192
|
+
|
|
193
|
+
### Custom palette
|
|
194
|
+
|
|
195
|
+
The palette lives in plain CSS variables, so any app can rebrand `@welldot/vue` with a few lines of CSS loaded after the package's stylesheet. No JavaScript is involved, and one change reaches both the PrimeVue components and the Tailwind utilities (`bg-primary-500`, `text-content-0`, …).
|
|
196
|
+
|
|
197
|
+
```css
|
|
198
|
+
/* app main.css */
|
|
199
|
+
@import 'tailwindcss';
|
|
200
|
+
@import 'tailwindcss-primeui';
|
|
201
|
+
@import '@welldot/vue/tailwind.css'; /* or '@welldot/vue/tokens.css' without PrimeVue */
|
|
202
|
+
|
|
203
|
+
:root {
|
|
204
|
+
--w-primary-500: #0a7d5a;
|
|
205
|
+
--w-primary-600: #086a4c;
|
|
206
|
+
/* … the other steps you use */
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.dark-mode {
|
|
210
|
+
--w-surface-0: #0b1410;
|
|
211
|
+
--w-content-0: #f4faf7;
|
|
212
|
+
/* … */
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
- **Names:** `--w-{surface,content}-{0,50,100,…,900,950}` and `--w-{primary,success,info,warning,error}-{50,100,…,900,950}`. See [`src/theme/tokens.css`](src/theme/tokens.css) for the defaults.
|
|
217
|
+
- **Dark mode:** only surface and content change between light and dark (they mirror each other: `surface-0` is the page, `content-0` the main text). The other palettes need just the `:root` value.
|
|
218
|
+
- **Surface and content come in pairs:** whenever you redeclare a `--w-surface-*` or `--w-content-*` step in `:root`, redeclare it in `.dark-mode` too, in a rule placed after your `:root` rule. Both selectors match `<html>` with the same specificity, so a lone `:root` override would also win in dark mode (e.g. a light page background under white dark-mode text).
|
|
219
|
+
- **Order:** your rules have the same specificity as the package's, so they must load after it.
|
|
220
|
+
- **No layers:** `tokens.css` is unlayered, and unlayered CSS beats any `@layer`, so write the `--w-*` overrides outside `@layer` (not in `@layer base` like the rings above), or they are silently ignored.
|
|
221
|
+
- Use [`defineWelldotTheme`](#overriding-the-theme) for component-level tweaks (padding, radius, a component's own colors), not for the palette.
|
|
181
222
|
|
|
182
223
|
---
|
|
183
224
|
|
|
@@ -498,14 +539,14 @@ DD/DMS toggle, latitude/longitude inputs, optional elevation and the map. `v-mod
|
|
|
498
539
|
|
|
499
540
|
`@welldot/vue/theme` exports:
|
|
500
541
|
|
|
501
|
-
- `WelldotPreset`: `{ preset, options }` for PrimeVue's `theme` option (prefix `
|
|
542
|
+
- `WelldotPreset`: `{ preset, options }` for PrimeVue's `theme` option (prefix `p`, dark mode on `.dark-mode`, CSS layer `primevue`). Its palettes point at the `--w-*` variables of `tokens.css`;
|
|
502
543
|
- `welldotPt`: the global pass-through (filled inputs, full-width fields, …).
|
|
503
544
|
|
|
504
545
|
```ts
|
|
505
546
|
app.use(PrimeVue, { theme: WelldotPreset, pt: welldotPt });
|
|
506
547
|
```
|
|
507
548
|
|
|
508
|
-
Toggle dark mode with the `dark-mode` class on `<html>`.
|
|
549
|
+
The preset holds no color values: load `@welldot/vue/tailwind.css` or `@welldot/vue/tokens.css` alongside it, or PrimeVue components render with no colors. Toggle dark mode with the `dark-mode` class on `<html>`.
|
|
509
550
|
|
|
510
551
|
### Overriding the theme
|
|
511
552
|
|
|
@@ -514,15 +555,15 @@ Toggle dark mode with the `dark-mode` class on `<html>`.
|
|
|
514
555
|
- Plain objects merge key by key, so you only write what changes.
|
|
515
556
|
- Any other value you set wins: a PT section given as a class string or a function **replaces** the default's (it is not combined with it).
|
|
516
557
|
- Arrays are concatenated.
|
|
517
|
-
-
|
|
558
|
+
- Change colors in CSS ([Custom palette](#custom-palette)), not through the preset: a palette set here would reach PrimeVue but not the Tailwind utilities.
|
|
559
|
+
- Keep `options.darkModeSelector` at `.dark-mode`: the dark values in `tokens.css` switch on that class.
|
|
518
560
|
|
|
519
561
|
```ts
|
|
520
562
|
import { defineWelldotPt, defineWelldotTheme } from '@welldot/vue/theme';
|
|
521
563
|
|
|
522
564
|
app.use(PrimeVue, {
|
|
523
565
|
theme: defineWelldotTheme({
|
|
524
|
-
preset: {
|
|
525
|
-
options: { darkModeSelector: '.night' },
|
|
566
|
+
preset: { components: { dialog: { borderRadius: '0.5rem' } } },
|
|
526
567
|
}),
|
|
527
568
|
pt: defineWelldotPt({ tabpanels: { root: 'p-0' } }),
|
|
528
569
|
});
|
|
@@ -4,6 +4,8 @@ type __VLS_Props = {
|
|
|
4
4
|
save: (value: unknown, preventFocus?: boolean) => void;
|
|
5
5
|
close: (focusNext?: boolean) => void;
|
|
6
6
|
unitType: DisplayUnitType;
|
|
7
|
+
/** `val` is the key typed to open the editor, already in display units. */
|
|
8
|
+
entered?: boolean;
|
|
7
9
|
};
|
|
8
10
|
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
9
11
|
declare const _default: typeof __VLS_export;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridUnitEditor.d.ts","sourceRoot":"","sources":["../../../src/grid/cells/GridUnitEditor.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GridUnitEditor.d.ts","sourceRoot":"","sources":["../../../src/grid/cells/GridUnitEditor.vue"],"names":[],"mappings":"AAmGA,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,gCAAgC,CAAC;AAExC,KAAK,WAAW,GAAG;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACvD,KAAK,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,QAAQ,EAAE,eAAe,CAAC;IAC1B,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAiHF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridUnitEditor.js","names":[],"sources":["../../../src/grid/cells/GridUnitEditor.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { nextTick, onMounted, ref } from 'vue';\nimport WellInputNumber from '../../components/WellInputNumber.vue';\nimport {\n isDisplayedValue,\n useWellUnits,\n type DisplayUnitType,\n} from '../../composables/useWellUnits';\n\nconst props = defineProps<{\n val?: unknown;\n save: (value: unknown, preventFocus?: boolean) => void;\n close: (focusNext?: boolean) => void;\n unitType: DisplayUnitType;\n}>();\n\ndefineOptions({ inheritAttrs: false });\n\nconst { toDisplay, toCanonical } = useWellUnits(() => props.unitType);\n\n/** Matches the `max-fraction-digits` of the input below. */\nconst MAX_FRACTION_DIGITS = 4;\n\nconst numRef = ref<{ $el: HTMLElement } | null>(null);\n\nconst raw =\n props.val !== undefined && props.val !== null && props.val !== ''\n ? Number(props.val)\n : null;\n\n/** Display value the editor opened with (null for an empty cell). */\nconst initialDisplay
|
|
1
|
+
{"version":3,"file":"GridUnitEditor.js","names":[],"sources":["../../../src/grid/cells/GridUnitEditor.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { nextTick, onMounted, ref } from 'vue';\nimport WellInputNumber from '../../components/WellInputNumber.vue';\nimport {\n isDisplayedValue,\n useWellUnits,\n type DisplayUnitType,\n} from '../../composables/useWellUnits';\n\nconst props = defineProps<{\n val?: unknown;\n save: (value: unknown, preventFocus?: boolean) => void;\n close: (focusNext?: boolean) => void;\n unitType: DisplayUnitType;\n /** `val` is the key typed to open the editor, already in display units. */\n entered?: boolean;\n}>();\n\ndefineOptions({ inheritAttrs: false });\n\nconst { toDisplay, toCanonical } = useWellUnits(() => props.unitType);\n\n/** Matches the `max-fraction-digits` of the input below. */\nconst MAX_FRACTION_DIGITS = 4;\n\nconst numRef = ref<{ $el: HTMLElement } | null>(null);\n\nconst raw =\n props.val !== undefined && props.val !== null && props.val !== ''\n ? Number(props.val)\n : null;\n\nconst opened = raw != null && !isNaN(raw) ? raw : null;\n\n/** Display value the editor opened with (null for an empty cell). */\nconst initialDisplay =\n opened != null && !props.entered ? toDisplay(opened) : null;\nconst localValue = ref<number | null>(props.entered ? opened : initialDisplay);\n\nonMounted(() =>\n nextTick(() => {\n const el = numRef.value?.$el;\n (el?.querySelector('input') as HTMLInputElement | null)?.focus();\n }),\n);\n\nlet lastKeyWasEnter = false;\n\nfunction onKeydownCapture(e: KeyboardEvent) {\n lastKeyWasEnter = e.key === 'Enter';\n}\n\nfunction commit() {\n if (localValue.value === null) return;\n // `InputNumber` emits its rounded text on blur/Enter: an untouched edit\n // closes without saving, so the exact canonical value is kept.\n if (isDisplayedValue(localValue.value, initialDisplay, MAX_FRACTION_DIGITS)) {\n props.close(lastKeyWasEnter);\n return;\n }\n props.save(toCanonical(localValue.value), !lastKeyWasEnter);\n}\n\nfunction onKeydown(e: KeyboardEvent) {\n if (e.key === 'Enter') {\n e.stopPropagation();\n commit();\n } else if (e.key === 'Escape') {\n e.stopPropagation();\n props.close();\n }\n}\n\nfunction update(value: number | null) {\n localValue.value = value;\n commit();\n}\n</script>\n\n<template>\n <div class=\"contents\" @keydown.capture=\"onKeydownCapture\">\n <WellInputNumber\n ref=\"numRef\"\n :model-value=\"localValue\"\n :max-fraction-digits=\"MAX_FRACTION_DIGITS\"\n :pt=\"{\n root: 'well-cell-input-number',\n pcInput: { root: 'well-cell-input well-cell-input-number text-right' },\n }\"\n @update:model-value=\"update\"\n @keydown=\"onKeydown\"\n />\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -9,46 +9,47 @@ var u = 4, d = /* @__PURE__ */ a({
|
|
|
9
9
|
val: {},
|
|
10
10
|
save: { type: Function },
|
|
11
11
|
close: { type: Function },
|
|
12
|
-
unitType: {}
|
|
12
|
+
unitType: {},
|
|
13
|
+
entered: { type: Boolean }
|
|
13
14
|
},
|
|
14
15
|
setup(a) {
|
|
15
|
-
let d = a, { toDisplay: f, toCanonical: p } = t(() => d.unitType), m = l(null), h = d.val !== void 0 && d.val !== null && d.val !== "" ? Number(d.val) : null, g = h != null && !isNaN(h) ? f(
|
|
16
|
+
let d = a, { toDisplay: f, toCanonical: p } = t(() => d.unitType), m = l(null), h = d.val !== void 0 && d.val !== null && d.val !== "" ? Number(d.val) : null, g = h != null && !isNaN(h) ? h : null, _ = g != null && !d.entered ? f(g) : null, v = l(d.entered ? g : _);
|
|
16
17
|
s(() => o(() => {
|
|
17
18
|
((m.value?.$el)?.querySelector("input"))?.focus();
|
|
18
19
|
}));
|
|
19
|
-
let
|
|
20
|
-
function
|
|
21
|
-
|
|
20
|
+
let y = !1;
|
|
21
|
+
function b(e) {
|
|
22
|
+
y = e.key === "Enter";
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
-
if (
|
|
25
|
-
if (e(
|
|
26
|
-
d.close(
|
|
24
|
+
function x() {
|
|
25
|
+
if (v.value !== null) {
|
|
26
|
+
if (e(v.value, _, u)) {
|
|
27
|
+
d.close(y);
|
|
27
28
|
return;
|
|
28
29
|
}
|
|
29
|
-
d.save(p(
|
|
30
|
+
d.save(p(v.value), !y);
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
|
-
function x(e) {
|
|
33
|
-
e.key === "Enter" ? (e.stopPropagation(), b()) : e.key === "Escape" && (e.stopPropagation(), d.close());
|
|
34
|
-
}
|
|
35
33
|
function S(e) {
|
|
36
|
-
|
|
34
|
+
e.key === "Enter" ? (e.stopPropagation(), x()) : e.key === "Escape" && (e.stopPropagation(), d.close());
|
|
35
|
+
}
|
|
36
|
+
function C(e) {
|
|
37
|
+
v.value = e, x();
|
|
37
38
|
}
|
|
38
39
|
return (e, t) => (c(), r("div", {
|
|
39
40
|
class: "contents",
|
|
40
|
-
onKeydownCapture:
|
|
41
|
+
onKeydownCapture: b
|
|
41
42
|
}, [i(n, {
|
|
42
43
|
ref_key: "numRef",
|
|
43
44
|
ref: m,
|
|
44
|
-
"model-value":
|
|
45
|
+
"model-value": v.value,
|
|
45
46
|
"max-fraction-digits": u,
|
|
46
47
|
pt: {
|
|
47
48
|
root: "well-cell-input-number",
|
|
48
49
|
pcInput: { root: "well-cell-input well-cell-input-number text-right" }
|
|
49
50
|
},
|
|
50
|
-
"onUpdate:modelValue":
|
|
51
|
-
onKeydown:
|
|
51
|
+
"onUpdate:modelValue": C,
|
|
52
|
+
onKeydown: S
|
|
52
53
|
}, null, 8, ["model-value"])], 32));
|
|
53
54
|
}
|
|
54
55
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridUnitEditor.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/grid/cells/GridUnitEditor.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { nextTick, onMounted, ref } from 'vue';\nimport WellInputNumber from '../../components/WellInputNumber.vue';\nimport {\n isDisplayedValue,\n useWellUnits,\n type DisplayUnitType,\n} from '../../composables/useWellUnits';\n\nconst props = defineProps<{\n val?: unknown;\n save: (value: unknown, preventFocus?: boolean) => void;\n close: (focusNext?: boolean) => void;\n unitType: DisplayUnitType;\n}>();\n\ndefineOptions({ inheritAttrs: false });\n\nconst { toDisplay, toCanonical } = useWellUnits(() => props.unitType);\n\n/** Matches the `max-fraction-digits` of the input below. */\nconst MAX_FRACTION_DIGITS = 4;\n\nconst numRef = ref<{ $el: HTMLElement } | null>(null);\n\nconst raw =\n props.val !== undefined && props.val !== null && props.val !== ''\n ? Number(props.val)\n : null;\n\n/** Display value the editor opened with (null for an empty cell). */\nconst initialDisplay
|
|
1
|
+
{"version":3,"file":"GridUnitEditor.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/grid/cells/GridUnitEditor.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { nextTick, onMounted, ref } from 'vue';\nimport WellInputNumber from '../../components/WellInputNumber.vue';\nimport {\n isDisplayedValue,\n useWellUnits,\n type DisplayUnitType,\n} from '../../composables/useWellUnits';\n\nconst props = defineProps<{\n val?: unknown;\n save: (value: unknown, preventFocus?: boolean) => void;\n close: (focusNext?: boolean) => void;\n unitType: DisplayUnitType;\n /** `val` is the key typed to open the editor, already in display units. */\n entered?: boolean;\n}>();\n\ndefineOptions({ inheritAttrs: false });\n\nconst { toDisplay, toCanonical } = useWellUnits(() => props.unitType);\n\n/** Matches the `max-fraction-digits` of the input below. */\nconst MAX_FRACTION_DIGITS = 4;\n\nconst numRef = ref<{ $el: HTMLElement } | null>(null);\n\nconst raw =\n props.val !== undefined && props.val !== null && props.val !== ''\n ? Number(props.val)\n : null;\n\nconst opened = raw != null && !isNaN(raw) ? raw : null;\n\n/** Display value the editor opened with (null for an empty cell). */\nconst initialDisplay =\n opened != null && !props.entered ? toDisplay(opened) : null;\nconst localValue = ref<number | null>(props.entered ? opened : initialDisplay);\n\nonMounted(() =>\n nextTick(() => {\n const el = numRef.value?.$el;\n (el?.querySelector('input') as HTMLInputElement | null)?.focus();\n }),\n);\n\nlet lastKeyWasEnter = false;\n\nfunction onKeydownCapture(e: KeyboardEvent) {\n lastKeyWasEnter = e.key === 'Enter';\n}\n\nfunction commit() {\n if (localValue.value === null) return;\n // `InputNumber` emits its rounded text on blur/Enter: an untouched edit\n // closes without saving, so the exact canonical value is kept.\n if (isDisplayedValue(localValue.value, initialDisplay, MAX_FRACTION_DIGITS)) {\n props.close(lastKeyWasEnter);\n return;\n }\n props.save(toCanonical(localValue.value), !lastKeyWasEnter);\n}\n\nfunction onKeydown(e: KeyboardEvent) {\n if (e.key === 'Enter') {\n e.stopPropagation();\n commit();\n } else if (e.key === 'Escape') {\n e.stopPropagation();\n props.close();\n }\n}\n\nfunction update(value: number | null) {\n localValue.value = value;\n commit();\n}\n</script>\n\n<template>\n <div class=\"contents\" @keydown.capture=\"onKeydownCapture\">\n <WellInputNumber\n ref=\"numRef\"\n :model-value=\"localValue\"\n :max-fraction-digits=\"MAX_FRACTION_DIGITS\"\n :pt=\"{\n root: 'well-cell-input-number',\n pcInput: { root: 'well-cell-input well-cell-input-number text-right' },\n }\"\n @update:model-value=\"update\"\n @keydown=\"onKeydown\"\n />\n </div>\n</template>\n"],"mappings":";;;;AAuBA,IAAM,IAAsB;;;;;;;;;;;EAd5B,IAAM,IAAQ,GAWR,EAAE,cAAW,mBAAgB,QAAmB,EAAM,SAAS,EAK/D,IAAS,EAAiC,KAAK,EAE/C,IACJ,EAAM,QAAQ,KAAA,KAAa,EAAM,QAAQ,QAAQ,EAAM,QAAQ,KAC3D,OAAO,EAAM,IAAG,GAChB,MAEA,IAAS,KAAO,QAAQ,CAAC,MAAM,EAAI,GAAG,IAAM,MAG5C,IACJ,KAAU,QAAQ,CAAC,EAAM,UAAU,EAAU,EAAO,GAAG,MACnD,IAAa,EAAmB,EAAM,UAAU,IAAS,EAAe;AAE9E,UACE,QAAe;AAEb,KADW,EAAO,OAAO,MACpB,cAAc,QAAQ,GAA8B,OAAO;IAChE,CACH;EAED,IAAI,IAAkB;EAEtB,SAAS,EAAiB,GAAkB;AAC1C,OAAkB,EAAE,QAAQ;;EAG9B,SAAS,IAAS;AACZ,SAAW,UAAU,MAGzB;QAAI,EAAiB,EAAW,OAAO,GAAgB,EAAoB,EAAE;AAC3E,OAAM,MAAM,EAAgB;AAC5B;;AAEF,MAAM,KAAK,EAAY,EAAW,MAAM,EAAE,CAAC,EAAgB;;;EAG7D,SAAS,EAAU,GAAkB;AACnC,GAAI,EAAE,QAAQ,WACZ,EAAE,iBAAiB,EACnB,GAAQ,IACC,EAAE,QAAQ,aACnB,EAAE,iBAAiB,EACnB,EAAM,OAAO;;EAIjB,SAAS,EAAO,GAAsB;AAEpC,GADA,EAAW,QAAQ,GACnB,GAAQ;;yBAKR,EAYM,OAAA;GAZD,OAAM;GAA6B;MACtC,EAUE,GAAA;YATI;GAAJ,KAAI;GACH,eAAa,EAAA;GACb,uBAAqB;GACrB,IAAI;;;IAGJ;GACA,uBAAoB;GACX"}
|
|
@@ -3,6 +3,27 @@ import { BasePlugin } from '@revolist/vue3-datagrid';
|
|
|
3
3
|
import { LanguageTextInput } from '@welldot/core';
|
|
4
4
|
import { MaybeRefOrGetter } from 'vue';
|
|
5
5
|
import { WellDataGridComponents, WellDataGridLabels, WellGridColumn } from './types';
|
|
6
|
+
/** Props RevoGrid hands to every editor (`EditorType`). */
|
|
7
|
+
export interface GridEditorProps {
|
|
8
|
+
val?: unknown;
|
|
9
|
+
save: (value: unknown, preventFocus?: boolean) => void;
|
|
10
|
+
close: (focusNext?: boolean) => void;
|
|
11
|
+
/** Cell data model; `column.column` is the `ColumnRegular`. */
|
|
12
|
+
column?: {
|
|
13
|
+
column?: {
|
|
14
|
+
editorProps?: Record<string, unknown>;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
/** Row model of the edited cell. */
|
|
18
|
+
model?: Record<string, unknown>;
|
|
19
|
+
/** Key of the edited cell on `model`. */
|
|
20
|
+
prop?: string | number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Whether `val` is the key the user typed to open the editor rather than
|
|
24
|
+
* the cell's stored value (RevoGrid passes `editCell.val || modelValue`).
|
|
25
|
+
*/
|
|
26
|
+
export declare function isEnteredValue(p: GridEditorProps): boolean;
|
|
6
27
|
export interface UseWellGridColumnsOptions {
|
|
7
28
|
columns: MaybeRefOrGetter<WellGridColumn[]>;
|
|
8
29
|
onDelete: (rowIndex: number, model: Record<string, unknown>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWellGridColumns.d.ts","sourceRoot":"","sources":["../../src/grid/useWellGridColumns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAEd,aAAa,EACb,OAAO,EACP,qBAAqB,EAEtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,UAAU,EAGX,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAOL,KAAK,gBAAgB,EACtB,MAAM,KAAK,CAAC;AA4Bb,OAAO,KAAK,EAEV,sBAAsB,EACtB,kBAAkB,EAClB,cAAc,EAEf,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"useWellGridColumns.d.ts","sourceRoot":"","sources":["../../src/grid/useWellGridColumns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAEd,aAAa,EACb,OAAO,EACP,qBAAqB,EAEtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,UAAU,EAGX,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAOL,KAAK,gBAAgB,EACtB,MAAM,KAAK,CAAC;AA4Bb,OAAO,KAAK,EAEV,sBAAsB,EACtB,kBAAkB,EAClB,cAAc,EAEf,MAAM,SAAS,CAAC;AAqDjB,2DAA2D;AAC3D,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACvD,KAAK,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,+DAA+D;IAC/D,MAAM,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE;YAAE,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;SAAE,CAAA;KAAE,CAAC;IAChE,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAcD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,eAAe,GAAG,OAAO,CAE1D;AAoCD,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,gBAAgB,CAAC,cAAc,EAAE,CAAC,CAAC;IAC5C,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACrE,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnE,iEAAiE;IACjE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,8DAA8D;IAC9D,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,0EAA0E;IAC1E,WAAW,CAAC,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;IAClD,gEAAgE;IAChE,MAAM,CAAC,EAAE,gBAAgB,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAAC;IAC1D,wEAAwE;IACxE,UAAU,CAAC,EAAE,gBAAgB,CAAC,sBAAsB,GAAG,SAAS,CAAC,CAAC;CACnE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB;;;;;4BAkOpC,MAAM,OAAO,OAAO,KAAG,OAAO;6BA6D7B,WAAW,CAAC,cAAc,CAAC;;8BAxC1B,WAAW,CAAC,qBAAqB,CAAC;;6BAYnC,UAAU;EAiE3C"}
|
|
@@ -4,27 +4,27 @@ import { columnStretchPlugin as r } from "./columnStretchPlugin.js";
|
|
|
4
4
|
import i from "./cells/GridCheckboxCell.js";
|
|
5
5
|
import a from "./cells/GridColorCell.js";
|
|
6
6
|
import o from "./cells/GridColorPickerEditor.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import { useUnitSuffix as
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import { useCellTemplate as
|
|
7
|
+
import s from "./cells/GridComboEditor.js";
|
|
8
|
+
import c from "./cells/GridDeleteCell.js";
|
|
9
|
+
import l from "./cells/GridDragCell.js";
|
|
10
|
+
import ee from "./cells/GridFormattedCell.js";
|
|
11
|
+
import te from "./cells/GridHeaderCell.js";
|
|
12
|
+
import ne from "./cells/GridNumberEditor.js";
|
|
13
|
+
import re from "./cells/GridSelectButtonCell.js";
|
|
14
|
+
import u from "./cells/GridSelectCell.js";
|
|
15
|
+
import d from "./cells/GridSelectEditor.js";
|
|
16
|
+
import f from "./cells/GridTextEditor.js";
|
|
17
|
+
import p from "./cells/GridTextureSelectCell.js";
|
|
18
|
+
import m from "./cells/GridTextureSelectEditor.js";
|
|
19
|
+
import { useUnitSuffix as h } from "./composables/useUnitSuffix.js";
|
|
20
|
+
import g from "./cells/GridUnitCell.js";
|
|
21
|
+
import _ from "./cells/GridUnitEditor.js";
|
|
22
|
+
import { useCellTemplate as v } from "./composables/useCellTemplate.js";
|
|
23
23
|
import y from "./parts/WellGridDeleteButton.js";
|
|
24
24
|
import { computed as b, defineComponent as x, h as S, ref as C, toValue as w } from "vue";
|
|
25
|
-
import { BasePlugin as
|
|
25
|
+
import { BasePlugin as ie, VGridVueEditor as T } from "@revolist/vue3-datagrid";
|
|
26
26
|
//#region src/grid/useWellGridColumns.ts
|
|
27
|
-
function
|
|
27
|
+
function E(e) {
|
|
28
28
|
return e.type === "texture" ? "texture" : e.type === "select" ? "select" : e.type === "select-button" ? "select-button" : e.type === "combo" ? "combo" : e.type === "color" ? "color" : e.type === "checkbox" ? "checkbox" : e.unitType ? "unit" : e.formatter ? "formatted" : e.type === "number" ? "number" : "text";
|
|
29
29
|
}
|
|
30
30
|
var D = [
|
|
@@ -37,40 +37,45 @@ var D = [
|
|
|
37
37
|
"val",
|
|
38
38
|
"save",
|
|
39
39
|
"close",
|
|
40
|
-
"column"
|
|
40
|
+
"column",
|
|
41
|
+
"model",
|
|
42
|
+
"prop"
|
|
41
43
|
];
|
|
42
|
-
function k(e
|
|
43
|
-
return
|
|
44
|
+
function k(e) {
|
|
45
|
+
return e.prop != null && e.val !== e.model?.[e.prop];
|
|
46
|
+
}
|
|
47
|
+
function A(e, t) {
|
|
48
|
+
return T(x((n) => () => S(e, {
|
|
44
49
|
val: n.val,
|
|
45
50
|
save: n.save,
|
|
46
51
|
close: n.close,
|
|
47
52
|
...n.column?.column?.editorProps,
|
|
48
|
-
...t?.()
|
|
53
|
+
...t?.(n)
|
|
49
54
|
}), {
|
|
50
55
|
inheritAttrs: !1,
|
|
51
56
|
props: O
|
|
52
57
|
}));
|
|
53
58
|
}
|
|
54
|
-
var
|
|
59
|
+
var j = x((e) => (e.close(), () => null), {
|
|
55
60
|
inheritAttrs: !1,
|
|
56
61
|
props: O
|
|
57
62
|
});
|
|
58
|
-
function
|
|
59
|
-
let { onDelete: S, onChange: O, enableDrag:
|
|
60
|
-
noop:
|
|
61
|
-
text:
|
|
62
|
-
number:
|
|
63
|
-
color:
|
|
64
|
-
unit: k(
|
|
65
|
-
select:
|
|
66
|
-
combo:
|
|
67
|
-
texture:
|
|
68
|
-
placeholder:
|
|
69
|
-
showPending:
|
|
63
|
+
function M(x) {
|
|
64
|
+
let { onDelete: S, onChange: O, enableDrag: M = !0, enableDelete: N = !0 } = x, P = b(() => w(x.columns)), F = b(() => w(x.labels) ?? {}), I = b(() => w(x.components) ?? {}), L = t(), R = n(), z = v(), B = Object.fromEntries(D.map((e) => [e, h(e)])), V = {
|
|
65
|
+
noop: T(j),
|
|
66
|
+
text: T(f),
|
|
67
|
+
number: T(ne),
|
|
68
|
+
color: T(o),
|
|
69
|
+
unit: A(_, (e) => ({ entered: k(e) })),
|
|
70
|
+
select: A(d),
|
|
71
|
+
combo: A(s, () => ({ hint: F.value.comboHint })),
|
|
72
|
+
texture: A(m, () => ({
|
|
73
|
+
placeholder: F.value.texturePlaceholder,
|
|
74
|
+
showPending: F.value.showPendingTextures
|
|
70
75
|
}))
|
|
71
|
-
},
|
|
76
|
+
}, ae = z(te), H = b(() => P.value.find((e) => e.stretch) ?? null), U = b(() => H.value?.prop ?? null), W = b(() => U.value === null), G = b(() => {
|
|
72
77
|
let e = [];
|
|
73
|
-
return
|
|
78
|
+
return M && e.push(class extends ie {
|
|
74
79
|
constructor(e, t) {
|
|
75
80
|
super(e, t), this.addEventListener("rowdragstart", (e) => {
|
|
76
81
|
let t = e.detail.model?.name;
|
|
@@ -85,27 +90,27 @@ function j(x) {
|
|
|
85
90
|
editor: "unit",
|
|
86
91
|
numeric: !0,
|
|
87
92
|
editorProps: ({ col: e }) => ({ unitType: e.unitType }),
|
|
88
|
-
cellTemplate: ({ col: e }) =>
|
|
93
|
+
cellTemplate: ({ col: e }) => z(g, { unitType: e.unitType })
|
|
89
94
|
},
|
|
90
95
|
color: {
|
|
91
96
|
editor: "color",
|
|
92
|
-
cellTemplate: () =>
|
|
97
|
+
cellTemplate: () => z(a)
|
|
93
98
|
},
|
|
94
99
|
select: {
|
|
95
100
|
editor: "select",
|
|
96
101
|
editorProps: ({ options: e }) => ({ options: e }),
|
|
97
|
-
cellTemplate: ({ options: e }) =>
|
|
102
|
+
cellTemplate: ({ options: e }) => z(u, { options: e })
|
|
98
103
|
},
|
|
99
104
|
combo: {
|
|
100
105
|
editor: "combo",
|
|
101
106
|
editorProps: ({ options: e }) => ({ options: e }),
|
|
102
|
-
cellTemplate: ({ options: e }) =>
|
|
107
|
+
cellTemplate: ({ options: e }) => z(u, { options: e })
|
|
103
108
|
},
|
|
104
|
-
formatted: { cellTemplate: ({ col: e }) =>
|
|
109
|
+
formatted: { cellTemplate: ({ col: e }) => z(ee, { formatter: e.formatter }) },
|
|
105
110
|
checkbox: {
|
|
106
111
|
editor: "noop",
|
|
107
112
|
cellProperties: K,
|
|
108
|
-
cellTemplate: ({ col: e }) =>
|
|
113
|
+
cellTemplate: ({ col: e }) => z(i, {
|
|
109
114
|
prop: e.prop,
|
|
110
115
|
onToggle: (e, t, n) => O(e, t, n)
|
|
111
116
|
})
|
|
@@ -113,7 +118,7 @@ function j(x) {
|
|
|
113
118
|
"select-button": {
|
|
114
119
|
editor: "noop",
|
|
115
120
|
cellProperties: K,
|
|
116
|
-
cellTemplate: ({ col: e, options: t }) =>
|
|
121
|
+
cellTemplate: ({ col: e, options: t }) => z(re, {
|
|
117
122
|
prop: e.prop,
|
|
118
123
|
options: t,
|
|
119
124
|
onChange: (e, t, n) => O(e, t, n)
|
|
@@ -121,21 +126,21 @@ function j(x) {
|
|
|
121
126
|
},
|
|
122
127
|
texture: {
|
|
123
128
|
editor: "texture",
|
|
124
|
-
cellTemplate: () =>
|
|
129
|
+
cellTemplate: () => z(p)
|
|
125
130
|
}
|
|
126
131
|
};
|
|
127
132
|
function J(e) {
|
|
128
133
|
return e.map((e) => ({
|
|
129
134
|
value: e.value,
|
|
130
|
-
label:
|
|
135
|
+
label: R(e.label) ?? e.value,
|
|
131
136
|
...e.deprecated && { deprecated: !0 }
|
|
132
137
|
}));
|
|
133
138
|
}
|
|
134
|
-
function
|
|
135
|
-
let t = q[
|
|
139
|
+
function oe(e) {
|
|
140
|
+
let t = q[E(e)], n = {
|
|
136
141
|
col: e,
|
|
137
142
|
options: "options" in e ? J(e.options) : void 0
|
|
138
|
-
}, r =
|
|
143
|
+
}, r = R(e.label) ?? "", i = e.unitType ? B[e.unitType].value : null, a = e.readonly ?? !1, o = R(e.info);
|
|
139
144
|
return {
|
|
140
145
|
prop: e.prop,
|
|
141
146
|
name: i ? `${r} (${i})` : r,
|
|
@@ -149,16 +154,16 @@ function j(x) {
|
|
|
149
154
|
cellTemplate: t.cellTemplate?.(n),
|
|
150
155
|
...o && {
|
|
151
156
|
info: o,
|
|
152
|
-
infoHighlight:
|
|
153
|
-
infoLabel:
|
|
154
|
-
columnTemplate:
|
|
157
|
+
infoHighlight: R(e.infoHighlight),
|
|
158
|
+
infoLabel: R(F.value.columnInfo),
|
|
159
|
+
columnTemplate: ae
|
|
155
160
|
}
|
|
156
161
|
};
|
|
157
162
|
}
|
|
158
|
-
let
|
|
163
|
+
let se = b(() => {
|
|
159
164
|
let t = [];
|
|
160
|
-
if (
|
|
161
|
-
let n = e("dragHandle",
|
|
165
|
+
if (M) {
|
|
166
|
+
let n = e("dragHandle", I.value.dragHandle, void 0, L);
|
|
162
167
|
t.push({
|
|
163
168
|
prop: "_drag",
|
|
164
169
|
name: "",
|
|
@@ -166,77 +171,77 @@ function j(x) {
|
|
|
166
171
|
pin: "colPinStart",
|
|
167
172
|
rowDrag: !0,
|
|
168
173
|
cellProperties: () => ({ class: "well-grid-drag-cell" }),
|
|
169
|
-
...n && { cellTemplate:
|
|
174
|
+
...n && { cellTemplate: z(l, { part: n }) }
|
|
170
175
|
});
|
|
171
176
|
}
|
|
172
|
-
return t.push(...
|
|
177
|
+
return t.push(...P.value.map(oe)), N && t.push({
|
|
173
178
|
prop: "_delete",
|
|
174
179
|
name: "",
|
|
175
180
|
size: 40,
|
|
176
181
|
readonly: !0,
|
|
177
182
|
pin: "colPinEnd",
|
|
178
183
|
cellProperties: () => ({ class: "well-grid-delete-cell" }),
|
|
179
|
-
cellTemplate:
|
|
180
|
-
part: e("deleteButton",
|
|
181
|
-
label:
|
|
184
|
+
cellTemplate: z(c, {
|
|
185
|
+
part: e("deleteButton", I.value.deleteButton, y, L),
|
|
186
|
+
label: R(w(x.deleteLabel)),
|
|
182
187
|
requestDelete: S
|
|
183
188
|
})
|
|
184
189
|
}), t;
|
|
185
190
|
});
|
|
186
|
-
function
|
|
187
|
-
return
|
|
191
|
+
function Y(e, t) {
|
|
192
|
+
return P.value.find((t) => t.prop === e)?.type === "checkbox" && typeof t == "string" ? t === "true" || t === "1" || t.toLowerCase() === "yes" : t;
|
|
188
193
|
}
|
|
189
|
-
let
|
|
190
|
-
function
|
|
194
|
+
let X = C(null), Z = C(null), Q = !1;
|
|
195
|
+
function ce(e) {
|
|
191
196
|
let { rowIndex: t, colIndex: n, column: r } = e.detail;
|
|
192
|
-
|
|
197
|
+
Z.value = r ? {
|
|
193
198
|
rowIndex: t,
|
|
194
199
|
colIndex: n,
|
|
195
200
|
prop: String(r.prop)
|
|
196
|
-
} : null,
|
|
201
|
+
} : null, Q = !0;
|
|
197
202
|
}
|
|
198
|
-
function
|
|
199
|
-
|
|
203
|
+
function le() {
|
|
204
|
+
Q = !1;
|
|
200
205
|
}
|
|
201
|
-
function
|
|
202
|
-
if (
|
|
203
|
-
|
|
206
|
+
function $(e) {
|
|
207
|
+
if (Q) {
|
|
208
|
+
Q = !1;
|
|
204
209
|
return;
|
|
205
210
|
}
|
|
206
|
-
let t =
|
|
211
|
+
let t = Z.value;
|
|
207
212
|
if (!t) return;
|
|
208
213
|
let n = e.target.closest("[data-rgrow][data-rgcol]");
|
|
209
214
|
if (!n || Number(n.dataset.rgrow) !== t.rowIndex || Number(n.dataset.rgcol) !== t.colIndex) return;
|
|
210
|
-
let r =
|
|
211
|
-
!r || r.readonly || (
|
|
215
|
+
let r = P.value.find((e) => e.prop === t.prop);
|
|
216
|
+
!r || r.readonly || (X.value?.querySelector("revo-grid"))?.setCellEdit(t.rowIndex, t.prop);
|
|
212
217
|
}
|
|
213
|
-
function
|
|
218
|
+
function ue(e) {
|
|
214
219
|
let t = e.detail;
|
|
215
220
|
if ("rowIndex" in t) {
|
|
216
221
|
let { rowIndex: e, prop: n, val: r } = t;
|
|
217
|
-
O(e, String(n),
|
|
222
|
+
O(e, String(n), Y(String(n), r));
|
|
218
223
|
return;
|
|
219
224
|
}
|
|
220
225
|
let n = t.data;
|
|
221
226
|
if (n) for (let [e, t] of Object.entries(n)) {
|
|
222
227
|
let n = Number(e);
|
|
223
|
-
for (let [e, r] of Object.entries(t)) O(n, e,
|
|
228
|
+
for (let [e, r] of Object.entries(t)) O(n, e, Y(e, r));
|
|
224
229
|
}
|
|
225
230
|
}
|
|
226
231
|
return {
|
|
227
|
-
gridEditors:
|
|
228
|
-
revoColumns:
|
|
232
|
+
gridEditors: V,
|
|
233
|
+
revoColumns: se,
|
|
229
234
|
gridStretch: W,
|
|
230
235
|
plugins: G,
|
|
231
|
-
coerceCellValue:
|
|
232
|
-
handleAfterEdit:
|
|
233
|
-
gridContainerRef:
|
|
234
|
-
handleAfterFocus:
|
|
235
|
-
handleGridMousedown:
|
|
236
|
-
handleGridClick:
|
|
236
|
+
coerceCellValue: Y,
|
|
237
|
+
handleAfterEdit: ue,
|
|
238
|
+
gridContainerRef: X,
|
|
239
|
+
handleAfterFocus: ce,
|
|
240
|
+
handleGridMousedown: le,
|
|
241
|
+
handleGridClick: $
|
|
237
242
|
};
|
|
238
243
|
}
|
|
239
244
|
//#endregion
|
|
240
|
-
export {
|
|
245
|
+
export { M as useWellGridColumns };
|
|
241
246
|
|
|
242
247
|
//# sourceMappingURL=useWellGridColumns.js.map
|