imean-service-engine-htmx-plugin 2.4.0 → 2.5.0

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/index.d.mts CHANGED
@@ -1066,4 +1066,41 @@ interface TagsEditorProps {
1066
1066
  */
1067
1067
  declare function TagsEditor(props: TagsEditorProps): hono_jsx_jsx_dev_runtime.JSX.Element;
1068
1068
 
1069
- export { type AuthProvider, BaseFeature, ComponentContext, CustomFeature, DefaultCreateFeature, DefaultDeleteFeature, DefaultDetailFeature, DefaultEditFeature, DefaultListFeature, Dialog, type DialogProps, type DialogSize, ErrorAlert, type ErrorAlertProps, type Feature, type FeatureContext, type FeatureType, type FieldMetadata, HtmxAdminPlugin, type HtmxAdminPluginOptions, HtmxComponent, type ListParams, type ListResult, LoadingBar, Method, type NavItemConfig, type Notification, type NotificationType, ObjectEditor, type ObjectEditorProps, type PageMetadata, PageModel, type PermissionResult, RenderContext, StringArrayEditor, type StringArrayEditorProps, TagsEditor, type TagsEditorProps, type UserInfo, checkUserPermission, getUserInfo, modelNameToPath, parseListParams };
1069
+ /**
1070
+ * 可拖拽排序列表组件
1071
+ * 使用 HTML5 原生拖放 API 实现拖拽排序
1072
+ *
1073
+ * 设计原则:
1074
+ * - 使用 Alpine.js 管理状态和事件处理
1075
+ * - 使用 HTML5 原生拖放 API(draggable、x-on:dragstart、x-on:dragover、x-on:drop)
1076
+ * - 高阶组件,可以包裹任何子元素
1077
+ * - 使用事件委托,在容器上统一处理所有拖拽事件
1078
+ * - 所有事件处理使用 Alpine.js 声明式语法
1079
+ */
1080
+ interface SortableListProps {
1081
+ /** 子元素 */
1082
+ children: any;
1083
+ /** 自定义类名 */
1084
+ className?: string;
1085
+ /** 拖拽手柄选择器(可选,如果提供,只有手柄可拖拽) */
1086
+ handle?: string;
1087
+ /** 拖拽时的样式类名(可选) */
1088
+ draggingClass?: string;
1089
+ /** 拖拽悬停时的样式类名(可选) */
1090
+ dragOverClass?: string;
1091
+ /** 排序变化回调(可选) */
1092
+ onSortableChange?: (detail: {
1093
+ oldIndex: number;
1094
+ newIndex: number;
1095
+ }) => void;
1096
+ /** 其他属性 */
1097
+ [key: string]: any;
1098
+ }
1099
+ /**
1100
+ * 可拖拽排序列表组件
1101
+ * 使用 HTML5 原生拖放 API 和 Alpine.js 声明式语法
1102
+ * 使用事件委托在容器上统一处理所有拖拽事件
1103
+ */
1104
+ declare function SortableList(props: SortableListProps): hono_jsx_jsx_dev_runtime.JSX.Element;
1105
+
1106
+ export { type AuthProvider, BaseFeature, ComponentContext, CustomFeature, DefaultCreateFeature, DefaultDeleteFeature, DefaultDetailFeature, DefaultEditFeature, DefaultListFeature, Dialog, type DialogProps, type DialogSize, ErrorAlert, type ErrorAlertProps, type Feature, type FeatureContext, type FeatureType, type FieldMetadata, HtmxAdminPlugin, type HtmxAdminPluginOptions, HtmxComponent, type ListParams, type ListResult, LoadingBar, Method, type NavItemConfig, type Notification, type NotificationType, ObjectEditor, type ObjectEditorProps, type PageMetadata, PageModel, type PermissionResult, RenderContext, SortableList, StringArrayEditor, type StringArrayEditorProps, TagsEditor, type TagsEditorProps, type UserInfo, checkUserPermission, getUserInfo, modelNameToPath, parseListParams };
package/dist/index.d.ts CHANGED
@@ -1066,4 +1066,41 @@ interface TagsEditorProps {
1066
1066
  */
1067
1067
  declare function TagsEditor(props: TagsEditorProps): hono_jsx_jsx_dev_runtime.JSX.Element;
1068
1068
 
1069
- export { type AuthProvider, BaseFeature, ComponentContext, CustomFeature, DefaultCreateFeature, DefaultDeleteFeature, DefaultDetailFeature, DefaultEditFeature, DefaultListFeature, Dialog, type DialogProps, type DialogSize, ErrorAlert, type ErrorAlertProps, type Feature, type FeatureContext, type FeatureType, type FieldMetadata, HtmxAdminPlugin, type HtmxAdminPluginOptions, HtmxComponent, type ListParams, type ListResult, LoadingBar, Method, type NavItemConfig, type Notification, type NotificationType, ObjectEditor, type ObjectEditorProps, type PageMetadata, PageModel, type PermissionResult, RenderContext, StringArrayEditor, type StringArrayEditorProps, TagsEditor, type TagsEditorProps, type UserInfo, checkUserPermission, getUserInfo, modelNameToPath, parseListParams };
1069
+ /**
1070
+ * 可拖拽排序列表组件
1071
+ * 使用 HTML5 原生拖放 API 实现拖拽排序
1072
+ *
1073
+ * 设计原则:
1074
+ * - 使用 Alpine.js 管理状态和事件处理
1075
+ * - 使用 HTML5 原生拖放 API(draggable、x-on:dragstart、x-on:dragover、x-on:drop)
1076
+ * - 高阶组件,可以包裹任何子元素
1077
+ * - 使用事件委托,在容器上统一处理所有拖拽事件
1078
+ * - 所有事件处理使用 Alpine.js 声明式语法
1079
+ */
1080
+ interface SortableListProps {
1081
+ /** 子元素 */
1082
+ children: any;
1083
+ /** 自定义类名 */
1084
+ className?: string;
1085
+ /** 拖拽手柄选择器(可选,如果提供,只有手柄可拖拽) */
1086
+ handle?: string;
1087
+ /** 拖拽时的样式类名(可选) */
1088
+ draggingClass?: string;
1089
+ /** 拖拽悬停时的样式类名(可选) */
1090
+ dragOverClass?: string;
1091
+ /** 排序变化回调(可选) */
1092
+ onSortableChange?: (detail: {
1093
+ oldIndex: number;
1094
+ newIndex: number;
1095
+ }) => void;
1096
+ /** 其他属性 */
1097
+ [key: string]: any;
1098
+ }
1099
+ /**
1100
+ * 可拖拽排序列表组件
1101
+ * 使用 HTML5 原生拖放 API 和 Alpine.js 声明式语法
1102
+ * 使用事件委托在容器上统一处理所有拖拽事件
1103
+ */
1104
+ declare function SortableList(props: SortableListProps): hono_jsx_jsx_dev_runtime.JSX.Element;
1105
+
1106
+ export { type AuthProvider, BaseFeature, ComponentContext, CustomFeature, DefaultCreateFeature, DefaultDeleteFeature, DefaultDetailFeature, DefaultEditFeature, DefaultListFeature, Dialog, type DialogProps, type DialogSize, ErrorAlert, type ErrorAlertProps, type Feature, type FeatureContext, type FeatureType, type FieldMetadata, HtmxAdminPlugin, type HtmxAdminPluginOptions, HtmxComponent, type ListParams, type ListResult, LoadingBar, Method, type NavItemConfig, type Notification, type NotificationType, ObjectEditor, type ObjectEditorProps, type PageMetadata, PageModel, type PermissionResult, RenderContext, SortableList, StringArrayEditor, type StringArrayEditorProps, TagsEditor, type TagsEditorProps, type UserInfo, checkUserPermission, getUserInfo, modelNameToPath, parseListParams };
package/dist/index.js CHANGED
@@ -631,7 +631,7 @@ function renderFormField(field, initialData, formFieldRenderers) {
631
631
  name: field.name,
632
632
  required: field.required,
633
633
  placeholder: field.placeholder || (isJsonString(value) ? "JSON \u683C\u5F0F\u6570\u636E" : ""),
634
- rows: isJsonString(value) ? 10 : 4,
634
+ rows: isJsonString(value) ? Math.max(10, value.split("\n").length) : Math.max(5, Math.ceil(value.length / 100)),
635
635
  className: "w-full px-4 py-2.5 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200 resize-y font-mono text-sm",
636
636
  "data-testid": `input-${field.name}`,
637
637
  children: isJsonString(value) ? formatJsonString(value) : value
@@ -5640,6 +5640,7 @@ exports.Method = Method;
5640
5640
  exports.ObjectEditor = ObjectEditor;
5641
5641
  exports.PageModel = PageModel;
5642
5642
  exports.RenderContext = RenderContext;
5643
+ exports.SortableList = SortableList;
5643
5644
  exports.StringArrayEditor = StringArrayEditor;
5644
5645
  exports.TagsEditor = TagsEditor;
5645
5646
  exports.checkUserPermission = checkUserPermission;
package/dist/index.mjs CHANGED
@@ -629,7 +629,7 @@ function renderFormField(field, initialData, formFieldRenderers) {
629
629
  name: field.name,
630
630
  required: field.required,
631
631
  placeholder: field.placeholder || (isJsonString(value) ? "JSON \u683C\u5F0F\u6570\u636E" : ""),
632
- rows: isJsonString(value) ? 10 : 4,
632
+ rows: isJsonString(value) ? Math.max(10, value.split("\n").length) : Math.max(5, Math.ceil(value.length / 100)),
633
633
  className: "w-full px-4 py-2.5 border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200 resize-y font-mono text-sm",
634
634
  "data-testid": `input-${field.name}`,
635
635
  children: isJsonString(value) ? formatJsonString(value) : value
@@ -5621,4 +5621,4 @@ var HtmxAdminPlugin = class {
5621
5621
  }
5622
5622
  };
5623
5623
 
5624
- export { BaseFeature, ComponentContext, CustomFeature, DefaultCreateFeature, DefaultDeleteFeature, DefaultDetailFeature, DefaultEditFeature, DefaultListFeature, Dialog, ErrorAlert, HtmxAdminPlugin, HtmxComponent, LoadingBar, Method, ObjectEditor, PageModel, RenderContext, StringArrayEditor, TagsEditor, checkUserPermission, getUserInfo, modelNameToPath, parseListParams };
5624
+ export { BaseFeature, ComponentContext, CustomFeature, DefaultCreateFeature, DefaultDeleteFeature, DefaultDetailFeature, DefaultEditFeature, DefaultListFeature, Dialog, ErrorAlert, HtmxAdminPlugin, HtmxComponent, LoadingBar, Method, ObjectEditor, PageModel, RenderContext, SortableList, StringArrayEditor, TagsEditor, checkUserPermission, getUserInfo, modelNameToPath, parseListParams };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imean-service-engine-htmx-plugin",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "HtmxAdminPlugin for IMean Service Engine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",