@shwfed/config 2.12.3 → 2.12.5
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/module.json +1 -1
- package/dist/runtime/components/actions/buttons/2026-05-11/com.shwfed.actions.button.modal.layout/runtime.vue +9 -2
- package/dist/runtime/components/actions/buttons/2026-05-11/com.shwfed.actions.button.modal.layout/schema.d.ts +8 -2
- package/dist/runtime/components/actions/buttons/2026-05-11/com.shwfed.actions.button.modal.layout/schema.js +3 -3
- package/dist/runtime/components/actions/components/group.vue +3 -1
- package/dist/runtime/components/actions/schema.d.ts +16 -4
- package/dist/runtime/components/actions/schema.js +5 -5
- package/dist/runtime/components/config/footer.d.vue.ts +4 -0
- package/dist/runtime/components/config/footer.vue +25 -12
- package/dist/runtime/components/config/footer.vue.d.ts +4 -0
- package/dist/runtime/components/config/history-picker.d.vue.ts +15 -0
- package/dist/runtime/components/config/history-picker.vue +155 -0
- package/dist/runtime/components/config/history-picker.vue.d.ts +15 -0
- package/dist/runtime/components/config/index.d.vue.ts +4 -0
- package/dist/runtime/components/config/index.vue +8 -1
- package/dist/runtime/components/config/index.vue.d.ts +4 -0
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.text/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.text/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.text/runtime.vue +5 -3
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.text/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.text/schema.js +2 -2
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/runtime.vue +5 -3
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/schema.js +2 -2
- package/dist/runtime/components/form/fields/2026-04-24/com.shwfed.form.field.combobox.single/config.d.vue.ts +16 -16
- package/dist/runtime/components/form/fields/2026-04-24/com.shwfed.form.field.combobox.single/config.vue.d.ts +16 -16
- package/dist/runtime/components/form/fields/2026-04-24/com.shwfed.form.field.combobox.single/runtime.vue +4 -3
- package/dist/runtime/components/form/fields/2026-04-24/com.shwfed.form.field.combobox.single/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-04-24/com.shwfed.form.field.combobox.single/schema.js +1 -1
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/config.d.vue.ts +16 -16
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/config.vue.d.ts +16 -16
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/runtime.vue +5 -3
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/schema.js +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.d.vue.ts +24 -24
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.vue.d.ts +24 -24
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/runtime.vue +5 -3
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/schema.js +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.d.vue.ts +18 -18
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.vue.d.ts +18 -18
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/runtime.vue +5 -3
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/schema.js +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.d.vue.ts +26 -26
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.vue.d.ts +26 -26
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/runtime.vue +5 -3
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/schema.js +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/config.d.vue.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/config.vue.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/runtime.vue +5 -3
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/schema.js +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.d.vue.ts +4 -4
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.vue.d.ts +4 -4
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/runtime.vue +5 -3
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/schema.js +2 -2
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/config.d.vue.ts +30 -30
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/config.vue.d.ts +30 -30
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/runtime.vue +5 -3
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.number/schema.js +2 -2
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.d.vue.ts +8 -8
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.vue.d.ts +8 -8
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/runtime.vue +5 -3
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/schema.js +2 -2
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/config.d.vue.ts +22 -22
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/config.vue.d.ts +22 -22
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/runtime.vue +5 -3
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.switch/schema.js +2 -2
- package/dist/runtime/components/form/fields/2026-04-29/com.shwfed.form.field.combobox.single/runtime.vue +4 -3
- package/dist/runtime/components/form/fields/2026-04-29/com.shwfed.form.field.combobox.single/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-04-29/com.shwfed.form.field.combobox.single/schema.js +1 -1
- package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/runtime.vue +5 -3
- package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-05-12/com.shwfed.form.field.upload/schema.js +1 -1
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.combobox.single.remote/config.d.vue.ts +16 -16
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.combobox.single.remote/config.vue.d.ts +16 -16
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.combobox.single.remote/runtime.vue +4 -3
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.combobox.single.remote/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.combobox.single.remote/schema.js +1 -1
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/config.d.vue.ts +2 -2
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/config.vue.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/row.vue +6 -1
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/runtime.vue +5 -3
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/schema.d.ts +9 -3
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.list/schema.js +2 -2
- package/dist/runtime/components/form/fields/2026-05-17/com.shwfed.form.field.checkbox.group/runtime.vue +4 -3
- package/dist/runtime/components/form/fields/2026-05-17/com.shwfed.form.field.checkbox.group/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-05-17/com.shwfed.form.field.checkbox.group/schema.js +1 -1
- package/dist/runtime/components/form/fields/2026-05-17/com.shwfed.form.field.radio.group/runtime.vue +4 -3
- package/dist/runtime/components/form/fields/2026-05-17/com.shwfed.form.field.radio.group/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-05-17/com.shwfed.form.field.radio.group/schema.js +1 -1
- package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/runtime.vue +5 -3
- package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-05-18/com.shwfed.form.field.table/schema.js +2 -1
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.d.vue.ts +10 -10
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/config.vue.d.ts +10 -10
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/runtime.vue +4 -3
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-05-23/com.shwfed.form.field.tree.multi/schema.js +1 -1
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/config.d.vue.ts +16 -16
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/config.vue.d.ts +16 -16
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/runtime.vue +5 -3
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/schema.js +2 -2
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.d.vue.ts +24 -24
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.vue.d.ts +24 -24
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/runtime.vue +5 -3
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/schema.js +2 -2
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/config.d.vue.ts +16 -16
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/config.vue.d.ts +16 -16
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/runtime.vue +4 -3
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/schema.js +1 -1
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/config.d.vue.ts +10 -10
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/config.vue.d.ts +10 -10
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/runtime.vue +4 -3
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.multi/schema.js +1 -1
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/config.d.vue.ts +10 -10
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/config.vue.d.ts +10 -10
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/runtime.vue +4 -3
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-05-26/com.shwfed.form.field.tree.combobox.single/schema.js +1 -1
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/runtime.vue +4 -3
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.multi/schema.js +1 -1
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/runtime.vue +4 -3
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.combobox.single/schema.js +1 -1
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.d.vue.ts +10 -10
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/config.vue.d.ts +10 -10
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/runtime.vue +4 -3
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.multi/schema.js +1 -1
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.d.vue.ts +10 -10
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/config.vue.d.ts +10 -10
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/runtime.vue +4 -3
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.combobox.single/schema.js +1 -1
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.d.vue.ts +10 -10
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/config.vue.d.ts +10 -10
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/runtime.vue +4 -3
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.multi/schema.js +1 -1
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.d.vue.ts +10 -10
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/config.vue.d.ts +10 -10
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/runtime.vue +4 -3
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-05-28/com.shwfed.form.field.tree.single/schema.js +1 -1
- package/dist/runtime/components/form/fields/2026-06-09/com.shwfed.form.field.upload/runtime.vue +5 -3
- package/dist/runtime/components/form/fields/2026-06-09/com.shwfed.form.field.upload/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-06-09/com.shwfed.form.field.upload/schema.js +1 -1
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/runtime.vue +5 -3
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.multi/schema.js +1 -1
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/runtime.vue +4 -3
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/schema.d.ts +8 -2
- package/dist/runtime/components/form/fields/2026-06-14/com.shwfed.form.field.combobox.single/schema.js +1 -1
- package/dist/runtime/components/form/index.vue +5 -1
- package/dist/runtime/components/form/utils/derived.d.ts +9 -0
- package/dist/runtime/components/form/utils/derived.js +1 -1
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-20/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.d.vue.ts +6 -6
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.vue.d.ts +6 -6
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.d.vue.ts +6 -6
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.vue.d.ts +6 -6
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +10 -10
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +10 -10
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +10 -10
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +10 -10
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +10 -10
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +10 -10
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +10 -10
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +10 -10
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.vue +224 -133
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.vue +224 -133
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +10 -10
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +10 -10
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +10 -10
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +10 -10
- package/dist/runtime/components/table/customization.d.vue.ts +15 -0
- package/dist/runtime/components/table/customization.vue +633 -0
- package/dist/runtime/components/table/customization.vue.d.ts +15 -0
- package/dist/runtime/components/table/index.vue +69 -6
- package/dist/runtime/components/table/utils/customization.d.ts +158 -0
- package/dist/runtime/components/table/utils/customization.js +315 -0
- package/dist/runtime/components/ui/date-picker/DatePickerInput.d.vue.ts +1 -1
- package/dist/runtime/components/ui/date-picker/DatePickerInput.vue.d.ts +1 -1
- package/dist/runtime/components/ui/date-picker/DatePickerTimeInput.d.vue.ts +1 -1
- package/dist/runtime/components/ui/date-picker/DatePickerTimeInput.vue.d.ts +1 -1
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerInput.d.vue.ts +1 -1
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerInput.vue.d.ts +1 -1
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerTimeInput.d.vue.ts +2 -2
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerTimeInput.vue.d.ts +2 -2
- package/dist/runtime/vendor/cel-js/CLAUDE.md +6 -5
- package/dist/runtime/vendor/cel-js/PROMPT.md +97 -19
- package/dist/runtime/vendor/cel-js/lib/decimal.d.ts +4 -0
- package/dist/runtime/vendor/cel-js/lib/decimal.js +35 -0
- package/dist/runtime/vendor/cel-js/lib/evaluator.js +2 -0
- package/dist/runtime/vendor/cel-js/lib/functions.js +107 -134
- package/dist/runtime/vendor/cel-js/lib/macros.js +125 -16
- package/dist/runtime/vendor/cel-js/lib/math-builtins.d.ts +2 -0
- package/dist/runtime/vendor/cel-js/lib/math-builtins.js +39 -0
- package/dist/runtime/vendor/cel-js/lib/optional.d.ts +4 -0
- package/dist/runtime/vendor/cel-js/lib/optional.js +73 -21
- package/dist/runtime/vendor/cel-js/lib/parser.js +2 -6
- package/dist/runtime/vendor/cel-js/lib/registry.js +2 -2
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import { TYPES, Type } from "./registry.js";
|
|
|
4
4
|
import { register as registerOptional, optionalOf } from "./optional.js";
|
|
5
5
|
import { objKeys, arrayFrom } from "./globals.js";
|
|
6
6
|
import { TZDate } from "@date-fns/tz";
|
|
7
|
-
import { startOfDay, startOfWeek, startOfMonth, startOfYear, endOfDay, endOfWeek, endOfMonth, endOfYear, addDays, addWeeks, addMonths, addYears,
|
|
7
|
+
import { startOfMinute, startOfHour, startOfDay, startOfWeek, startOfMonth, startOfYear, endOfMinute, endOfHour, endOfDay, endOfWeek, endOfMonth, endOfYear, addMilliseconds, addSeconds, addMinutes, addHours, addDays, addWeeks, addMonths, addYears, setMilliseconds, setSeconds, setMinutes, setHours, setDate as setDayOfMonth, setMonth, setYear, format as formatDate, differenceInMilliseconds, differenceInSeconds, differenceInMinutes, differenceInHours, differenceInDays, differenceInWeeks, differenceInMonths, differenceInYears } from "date-fns";
|
|
8
8
|
function toNum(v) {
|
|
9
9
|
if (v instanceof Decimal) return v.toNumber();
|
|
10
10
|
if (typeof v === "bigint") return Number(v);
|
|
@@ -82,53 +82,6 @@ export function registerFunctions(registry) {
|
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
84
|
functionOverload("number(bool): number", (v) => Decimal.from(v ? 1 : 0));
|
|
85
|
-
functionOverload("int(number): number", (v) => {
|
|
86
|
-
const d = Decimal.from(v);
|
|
87
|
-
if (d.isInteger()) return d;
|
|
88
|
-
const n = d.toNumber();
|
|
89
|
-
if (!Number.isFinite(n)) throw evaluationError("numeric_overflow", "int() type error: integer overflow");
|
|
90
|
-
return Decimal.from(BigInt(Math.trunc(n)));
|
|
91
|
-
});
|
|
92
|
-
functionOverload("int(string): number", (v) => {
|
|
93
|
-
const s = v;
|
|
94
|
-
if (s !== s.trim() || s.length > 20 || s.includes("0x")) {
|
|
95
|
-
throw evaluationError("int_conversion_error", "int() type error: cannot convert to int");
|
|
96
|
-
}
|
|
97
|
-
try {
|
|
98
|
-
return Decimal.from(s);
|
|
99
|
-
} catch {
|
|
100
|
-
throw evaluationError("int_conversion_error", "int() type error: cannot convert to int");
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
functionOverload("double(number): number", (v) => Decimal.from(v));
|
|
104
|
-
functionOverload("double(string): number", (v) => {
|
|
105
|
-
const s = v;
|
|
106
|
-
if (!s || s !== s.trim())
|
|
107
|
-
throw evaluationError(
|
|
108
|
-
"double_conversion_error",
|
|
109
|
-
"double() type error: cannot convert to double"
|
|
110
|
-
);
|
|
111
|
-
try {
|
|
112
|
-
return Decimal.from(s);
|
|
113
|
-
} catch {
|
|
114
|
-
throw evaluationError(
|
|
115
|
-
"double_conversion_error",
|
|
116
|
-
"double() type error: cannot convert to double"
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
functionOverload("uint(number): number", (v) => Decimal.from(v));
|
|
121
|
-
functionOverload("uint(string): number", (v) => {
|
|
122
|
-
const s = v;
|
|
123
|
-
if (s !== s.trim() || s.length > 20 || s.includes("0x")) {
|
|
124
|
-
throw evaluationError("uint_conversion_error", "uint() type error: cannot convert to uint");
|
|
125
|
-
}
|
|
126
|
-
try {
|
|
127
|
-
return Decimal.from(s);
|
|
128
|
-
} catch {
|
|
129
|
-
throw evaluationError("uint_conversion_error", "uint() type error: cannot convert to uint");
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
85
|
functionOverload("string(string): string", identity);
|
|
133
86
|
functionOverload("string(bool): string", (v) => `${v}`);
|
|
134
87
|
functionOverload("string(number): string", (v) => Decimal.from(v).toString());
|
|
@@ -284,23 +237,55 @@ export function registerFunctions(registry) {
|
|
|
284
237
|
return new TZDate(result.getTime(), source.timeZone);
|
|
285
238
|
}
|
|
286
239
|
registry.registerType("Date", TZDate);
|
|
287
|
-
|
|
288
|
-
|
|
240
|
+
const singularUnit = (unit) => unit.replace(/s$/, "");
|
|
241
|
+
function pickUnit(table, unit, method) {
|
|
242
|
+
const fn = table[singularUnit(unit)];
|
|
243
|
+
if (fn) return fn;
|
|
244
|
+
throw evaluationError("invalid_unit", `${method}(): unknown unit "${unit}" (expected ${objKeys(table).join(" / ")})`);
|
|
245
|
+
}
|
|
246
|
+
function checkTimeZone(tz) {
|
|
247
|
+
try {
|
|
248
|
+
new Intl.DateTimeFormat("en-US", { timeZone: tz });
|
|
249
|
+
return tz;
|
|
250
|
+
} catch {
|
|
251
|
+
throw evaluationError("invalid_timezone", `Unknown time zone "${tz}" (expected an IANA name like "Asia/Shanghai" or an offset like "+08:00")`);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
const WALL_CLOCK_STRING = /^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?)?$/;
|
|
255
|
+
function dateFromString(v, tz) {
|
|
256
|
+
const s = v;
|
|
257
|
+
let d;
|
|
258
|
+
const m = tz === void 0 ? null : WALL_CLOCK_STRING.exec(s);
|
|
259
|
+
if (tz === void 0) {
|
|
260
|
+
d = new TZDate(s);
|
|
261
|
+
} else if (m) {
|
|
262
|
+
const ms = +(m[7] ?? "0").padEnd(3, "0").slice(0, 3);
|
|
263
|
+
d = new TZDate(+m[1], +m[2] - 1, +m[3], +(m[4] ?? "0"), +(m[5] ?? "0"), +(m[6] ?? "0"), ms, tz);
|
|
264
|
+
} else {
|
|
265
|
+
d = new TZDate(s, tz);
|
|
266
|
+
}
|
|
289
267
|
if (Number.isNaN(d.getTime())) throw evaluationError("invalid_date", `date() requires a valid date string, got "${v}"`);
|
|
290
268
|
return d;
|
|
291
|
-
}
|
|
292
|
-
|
|
269
|
+
}
|
|
270
|
+
function dateFromTimestamp(v, tz) {
|
|
293
271
|
const n = toNum(v);
|
|
294
272
|
if (!Number.isFinite(n)) {
|
|
295
273
|
throw evaluationError("invalid_date", `date() requires a finite timestamp, got ${v}`);
|
|
296
274
|
}
|
|
297
275
|
const ms = Math.abs(n) < 1e11 ? n * 1e3 : n;
|
|
298
|
-
const d = new TZDate(ms);
|
|
276
|
+
const d = tz === void 0 ? new TZDate(ms) : new TZDate(ms, tz);
|
|
299
277
|
if (Number.isNaN(d.getTime())) {
|
|
300
278
|
throw evaluationError("invalid_date", `date() got an out-of-range timestamp: ${v}`);
|
|
301
279
|
}
|
|
302
280
|
return d;
|
|
303
|
-
}
|
|
281
|
+
}
|
|
282
|
+
functionOverload("date(string): Date", (v) => dateFromString(v));
|
|
283
|
+
functionOverload("date(number): Date", (v) => dateFromTimestamp(v));
|
|
284
|
+
functionOverload("date(string, string): Date", (v, tz) => dateFromString(v, checkTimeZone(tz)));
|
|
285
|
+
functionOverload("date(number, string): Date", (v, tz) => dateFromTimestamp(v, checkTimeZone(tz)));
|
|
286
|
+
functionOverload("Date.tz(string): Date", (d, tz) => new TZDate(d.getTime(), checkTimeZone(tz)));
|
|
287
|
+
functionOverload("number(Date): number", (v) => Decimal.from(v.getTime()));
|
|
288
|
+
functionOverload("string(Date): string", (v) => v.toISOString());
|
|
304
289
|
const RANGE_LIMIT = 1e5;
|
|
305
290
|
function numericRange(startD, endD, stepD) {
|
|
306
291
|
const step = stepD.toNumber();
|
|
@@ -324,18 +309,17 @@ export function registerFunctions(registry) {
|
|
|
324
309
|
functionOverload("range(number, number): list<dyn>", (start, end) => numericRange(start, end, Decimal.from(1)));
|
|
325
310
|
functionOverload("range(number, number, number): list<dyn>", (start, end, step) => numericRange(start, end, step));
|
|
326
311
|
const rangeSteppers = {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
day: addDays,
|
|
312
|
+
second: addSeconds,
|
|
313
|
+
minute: addMinutes,
|
|
330
314
|
hour: addHours,
|
|
331
|
-
|
|
315
|
+
day: addDays,
|
|
316
|
+
week: addWeeks,
|
|
317
|
+
month: addMonths,
|
|
318
|
+
year: addYears
|
|
332
319
|
};
|
|
333
320
|
functionOverload("range(Date, Date, string): list<dyn>", (startV, endV, unitV) => {
|
|
334
321
|
const start = startV;
|
|
335
|
-
const stepFn = rangeSteppers
|
|
336
|
-
if (!stepFn) {
|
|
337
|
-
throw evaluationError("invalid_unit", `range(): unknown unit "${unitV}" (expected year / month / day / hour / minute)`);
|
|
338
|
-
}
|
|
322
|
+
const stepFn = pickUnit(rangeSteppers, unitV, "range");
|
|
339
323
|
const endMs = endV.getTime();
|
|
340
324
|
const ascending = start.getTime() < endMs;
|
|
341
325
|
const out = [];
|
|
@@ -349,90 +333,79 @@ export function registerFunctions(registry) {
|
|
|
349
333
|
}
|
|
350
334
|
return out;
|
|
351
335
|
});
|
|
336
|
+
const startOfFns = {
|
|
337
|
+
minute: startOfMinute,
|
|
338
|
+
hour: startOfHour,
|
|
339
|
+
day: startOfDay,
|
|
340
|
+
week: startOfWeek,
|
|
341
|
+
month: startOfMonth,
|
|
342
|
+
year: startOfYear
|
|
343
|
+
};
|
|
344
|
+
const endOfFns = {
|
|
345
|
+
minute: endOfMinute,
|
|
346
|
+
hour: endOfHour,
|
|
347
|
+
day: endOfDay,
|
|
348
|
+
week: endOfWeek,
|
|
349
|
+
month: endOfMonth,
|
|
350
|
+
year: endOfYear
|
|
351
|
+
};
|
|
352
|
+
const offsetFns = {
|
|
353
|
+
millisecond: addMilliseconds,
|
|
354
|
+
second: addSeconds,
|
|
355
|
+
minute: addMinutes,
|
|
356
|
+
hour: addHours,
|
|
357
|
+
day: addDays,
|
|
358
|
+
week: addWeeks,
|
|
359
|
+
month: addMonths,
|
|
360
|
+
year: addYears
|
|
361
|
+
};
|
|
362
|
+
const setFns = {
|
|
363
|
+
millisecond: setMilliseconds,
|
|
364
|
+
second: setSeconds,
|
|
365
|
+
minute: setMinutes,
|
|
366
|
+
hour: setHours,
|
|
367
|
+
day: setDayOfMonth,
|
|
368
|
+
month: (d, v) => setMonth(d, v - 1),
|
|
369
|
+
year: setYear
|
|
370
|
+
};
|
|
371
|
+
const diffFns = {
|
|
372
|
+
millisecond: differenceInMilliseconds,
|
|
373
|
+
second: differenceInSeconds,
|
|
374
|
+
minute: differenceInMinutes,
|
|
375
|
+
hour: differenceInHours,
|
|
376
|
+
day: differenceInDays,
|
|
377
|
+
week: differenceInWeeks,
|
|
378
|
+
month: differenceInMonths,
|
|
379
|
+
year: differenceInYears
|
|
380
|
+
};
|
|
381
|
+
const getFns = {
|
|
382
|
+
millisecond: (d) => d.getMilliseconds(),
|
|
383
|
+
second: (d) => d.getSeconds(),
|
|
384
|
+
minute: (d) => d.getMinutes(),
|
|
385
|
+
hour: (d) => d.getHours(),
|
|
386
|
+
day: (d) => d.getDate(),
|
|
387
|
+
weekday: (d) => (d.getDay() + 6) % 7 + 1,
|
|
388
|
+
month: (d) => d.getMonth() + 1,
|
|
389
|
+
year: (d) => d.getFullYear()
|
|
390
|
+
};
|
|
352
391
|
functionOverload("Date.startOf(string): Date", (d, unit) => {
|
|
353
392
|
const date = d;
|
|
354
|
-
|
|
355
|
-
case "day":
|
|
356
|
-
return wrapTZ(startOfDay(date), date);
|
|
357
|
-
case "week":
|
|
358
|
-
return wrapTZ(startOfWeek(date), date);
|
|
359
|
-
case "month":
|
|
360
|
-
return wrapTZ(startOfMonth(date), date);
|
|
361
|
-
case "year":
|
|
362
|
-
return wrapTZ(startOfYear(date), date);
|
|
363
|
-
default:
|
|
364
|
-
throw evaluationError("invalid_unit", `startOf(): unknown unit "${unit}"`);
|
|
365
|
-
}
|
|
393
|
+
return wrapTZ(pickUnit(startOfFns, unit, "startOf")(date), date);
|
|
366
394
|
});
|
|
367
395
|
functionOverload("Date.endOf(string): Date", (d, unit) => {
|
|
368
396
|
const date = d;
|
|
369
|
-
|
|
370
|
-
case "day":
|
|
371
|
-
return wrapTZ(endOfDay(date), date);
|
|
372
|
-
case "week":
|
|
373
|
-
return wrapTZ(endOfWeek(date), date);
|
|
374
|
-
case "month":
|
|
375
|
-
return wrapTZ(endOfMonth(date), date);
|
|
376
|
-
case "year":
|
|
377
|
-
return wrapTZ(endOfYear(date), date);
|
|
378
|
-
default:
|
|
379
|
-
throw evaluationError("invalid_unit", `endOf(): unknown unit "${unit}"`);
|
|
380
|
-
}
|
|
397
|
+
return wrapTZ(pickUnit(endOfFns, unit, "endOf")(date), date);
|
|
381
398
|
});
|
|
382
399
|
functionOverload("Date.offset(number, string): Date", (d, n, unit) => {
|
|
383
400
|
const date = d;
|
|
384
|
-
|
|
385
|
-
switch (unit.replace(/s$/, "")) {
|
|
386
|
-
case "day":
|
|
387
|
-
return wrapTZ(addDays(date, num), date);
|
|
388
|
-
case "week":
|
|
389
|
-
return wrapTZ(addWeeks(date, num), date);
|
|
390
|
-
case "month":
|
|
391
|
-
return wrapTZ(addMonths(date, num), date);
|
|
392
|
-
case "year":
|
|
393
|
-
return wrapTZ(addYears(date, num), date);
|
|
394
|
-
default:
|
|
395
|
-
throw evaluationError("invalid_unit", `offset(): unknown unit "${unit}"`);
|
|
396
|
-
}
|
|
397
|
-
});
|
|
398
|
-
functionOverload("Date.diff(Date, string): number", (d, other, unit) => {
|
|
399
|
-
const left = d;
|
|
400
|
-
const right = other;
|
|
401
|
-
switch (unit.replace(/s$/, "")) {
|
|
402
|
-
case "millisecond":
|
|
403
|
-
return Decimal.from(differenceInMilliseconds(left, right));
|
|
404
|
-
case "second":
|
|
405
|
-
return Decimal.from(differenceInSeconds(left, right));
|
|
406
|
-
case "minute":
|
|
407
|
-
return Decimal.from(differenceInMinutes(left, right));
|
|
408
|
-
case "hour":
|
|
409
|
-
return Decimal.from(differenceInHours(left, right));
|
|
410
|
-
case "day":
|
|
411
|
-
return Decimal.from(differenceInDays(left, right));
|
|
412
|
-
case "week":
|
|
413
|
-
return Decimal.from(differenceInWeeks(left, right));
|
|
414
|
-
case "month":
|
|
415
|
-
return Decimal.from(differenceInMonths(left, right));
|
|
416
|
-
case "year":
|
|
417
|
-
return Decimal.from(differenceInYears(left, right));
|
|
418
|
-
default:
|
|
419
|
-
throw evaluationError("invalid_unit", `diff(): unknown unit "${unit}"`);
|
|
420
|
-
}
|
|
401
|
+
return wrapTZ(pickUnit(offsetFns, unit, "offset")(date, toNum(n)), date);
|
|
421
402
|
});
|
|
403
|
+
functionOverload("Date.diff(Date, string): number", (d, other, unit) => Decimal.from(pickUnit(diffFns, unit, "diff")(d, other)));
|
|
422
404
|
functionOverload("Date.set(string, number): Date", (d, field, value) => {
|
|
423
405
|
const date = d;
|
|
424
|
-
|
|
425
|
-
switch (field) {
|
|
426
|
-
case "day":
|
|
427
|
-
return wrapTZ(setDayOfMonth(date, val), date);
|
|
428
|
-
case "month":
|
|
429
|
-
return wrapTZ(setMonth(date, val - 1), date);
|
|
430
|
-
case "year":
|
|
431
|
-
return wrapTZ(setYear(date, val), date);
|
|
432
|
-
default:
|
|
433
|
-
throw evaluationError("invalid_field", `set(): unknown field "${field}"`);
|
|
434
|
-
}
|
|
406
|
+
return wrapTZ(pickUnit(setFns, field, "set")(date, toNum(value)), date);
|
|
435
407
|
});
|
|
408
|
+
functionOverload("Date.get(string): number", (d, field) => Decimal.from(pickUnit(getFns, field, "get")(d)));
|
|
436
409
|
functionOverload("Date.format(string): string", (d, fmt) => formatDate(d, fmt));
|
|
437
410
|
registry.registerType("File", File);
|
|
438
411
|
registry.registerType("URL", URL);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect, Option } from "effect";
|
|
2
2
|
import { evaluationError, parseError } from "./errors.js";
|
|
3
3
|
import { OPERATORS as OPS } from "./operators.js";
|
|
4
|
-
import { optionalOf } from "./optional.js";
|
|
4
|
+
import { optionalOf, ensureOptional, bindOptionalValueType } from "./optional.js";
|
|
5
5
|
const identity = (x) => x;
|
|
6
6
|
function assertIdentifier(node, message) {
|
|
7
7
|
if (node.op === "id") return node.args;
|
|
@@ -34,9 +34,10 @@ function createMapExpander(hasFilter) {
|
|
|
34
34
|
}
|
|
35
35
|
function functorMap(ev, macro, ctx, recv) {
|
|
36
36
|
return Effect.gen(function* () {
|
|
37
|
-
|
|
37
|
+
const optional = ensureOptional(recv, macro.receiver, `${functionDesc} receiver`);
|
|
38
|
+
if (Option.isNone(optional)) return Option.none();
|
|
38
39
|
const iterCtx = macro.iterCtx.reuse(ctx);
|
|
39
|
-
const result = yield* ev.eval(macro.body, iterCtx.setIterValue(
|
|
40
|
+
const result = yield* ev.eval(macro.body, iterCtx.setIterValue(optional.value, ev));
|
|
40
41
|
return Option.some(result);
|
|
41
42
|
});
|
|
42
43
|
}
|
|
@@ -44,7 +45,7 @@ function createMapExpander(hasFilter) {
|
|
|
44
45
|
const recvType = chk.check(macro.receiver, ctx);
|
|
45
46
|
if (recvType.kind === "optional") {
|
|
46
47
|
macro.mode = "optional";
|
|
47
|
-
const innerType = recvType
|
|
48
|
+
const innerType = bindOptionalValueType(chk, recvType);
|
|
48
49
|
macro.iterCtx = ctx.forkWithVariable(macro.iterVarName, innerType);
|
|
49
50
|
const bodyType = chk.check(macro.body, macro.iterCtx);
|
|
50
51
|
return chk.registry.getOptionalType(bodyType);
|
|
@@ -83,10 +84,62 @@ function createMapExpander(hasFilter) {
|
|
|
83
84
|
};
|
|
84
85
|
};
|
|
85
86
|
}
|
|
87
|
+
function evaluateOptionalPredicate(ev, macro, ctx, optional, label) {
|
|
88
|
+
return Effect.gen(function* () {
|
|
89
|
+
const iterCtx = macro.iterCtx.reuse(ctx);
|
|
90
|
+
const result = yield* ev.eval(macro.body, iterCtx.setIterValue(optional.value, ev));
|
|
91
|
+
if (typeof result !== "boolean") {
|
|
92
|
+
throw evaluationError("invalid_condition_type", `${label}, got '${ev.debugRuntimeType(result)}'`, macro.body);
|
|
93
|
+
}
|
|
94
|
+
return result;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function checkOptionalPredicate(chk, macro, ctx, recvType, label) {
|
|
98
|
+
macro.iterCtx = ctx.forkWithVariable(macro.iterVarName, bindOptionalValueType(chk, recvType));
|
|
99
|
+
const bodyType = chk.check(macro.body, macro.iterCtx);
|
|
100
|
+
if (!bodyType.isDynOrBool() && bodyType.kind !== "param") {
|
|
101
|
+
throw chk.createError("invalid_condition_type", `${label}, got '${bodyType}'`, macro.body);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
86
104
|
function createFilterExpander() {
|
|
87
105
|
const functionDesc = "filter(var, predicate)";
|
|
88
106
|
const invalidMsg = `${functionDesc} invalid predicate iteration variable`;
|
|
89
107
|
const label = `${functionDesc} predicate must return bool`;
|
|
108
|
+
const invalidReceiver = `${functionDesc} receiver`;
|
|
109
|
+
function typeCheck(chk, macro, ctx) {
|
|
110
|
+
const recvType = chk.check(macro.receiver, ctx);
|
|
111
|
+
if (recvType.kind === "optional") {
|
|
112
|
+
macro.mode = "optional";
|
|
113
|
+
checkOptionalPredicate(chk, macro, ctx, recvType, label);
|
|
114
|
+
return recvType;
|
|
115
|
+
}
|
|
116
|
+
if (recvType.kind === "dyn") {
|
|
117
|
+
macro.mode = "dyn";
|
|
118
|
+
macro.iterCtx = ctx.forkWithVariable(macro.iterVarName, chk.getType("dyn"));
|
|
119
|
+
chk.check(macro.comprehension, ctx);
|
|
120
|
+
return chk.getType("dyn");
|
|
121
|
+
}
|
|
122
|
+
macro.mode = "list";
|
|
123
|
+
return chk.check(macro.comprehension, ctx);
|
|
124
|
+
}
|
|
125
|
+
function filterOptional(ev, macro, ctx, recv) {
|
|
126
|
+
return Effect.gen(function* () {
|
|
127
|
+
const optional = ensureOptional(recv, macro.receiver, invalidReceiver);
|
|
128
|
+
if (Option.isNone(optional)) return optional;
|
|
129
|
+
const keep = yield* evaluateOptionalPredicate(ev, macro, ctx, optional, label);
|
|
130
|
+
return keep ? optional : Option.none();
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function evaluate(ev, macro, ctx) {
|
|
134
|
+
if (macro.mode === "list") return ev.eval(macro.comprehension, ctx);
|
|
135
|
+
if (macro.mode === "optional") {
|
|
136
|
+
return Effect.flatMap(ev.eval(macro.receiver, ctx), (recv) => filterOptional(ev, macro, ctx, recv));
|
|
137
|
+
}
|
|
138
|
+
return Effect.flatMap(
|
|
139
|
+
ev.eval(macro.receiver, ctx),
|
|
140
|
+
(recv) => Option.isOption(recv) ? filterOptional(ev, macro, ctx, recv) : ev.eval(macro.comprehension, ctx)
|
|
141
|
+
);
|
|
142
|
+
}
|
|
90
143
|
return (opts) => {
|
|
91
144
|
const { args, receiver, ast: callAst } = opts;
|
|
92
145
|
const iterVarName = assertIdentifier(args[0], invalidMsg);
|
|
@@ -95,35 +148,89 @@ function createFilterExpander() {
|
|
|
95
148
|
const appendItem = callAst.clone(OPS.accuPush, callAst.clone(OPS.id, iterVarName));
|
|
96
149
|
const step = predicate.clone(OPS.ternary, [predicate, appendItem, accuValue]);
|
|
97
150
|
return {
|
|
98
|
-
|
|
151
|
+
ast: callAst,
|
|
152
|
+
receiver,
|
|
153
|
+
iterVarName,
|
|
154
|
+
body: predicate,
|
|
155
|
+
comprehension: callAst.clone(OPS.comprehension, {
|
|
99
156
|
errorsAreFatal: true,
|
|
100
157
|
iterable: receiver,
|
|
101
158
|
iterVarName,
|
|
102
159
|
init: callAst.clone(OPS.list, []),
|
|
103
160
|
step,
|
|
104
161
|
result: identity
|
|
105
|
-
})
|
|
162
|
+
}),
|
|
163
|
+
iterCtx: void 0,
|
|
164
|
+
mode: "list",
|
|
165
|
+
typeCheck,
|
|
166
|
+
evaluate
|
|
106
167
|
};
|
|
107
168
|
};
|
|
108
169
|
}
|
|
109
170
|
function createQuantifierExpander(opts) {
|
|
110
171
|
const invalidMsg = `${opts.name}(var, predicate) invalid predicate iteration variable`;
|
|
111
172
|
const label = `${opts.name}(var, predicate) predicate must return bool`;
|
|
173
|
+
const invalidReceiver = `${opts.name}(var, predicate) receiver`;
|
|
174
|
+
const optionalBranch = opts.optional;
|
|
175
|
+
function typeCheck(chk, macro, ctx) {
|
|
176
|
+
const recvType = chk.check(macro.receiver, ctx);
|
|
177
|
+
if (recvType.kind === "optional") {
|
|
178
|
+
macro.mode = "optional";
|
|
179
|
+
checkOptionalPredicate(chk, macro, ctx, recvType, label);
|
|
180
|
+
return chk.getType("bool");
|
|
181
|
+
}
|
|
182
|
+
if (recvType.kind === "dyn") {
|
|
183
|
+
macro.mode = "dyn";
|
|
184
|
+
macro.iterCtx = ctx.forkWithVariable(macro.iterVarName, chk.getType("dyn"));
|
|
185
|
+
chk.check(macro.comprehension, ctx);
|
|
186
|
+
return chk.getType("bool");
|
|
187
|
+
}
|
|
188
|
+
macro.mode = "list";
|
|
189
|
+
return chk.check(macro.comprehension, ctx);
|
|
190
|
+
}
|
|
191
|
+
function foldOptional(ev, macro, ctx, recv) {
|
|
192
|
+
return Effect.gen(function* () {
|
|
193
|
+
const optional = ensureOptional(recv, macro.receiver, invalidReceiver);
|
|
194
|
+
if (Option.isNone(optional)) return optionalBranch.onNone;
|
|
195
|
+
return yield* evaluateOptionalPredicate(ev, macro, ctx, optional, label);
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
function evaluate(ev, macro, ctx) {
|
|
199
|
+
if (macro.mode === "list") return ev.eval(macro.comprehension, ctx);
|
|
200
|
+
if (macro.mode === "optional") {
|
|
201
|
+
return Effect.flatMap(ev.eval(macro.receiver, ctx), (recv) => foldOptional(ev, macro, ctx, recv));
|
|
202
|
+
}
|
|
203
|
+
return Effect.flatMap(
|
|
204
|
+
ev.eval(macro.receiver, ctx),
|
|
205
|
+
(recv) => Option.isOption(recv) ? foldOptional(ev, macro, ctx, recv) : ev.eval(macro.comprehension, ctx)
|
|
206
|
+
);
|
|
207
|
+
}
|
|
112
208
|
return (callOpts) => {
|
|
113
209
|
const { args, receiver, ast: callAst } = callOpts;
|
|
210
|
+
const iterVarName = assertIdentifier(args[0], invalidMsg);
|
|
114
211
|
const predicate = args[1].setMeta("label", label);
|
|
115
212
|
const transform = opts.transform({ args, ast: callAst, predicate, opts });
|
|
213
|
+
const comprehension = callAst.clone(OPS.comprehension, {
|
|
214
|
+
kind: "quantifier",
|
|
215
|
+
errorsAreFatal: opts.errorsAreFatal || false,
|
|
216
|
+
iterable: receiver,
|
|
217
|
+
iterVarName,
|
|
218
|
+
init: transform.init,
|
|
219
|
+
condition: transform.condition,
|
|
220
|
+
step: transform.step,
|
|
221
|
+
result: transform.result || identity
|
|
222
|
+
});
|
|
223
|
+
if (!optionalBranch) return { callAst: comprehension };
|
|
116
224
|
return {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
})
|
|
225
|
+
ast: callAst,
|
|
226
|
+
receiver,
|
|
227
|
+
iterVarName,
|
|
228
|
+
body: predicate,
|
|
229
|
+
comprehension,
|
|
230
|
+
iterCtx: void 0,
|
|
231
|
+
mode: "list",
|
|
232
|
+
typeCheck,
|
|
233
|
+
evaluate
|
|
127
234
|
};
|
|
128
235
|
};
|
|
129
236
|
}
|
|
@@ -231,6 +338,7 @@ export function registerMacros(registry) {
|
|
|
231
338
|
"list.all(ast, ast): bool",
|
|
232
339
|
createQuantifierExpander({
|
|
233
340
|
name: "all",
|
|
341
|
+
optional: { onNone: true },
|
|
234
342
|
transform({ ast: callAst, predicate }) {
|
|
235
343
|
return {
|
|
236
344
|
init: callAst.clone(OPS.value, true),
|
|
@@ -248,6 +356,7 @@ export function registerMacros(registry) {
|
|
|
248
356
|
"list.exists(ast, ast): bool",
|
|
249
357
|
createQuantifierExpander({
|
|
250
358
|
name: "exists",
|
|
359
|
+
optional: { onNone: false },
|
|
251
360
|
condition(accu) {
|
|
252
361
|
return !accu;
|
|
253
362
|
},
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { evaluationError } from "./errors.js";
|
|
2
|
+
import { Decimal } from "./decimal.js";
|
|
3
|
+
class MathNamespace {
|
|
4
|
+
brand = "math";
|
|
5
|
+
}
|
|
6
|
+
const MATH_INSTANCE = new MathNamespace();
|
|
7
|
+
function toDecimal(v) {
|
|
8
|
+
return Decimal.from(v);
|
|
9
|
+
}
|
|
10
|
+
function extremum(name, values) {
|
|
11
|
+
if (values.length === 0) {
|
|
12
|
+
throw evaluationError("empty_list", `math.${name}(): an empty list has no ${name === "min" ? "minimum" : "maximum"}`);
|
|
13
|
+
}
|
|
14
|
+
let best = toDecimal(values[0]);
|
|
15
|
+
for (let i = 1; i < values.length; i++) {
|
|
16
|
+
const v = toDecimal(values[i]);
|
|
17
|
+
if (name === "min" ? v.lt(best) : v.gt(best)) best = v;
|
|
18
|
+
}
|
|
19
|
+
return best;
|
|
20
|
+
}
|
|
21
|
+
export function registerMathBuiltins(registry) {
|
|
22
|
+
registry.registerType("math", MathNamespace);
|
|
23
|
+
registry.registerVariable({
|
|
24
|
+
name: "math",
|
|
25
|
+
type: "math",
|
|
26
|
+
value: MATH_INSTANCE,
|
|
27
|
+
description: "\u6570\u5B66\u51FD\u6570"
|
|
28
|
+
});
|
|
29
|
+
const overload = (sig, handler) => registry.registerFunctionOverload(sig, handler);
|
|
30
|
+
overload("math.trunc(number): number", (_r, v) => toDecimal(v).trunc());
|
|
31
|
+
overload("math.floor(number): number", (_r, v) => toDecimal(v).floor());
|
|
32
|
+
overload("math.ceil(number): number", (_r, v) => toDecimal(v).ceil());
|
|
33
|
+
overload("math.round(number): number", (_r, v) => toDecimal(v).round());
|
|
34
|
+
overload("math.abs(number): number", (_r, v) => toDecimal(v).abs());
|
|
35
|
+
overload("math.min(number, number): number", (_r, a, b) => extremum("min", [a, b]));
|
|
36
|
+
overload("math.max(number, number): number", (_r, a, b) => extremum("max", [a, b]));
|
|
37
|
+
overload("math.min(list<number>): number", (_r, values) => extremum("min", values));
|
|
38
|
+
overload("math.max(list<number>): number", (_r, values) => extremum("max", values));
|
|
39
|
+
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Option } from 'effect';
|
|
2
|
+
import type { IContextBase, ITypeCheckerBase, IASTNode, ITypeDeclaration } from './types.js.js';
|
|
2
3
|
import type { Registry } from './registry.js.js';
|
|
3
4
|
export declare function optionalOf(value: unknown): Option.None<{} | null> | Option.Some<{} | null>;
|
|
4
5
|
export declare function optionalValue(opt: Option.Option<unknown>): unknown;
|
|
6
|
+
export declare function ensureOptional(value: unknown, ast: IASTNode, description: string): Option.Option<unknown>;
|
|
7
|
+
export declare function ensureOptionalType(checker: ITypeCheckerBase, node: IASTNode, ctx: IContextBase, description: string): ITypeDeclaration;
|
|
8
|
+
export declare function bindOptionalValueType(checker: ITypeCheckerBase, type: ITypeDeclaration): ITypeDeclaration;
|
|
5
9
|
export declare function register(registry: Registry): void;
|