@jnrs/vue-core 1.2.41 → 1.2.43

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/AGENTS.md CHANGED
@@ -455,37 +455,37 @@ const tableRowClassName = ({ row }) => {
455
455
 
456
456
  **Props:**
457
457
 
458
- | 属性名 | 类型 | 默认值 | 说明 |
459
- | --------------------- | -------------------------------------------------------------------------- | ---------------------------- | ------------------------------------------ |
460
- | listApi | `Function` | — | 列表接口(必填) |
461
- | tableName | `string` | `''` | 列表名称 |
462
- | tableWidth | `string` | `'60%'` | 列表宽度 |
463
- | listParams | `Record<string, unknown>` | `{}` | 列表查询参数 |
464
- | listParamsHandle | `(params) => params` | `(params) => params` | 列表查询参数前置处理函数 |
465
- | listParamsHandleAfter | `(params) => params` | `(params) => params` | 列表查询参数后置处理函数 |
466
- | keyValue | `{ name: string; id: string; [key: string]: string }` | `{ name: 'name', id: 'id' }` | 真实数据匹配的键值对名 |
467
- | optionSecondaryField | `string` | — | keyValue 的拓展字段,用于 el-option 中显示 |
468
- | modelValue | `Record<string, unknown> \| Record<string, unknown>[] \| number \| string` | — | 双向绑定值(支持多种类型) |
469
- | width | `string` | `'100%'` | 宽度 |
470
- | simpleValue | `boolean` | `true` | 简单数据类型,仅返回 keyValue.id |
471
- | showAllTips | `boolean` | `false` | option 组件是否显示 [全部] |
472
- | onlyOption | `boolean` | `false` | 仅显示选择器 |
473
- | onlyButton | `boolean` | `false` | 仅显示选择按钮 |
474
- | filterable | `boolean` | `true` | 是否可筛选 |
475
- | clearable | `boolean` | `true` | 是否可清空 |
476
- | buttonDialogText | `string` | `'更多'` | 按钮文字 |
477
- | size | `ElSize` | `'default'` | 按钮大小 |
478
- | plain | `boolean` | `true` | 按钮 plain |
479
- | formRef | `FormInstance` | `null` | 父级组件的表单对象 |
480
- | validateFieldName | `string` | `''` | 父级表单验证的字段名 |
481
- | limit | `number` | `1` | 可选择的数量 |
482
- | queryForm | `Record<string, unknown>` | — | 表单查询参数 |
483
- | initialParams | `Record<string, unknown>` | — | 初始查询参数 |
484
- | remoteFilterKey | `string` | `'name'` | 下拉框查询参数远程过滤参数的 key 值 |
485
- | collapseTags | `boolean` | `true` | 是否折叠标签 |
486
- | maxCollapseTags | `number` | `1` | 折叠时显示的最大标签数 |
458
+ | 属性名 | 类型 | 默认值 | 说明 |
459
+ | --------------------- | -------------------------------------------------------------------------- | ---------------------------- | -------------------------------------------------------------------------- |
460
+ | listApi | `Function` | — | 列表接口(必填) |
461
+ | tableName | `string` | `''` | 列表名称 |
462
+ | tableWidth | `string` | `'60%'` | 列表宽度 |
463
+ | listParams | `Record<string, unknown>` | `{}` | 列表查询参数 |
464
+ | listParamsHandle | `(params) => params` | `(params) => params` | 列表查询参数前置处理函数 |
465
+ | listParamsHandleAfter | `(params) => params` | `(params) => params` | 列表查询参数后置处理函数 |
466
+ | keyValue | `{ name: string; id: string; [key: string]: string }` | `{ name: 'name', id: 'id' }` | 真实数据匹配的键值对名 |
467
+ | optionSecondaryField | `string` | — | keyValue 的拓展字段,用于 el-option 中显示 |
468
+ | modelValue | `Record<string, unknown> \| Record<string, unknown>[] \| number \| string` | — | 双向绑定值(支持多种类型) |
469
+ | width | `string` | `'100%'` | 宽度 |
470
+ | simpleValue | `boolean` | `true` | 简单数据类型,仅返回 keyValue.id |
471
+ | showAllTips | `boolean` | `false` | option 组件是否显示 \[全部] |
472
+ | onlyOption | `boolean` | `false` | 仅显示选择器 |
473
+ | onlyButton | `boolean` | `false` | 仅显示选择按钮 |
474
+ | filterable | `boolean` | `true` | 是否可筛选 |
475
+ | clearable | `boolean` | `true` | 是否可清空 |
476
+ | buttonDialogText | `string` | `'更多'` | 按钮文字 |
477
+ | size | `ElSize` | `'default'` | 按钮大小 |
478
+ | plain | `boolean` | `true` | 按钮 plain |
479
+ | formRef | `FormInstance` | `null` | 父级组件的表单对象 |
480
+ | validateFieldName | `string` | `''` | 父级表单验证的字段名 |
481
+ | limit | `number` | `1` | 可选择的数量 |
482
+ | queryForm | `Record<string, unknown>` | — | 表单查询参数 |
483
+ | initialParams | `Record<string, unknown>` | — | 初始查询参数 |
484
+ | remoteFilterKey | `string` | `'name'` | 下拉框查询参数远程过滤参数的 key 值 |
485
+ | collapseTags | `boolean` | `true` | 是否折叠标签 |
486
+ | maxCollapseTags | `number` | `1` | 折叠时显示的最大标签数 |
487
487
  | immediate | `boolean` | `false` | 是否在 onMounted 期间立即请求列表(默认懒加载:下拉展开/弹窗显示时才请求) |
488
- | pageSize | `number` | `100` | 每页条数 |
488
+ | pageSize | `number` | `100` | 每页条数 |
489
489
 
490
490
  **使用示例:**
491
491
 
@@ -751,30 +751,21 @@ const dialogVisible = ref(false)
751
751
 
752
752
  #### JnDateQuery
753
753
 
754
- 通用时间查询组件,通过 `range` prop 控制范围模式或单值模式,类型选项由组件内部根据 `range` 自动配置(不可由用户自定义)。配合快捷按钮实现前后时间段快速导航。`showDefault=true` 时组件初始化自动设置当天为默认值。
755
-
756
- - `range=true`(默认):typeOptions 为 `['daterange','week','month','year']`,modelValue 始终为 `[string, string]`。默认类型为 `daterange`。month/year 选择器为单选,组件自动展开为 `[月初,月末]`/`[年初,年末]`。
757
- - `range=false`:typeOptions 为 `['date','month','year']`,modelValue 为 `string`。默认类型为 `date`。
758
- - `valueFormat` 仅对 `range=true` 的所有类型最终 modelValue,或 `range=false` 的 `date` 类型有效。`range=false` 的 month/year 使用各自默认格式(`YYYY-MM`/`YYYY`)。
754
+ 通用时间查询组件,通过 `isRange` 控制范围模式或单值模式,类型选项由组件内部根据 `isRange` 自动配置。
759
755
 
760
756
  **Props:**
761
757
 
762
- | 属性名 | 类型 | 默认值 | 说明 |
763
- | ---------------- | ----------------------------------------------------------------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
764
- | modelValue | `string \| [string, string]` | | v-model 绑定值(`range=true` 为 [string, string];`range=false` 为 string) |
765
- | type | `'date' \| 'week' \| 'month' \| 'year' \| 'daterange'` | — | 日期类型;`showTypeSwitcher=true` 时作为初始类型。未指定时:`range=true` 默认 `'daterange'`,`range=false` 默认 `'date'` |
766
- | showTypeSwitcher | `boolean` | `false` | 是否显示类型切换器 |
767
- | switcherStyle | `'select' \| 'button-group'` | `'select'` | 切换器风格(下拉选择 or 按钮组) |
768
- | quickButtons | `'none' \| 'arrows' \| 'group'` | `'none'` | 快捷按钮风格(无 / 左右箭头 / 按钮组);`arrows` 模式不支持 daterange |
769
- | valueFormat | `string` | `'YYYY-MM-DD'` | 日期格式(仅对 `range=true` 所有类型最终 modelValue,或 `range=false` 的 date 有效) |
770
- | clearable | `boolean` | `false` | 是否可清除 |
771
- | size | `'' \| 'small' \| 'default' \| 'large'` | `'default'` | 尺寸 |
772
- | placeholder | `string` | `''`(i18n 提供) | 单值 placeholder |
773
- | startPlaceholder | `string` | `''`(i18n 提供) | 范围开始 placeholder |
774
- | endPlaceholder | `string` | `''`(i18n 提供) | 范围结束 placeholder |
775
- | rangeSeparator | `string` | `''`(i18n 提供) | 范围分隔符 |
776
- | range | `boolean` | `true` | 是否启用范围模式。`true`:typeOptions 为 `['daterange','week','month','year']`;`false`:typeOptions 为 `['date','month','year']` |
777
- | showDefault | `boolean` | `true` | 是否在 modelValue 为空时自动设置默认值为当天 |
758
+ | 属性名 | 类型 | 默认值 | 说明 |
759
+ | -------------- | --------------------------------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------- |
760
+ | modelValue | `string \| [string, string] \| null` | null | v-model 绑定值(`isRange=true` 为 [string, string];`isRange=false` 为 string) |
761
+ | switcherStyle | `'select' \| 'button-group' \| ''` | `'button-group'` | 切换器风格,有值时显示切换器,为空时不显示 |
762
+ | quickButtons | `boolean` | `true` | 是否显示左右箭头快捷按钮 |
763
+ | valueFormat | `string` | `'YYYY-MM-DD'` | 日期格式(仅对 `isRange=true` 所有类型最终 modelValue,或 `isRange=false` 的 date 有效) |
764
+ | clearable | `boolean` | `false` | 是否可清除 |
765
+ | size | `'' \| 'small' \| 'default' \| 'large'` | `'default'` | 尺寸 |
766
+ | rangeSeparator | `string` | `''`(i18n 提供) | 范围分隔符 |
767
+ | isRange | `boolean` | `true` | 是否启用范围模式。`true`:typeOptions `['daterange','week','month','year']`;`false`:typeOptions `['date','month','year']` |
768
+ | showDefault | `boolean` | `false` | 是否在 modelValue 为空时自动设置默认值为当天 |
778
769
 
779
770
  **Events:**
780
771
 
@@ -782,29 +773,19 @@ const dialogVisible = ref(false)
782
773
  - `change` - 值变化时触发,参数为 `(value, type)`
783
774
  - `type-change` - 类型切换时触发,参数为 `(type)`
784
775
 
785
- **使用示例:时间查询(range 模式,推荐)**
776
+ **使用示例:时间查询(isRange 模式,推荐)**
786
777
 
787
778
  ```vue
788
779
  <template>
789
- <JnDateQuery
790
- v-model="dateValue"
791
- show-type-switcher
792
- switcher-style="button-group"
793
- quick-buttons="arrows"
794
- value-format="YYYY-MM-DD"
795
- placeholder="选择日期"
796
- start-placeholder="开始日期"
797
- end-placeholder="结束日期"
798
- @change="handleDateQueryChange"
799
- />
780
+ <JnDateQuery v-model="dateValue" value-format="YYYY-MM-DD" @change="handleDateQueryChange" />
800
781
  </template>
801
782
 
802
783
  <script setup>
803
784
  import { ref } from 'vue'
804
785
  import { JnDateQuery } from '@jnrs/vue-core/components'
805
786
 
806
- const dateValue = ref<string | [string, string]>('')
807
- const handleDateQueryChange = (val: string | [string, string]) => {
787
+ const dateValue = ref()
788
+ const handleDateQueryChange = (val?: string) => {
808
789
  console.log(val)
809
790
  }
810
791
  </script>
@@ -830,11 +811,11 @@ const handleDateQueryChange = (val: string | [string, string]) => {
830
811
 
831
812
  **参数:**
832
813
 
833
- | 参数名 | 类型 | 默认值 | 说明 |
834
- | -------------- | ---------------------------- | ----------------- | -------------------------------------------------- |
835
- | containerClass | `string` | `'jn_table'` | 表格或容器类名,多个表格时需传入不同类名 |
836
- | rowClass | `string` | `'el-table__row'` | 表格行类名 |
837
- | callback | `(row: HTMLElement) => void` | `handleSelection` | 框选后的回调,默认处理 input[type='checkbox'] 元素 |
814
+ | 参数名 | 类型 | 默认值 | 说明 |
815
+ | -------------- | ---------------------------- | ----------------- | --------------------------------------------------- |
816
+ | containerClass | `string` | `'jn_table'` | 表格或容器类名,多个表格时需传入不同类名 |
817
+ | rowClass | `string` | `'el-table__row'` | 表格行类名 |
818
+ | callback | `(row: HTMLElement) => void` | `handleSelection` | 框选后的回调,默认处理 input\[type='checkbox'] 元素 |
838
819
 
839
820
  **返回值:**
840
821
 
package/CHANGELOG.md CHANGED
@@ -1,6 +1,32 @@
1
1
  # 发版日志
2
2
 
3
- ## [1.2.41] - 2026-07-30 【latest】
3
+ ## [1.2.43] - 2026-07-30 【latest】
4
+
5
+ ### ⚠️ Breaking Changes
6
+
7
+ - `JnDateQuery`:`showDefault` 默认值从 `true` 改为 `false`
8
+ - `JnDateQuery`:`modelValue` 类型增加 `null` 支持
9
+
10
+ ### Docs
11
+
12
+ - `AGENTS.md`:表格格式统一对齐
13
+
14
+ ## [1.2.42] - 2026-07-30
15
+
16
+ ### ⚠️ Breaking Changes
17
+
18
+ - `JnDateQuery`:移除 `showTypeSwitcher` prop,改用 `switcherStyle` 是否有值控制(默认 `'button-group'`)
19
+ - `JnDateQuery`:移除 `type` prop
20
+ - `JnDateQuery`:`quickButtons` 类型从 `'none'|'arrows'|'group'` 改为 `boolean`(默认 `true`),移除 `'group'` 按钮组逻辑
21
+ - `JnDateQuery`:`range` prop 重命名为 `isRange`
22
+ - `JnDateQuery`:移除 `placeholder`、`startPlaceholder`、`endPlaceholder` props
23
+
24
+ ### Refactor
25
+
26
+ - `JnDateQuery`:移除 `groupButtons`、`hasGroup`、`QuickButton` 等相关逻辑
27
+ - `JnDateQuery`:国际化移除 `placeholder`、`startPlaceholder`、`endPlaceholder` 条目
28
+
29
+ ## [1.2.41] - 2026-07-30
4
30
 
5
31
  ### Fixed
6
32
 
@@ -1,29 +1,18 @@
1
1
  type DateType = 'date' | 'week' | 'month' | 'year' | 'daterange';
2
- type QuickButtonStyle = 'none' | 'arrows' | 'group';
3
2
  type SwitcherStyle = 'select' | 'button-group';
4
3
  interface Props {
5
4
  /** v-model 绑定值(单值为 string,范围为 [string, string]) */
6
- modelValue: string | [string, string];
7
- /** 日期类型(固定模式),showTypeSwitcher=true 时作为初始类型。未指定时:range=true 默认 'daterange',range=false 默认 'date' */
8
- type?: DateType;
9
- /** 是否显示类型切换器 */
10
- showTypeSwitcher?: boolean;
11
- /** 切换器风格 */
12
- switcherStyle?: SwitcherStyle;
13
- /** 快捷按钮风格 */
14
- quickButtons?: QuickButtonStyle;
15
- /** 日期格式(仅对 range=true 的所有类型最终 modelValue,或 range=false 的 date 有效) */
5
+ modelValue: string | [string, string] | null;
6
+ /** 切换器风格,有值时显示切换器,为空时不显示 */
7
+ switcherStyle?: SwitcherStyle | '';
8
+ /** 是否显示左右箭头快捷按钮 */
9
+ quickButtons?: boolean;
10
+ /** 日期格式(仅对 isRange=true 的所有类型最终 modelValue,或 isRange=false 的 date 有效) */
16
11
  valueFormat?: string;
17
12
  /** 是否可清除 */
18
13
  clearable?: boolean;
19
14
  /** 尺寸 */
20
15
  size?: '' | 'small' | 'default' | 'large';
21
- /** 单值 placeholder */
22
- placeholder?: string;
23
- /** 范围开始 placeholder */
24
- startPlaceholder?: string;
25
- /** 范围结束 placeholder */
26
- endPlaceholder?: string;
27
16
  /** 范围分隔符 */
28
17
  rangeSeparator?: string;
29
18
  /**
@@ -32,10 +21,10 @@ interface Props {
32
21
  * - false:typeOptions 为 ['date', 'month', 'year'],modelValue 为 string
33
22
  * @default true
34
23
  */
35
- range?: boolean;
24
+ isRange?: boolean;
36
25
  /**
37
26
  * 是否在 modelValue 为空时自动设置默认值为当天
38
- * @default true
27
+ * @default false
39
28
  */
40
29
  showDefault?: boolean;
41
30
  }
@@ -49,17 +38,12 @@ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, imp
49
38
  "onType-change"?: ((type: DateType) => any) | undefined;
50
39
  }>, {
51
40
  size: "" | "small" | "default" | "large";
52
- type: DateType;
53
- placeholder: string;
54
41
  clearable: boolean;
55
- showTypeSwitcher: boolean;
56
- switcherStyle: SwitcherStyle;
57
- quickButtons: QuickButtonStyle;
42
+ switcherStyle: SwitcherStyle | "";
43
+ quickButtons: boolean;
58
44
  valueFormat: string;
59
- startPlaceholder: string;
60
- endPlaceholder: string;
61
45
  rangeSeparator: string;
62
- range: boolean;
46
+ isRange: boolean;
63
47
  showDefault: boolean;
64
48
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
65
49
  export default _default;