knt-shared 1.10.8 → 1.10.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/index.esm.js CHANGED
@@ -22,6 +22,162 @@ var _export_sfc$1 = (sfc, props) => {
22
22
  }
23
23
  return sfc;
24
24
  };
25
+ const _sfc_main$C = defineComponent({
26
+ name: "IconDown",
27
+ props: {
28
+ size: {
29
+ type: [Number, String]
30
+ },
31
+ strokeWidth: {
32
+ type: Number,
33
+ default: 4
34
+ },
35
+ strokeLinecap: {
36
+ type: String,
37
+ default: "butt",
38
+ validator: (value) => {
39
+ return ["butt", "round", "square"].includes(value);
40
+ }
41
+ },
42
+ strokeLinejoin: {
43
+ type: String,
44
+ default: "miter",
45
+ validator: (value) => {
46
+ return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
47
+ }
48
+ },
49
+ rotate: Number,
50
+ spin: Boolean
51
+ },
52
+ emits: {
53
+ click: (ev) => true
54
+ },
55
+ setup(props, { emit }) {
56
+ const prefixCls = getPrefixCls("icon");
57
+ const cls = computed(() => [prefixCls, `${prefixCls}-down`, { [`${prefixCls}-spin`]: props.spin }]);
58
+ const innerStyle = computed(() => {
59
+ const styles = {};
60
+ if (props.size) {
61
+ styles.fontSize = isNumber$1(props.size) ? `${props.size}px` : props.size;
62
+ }
63
+ if (props.rotate) {
64
+ styles.transform = `rotate(${props.rotate}deg)`;
65
+ }
66
+ return styles;
67
+ });
68
+ const onClick = (ev) => {
69
+ emit("click", ev);
70
+ };
71
+ return {
72
+ cls,
73
+ innerStyle,
74
+ onClick
75
+ };
76
+ }
77
+ });
78
+ const _hoisted_1$w = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
79
+ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
80
+ return openBlock(), createElementBlock("svg", {
81
+ viewBox: "0 0 48 48",
82
+ fill: "none",
83
+ xmlns: "http://www.w3.org/2000/svg",
84
+ stroke: "currentColor",
85
+ class: normalizeClass(_ctx.cls),
86
+ style: normalizeStyle(_ctx.innerStyle),
87
+ "stroke-width": _ctx.strokeWidth,
88
+ "stroke-linecap": _ctx.strokeLinecap,
89
+ "stroke-linejoin": _ctx.strokeLinejoin,
90
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
91
+ }, _cache[1] || (_cache[1] = [
92
+ createElementVNode("path", { d: "M39.6 17.443 24.043 33 8.487 17.443" }, null, -1)
93
+ ]), 14, _hoisted_1$w);
94
+ }
95
+ var _IconDown = /* @__PURE__ */ _export_sfc$1(_sfc_main$C, [["render", _sfc_render$i]]);
96
+ const IconDown = Object.assign(_IconDown, {
97
+ install: (app, options) => {
98
+ var _a;
99
+ const iconPrefix = (_a = options == null ? void 0 : options.iconPrefix) != null ? _a : "";
100
+ app.component(iconPrefix + _IconDown.name, _IconDown);
101
+ }
102
+ });
103
+ const _sfc_main$B = defineComponent({
104
+ name: "IconUp",
105
+ props: {
106
+ size: {
107
+ type: [Number, String]
108
+ },
109
+ strokeWidth: {
110
+ type: Number,
111
+ default: 4
112
+ },
113
+ strokeLinecap: {
114
+ type: String,
115
+ default: "butt",
116
+ validator: (value) => {
117
+ return ["butt", "round", "square"].includes(value);
118
+ }
119
+ },
120
+ strokeLinejoin: {
121
+ type: String,
122
+ default: "miter",
123
+ validator: (value) => {
124
+ return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
125
+ }
126
+ },
127
+ rotate: Number,
128
+ spin: Boolean
129
+ },
130
+ emits: {
131
+ click: (ev) => true
132
+ },
133
+ setup(props, { emit }) {
134
+ const prefixCls = getPrefixCls("icon");
135
+ const cls = computed(() => [prefixCls, `${prefixCls}-up`, { [`${prefixCls}-spin`]: props.spin }]);
136
+ const innerStyle = computed(() => {
137
+ const styles = {};
138
+ if (props.size) {
139
+ styles.fontSize = isNumber$1(props.size) ? `${props.size}px` : props.size;
140
+ }
141
+ if (props.rotate) {
142
+ styles.transform = `rotate(${props.rotate}deg)`;
143
+ }
144
+ return styles;
145
+ });
146
+ const onClick = (ev) => {
147
+ emit("click", ev);
148
+ };
149
+ return {
150
+ cls,
151
+ innerStyle,
152
+ onClick
153
+ };
154
+ }
155
+ });
156
+ const _hoisted_1$v = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
157
+ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
158
+ return openBlock(), createElementBlock("svg", {
159
+ viewBox: "0 0 48 48",
160
+ fill: "none",
161
+ xmlns: "http://www.w3.org/2000/svg",
162
+ stroke: "currentColor",
163
+ class: normalizeClass(_ctx.cls),
164
+ style: normalizeStyle(_ctx.innerStyle),
165
+ "stroke-width": _ctx.strokeWidth,
166
+ "stroke-linecap": _ctx.strokeLinecap,
167
+ "stroke-linejoin": _ctx.strokeLinejoin,
168
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
169
+ }, _cache[1] || (_cache[1] = [
170
+ createElementVNode("path", { d: "M39.6 30.557 24.043 15 8.487 30.557" }, null, -1)
171
+ ]), 14, _hoisted_1$v);
172
+ }
173
+ var _IconUp = /* @__PURE__ */ _export_sfc$1(_sfc_main$B, [["render", _sfc_render$h]]);
174
+ const IconUp = Object.assign(_IconUp, {
175
+ install: (app, options) => {
176
+ var _a;
177
+ const iconPrefix = (_a = options == null ? void 0 : options.iconPrefix) != null ? _a : "";
178
+ app.component(iconPrefix + _IconUp.name, _IconUp);
179
+ }
180
+ });
25
181
  const _sfc_main$A = defineComponent({
26
182
  name: "IconPlus",
27
183
  props: {
@@ -2881,7 +3037,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
2881
3037
  };
2882
3038
  }
2883
3039
  });
