@dt-frames/ui 2.0.18 → 2.0.20

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.
@@ -169,14 +169,6 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
169
169
  };
170
170
  }
171
171
  });
172
- const _export_sfc = (sfc, props) => {
173
- const target = sfc.__vccOpts || sfc;
174
- for (const [key, val] of props) {
175
- target[key] = val;
176
- }
177
- return target;
178
- };
179
- const RadioButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/form/src/components/radioButton.vue"]]);
180
172
  const _hoisted_1$1 = { class: "input-with-dialog" };
181
173
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
182
174
  __name: "formInputUseDialog",
@@ -213,15 +205,14 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
213
205
  key: 0,
214
206
  class: "i mdi:close-circle",
215
207
  onClick: clearProps
216
- })) : createCommentVNode("v-if", true)
208
+ })) : createCommentVNode("", true)
217
209
  ]);
218
210
  };
219
211
  }
220
212
  });
221
- const DtFormInputDialog = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/form/src/components/formInputUseDialog.vue"]]);
222
213
  const components = {
223
214
  Input: Input$1,
224
- InputWithDialog: DtFormInputDialog,
215
+ InputWithDialog: _sfc_main$3,
225
216
  InputTextArea: Input$1.TextArea,
226
217
  InputSearch: Input$1.Search,
227
218
  InputGroup: Input$1.Group,
@@ -230,7 +221,7 @@ const components = {
230
221
  TreeSelect,
231
222
  Radio,
232
223
  RadioGroup: Radio.Group,
233
- RadioButtonGroup,
224
+ RadioButtonGroup: _sfc_main$4,
234
225
  Checkbox,
235
226
  CheckboxGroup: Checkbox.Group,
236
227
  AutoComplete,
@@ -282,7 +273,6 @@ const _sfc_main$2 = {
282
273
  }
283
274
  },
284
275
  setup(props, {
285
- emit,
286
276
  slots
287
277
  }) {
288
278
  const {
@@ -359,7 +349,8 @@ const _sfc_main$2 = {
359
349
  name,
360
350
  colon = appConf.ui.form.colon,
361
351
  suffix,
362
- prefix
352
+ prefix,
353
+ description
363
354
  } = props.schema;
364
355
  const {
365
356
  labelCol,
@@ -399,7 +390,9 @@ const _sfc_main$2 = {
399
390
  "style": "flex:1; width: 100%;"
400
391
  }, [getContent()]), !!suffix && createVNode("span", {
401
392
  "class": "suffix px-2"
402
- }, [getSuffix()])])]
393
+ }, [getSuffix()])]), description && createVNode("div", {
394
+ "class": "opacity-50 text-12"
395
+ }, [description])]
403
396
  });
404
397
  }
405
398
  function renderLabel() {
@@ -409,7 +402,7 @@ const _sfc_main$2 = {
409
402
  subLabel,
410
403
  toolTipProps = {}
411
404
  } = props.schema;
412
- const renderLabel2 = subLabel ? createVNode("span", null, [createTextVNode(" "), label, createTextVNode(" "), createVNode("span", {
405
+ const renderLabel2 = subLabel ? createVNode("span", null, [" ", label, createTextVNode(" "), createVNode("span", {
413
406
  "class": "text-secondary opacity-50"
414
407
  }, [createTextVNode("("), subLabel, createTextVNode(")")])]) : label;
415
408
  const _toolTip = isFunction(toolTip) ? toolTip(unref(getValues).model) : toolTip;
@@ -452,8 +445,9 @@ const _sfc_main$2 = {
452
445
  } else if (isArray(name)) {
453
446
  name.map((key) => props.setFormModel(key, value));
454
447
  }
455
- if (_sProps && _sProps[eventKey])
448
+ if (_sProps && _sProps[eventKey]) {
456
449
  _sProps[eventKey](...args, formModel);
450
+ }
457
451
  }
458
452
  };
459
453
  for (let it in _sProps) {
@@ -474,10 +468,12 @@ const _sfc_main$2 = {
474
468
  disabled: itemDisabled = false
475
469
  } = unref(getComponentProps);
476
470
  let _disabled = !!gDisabled || itemDisabled;
477
- if (isBoolean(disabled))
471
+ if (isBoolean(disabled)) {
478
472
  _disabled = disabled;
479
- if (isFunction(disabled))
473
+ }
474
+ if (isFunction(disabled)) {
480
475
  _disabled = disabled(unref(getValues).model);
476
+ }
481
477
  return _disabled;
482
478
  });
483
479
  const getSize = () => {
@@ -496,10 +492,8 @@ const _sfc_main$2 = {
496
492
  disabled: unref(getDisable)
497
493
  };
498
494
  if (component === "Select") {
499
- {
500
- itemProps.showSearch = true;
501
- itemProps.optionFilterProp = "label";
502
- }
495
+ itemProps.showSearch = true;
496
+ itemProps.optionFilterProp = "label";
503
497
  }
504
498
  if (component !== "RangePicker") {
505
499
  itemProps.placeholder = unref(getComponentProps)?.placeholder || createPlaceholder(component);
@@ -544,8 +538,9 @@ const _sfc_main$2 = {
544
538
  dynamicRules,
545
539
  required
546
540
  } = props.schema;
547
- if (!component)
541
+ if (!component) {
548
542
  return [];
543
+ }
549
544
  if (isFunction(dynamicRules)) {
550
545
  return dynamicRules(unref(getValues).model);
551
546
  }
@@ -553,8 +548,9 @@ const _sfc_main$2 = {
553
548
  let rules = cloneDeep(defaultRules);
554
549
  const getRequired = isFunction(required) ? required(unref(getValues).model) : required;
555
550
  function validator(rule, value) {
556
- if (component === "Upload" && unref(uploadFiles).map((file) => file.fileId).includes(void 0))
551
+ if (component === "Upload" && unref(uploadFiles).map((file) => file.fileId).includes(void 0)) {
557
552
  return Promise.resolve();
553
+ }
558
554
  const msg = rule.message || defaultMsg;
559
555
  if (value === void 0 || isNull(value) || Array.isArray(value) && value.length === 0 || typeof value === "string" && value.trim() === "" || typeof value === "object" && Reflect.has(value, "checked") && Reflect.has(value, "halfChecked") && Array.isArray(value.checked) && Array.isArray(value.halfChecked) && value.checked.length === 0 && value.halfChecked.length === 0) {
560
556
  return Promise.reject(msg);
@@ -655,7 +651,6 @@ const _sfc_main$2 = {
655
651
  };
656
652
  }
657
653
  };
658
- const DtFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/form/src/components/FormItem.vue"]]);
659
654
  const _hoisted_1 = {
660
655
  key: 0,
661
656
  className: "preIcon pr-1"
@@ -822,18 +817,18 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
822
817
  icon: withCtx(() => [
823
818
  button.preIcon ? withDirectives((openBlock(), createElementBlock("span", _hoisted_1, null, 512)), [
824
819
  [_directive_icon, button.preIcon]
825
- ]) : createCommentVNode("v-if", true)
820
+ ]) : createCommentVNode("", true)
826
821
  ]),
827
822
  default: withCtx(() => [
828
823
  createTextVNode(" " + toDisplayString(unref(t)(button.label)) + " ", 1),
829
824
  button.postIcon ? withDirectives((openBlock(), createElementBlock("span", _hoisted_2, null, 512)), [
830
825
  [_directive_icon, button.postIcon]
831
- ]) : createCommentVNode("v-if", true)
826
+ ]) : createCommentVNode("", true)
832
827
  ]),
833
828
  _: 2
834
829
  }, 1032, ["type", "class", "loading", "disabled", "onClick"])), [
835
830
  [_directive_auth, getAuth(button.auth)]
836
- ]) : createCommentVNode("v-if", true)
831
+ ]) : createCommentVNode("", true)
837
832
  ], 64);