2884
- const VideoPreviewModal = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-db151e2d"]]);
3040
+ const VideoPreviewModal = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-7b674f81"]]);
2885
3041
  const _hoisted_1$9 = { class: "basic-upload" };
2886
3042
  const _hoisted_2$6 = {
2887
3043
  key: 0,
@@ -2972,7 +3128,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2972
3128
  emits: ["register", "update:modelValue", "change", "handleSuccess", "handleError", "progress", "remove", "preview", "exceed", "sortChange"],
2973
3129
  setup(__props, { expose: __expose, emit: __emit }) {
2974
3130
  useCssVars((_ctx) => ({
2975
- "v0a277aea": cardSizeValue.value
3131
+ "v5d214bdf": cardSizeValue.value
2976
3132
  }));
2977
3133
  const MAX_SIZE_UNIT_BYTES = {
2978
3134
  B: 1,
@@ -3256,8 +3412,8 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
3256
3412
  const addVideoFileClass = () => {
3257
3413
  nextTick(() => {
3258
3414
  var _a;
3259
- const root = ((_a = uploadRef.value) == null ? void 0 : _a.$el) ?? null;
3260
- const scope = root ?? document;
3415
+ const root = (_a = uploadRef.value) == null ? void 0 : _a.$el;
3416
+ const scope = root instanceof Element ? root : document;
3261
3417
  const uploadItems = scope.querySelectorAll(".arco-upload-list-picture");
3262
3418
  uploadItems.forEach((item) => {
3263
3419
  const img = item.querySelector("img");
@@ -3661,7 +3817,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
3661
3817
  };
3662
3818
  }
3663
3819
  });
3664
- const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-d256c7da"]]);
3820
+ const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-627de95c"]]);
3665
3821
  function useUpload(props) {
3666
3822
  const uploadRef = ref(null);
3667
3823
  const fileListRef = ref((props == null ? void 0 : props.defaultFileList) || []);
@@ -5032,7 +5188,10 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5032
5188
  showActionButtons: { type: Boolean, default: true },
5033
5189
  readonly: { type: Boolean },
5034
5190
  autoTrim: { type: Boolean, default: true },
5035
- context: {}
5191
+ context: {},
5192
+ showCollapse: { type: Boolean, default: false },
5193
+ collapseRows: { default: 1 },
5194
+ defaultCollapsed: { type: Boolean, default: true }
5036
5195
  },
5037
5196
  emits: ["register", "submit", "reset", "validate"],
5038
5197
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -5099,6 +5258,36 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5099
5258
  return schema.show(formModel);
5100
5259
  });
5101
5260
  });