838
833
  }), 256)),
839
834
  unref(showAdvanceRef) ? (openBlock(), createBlock(_component_AButton, {
@@ -843,24 +838,22 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
843
838
  onClick: toggleAdvanced
844
839
  }, {
845
840
  default: withCtx(() => [
846
- createCommentVNode(" \u6536\u8D77 | \u5C55\u5F00 "),
847
841
  createElementVNode("span", _hoisted_3, toDisplayString(advancedRef.value ? unref(t)("UI.ADVANCED") : unref(t)("UI.EXPAND")), 1),
848
842
  createElementVNode("span", {
849
843
  class: normalizeClass(unref(getAdvanceClass))
850
844
  }, _hoisted_5, 2)
851
845
  ]),
852
846
  _: 1
853
- })) : createCommentVNode("v-if", true)
847
+ })) : createCommentVNode("", true)
854
848
  ]),
855
849
  _: 1
856
850
  }, 8, ["style"])
857
851
  ]),
858
852
  _: 1
859
- }, 16)) : createCommentVNode("v-if", true);
853
+ }, 16)) : createCommentVNode("", true);
860
854
  };
861
855
  }
862
856
  });
863
- const DtFormButtons = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/form/src/components/FormButtons.vue"]]);
864
857
  const SEARCH_BTN_NAME = "UI.SEARCH";
865
858
  const RESET_BTN_NAME = "UI.RESET";