5261
+ const isCollapsed = ref(props.defaultCollapsed !== false);
5262
+ const getDisplaySchemas = computed(() => {
5263
+ var _a, _b;
5264
+ const propsData = unref(getProps);
5265
+ if (!propsData.showCollapse || !isCollapsed.value) {
5266
+ return getVisibleSchemas.value;
5267
+ }
5268
+ const maxRows = propsData.collapseRows ?? 1;
5269
+ const baseSpan = ((_a = propsData.baseColProps) == null ? void 0 : _a.span) ?? 24;
5270
+ let rowSpan = 0;
5271
+ let rowCount = 1;
5272
+ const result = [];
5273
+ for (const schema of getVisibleSchemas.value) {
5274
+ const span = ((_b = schema.colProps) == null ? void 0 : _b.span) ?? baseSpan;
5275
+ if (rowSpan + span > 24) {
5276
+ rowCount++;
5277
+ if (rowCount > maxRows) break;
5278
+ rowSpan = 0;
5279
+ }
5280
+ result.push(schema);
5281
+ rowSpan += span;
5282
+ }
5283
+ return result;
5284
+ });
5285
+ const showCollapseBtn = computed(() => {
5286
+ const propsData = unref(getProps);
5287
+ if (!propsData.showCollapse) return false;
5288
+ const hasHidden = getVisibleSchemas.value.length !== getDisplaySchemas.value.length;
5289
+ return hasHidden || !isCollapsed.value;
5290
+ });
5102
5291
  const getColProps = (schema) => {
5103
5292
  const propsData = unref(getProps);
5104
5293
  return schema.colProps || propsData.baseColProps || { span: 24 };
@@ -5434,7 +5623,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5434
5623
  default: withCtx(() => [
5435
5624
  createVNode(unref(Row), normalizeProps(guardReactiveProps(getRow.value)), {
5436
5625
  default: withCtx(() => [
5437
- (openBlock(true), createElementBlock(Fragment, null, renderList(getVisibleSchemas.value, (schema) => {
5626
+ (openBlock(true), createElementBlock(Fragment, null, renderList(getDisplaySchemas.value, (schema) => {
5438
5627
  return openBlock(), createBlock(unref(Col), mergeProps({
5439
5628
  key: schema.key || schema.field,
5440
5629
  ref_for: true
@@ -5512,39 +5701,55 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
5512
5701
  _: 2
5513
5702
  }, 1040, ["data-field"]);
5514
5703
  }), 128)),
5515
- getActionProps.value.showActionButtons ? (openBlock(), createBlock(unref(Col), normalizeProps(mergeProps({ key: 0 }, getActionProps.value.actionColOptions)), {
5704
+ getActionProps.value.showActionButtons || showCollapseBtn.value ? (openBlock(), createBlock(unref(Col), normalizeProps(mergeProps({ key: 0 }, getActionProps.value.actionColOptions)), {
5516
5705
  default: withCtx(() => [
5517
5706
  createVNode(unref(FormItem), normalizeProps(guardReactiveProps(getActionProps.value.actionFormItemProps)), {
5518
5707
  default: withCtx(() => [
5519
5708
  createVNode(unref(Space), null, {
5520
5709
  default: withCtx(() => [
5521
- getActionProps.value.showSubmitButton ? (openBlock(), createBlock(unref(Button), {
5522
- key: 0,
5523
- type: "primary",
5524
- "html-type": "submit",
5525
- loading: submitLoading.value
5526
- }, {
5527
- icon: withCtx(() => [
5528
- createVNode(unref(IconSearch))
5529
- ]),
5530
- default: withCtx(() => [
5531
- createTextVNode(" " + toDisplayString(getActionProps.value.submitButtonText), 1)
5532
- ]),
5533
- _: 1
5534
- }, 8, ["loading"])) : createCommentVNode("", true),
5535
- getActionProps.value.showResetButton ? (openBlock(), createBlock(unref(Button), {
5710
+ getActionProps.value.showActionButtons ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
5711
+ getActionProps.value.showSubmitButton ? (openBlock(), createBlock(unref(Button), {
5712
+ key: 0,
5713
+ type: "primary",
5714
+ "html-type": "submit",
5715
+ loading: submitLoading.value
5716
+ }, {
5717
+ icon: withCtx(() => [
5718
+ createVNode(unref(IconSearch))
5719
+ ]),
5720
+ default: withCtx(() => [
5721
+ createTextVNode(" " + toDisplayString(getActionProps.value.submitButtonText), 1)
5722
+ ]),
5723
+ _: 1
5724
+ }, 8, ["loading"])) : createCommentVNode("", true),
5725
+ getActionProps.value.showResetButton ? (openBlock(), createBlock(unref(Button), {
5726
+ key: 1,
5727
+ onClick: handleReset
5728
+ }, {
5729
+ icon: withCtx(() => [
5730
+ createVNode(unref(IconRefresh))
5731
+ ]),
5732
+ default: withCtx(() => [
5733
+ createTextVNode(" " + toDisplayString(getActionProps.value.resetButtonText), 1)
5734
+ ]),
5735
+ _: 1
5736
+ })) : createCommentVNode("", true),
5737
+ renderSlot(_ctx.$slots, "actions")
5738
+ ], 64)) : createCommentVNode("", true),
5739
+ showCollapseBtn.value ? (openBlock(), createBlock(unref(Button), {
5536
5740
  key: 1,
5537
- onClick: handleReset
5741
+ type: "text",
5742
+ size: "small",
5743
+ onClick: _cache[0] || (_cache[0] = ($event) => isCollapsed.value = !isCollapsed.value)
5538
5744
  }, {
5539
5745
  icon: withCtx(() => [
5540
- createVNode(unref(IconRefresh))
5746
+ !isCollapsed.value ? (openBlock(), createBlock(unref(IconUp), { key: 0 })) : (openBlock(), createBlock(unref(IconDown), { key: 1 }))
5541
5747
  ]),
5542
5748
  default: withCtx(() => [
5543
- createTextVNode(" " + toDisplayString(getActionProps.value.resetButtonText), 1)
5749
+ createTextVNode(" " + toDisplayString(isCollapsed.value ? "更多筛选" : "收起"), 1)
5544
5750
  ]),
5545
5751
  _: 1
5546
- })) : createCommentVNode("", true),
5547
- renderSlot(_ctx.$slots, "actions")
5752
+ })) : createCommentVNode("", true)
5548
5753
  ]),
5549
5754
  _: 3
5550
5755
  })
@@ -7085,7 +7290,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
7085
7290
  return {
7086
7291
  show: true,
7087
7292
  layout: "horizontal",
7088
- showCollapse: true,
7293
+ showCollapse: false,
7089
7294
  defaultCollapseRows: 1,
7090
7295
  showResetButton: true,
7091
7296
  showSubmitButton: true,
@@ -7105,6 +7310,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
7105
7310
  showResetButton: config.showResetButton,
7106
7311
  submitButtonText: config.submitButtonText,
7107
7312
  resetButtonText: config.resetButtonText,
7313
+ showCollapse: config.showCollapse,
7314
+ collapseRows: config.defaultCollapseRows,
7108
7315
  // 其他 formProps(先展开,后面会被覆盖)
7109
7316
  ...formProps,
7110
7317
  // 合并 baseFormItemProps(保留默认值)
@@ -8392,7 +8599,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
8392
8599
  };
8393
8600
  }
8394
8601
  });
8395
- const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-1a0967ac"]]);
8602
+ const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-0e01115d"]]);
8396
8603
  function useTable(options = {}) {
8397
8604
  const tableRef = ref(null);
8398
8605
  const formRef = ref(null);