866
859
  const SEARCH_BTNS = [
@@ -961,22 +954,22 @@ function useFormEvents({
961
954
  schemaRef.value = schemaList;
962
955
  }
963
956
  function _removeSchemaByName(name, schemaList) {
964
- const index2 = schemaList.findIndex((schema) => schema.name === name);
965
- if (index2 !== -1) {
957
+ const index = schemaList.findIndex((schema) => schema.name === name);
958
+ if (index !== -1) {
966
959
  delete formModel[name];
967
- schemaList.splice(index2, 1);
960
+ schemaList.splice(index, 1);
968
961
  }
969
962
  }
970
963
  function appendFormItems(schema, prefixName, first = false) {
971
964
  const schemaList = cloneDeep(unref(getSchema));
972
- const index2 = schemaList.findIndex((schema2) => schema2.name === prefixName);
973
- if (!prefixName || index2 === -1 || first) {
965
+ const index = schemaList.findIndex((schema2) => schema2.name === prefixName);
966
+ if (!prefixName || index === -1 || first) {
974
967
  first ? schemaList.unshift(...schema) : schemaList.push(...schema);
975
968
  schemaRef.value = schemaList;
976
969
  return;
977
970
  }
978
- if (index2 !== -1) {
979
- schemaList.splice(index2 + 1, 0, ...schema);
971
+ if (index !== -1) {
972
+ schemaList.splice(index + 1, 0, ...schema);
980
973
  }
981
974
  schemaRef.value = schemaList;
982
975
  }
@@ -1102,7 +1095,7 @@ function useFormValues({
1102
1095
  if (isArray(defaultValue2)) {
1103
1096
  let vals = defaultValue2.map((it) => format ? dayjs(it, format) : dayjs(it));
1104
1097
  if (names.length > 1) {
1105
- names.map((key, index2) => obj[key] = vals[index2] ?? null);
1098
+ names.map((key, index) => obj[key] = vals[index] ?? null);
1106
1099
  } else {
1107
1100
  obj[names[0]] = vals;
1108
1101
  }
@@ -1111,11 +1104,11 @@ function useFormValues({
1111
1104
  }
1112
1105
  } else {
1113
1106
  if (names.length > 1) {
1114
- names.forEach((key, index2) => {
1115
- if (!defaultValue2 || defaultValue2.length - 1 < index2) {
1107
+ names.forEach((key, index) => {
1108
+ if (!defaultValue2 || defaultValue2.length - 1 < index) {
1116
1109
  obj[key] = null;
1117
1110
  } else {
1118
- obj[key] = defaultValue2[index2];
1111
+ obj[key] = defaultValue2[index];
1119
1112
  }
1120
1113
  });
1121
1114
  } else {
@@ -1124,7 +1117,7 @@ function useFormValues({
1124
1117
  }
1125
1118
  } else {
1126
1119
  names.map((it) => {
1127
- if (component === "TreeSelect" || (mode === "multiple" || treeCheckable) || component === "Select" && mode === "multiple") {
1120
+ if (component === "TreeSelect" && (mode === "multiple" || treeCheckable) || component === "Select" && mode === "multiple") {
1128
1121
  obj[it] = [];
1129
1122
  } else {
1130
1123
  obj[it] = null;
@@ -1153,8 +1146,8 @@ function useFormActions(opt) {
1153
1146
  } = unref(getProps);
1154
1147
  let schema = [...schemas];
1155
1148
  if (showAdvancedButton) {
1156
- schema = schemas.reduce((t, it, index2) => {
1157
- if (index2 > minShowColumn - 1)
1149
+ schema = schemas.reduce((t, it, index) => {
1150
+ if (index > minShowColumn - 1)
1158
1151
  it.isAdvanced = isAdvanced;
1159
1152
  t.push(it);
1160
1153
  return t;
@@ -1338,7 +1331,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1338
1331
  formModel[key] = value;
1339
1332
  const { validateTrigger } = unref(getBindValue);
1340
1333
  if (!validateTrigger || validateTrigger === "change") {
1341
- validateFields([key]).catch((err) => {
1334
+ validateFields([key]).catch(() => {
1342
1335
  });
1343
1336
  }
1344
1337
  }
@@ -1423,7 +1416,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1423
1416
  return {
1424
1417
  colspan,
1425
1418
  style: {
1426
- marginLeft: "auto"
1419
+ marginLeft: showAdvancedButton ? "auto" : ""
1427
1420
  },
1428
1421
  ...{
1429
1422
  showAdvancedButton,
@@ -1459,10 +1452,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1459
1452
  );
1460
1453
  watch(
1461
1454
  () => unref(getProps).model,
1462
- (v) => {
1455
+ () => {
1463
1456
  const { model } = unref(getProps);
1464
- if (!model || !Object.keys(model).length)
1457
+ if (!model || !Object.keys(model).length) {
1465
1458
  return;
1459
+ }
1466
1460
  setFormValues(model);
1467
1461
  },
1468
1462
  {
@@ -1487,14 +1481,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1487
1481
  } }), {
1488
1482
  default: withCtx(() => [
1489
1483
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(getSchema), (schema) => {
1490
- return openBlock(), createBlock(unref(DtFormItem), {
1484
+ return openBlock(), createBlock(unref(_sfc_main$2), {
1491
1485
  key: schema.name,
1492
1486
  schema,
1493
- formProps: unref(getProps),
1494
- formModel,
1495
- defaultValues: defaultValue.value,
1496
- setFormModel,
1497
- formActionType: formActionMethods
1487
+ "form-props": unref(getProps),
1488
+ "form-model": formModel,
1489
+ "default-values": defaultValue.value,
1490
+ "set-form-model": setFormModel,
1491
+ "form-action-type": formActionMethods
1498
1492
  }, createSlots({ _: 2 }, [
1499
1493
  renderList(Object.keys(_ctx.$slots), (item) => {
1500
1494
  return {
@@ -1504,9 +1498,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1504
1498
  ])
1505
1499
  };
1506
1500
  })
1507
- ]), 1032, ["schema", "formProps", "formModel", "defaultValues"]);
1501
+ ]), 1032, ["schema", "form-props", "form-model", "default-values"]);
1508
1502
  }), 128)),
1509
- unref(getActionsProps).buttonList?.length ? (openBlock(), createBlock(unref(DtFormButtons), mergeProps({ key: 0 }, unref(getActionsProps), { onHandleMethod: unref(handleMethod) }), null, 16, ["onHandleMethod"])) : createCommentVNode("v-if", true)
1503
+ unref(getActionsProps).buttonList?.length ? (openBlock(), createBlock(unref(_sfc_main$1), mergeProps({ key: 0 }, unref(getActionsProps), { onHandleMethod: unref(handleMethod) }), null, 16, ["onHandleMethod"])) : createCommentVNode("", true)
1510
1504
  ]),
1511
1505
  _: 3
1512
1506
  }, 16)
@@ -1516,7 +1510,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1516
1510
  };
1517
1511
  }
1518
1512
  });
1519
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "D:/dt/dt-frame-front/dt-frames/frames/packages/ui/src/components/form/src/index.vue"]]);
1520
1513
  function useForm(props) {
1521
1514
  const formRef = ref(null);
1522
1515
  const loadedRef = ref(false);
@@ -1588,7 +1581,7 @@ function useForm(props) {
1588
1581
  return [register, methods];
1589
1582
  }
1590
1583
  export {
1591
- index as DtForm,
1592
- DtFormButtons,
1584
+ _sfc_main as DtForm,
1585
+ _sfc_main$1 as DtFormButtons,
1593
1586
  useForm
1594
1587
  };
@@ -71,7 +71,7 @@ declare const _sfc_main: {
71
71
  type: NumberConstructor;
72
72
  };
73
73
  size: {
74
- type: PropType<"small" | "large" | "middle">;
74
+ type: PropType<"large" | "small" | "middle">;
75
75
  };
76
76
  disabled: {
77
77
  type: BooleanConstructor;
@@ -151,8 +151,7 @@ declare const _sfc_main: {
151
151
  type: PropType<FormActionType>;
152
152
  };
153
153
  };
154
- setup(props: any, { emit, slots }: {
155
- emit: any;
154
+ setup(props: any, { slots }: {
156
155
  slots: any;
157
156
  }): () => JSX.Element;
158
157
  };
@@ -1,7 +1,7 @@
1
- import { Recordable } from "@dt-frames/core";
2
- import { PropType, Ref } from "vue";
3
- import { ButtonProps, ColEx, FormSchema } from "./types/form.type";
4
- import { FormActionType } from "./types/actions.type";
1
+ import { Recordable } from '@dt-frames/core';
2
+ import { PropType, Ref } from 'vue';
3
+ import { ButtonProps, ColEx, FormSchema } from './types/form.type';
4
+ import { FormActionType } from './types/actions.type';
5
5
  export declare const BasicProps: {
6
6
  mode: {
7
7
  type: PropType<"search" | "dialog">;
@@ -16,7 +16,7 @@ export declare const BasicProps: {
16
16
  default: () => {};
17
17
  };
18
18
  layout: {
19
- type: PropType<"inline" | "horizontal" | "vertical">;
19
+ type: PropType<"vertical" | "inline" | "horizontal">;
20
20
  default: string;
21
21
  };
22
22
  labelWidth: {
@@ -41,8 +41,8 @@ export declare const BasicProps: {
41
41
  };
42
42
  rowProps: {
43
43
  type: PropType<Partial<import("vue").ExtractPropTypes<{
44
- align: PropType<"bottom" | "top" | "stretch" | "middle">;
45
- justify: PropType<"space-around" | "space-between" | "center" | "end" | "start">;
44
+ align: PropType<"middle" | "top" | "bottom" | "stretch">;
45
+ justify: PropType<"center" | "space-around" | "space-between" | "end" | "start">;
46
46
  prefixCls: StringConstructor;
47
47
  gutter: {
48
48
  type: PropType<import("ant-design-vue/lib/grid/Row").Gutter | [import("ant-design-vue/lib/grid/Row").Gutter, import("ant-design-vue/lib/grid/Row").Gutter]>;
@@ -56,6 +56,7 @@ declare type Schema<ComponentType, T> = {
56
56
  wrapperCol?: Partial<ColEx>;
57
57
  isAdvanced?: boolean;
58
58
  extraName?: string[];
59
+ description?: String;
59
60
  };
60
61
  export declare type FormSchema = Schema<'Input', Input> | Schema<'InputWithDialog', InputWithDialog> | Schema<'InputGroup', InputGroup> | Schema<'InputPassword', InputPassword> | Schema<'InputSearch', InputSearch> | Schema<'InputTextArea', InputTextArea> | Schema<'InputNumber', InputNumber> | Schema<'Select', Select> | Schema<'TreeSelect', TreeSelect> | Schema<'Radio', Radio> | Schema<'RadioButtonGroup', Radio> | Schema<'RadioGroup', RadioGroup> | Schema<'Checkbox', Checkbox> | Schema<'CheckboxGroup', CheckboxGroup> | Schema<'AutoComplete', Recordable> | Schema<'Cascader', Cascader> | Schema<'DatePicker', DatePicker> | Schema<'MonthPicker', DatePicker> | Schema<'RangePicker', RangePicker> | Schema<'WeekPicker', DatePicker> | Schema<'TimePicker', TimePicker> | Schema<'Switch', Switch> | Schema<'Slider', {
61
62
  disabled?: boolean;
@@ -135,6 +135,8 @@ function useSource(props) {
135
135
  const { t } = useI18n("UI");
136
136
  const { confirm, message } = useMessage();
137
137
  const { appConf } = useAppStore();
138
+ let okCode = appConf?.http?.okCode;
139
+ let _okCode = isArray(okCode) ? okCode : [okCode];
138
140
  const { baseUrl, api: orgApi, exportName, queryAfterUpdate, beforeUpdate, afterUpdate, authPrefix } = props;
139
141
  const pagination = ref({
140
142
  current: appConf?.ui?.table?.defaultPageNo || 1,
@@ -202,7 +204,7 @@ function useSource(props) {
202
204
  pagination.value = {
203
205
  current,
204
206
  pageSize: size || appConf?.ui?.table?.defaultPageSize,
205
- total: 100
207
+ total
206
208
  };
207
209
  }
208
210
  } catch (err) {
@@ -278,7 +280,7 @@ function useSource(props) {
278
280
  loading.onAdd.value = true;
279
281
  try {
280
282
  const result = await fetch(api.add, { ...model }, false);
281
- if (result?.code === appConf?.http?.okCode) {
283
+ if (_okCode.includes(result?.code)) {
282
284
  message.success(t("ADD_SUCCESS"));
283
285
  curdInstance && curdInstance.closeModal();
284
286
  if (queryAfterUpdate !== false)
@@ -294,7 +296,7 @@ function useSource(props) {
294
296
  loading.onUpdate.value = true;
295
297
  try {
296
298
  const result = await fetch(api.update, { ...model }, false);
297
- if (result?.code === appConf?.http?.okCode) {
299
+ if (_okCode.includes(result?.code)) {
298
300
  message.success(t("UPDATE_SUCCESS"));
299
301
  curdInstance && curdInstance.closeModal();
300
302
  if (queryAfterUpdate !== false)
@@ -332,7 +334,7 @@ function useSource(props) {
332
334
  iconType: "warning",
333
335
  onOk() {
334
336
  fetch(api.deletes, toRaw(_ids), false).then((rsp) => {
335
- if (rsp?.code === appConf?.http?.okCode) {
337
+ if (_okCode.includes(rsp?.code)) {
336
338
  message.success((isSingleDelete ? "" : t("MULTIFY")) + t("DELETE_SUCCESS"));
337
339
  !isSingleDelete && tableInstance.clearSelectedRowKeys();
338
340
  if (queryAfterUpdate !== false)